🏆Code for 1st Place Soluition in both the Tiger Re-ID in the plain track and Tiger Re-ID in the wild trackCVWC2019 @ICCV19 Workshop.
git clone https://github.com/LcenArthas/CWCV2019-Amur-Tiger-Re-ID.git
Tested under python3.6 Ubantu16.04
- python packages
- pytorch=1.0.1
- torchvision==0.2.1
- pytorch-ignite=0.1.2 (Note: V0.2.0 may result in an error)
- yacs==0.1.6
- tensorboardx
- h5py==2.9.0
- imgaug==0.2.9
- matplotlib==3.1.0
- numpy==1.16.4
- opencv==4.1.0.15
- pillow==6.0.0
- scikit-image==0.15.0
- scipy==1.3.0
- tensorboardx==1.6
- tqdm==4.32.1
- yacs==0.1.6
🔸 Download the train dataset and put them(atrw_reid_train, atrw_anno_reid_train) into the {repo_root}/process_data/
.
🔸 Transform the data style for the model
python data_process.py
🔸 Creat a new folder named /pretrained_model/
under the {repo_root}/
:
cd data
mkdir pretrained_model
🔸 Download the pre-trained weighte and put them into the {repo_root}/pretrained_model/
.
And make sure the repo files as the following structure:
{repo_root}
├── config
├── configs
├── data
| ├── AmurTiger
│ │ ├── flod0
│ │ └── flod1
│ │ ├── flod2
│ │ └── flod3
│ ├── datasets
│ ├── samplers
│ └── ...
├── engine
├── layers
├── modeling
├── pre_data
├── pretrained_model
├── solver
├── tests
├── utils
├── check_result.py
├── data_process.py
├── medo.py
├── medo_wide.py
├── test.py
└── train.py
In this competition, I use 4-fold to train and ues the Resnet152 for the backbone.
python train.py --config_file ./configs/tiger_b_resnet152_34.yml --index_flod 0
python train.py --config_file ./configs/tiger_b_resnet152_34.yml --index_flod 1
python train.py --config_file ./configs/tiger_b_resnet152_34.yml --index_flod 2
python train.py --config_file ./configs/tiger_b_resnet152_34.yml --index_flod 3
Eventually the trained model will be saved in {repo_root}/tiger_out/b_resnet152_34/
🔸 Creat a new folder named /reid_test/
under the {repo_root}/data/AmurTiger/
:
cd data
cd AmurTiger
mkdir reid_test
🔸 Put the test images in the {repo_root}/data/AmurTiger/reid_test/
.
The trained weights are following:
Download it and create a new folder under the {repo_root} named /trained_weight/
mkdir trained_weight
Unzip the model.zip(there will be 8 trained weights) and put them in the {repo_root}/trained_weight/
.
And make sure the repo files as the following structure:
{repo_root}
├── config
├── configs
├── data
| ├── AmurTiger
│ │ ├── flod0
│ │ └── reid_test
│ │ ├── 000000.jpg
│ │ ├── 000004.jpg
│ │ ├── 000005.jpg
│ │ ├── 000006.jpg
│ │ ├── 000008.jpg
│ │ └── ...
│ ├── datasets
│ ├── samplers
│ └── ...
├── engine
├── layers
├── modeling
├── solver
├── tests
├── trained_weight
│ ├── resnet101-bsize_model_100.pth
│ ├── resnet101-bsize_model_300.pth
│ ├── resnet101-bsize_model_301.pth
│ ├── resnet101-bsize_model_400.pth
│ └──...
├── utils
├── check_result.py
├── medo.py
├── medo_wide.py
├── test.py
└── train.py
python demo.py
This process will take about 6 minutes, just a moment, please.
It will generate a submission in the {repo_root/}:
- submission_plain.json —-you can submit to the Tiger Plain Re-ID track.
Same thing up here
In this task, it's a two-step process: Detection and Re-id
🔸 Please follow this repo: CWCV2019-Amur-Tiger-Detection
Note that the two repos depend on different environments(Re-ID is pytorch==1.0.1, Detection is pytorch==0.4.1)
🔸 Run scrip in above repo will generate 3 files in the {repo_root/}:
-
det_submission.json
-
wide_box.json
-
reid_test(a folder) --it contains images that have been detected and croped.
This wide_box.json and reid_test(a folder) are what we need next.
Use this reop.
Put wide_box.json and reid_test(a folder)(created by the detector above) under the {repo_root}/data/AmurTiger/
.
The trained weight is following:
Download it and create a new folder under the {repo_root} named /trained_weight/
mkdir trained_weight
Unzip the model.zip and put them into the {repo_root}/trained_weight/
.
And make sure the repo files as the following structure:
{repo_root}
├── config
├── configs
├── data
| ├── AmurTiger
│ │ ├── flod0
│ │ ├── wide_box.json
│ │ └── reid_test
│ │ ├── 000000.jpg
│ │ ├── 000004.jpg
│ │ ├── 000005.jpg
│ │ ├── 000006.jpg
│ │ ├── 000008.jpg
│ │ └── ...
│ ├── datasets
│ ├── samplers
│ └── ...
├── engine
├── layers
├── modeling
├── solver
├── tests
├── trained_weight
│ ├── best_model.pth
│ ├── resnet101-bsize_model_100.pth
│ ├── resnet101-bsize_model_300.pth
│ ├── resnet101-bsize_model_301.pth
│ ├── resnet101-bsize_model_400.pth
│ └──...
├── utils
├── check_result.py
├── medo.py
├── medo_wide.py
├── test.py
└── train.py
python demo_wide.py
This process will take about 15 minutes, just a moment, please.
It will generate a submission in the {repo_root/}:
- submission_wide.json —-you can submit to the Tiger Wide Re-ID track.