The police have facial recognition databases on everyone in the UK.
No they don't. They have a watchlist, but they don't have a current photo of everyone in the UK. How do you think that would work? They can apply to have access to e.g. passport information, but they aren't going to do that because somebody is using the wrong loo.
They will run the photo against the database and their ID including their sex will come up.
The photo that you have taken surreptitiously because you are worried about causing offence? Is it of the back of their head?
and their ID including their sex will come up.
And the information on sex (from the database that they don't have) comes from where?
It is not a criminal offence to accidentally go into the wrong toilet but if a pattern of behaviour emerges from logged reports of repeated, deliberate entry into the wrong toilet and they have these reports where we have said we were alarmed and intimidated that is harrassment and they will take further action.
All that when somebody could have just said 'I'm sorry, I think you might be in the wrong loo"?