How to use insightFace for image recognition?
8 views (last 30 days)
Show older comments
I need help running this program called insightFace,
This program is supposed to be an implementation of the arcFace loss function into a convolutional neural network. However, I don't undertand how to use this program to classify images. The program seems to have no classification layer. If anyone can help me it would be of great help.
Another working implementation of arcface would be helpful as well.
Thanks in advance.
0 Comments
Answers (1)
Githin George
on 9 Nov 2023
Hello,
My understanding is that you are trying to use the “insightFace” File Exchange program and would like to understand the classification layer and details on how to perform the classification.
The code below is part of the source code for “insightFace” and models the layer structure of the neural network. The ‘embeddingL’ layer is replacing the Classfication layer of the original ‘mobilenetv2’ backbone.
%% network arc
backbone = mobilenetv2();
lg = layerGraph(backbone);
lg = removeLayers(lg,{'input_1',...
'Logits','Logits_softmax',...
'ClassificationLayer_Logits'});
inputLayer = imageInputLayer([inputSize,3],'name','input','Normalization','none');
embeddingL = fullyConnectedLayer(embedding_size,'name','embedding',...
'Bias',zeros(embedding_size,1,'single'),'BiasLearnRateFactor',0);% embedding
lg = addLayers(lg,inputLayer);
lg = addLayers(lg,embeddingL);
lg = connectLayers(lg,'input','Conv1');
lg = connectLayers(lg,'global_average_pooling2d_1','embedding');
A ‘dlnetwork’ object is then used to train this model. The following documentation link contains the end-to-end workflow for training and testing a model using ‘dlnetwork’ object.
As an alternative you can consider exploring the File Exchange program ‘Implementation-ArcFace-in-MATLAB’ which contains a working example for the Oxford-IIIT Pet Datset. Please refer to the link below.
I hope this helps.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!