How to use insightFace for image recognition?
8 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Githin George
2023-11-9
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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!