Skip to content

All person ReIDentification samples.#19108

Merged
opencv-pushbot merged 1 commit intoopencv:masterfrom
ReID-Team:sample_person_reid
Jan 13, 2021
Merged

All person ReIDentification samples.#19108
opencv-pushbot merged 1 commit intoopencv:masterfrom
ReID-Team:sample_person_reid

Conversation

@X-ing
Copy link
Copy Markdown

@X-ing X-ing commented Dec 14, 2020

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.

000_0030_c1_f0057043
000_0356_c3_f0082818
246_0608_c1_f0157906

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

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake
force_builders_only=linux,windows,mac,docs
**WIP**
test_modules=none

features.push_back(normalization(temp_feature));
}
}
return features;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix formatting

Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sample is really hard to use due to missing of input data

//
//
// License Agreement
// For Open Source Computer Vision Library
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines +54 to +59
"{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: "
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CUDA backend?

Comment on lines +91 to +95
{
sum += feature[i] * feature[i];
}
sum = sqrt(sum);
for(int i = 0; i < (int)feature.size(); i++)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix indentation

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)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::string
std::vector<std::string>

use references, const references instead of copied values.

Comment on lines +50 to +51
"{resize_h | 256 | height of input image}"
"{resize_w | 128 | width of input image}"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

of input image

IMHO, it doesn't look accurate.
This is about size of the input for model inference.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hello, i have fixed all indentation mistakes, used references for parameters, and changed the description of resize_* to size of model.

@X-ing
Copy link
Copy Markdown
Author

X-ing commented Dec 16, 2020

This sample is really hard to use due to missing of input data

we have opened a new repo for model and sample input images.

@X-ing X-ing requested review from alalek and dkurt December 16, 2020 11:27
@asmorkalov asmorkalov requested a review from sl-sergei December 25, 2020 09:52
Copy link
Copy Markdown
Contributor

@sl-sergei sl-sergei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! 👍

@alalek
Copy link
Copy Markdown
Member

alalek commented Jan 12, 2021

root and others added 10 commits
root
root <root@TENCENT64.site>

Please cleanup duplicated commits and their malformed emails before PR merge.
"Merge" commits should not be used in the Pull Requests. Use git rebase instead.

@mznw mznw force-pushed the sample_person_reid branch from 04e336b to f9f33a7 Compare January 13, 2021 03:26
@X-ing X-ing closed this Jan 13, 2021
@X-ing X-ing reopened this Jan 13, 2021
@X-ing
Copy link
Copy Markdown
Author

X-ing commented Jan 13, 2021

root and others added 10 commits
root
root <root@TENCENT64.site>

Please cleanup duplicated commits and their malformed emails before PR merge.
"Merge" commits should not be used in the Pull Requests. Use git rebase instead.

We have squashed all the commits into one.

@opencv-pushbot opencv-pushbot merged commit bbdae29 into opencv:master Jan 13, 2021
@alalek alalek mentioned this pull request Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants