Giter VIP home page Giter VIP logo

batch-dropblock-network's Introduction

Batch DropBlock Network for Person Re-identification and Beyond

Official source code of paper https://arxiv.org/abs/1811.07130

Update on 2019.3.15

Update CUHK03 results.

Update on 2019.1.29

Traning scripts are released. The best Markt1501 result is 95.3%! Please look at the training section of README.md.

Update on 2019.1.23

In-Shop Clothes Retrieval dataset and pretrained model are released!. The rank-1 result is 89.5 which is a litter bit higher than paper reported.

This paper is accepted by ICCV 2019. Please cite if you use this code in your research.

@article{dai2018batch,
  title={Batch DropBlock Network for Person Re-identification and Beyond},
  author={Dai, Zuozhuo and Chen, Mingqiang and Gu, Xiaodong and Zhu, Siyu and Tan, Ping},
  journal={arXiv preprint arXiv:1811.07130},
  year={2018}
}

Setup running environment

This project requires python3, cython, torch, torchvision, scikit-learn, tensorboardX, fire. The baseline source code is borrowed from https://github.com/L1aoXingyu/reid_baseline.

Prepare dataset

Create a directory to store reid datasets under this repo via
```bash
cd reid
mkdir data
```

For market1501 dataset, 
1. Download Market1501 dataset to `data/` from http://www.liangzheng.org/Project/project_reid.html
2. Extract dataset and rename to `market1501`. The data structure would like:
```
market1501/
    bounding_box_test/
    bounding_box_train/
    query/
```

For CUHK03 dataset,
1. Download CUHK03-NP dataset from https://github.com/zhunzhong07/person-re-ranking/tree/master/CUHK03-NP 
2. Extract dataset and rename folers inside it to cuhk-detect and cuhk-label.
For DukeMTMC-reID dataset,
Dowload from https://github.com/layumi/DukeMTMC-reID_evaluation

For In-Shop Clothes dataset,
1. Downlaod clothes dataset from http://virutalbuy-public.oss-cn-hangzhou.aliyuncs.com/share/bfe_models/clothes.tar
2. Extract dataset and put it to `data/` folder.

Results

Dataset CUHK03-Label CUHK03-Detect DukeMTMC re-ID Market1501 In-Shop Clothes
Rank-1 79.4 76.4 88.9 95.3 89.5
mAP 76.7 73.5 75.9 86.2 72.3
model aliyun aliyun] aliyun aliyun aliyun

You can download the pre-trained models from the above table and evaluate on person re-ID datasets. For example, to evaluate CUHK03-Label dataset, you can download the model to './pytorch-ckpt/cuhk_label_bfe' directory and run the following commands.

Evaluate Market1501

python3 main_reid.py train --save_dir='./pytorch-ckpt/market_bfe' --model_name=bfe --train_batch=32 --test_batch=32 --dataset=market1501 --pretrained_model='./pytorch-ckpt/market_bfe/944.pth.tar' --evaluate

Evaluate CUHK03-Label

python3 main_reid.py train --save_dir='./pytorch-ckpt/cuhk_label_bfe' --model_name=bfe --train_batch=32 --test_batch=32 --dataset=cuhk-label  --pretrained_model='./pytorch-ckpt/cuhk_label_bfe/750.pth.tar' --evaluate

Evaluate In-Shop clothes

python main_reid.py train --save_dir='./pytorch-ckpt/clothes_bfe' --model_name=bfe --pretrained_model='./pytorch-ckpt/clothes_bfe/clothes_895.pth.tar' --test_batch=32 --dataset=clothes --evaluate

Training

Traning Market1501

python main_reid.py train --save_dir='./pytorch-ckpt/market-bfe' --max_epoch=400 --eval_step=30 --dataset=market1501 --test_batch=128 --train_batch=128 --optim=adam --adjust_lr

This traning command is tested on 4 GTX1080 gpus. Here is training log. You shoud get a result around 95%.

batch-dropblock-network's People

Contributors

daizuozhuo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

batch-dropblock-network's Issues

ValueError: expected 2D or 3D input (got 1D input)

hi~,thank you for sharing your job. when I run main_reid.py for evaluating pre-trained models on market1501 datasets, I meet a problem of ValueError: expected 2D or 3D input (got 1D input), line 68, in evaluate, feature0 = self._forward(inputs)

about triplet loss

Thanks for opening your code .
I meet some issues when I train my own data by triplet loss .

shape dist_mat : 64*64
N:64
shape '[N, -1]' is invalid for input of size dist_mat[is_pos]
how to solve it ?

a question about code

hi, thank you for release your code. two lines below has different order of w_ratio and h_ratio in your code.

self.batch_crop = BatchDrop(width_ratio, height_ratio)

def init(self, h_ratio, w_ratio):

should change its order or not?

About re_ranking

It seems that it is no use to set the parameter --re_ranking = True if I want to use re-ranking, because the following code in Line 171 in main_reid.py
rank1 = reid_evaluator.evaluate(queryloader, galleryloader, queryFliploader, galleryFliploader)
doesn't pass the parameter opt.re_ranking.

bug in the code to calculate

@daizuozhuo There is something wrong in the function eval_func_gpu, the default max_rank = 50. When the numbers of images of the same id is larger than 50, it will return a wrong mAP.

test的逻辑疑问

#part branch
x = self.res_part2(x)
x = self.batch_crop(x)
triplet_feature = self.part_maxpool(x).squeeze()

楼主,你好,上述代码是您part分支进行batch drop的操作,我想问下在测试过程中为什么也要进行此操作?而当我在测试代码中去掉此操作时,他的结果和使用是完全一样的,请您指导一下,期待您的回复!!!!

The rank-1 is always 93.9%

So sorry to bother you!
The rank-1 is always 93.9% when I train the model on market-1501 . Comparing the log you have opened, there is nothing different but the configuration parameter ‘mgn_model' and 'mgn_part'. In my log, they are absent. Are they necessary? Could you give me advise and I will be appreciated. thx for your great job!

Hyperparameter config for CUB 200

Hi @daizuozhuo
Thanks a lot for sharing your amazing work.

I wanted to try to train for CUB 200. Is there a specific hyperparameter config to use for the same? or would the default in config.py?

Looking forward to your response?

Validation dataset are need ?

Hello,
I successfully executed this program, but I have some questions about the allocation of datasets.
Under normal circumstances, the training dataset and the validation dataset are carried out together.
And in your program it seems that the test dataset is used for training and also for testing.

Recall@K Code

Hi,
I think you only have CMC curve Rank-1~Rank-20 in your code,
but I don’t see the Recall@K(%) code for CUB200-2011, CARS196, Clothes, Stanford online products dataset.
Is it convenient for you to provide it?
Thank you for your reply.

image

eval_func_gpu

when using eval_func_gpu,list named results is always none

about train/test result

Thank you very much for sharing the code. I have been training less than 95.3% when I use your script to do training. I can only train about 94.5%. The environment I use is pytorch1.0.1, 4 v100, can you help me analysis? Thanks!

accuracy

Hi, I was able to execute the code correctly, but I don't know why I can't achieve the accuracy stated in the article. For the duke dataset I got a maximum accuracy of 87.2. Can I ask the reason?

with provided market_953.pth.tar, unable to get 95.3 rank1 results

Hi,
Thanks a lot for your provided codes and models.

But with your provided with provided model “market_953.pth.tar”, and your code main_reid.py, I cannot get the result of rank1 95.3%.
Is there any tricks to play with inference? Thanks in advance!

I run the following command:
python3 main_reid.py train --save_dir='./pytorch-ckpt/market_bfe' --model_name=bfe --train_batch=32 --test_batch=32 --dataset=market1501 --pretrained_model='./pytorch-ckpt/market_bfe/market_953.pth.tar' --evaluate

And I get the market1501 dataset from the below link:
https://jingdongwang2017.github.io/Projects/ReID/Datasets/Market-1501.html

resuls:
=> Market1501 loaded
Dataset statistics:

subset | # ids | # images

train | 751 | 12936
query | 750 | 3368
gallery | 751 | 15913

total | 1501 | 32217

initializing model ...
load pretrained model ./pytorch-ckpt/market_bfe/market_953.pth.tar
model size: 32.27600M
Extracted features for query set: 3368 x 1536
Extracted features for gallery set: 15913 x 1536
Computing distance matrix
Computing CMC and mAP
Results ----------
mAP: 85.5%
CMC curve
Rank-1 : 94.6%
Rank-2 : 96.5%
Rank-4 : 97.4%
Rank-5 : 97.8%
Rank-8 : 98.4%
Rank-10 : 98.8%
Rank-16 : 99.3%
Rank-20 : 99.3%

hardwares and softwares:
GPU : 2080TI CUDA:10.0 pytorch:1.0.0

class activation map

Hello, after reading through your dissertation, I saw the class activation map, but I do n’t know how to get it, can you share this visual code? Thank you very much

test

when I test, there is a error, ValueError: expected 2D or 3D input (got 1D input), please tell me how should I do.

数据处理

你好,请问是不是不管是哪个数据集,都是用data_manager的class Market1501来处理,只需要更换config里的dataset即可,其他均不变。

The use of “num_instances”

Hi!I read your code but i can't understand the use of "num_instances" in SandomIdentitySampler. Could you help me? Thanks!

result when height_ratio=0

when set width_ratio=1.0,

(1)height_ratio=0.2, map=86.5, rank1=94.7

(2)heigth_ratio=0.0(no use of batch crop), map=85.6, rank1=94.7

does my exps right?

data_manager

您好,您能把data_manager 中关于在cuhk03数据集处理部分代码公布一下吗?谢谢!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.