Why not have the managers of the underperforming employees be straightforward with them? Tell them that, as far as the manager/company is concerned, they're underperforming (no need to single out the WFH aspect here if you don't want to). They may deny that their performance while working from home is different from their performance in the office, but the manager can dismiss that. It's unpleasant, but better than resorting to surveillance software, and better than making things worse for everyone just to help out this minority who underperform while working from home.
Once they've been notified that they're underperforming, try to help them out. If they can't be helped, fire them with well-documented cause (their history of poor performance).