Note: This code is only used for academic purposes, people cannot use this code for anything that might be considered commercial use.
OpenGait
OpenGait is a flexible and extensible gait recognition project provided by the Shiqi Yu Group and supported in part by WATRIX.AI. Just the pre-beta version is released now, and more documentations as well as the reproduced methods will be offered as soon as possible.
Highlighted features:
- Multiple Models Support: We reproduced several SOTA methods, and reached the same or even better performance.
- DDP Support: The officially recommended
Distributed Data Parallel (DDP)
mode is used during the training and testing phases. - AMP Support: The
Auto Mixed Precision (AMP)
option is available. - Nice log: We use
tensorboard
andlogging
to log everything, which looks pretty.
Model Zoo
Model | NM | BG | CL | Configuration | Input Size | Inference Time | Model Size |
---|---|---|---|---|---|---|---|
Baseline | 96.3 | 92.2 | 77.6 | baseline.yaml | 64x44 | 12s | 3.78M |
GaitSet(AAAI2019) | 95.8(95.0) | 90.0(87.2) | 75.4(70.4) | gaitset.yaml | 64x44 | 11s | 2.59M |
GaitPart(CVPR2020) | 96.1(96.2) | 90.7(91.5) | 78.7(78.7) | gaitpart.yaml | 64x44 | 22s | 1.20M |
GLN*(ECCV2020) | 96.1(95.6) | 92.5(92.0) | 80.4(77.2) | gln_phase1.yaml, gln_phase2.yaml | 128x88 | 14s | 9.46M / 15.6214M |
GaitGL(ICCV2021) | 97.5(97.4) | 95.1(94.5) | 83.5(83.6) | gaitgl.yaml | 64x44 | 31s | 3.10M |
The results in the parentheses are mentioned in the papers
Note:
- All the models were tested on CASIA-B (Rank@1, excluding identical-view cases).
- The shown result of GLN is implemented without compact block.
- Only 2 RTX6000 are used during the inference phase.
- The results on OUMVLP will be released soon. It's inference process just cost about 90 secs(Baseline & 8 RTX6000).
Get Started
Installation
-
clone this repo.
git clone https://github.com/ShiqiYu/OpenGait.git
-
Install dependenices:
- pytorch >= 1.6
- torchvision
- pyyaml
- tensorboard
- opencv-python
- tqdm
Install dependenices by Anaconda:
conda install tqdm pyyaml tensorboard opencv conda install pytorch==1.6.0 torchvision -c pytorch
Or, Install dependenices by pip:
pip install tqdm pyyaml tensorboard opencv-python pip install torch==1.6.0 torchvision==0.7.0
Prepare dataset
See prepare dataset.
Train
Train a model by
CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.launch --nproc_per_node=2 lib/main.py --cfgs ./config/baseline.yaml --phase train
python -m torch.distributed.launch
Our implementation uses DistributedDataParallel.--nproc_per_node
The number of gpu to use, it must equal the length ofCUDA_VISIBLE_DEVICES
.--cfgs
The path of config file.--phase
Specified astrain
.--iter
You can specify a number of iterations or userestore_hint
in the configuration file and resume training from there.--log_to_file
If specified, log will be written on disk simultaneously.
You can run commands in train.sh for training different models.
Test
Use trained model to evaluate by
CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.launch --nproc_per_node=2 lib/main.py --cfgs ./config/baseline.yaml --phase test
--phase
Specified astest
.--iter
You can specify a number of iterations or or userestore_hint
in the configuration file and restore model from there.
Tip: Other arguments are the same as train phase.
You can run commands in test.sh for testing different models.
Customize
If you want customize your own model, see here.
Warning
- Some models may not be compatible with
AMP
, you can disable it by settingenable_float16
False. - In
DDP
mode, zombie processes may occur when the program terminates abnormally. You can use this commandkill $(ps aux | grep main.py | grep -v grep | awk '{print $2}')
to clear them. - We implemented the functionality of testing while training, but it slightly affected the results. None of our published models use this functionality. You can disable it by setting
with_test
False.
Authors:
Open Gait Team (OGT)
Acknowledgement
- GLN: Saihui Hou (侯赛辉)
- GaitGL: Beibei Lin (林贝贝)