Person_reID_baseline_pytorch icon indicating copy to clipboard operation
Person_reID_baseline_pytorch copied to clipboard

demo on images other than dataset

Open TheLeopardsH opened this issue 4 years ago • 14 comments

I want to know that how can we use this trained model to predict on real images just like demo.py do it on market 1501 dataset .Suppose I have a person detection module which outputs cropped images of persons after detecting persons from videos of different cameras.Now I want to rank top 10 images of query person on this real image data.

TheLeopardsH avatar Dec 01 '19 18:12 TheLeopardsH

Hi , for the custom dataset, you need to extract the feature first by test.py and then you could use demo.py.

layumi avatar Dec 02 '19 05:12 layumi

Ok,Now we have to add path of our real images(after detection of persons) in --test_dir(--data_dir) for test.py where our real images are stored? and for demo.py we also have to provide path to our real images --test_dir?And the --query_index is also from the same real image dataset? Is that right?

TheLeopardsH avatar Dec 03 '19 03:12 TheLeopardsH

also do the labelling of our real images matters here?

TheLeopardsH avatar Dec 03 '19 03:12 TheLeopardsH

Yes. @TheLeopardsH I suggest you to check the filename and organization in the Market-1501 dataset.

layumi avatar Dec 03 '19 03:12 layumi

As i am understanding from your perspective is that for my real image data,I have to manage my real data and manage it accordingly market1501 which is manually looking at ids of person and assigning the identities person. But i want something like this case:Suppose I have pool of images of different persons(cropped after person detection) coming in the same directory and I want to query one of image from same pool of images and it gives me correct ranked images of person in query

TheLeopardsH avatar Dec 03 '19 03:12 TheLeopardsH

From your perspective which i maybe understanding it wrongly,each time I have to do everything manually if new persons of different identities comes in cameras but I want everything to be automated

TheLeopardsH avatar Dec 03 '19 04:12 TheLeopardsH

OK. You may need to modify the demo.py a little bit, especially, for showing images, and only use test.py to extract the feature.

layumi avatar Dec 03 '19 04:12 layumi

OK I would work on this.If I face any thing I would let you know.Thank you

TheLeopardsH avatar Dec 03 '19 04:12 TheLeopardsH

results are not showing right here is what I did.To make things faster,I took images of three different persons from market1501 of my own choice(Folders assigned to different identities:001,002,003(inside them are images of corresponding identity).Dataset is like this market ->gallery ->001(all images of peson1) 002(all images of person2) 003(all images of person3) ->query ->001(few images of person1) 002 (few images of person2) 003(few images of person3) When i query image from person3 inside query folder ->003 whose results should correspond to nearly all images of gallery 003 but they are not. testoutput demo1

TheLeopardsH avatar Dec 03 '19 13:12 TheLeopardsH

here is the small dataset which i used.Can you tell whats wrong here market.zip

TheLeopardsH avatar Dec 03 '19 13:12 TheLeopardsH

First of all, could you check the features? Are they wrong (for example, all zeros)? Second, you need to check the feature order with the corresponding image order? Do you save a right image name for the feature? Third, please check again with your code.

layumi avatar Dec 03 '19 21:12 layumi

Cool repo. I'm just jumping on this thread because it's what I would like to do.

If we want to test on our own images, we need to change test.py and demo.py correct?

In test.py, could we just refer to our dataset on line 248 and 249 and format it like the market dataset?

I also don't fully understand how to setup the folders to run inference. Under the pytorch folder in Market, there are query and gallery. Are the features from query being tested against gallery? If I have all the images I would like to test, how would I setup this up to use the prebuild networks using the data structure?

Any help would be greatly appreciated.

ttdd11 avatar Feb 12 '20 15:02 ttdd11

If we want to test on our own images, we need to change test.py and demo.py correct? Yes.

In test.py, could we just refer to our dataset on line 248 and 249 and format it like the market dataset? Yes. It is the main function to extract the feature.

The test folder should be like:

├── Market/
│       ├── query/                   /* query files  
│           ├── 001                   /* If you do not know the ground-truth, you may put all images in 001
│                   ├── xxxx.jpg
│                   ├── xxxxx.jpg
│                   ├── ...
│           ├── 002
...
│       ├── gallery/                 /* gallery files  
│           ├── 001                    /* If you do not know the ground-truth, you may put all images in 001
│           ├── 002
...

layumi avatar Feb 23 '20 23:02 layumi

结果没有显示正确 这里是我did.To使事情更快,我花了三个不同的人的图像,从我自己的选择(分配给不同身份的文件夹的market1501:001,002,003(在他们里面是相应的身份的图像).Dataset像这个 市场 ->画廊 -> 001(peson1的所有图像) 002(person2的所有图像) 003(person3的所有图像) ->查询 -> 001(person1的少量图像) 002(person2的少量图像) 003(很少) 当我从查询文件夹-> 003内的person3中查询图像时,其结果应几乎对应于图库003的所有图像,但实际上并非如此。 测试输出 演示1

I have the same problem as you. Have you solved it now? I have a query file with 20 people in it, and I have a gallery folder. I hope to find the same people in the gallery file for every picture in the query. It's like demo.py Visualization, sort from 1 to 10.Any help will be appreciated

viwa-creatr avatar Jul 08 '20 11:07 viwa-creatr