GaitPart is a CVPR 2020 paper.
This repo is not official, but almost reproduces the same recognition accuracy on CASIA-B dataset like the paper said. This repo is based on GaitSet
- Python 3.6
- PyTorch 1.5
- CUDA 10.2
pip install -r requirement.txt
Download CASIA-B Dataset
!!! ATTENTION !!! ATTENTION !!! ATTENTION !!!
Before training or test, please make sure you have prepared the dataset by this two steps:
- Step1: Organize the directory as:
your_dataset_path/subject_ids/walking_conditions/views. E.g.CASIA-B/001/nm-01/000/. - Step2: Cut and align the raw silhouettes with
pretreatment.py. (See pretreatment for details.) Welcome to try different ways of pretreatment but note that the silhouettes after pretreatment MUST have a size of 64x64.
Futhermore, you also can test our code on OU-MVLP Dataset. The number of channels and the training batchsize is slightly different for this dataset. For more detail, please refer to our paper.
Pretreatment your dataset by
python pretreatment.py --input_path='root_path_of_raw_dataset' --output_path='root_path_for_output'
--input_path(NECESSARY) Root path of raw dataset.--output_path(NECESSARY) Root path for output.--log_fileLog file path. #Default: './pretreatment.log'--logIf set as True, all logs will be saved. Otherwise, only warnings and errors will be saved. #Default: False--worker_numHow many subprocesses to use for data pretreatment. Default: 1
In config.py, you might want to change the following settings:
dataset_path(NECESSARY) root path of the dataset (for the above example, it is "gaitdata")WORK_PATHpath to save/load checkpointsCUDA_VISIBLE_DEVICESindices of GPUs
Train a model by
python train.py--cacheif set as TRUE all the training data will be loaded at once before the training start. This will accelerate the training. Note that if this arg is set as FALSE, samples will NOT be kept in the memory even they have been used in the former iterations. #Default: TRUE
Evaluate the trained model by
python test.py--iteriteration of the checkpoint to load. #Default: 80000--batch_sizebatch size of the parallel test. #Default: 1--cacheif set as TRUE all the test data will be loaded at once before the transforming start. This might accelerate the testing. #Default: FALSE
It will output Rank@1 of all three walking conditions.
Note that the test is parallelizable.
To conduct a faster evaluation, you could use --batch_size to change the batch size for test.
I do experiments on CASIA-B dataset, 74 for training and 50 for testing, totally train 80000 iters, the accuracies are in the following
| NM | BG | CL | |
|---|---|---|---|
| GaitPart | 96.2% | 91.5% | 78.7% |
| Ours | 96.0% | 90.6% | 77.8% |