timesler / facenet-pytorch

Pretrained Pytorch face detection (MTCNN) and facial recognition (InceptionResnet) models
MIT License
4.42k stars 943 forks source link

Softmax and Triplet loss #73

Open hazemahmed45 opened 4 years ago

hazemahmed45 commented 4 years ago

i tried to use the finetuning notebook, i trained the resnet model using softmax cross entropy for the first trial and with a triplet loss for the second both gived false embeddings. i changed the face detector method instead if mtcnn i used face alignment to crop the faces in case there is a side face the mtcnn would not recognize it. please confirm with me, does the face recognition model relate with the accuracy of the model?

ctivanovich commented 4 years ago

Yeah, I am trying to use this for classifying groups of people, and I looked at the final layer given classification and saw that it is just outputting a linear layer. Shouldn't it be applying a softmax function on that output, for multinomial classification?

Edit: I see that it has Linear(512, num_classes), and it names the output variable as self.logits. I've read a bit about this, log(p/(1-p)), log odds, but would simply throwing 512 features into a linear function output log odds? Isn't an activation function needed here at the final layer?