DLS C4 W4: Face Recognition with Binary Classification

Question: I need help figuring out if I’m heading in the right direction for my face recognition model. If not, what steps do you recommend I take?

Andrew mentioned that one can use an encoder (e.g., InceptionResNetV1) to create a 128-D encoding of pictures. And then train a binary classifier. But the InceptionResNetV1 provided came with weights. I assume you have already trained it, given the inceptionResNet V1 doesn’t have a 128-D output.

I’m learning to create and train mine. Thanks for your feedback and here is an overly simplified snippet of my code:
part 1

part 2

Thanks,

Hi @francktchafa

You are in the right track! However, consider training your model to output embeddings and switching to Triplet Loss for optimization. Make sure your dataset is well-structured for this, with clear anchor, positive, and negative samples. After training, you can compare embeddings directly using distance metrics instead of relying on a classifier.

Hope it helps! Feel free to ask if you need further assistance.

Thanks for your input.

Question: Is the snippet code using binary classification without triplet loss on the right track?

Btw, I have written one using the triplet loss function you mentioned. Andrew mentioned negatives shouldn’t be generated at random, and the triplet loss function requires a lot of data. As an alternative, he mentioned using a binary classifier after generating encodings and provided guidelines for doing such projects.

So, I created another code with a binary classifier (see snippet code above). As long as my code is the approach one will take if using a binary classifier, that is good for me. I just want to make sure I fully understand the process involved in Face Recognition with Binary Classification.

Yes, your approach is completely correct. Just make sure your data is well-prepared with meaningful negatives to improve performance, and keep an eye on class imbalance during training. Your code takes the right path for a binary classification setup.

Let me know if you need further clarification!

2 Likes