I have this too. It can be very embarrassing.
I work in HR. In my earlier career, I’d interview someone on a Monday, have them back for second round later that week, and would struggle to recognise them in reception 
Or would spend about 4 hours sitting across from someone in a disciplinary hearing, then walk past them in the canteen the following day and not even acknowledge them.
I really struggle with it.
I now always tell people that I’m terrible with faces. I’m really good with other details like names of children etc. That can help cover it up.
As an example, I’ll see someone I know I know but don’t recognise them so I’ll ask a very generalised “how are you all” type question with the hope they’ll say “all good, Ava is starting with crèche next next week and Julie is going back to work”.
That helps a lot.
I also try and link people to physical attributes but I’m lucky in that I’ve never spoken these out loud!
People I know include- Sarah with the birthmark, John with the eyeliner (he doesn’t wear eyeliner, he just has a lovely dark lash line that’s very distinctive), and Dermot with the lisp.