π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.