How to use insightFace for image recognition?

8 ビュー (過去 30 日間)
Dunil Kasturiratna
Dunil Kasturiratna 2022 年 4 月 28 日
回答済み: Githin George 2023 年 11 月 9 日
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.

回答 (1 件)

Githin George
Githin George 2023 年 11 月 9 日
Hello,
My understanding is that you are trying to use the “insightFaceFile 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 programImplementation-ArcFace-in-MATLAB’ which contains a working example for the Oxford-IIIT Pet Datset. Please refer to the link below.
I hope this helps.

製品


リリース

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by