|
a |
|
b/docs/0.get_started.md |
|
|
1 |
# Get Started |
|
|
2 |
## Installation |
|
|
3 |
1. clone this repo. |
|
|
4 |
``` |
|
|
5 |
git clone https://github.com/ShiqiYu/OpenGait.git |
|
|
6 |
``` |
|
|
7 |
2. Install dependenices: |
|
|
8 |
- pytorch >= 1.10 |
|
|
9 |
- torchvision |
|
|
10 |
- pyyaml |
|
|
11 |
- tensorboard |
|
|
12 |
- opencv-python |
|
|
13 |
- tqdm |
|
|
14 |
- py7zr |
|
|
15 |
- kornia |
|
|
16 |
- einops |
|
|
17 |
|
|
|
18 |
Install dependenices by [Anaconda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html): |
|
|
19 |
``` |
|
|
20 |
conda install tqdm pyyaml tensorboard opencv kornia einops -c conda-forge |
|
|
21 |
conda install pytorch==1.10 torchvision -c pytorch |
|
|
22 |
``` |
|
|
23 |
Or, Install dependenices by pip: |
|
|
24 |
``` |
|
|
25 |
pip install tqdm pyyaml tensorboard opencv-python kornia einops |
|
|
26 |
pip install torch==1.10 torchvision==0.11 |
|
|
27 |
``` |
|
|
28 |
## Prepare dataset |
|
|
29 |
See [prepare dataset](2.prepare_dataset.md). |
|
|
30 |
|
|
|
31 |
## Get trained model |
|
|
32 |
- Option 1: |
|
|
33 |
``` |
|
|
34 |
python misc/download_pretrained_model.py |
|
|
35 |
``` |
|
|
36 |
- Option 2: Go to the [release page](https://github.com/ShiqiYu/OpenGait/releases/), then download the model file and uncompress it to [output](output). |
|
|
37 |
|
|
|
38 |
## Train |
|
|
39 |
Train a model by |
|
|
40 |
``` |
|
|
41 |
CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.launch --nproc_per_node=2 opengait/main.py --cfgs ./configs/baseline/baseline.yaml --phase train |
|
|
42 |
``` |
|
|
43 |
- `python -m torch.distributed.launch` [DDP](https://pytorch.org/tutorials/intermediate/ddp_tutorial.html) launch instruction. |
|
|
44 |
- `--nproc_per_node` The number of gpus to use, and it must equal the length of `CUDA_VISIBLE_DEVICES`. |
|
|
45 |
- `--cfgs` The path to config file. |
|
|
46 |
- `--phase` Specified as `train`. |
|
|
47 |
<!-- - `--iter` You can specify a number of iterations or use `restore_hint` in the config file and resume training from there. --> |
|
|
48 |
- `--log_to_file` If specified, the terminal log will be written on disk simultaneously. |
|
|
49 |
|
|
|
50 |
You can run commands in [train.sh](train.sh) for training different models. |
|
|
51 |
|
|
|
52 |
## Test |
|
|
53 |
Evaluate the trained model by |
|
|
54 |
``` |
|
|
55 |
CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.launch --nproc_per_node=2 opengait/main.py --cfgs ./configs/baseline/baseline.yaml --phase test |
|
|
56 |
``` |
|
|
57 |
- `--phase` Specified as `test`. |
|
|
58 |
- `--iter` Specify a iteration checkpoint. |
|
|
59 |
|
|
|
60 |
**Tip**: Other arguments are the same as train phase. |
|
|
61 |
|
|
|
62 |
You can run commands in [test.sh](test.sh) for testing different models. |
|
|
63 |
|
|
|
64 |
## Customize |
|
|
65 |
1. Read the [detailed config](docs/1.detailed_config.md) to figure out the usage of needed setting items; |
|
|
66 |
2. See [how to create your model](docs/2.how_to_create_your_model.md); |
|
|
67 |
3. There are some advanced usages, refer to [advanced usages](docs/3.advanced_usages.md), please. |
|
|
68 |
|
|
|
69 |
## Warning |
|
|
70 |
- In `DDP` mode, zombie processes may be generated when the program terminates abnormally. You can use this command [sh misc/clean_process.sh](./misc/clean_process.sh) to clear them. |