Face recognition with Facenet

Hi, I trying to make a face recognition system.
For detection I used Yolov5 (because I need to detect people in masks and understand who isn’t wear mask)
For classification I use Facenet(FaceDetect | NVIDIA NGC)
Facenet gives me 2 outputs: 46x26x4 bbox coordinate tensor and 46x26x1 class confidence tensor
I writed class confidence tensor to csv file of 2 people. But the cosine similarity for 2 people equals 1. So what did I do not right?
Here is app file

deepstream_infer_tensor_meta_test.cpp (35.2 KB)

I getting tensor meta in sgie_pad_buffer_probe function

what does this mean? mean they are totally different?

They are the same. What am I doing wrong?

################################################################################
# Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
################################################################################

# Following properties are mandatory when engine files are not specified:
#   int8-calib-file(Only in INT8)
#   Caffemodel mandatory properties: model-file, proto-file, output-blob-names
#   UFF: uff-file, input-dims, uff-input-blob-name, output-blob-names
#   ONNX: onnx-file
#
# Mandatory properties for detectors:
#   num-detected-classes
#
# Optional properties for detectors:
#   cluster-mode(Default=Group Rectangles), interval(Primary mode only, Default=0)
#   custom-lib-path,
#   parse-bbox-func-name
#
# Mandatory properties for classifiers:
#   classifier-threshold, is-classifier
#
# Optional properties for classifiers:
#   classifier-async-mode(Secondary mode only, Default=false)
#
# Optional properties in secondary mode:
#   operate-on-gie-id(Default=0), operate-on-class-ids(Defaults to all classes),
#   input-object-min-width, input-object-min-height, input-object-max-width,
#   input-object-max-height
#
# Following properties are always recommended:
#   batch-size(Default=1)
#
# Other optional properties:
#   net-scale-factor(Default=1), network-mode(Default=0 i.e FP32),
#   model-color-format(Default=0 i.e. RGB) model-engine-file, labelfile-path,
#   mean-file, gie-unique-id(Default=0), offsets, process-mode (Default=1 i.e. primary),
#   custom-lib-path, network-mode(Default=0 i.e FP32)
#
# The values in the config file are overridden by values set through GObject
# properties.

[property]
gpu-id=0
net-scale-factor=0
tlt-model-key=nvidia_tlt
tlt-encoded-model=/home/cv/Desktop/Mask-Detection/Deepstream-app/model.etlt
labelfile-path=/home/cv/Desktop/Mask-Detection/Deepstream-app/labels.txt
int8-calib-file=/home/cv/Desktop/Mask-Detection/Deepstream-app/int8_calibration.txt
model-engine-file=/home/cv/Desktop/Mask-Detection/Deepstream-app/model.etlt_b1_gpu0_int8.engine
infer-dims=3;416;736
uff-input-order=0
uff-input-blob-name=input_1
batch-size=1
process-mode=2
model-color-format=0
## 0=FP32, 1=INT8, 2=FP16 mode
network-mode=1
num-detected-classes=1
interval=0
gie-unique-id=1
output-blob-names=output_bbox/BiasAdd;output_cov/Sigmoid

input-object-min-width=100
input-object-min-height=100

[class-attrs-all]
pre-cluster-threshold=0.2
group-threshold=1
cluster-mode=1
eps=0.2
#minBoxes=3

Here is config file for facenet

Ok, I tried to convert this model: face-recognition-resnet100-arcface-onnx — OpenVINO™ documentation

But after converting I haven’t got any output with this config:

[property]
gpu-id=0
net-scale-factor=0.0039215697906911373
labelfile-path=/home/cv/Desktop/Mask-Detection/Deepstream-app/labels.txt
model-engine-file=/home/cv/Desktop/Mask-Detection/Deepstream-app/arcfaceresnet100-8.onnx_b1_gpu0_fp16.engine
onnx-file=/home/cv/Desktop/Mask-Detection/Deepstream-app/arcfaceresnet100-8.onnx
infer-dims=3;112;112
uff-input-order=0
uff-input-blob-name=input_1
output-tensor-meta=1
batch-size=1
process-mode=1
model-color-format=0
## 0=FP32, 1=INT8, 2=FP16 mode
network-mode=1
network-type=1
num-detected-classes=1
interval=0
gie-unique-id=1
output-blob-names=output_cov/Sigmoid;output_cov/Sigmoid

I’m using another model and it worked well

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.