fast-reid/README.md

87 lines
3.2 KiB
Markdown
Raw Normal View History

2018-07-26 08:18:25 +08:00
# ReID_baseline
2019-02-26 16:21:23 +08:00
2019-08-15 08:59:24 +08:00
A strong baseline (state-of-the-art) for person re-identification.
2018-06-08 12:59:03 +08:00
2018-08-02 23:18:09 +08:00
We support
2019-01-10 18:39:31 +08:00
- [x] easy dataset preparation
- [x] end-to-end training and evaluation
2019-08-15 08:59:24 +08:00
- [ ] multi-GPU distributed training
- [ ] fast training speed with fp16
2019-08-20 09:36:47 +08:00
- [x] fast evaluation with cython
2019-08-15 08:59:24 +08:00
- [ ] support both image and video reid
- [x] multi-dataset training
- [x] cross-dataset evaluation
2019-01-10 18:39:31 +08:00
- [x] high modular management
2019-08-15 08:59:24 +08:00
- [x] state-of-the-art performance with simple model
- [ ] high efficient backbone
- [ ] advanced training techniques
- [ ] various loss functions
2019-08-20 09:36:47 +08:00
- [ ] tensorboard visualization
2018-06-13 16:53:32 +08:00
2018-08-02 23:18:09 +08:00
## Get Started
2019-01-10 18:39:31 +08:00
The designed architecture follows this guide [PyTorch-Project-Template](https://github.com/L1aoXingyu/PyTorch-Project-Template), you can check each folder's purpose by yourself.
2018-08-02 23:18:09 +08:00
1. `cd` to folder where you want to download this repo
2. Run `git clone https://github.com/L1aoXingyu/reid_baseline.git`
3. Install dependencies:
2019-08-15 13:28:03 +08:00
- [pytorch 1.0.0+](https://pytorch.org/)
2018-08-02 23:18:09 +08:00
- torchvision
2019-08-15 13:28:03 +08:00
- [fastai](https://github.com/fastai/fastai)
2019-01-10 18:39:31 +08:00
- [yacs](https://github.com/rbgirshick/yacs)
2018-08-02 23:18:09 +08:00
4. Prepare dataset
2019-01-10 18:39:31 +08:00
2018-08-02 23:18:09 +08:00
Create a directory to store reid datasets under this repo via
```bash
cd reid_baseline
2019-08-15 13:28:03 +08:00
mkdir datasets
2018-08-02 23:18:09 +08:00
```
2019-08-15 13:28:03 +08:00
1. Download dataset to `datasets/` from [baidu pan](https://pan.baidu.com/s/1ntIi2Op) or [google driver](https://drive.google.com/file/d/0B8-rUzbwVRk0c054eEozWG9COHM/view)
2. Extract dataset. The dataset structure would like:
2019-01-10 18:39:31 +08:00
```bash
2019-08-15 13:28:03 +08:00
datasets
Market-1501-v15.09.15
2019-01-10 18:39:31 +08:00
bounding_box_test/
bounding_box_train/
2018-08-02 23:18:09 +08:00
```
2019-08-20 09:36:47 +08:00
5. Prepare pretrained model.
If you use origin ResNet, you do not need to do anything. But if you want to use ResNet_ibn, you need to download pretrain model in [here](https://drive.google.com/open?id=1thS2B8UOSBi_cJX6zRy6YYRwz_nVFI_S). And then you can put it in `~/.cache/torch/checkpoints` or anywhere you like.
Then you should set this pretrain model path in `configs/softmax_triplet.yml`.
6. compile with cython to accelerate evalution
```bash
cd csrc/eval_cylib; make
2018-08-02 23:18:09 +08:00
```
## Train
2019-01-10 18:43:00 +08:00
Most of the configuration files that we provide, you can run this command for training market1501
2018-08-02 23:18:09 +08:00
```bash
2019-08-15 13:28:03 +08:00
bash scripts/train_market.sh
2019-01-10 18:39:31 +08:00
```
2019-08-15 13:28:03 +08:00
Or you can just run code below to modify your cfg parameters
2019-01-10 18:39:31 +08:00
```bash
2019-08-15 13:28:03 +08:00
python3 tools/train.py -cfg='configs/softmax.yml' INPUT.SIZE_TRAIN '(256, 128)' INPUT.SIZE_TEST '(256, 128)'
2018-08-02 23:18:09 +08:00
```
2018-06-13 16:53:32 +08:00
2019-01-10 18:52:09 +08:00
## Test
You can test your model's performance directly by running this command
```bash
python3 tools/test.py --config_file='configs/softmax.yml' TEST.WEIGHT '/save/trained_model/path'
```
## Experiment Results
2018-06-13 16:53:32 +08:00
| size=(256, 128) batch_size=64 (16 id x 4 imgs) | | | | | |
| :------: | :-----: | :-----: | :--: | :---: | :----: |
| softmax? | ✔︎ | ✔︎ | ✔︎ | ✔︎ | ✔︎ |
| triplet? | | ✔︎ | | ✔︎ | ✔︎ |
| ibn? | | | ✔︎ | ✔︎ | ✔︎ |
| gcnet? | | | | | ✔︎ |
| Market1501 | 93.4 (82.9) | 94.2 (86.1) |93.3 (84.3)|94.9 (86.4)|-|
| DukeMTMC-reid | 84.7 (72.7) | 87.3 (76.0) |86.7 (74.9)|87.9 (77.1)|-|
| CUHK03 | | ||||
2019-01-10 18:39:31 +08:00
🔥Any other tricks are welcomed