Hermione had a soulbond. She had a soulbond that was in that classroom, which meant that someone in that room also had a soulbond - her. It was either that or she knew of someone in that room that had smelt the finished Amortentia.