All person ReIDentification samples.#19108
Conversation
samples/dnn/person_reid.cpp
Outdated
| features.push_back(normalization(temp_feature)); | ||
| } | ||
| } | ||
| return features; |
alalek
left a comment
There was a problem hiding this comment.
This sample is really hard to use due to missing of input data
samples/dnn/person_reid.cpp
Outdated
| // | ||
| // | ||
| // License Agreement | ||
| // For Open Source Computer Vision Library |
There was a problem hiding this comment.
OpenCV samples don't use license headers.
These files are used as a part of documentation which may use whole sample's file or its snippets.
You may left here short notice about sample's authors and/or model's authors (and/or model's limitations).
https://github.com/opencv/opencv/wiki/Coding_Style_Guide#file-structure
samples/dnn/person_reid.cpp
Outdated
| "{backend b | 0 | Choose one of computation backends: " | ||
| "0: automatically (by default), " | ||
| "1: Halide language (http://halide-lang.org/), " | ||
| "2: Intel's Deep Learning Inference Engine (https://software.intel.com/openvino-toolkit), " | ||
| "3: OpenCV implementation }" | ||
| "{target t | 0 | Choose one of target computation devices: " |
samples/dnn/person_reid.cpp
Outdated
| { | ||
| sum += feature[i] * feature[i]; | ||
| } | ||
| sum = sqrt(sum); | ||
| for(int i = 0; i < (int)feature.size(); i++) |
samples/dnn/person_reid.cpp
Outdated
| return ret; | ||
| } | ||
|
|
||
| static Mat drawRankList(std::string queryName, std::vector<std::string> galleryImageNames, std::vector<int> topk_index, const int resize_h, const int resize_w) |
There was a problem hiding this comment.
std::string
std::vector<std::string>
use references, const references instead of copied values.
samples/dnn/person_reid.cpp
Outdated
| "{resize_h | 256 | height of input image}" | ||
| "{resize_w | 128 | width of input image}" |
There was a problem hiding this comment.
of input image
IMHO, it doesn't look accurate.
This is about size of the input for model inference.
There was a problem hiding this comment.
hello, i have fixed all indentation mistakes, used references for parameters, and changed the description of resize_* to size of model.
7e1fd46 to
baa635f
Compare
we have opened a new repo for model and sample input images. |
Please cleanup duplicated commits and their malformed emails before PR merge. |
04e336b to
f9f33a7
Compare
We have squashed all the commits into one. |
Hi, this is a sample of person ReIDentification.
This sample uses one of the state-of-the-art ReID models built by Tencent YoutuLab.
Status Update
Currently there are a python script and a Cpp script with the same features, both supportting extracting ReID feature with youtu baseline ReID model.
Introduction
This sample takes two sets of images as input, namely the query set and gallery set.
This sample first load the onnx model of youtu ReID baseline and then extract the ReID feature of all images in the query and gallery set.
For each query image, the gallery images are ranked based on its consine similarity with the query image.
Finally the ranking list is visualized in an output folder.
Following is the example of the visualization results. The first image of each row is the query, and the rest is the top-10 most similar gallery image found by the ReID model.
Reference
Zheng F, Deng C, Sun X, et al. Pyramidal person re-identification via multi-loss dynamic training[C]//Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 2019: 8514-8522.
Yu F, Jiang X, Gong Y, et al. Devil's in the Details: Aligning Visual Clues for Conditional Embedding in Person Re-Identification[J]. arXiv e-prints, 2020: arXiv: 2009.05250.
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.