|
| 1 | +# PySOT Training Tutorial |
| 2 | + |
| 3 | +This implements training of SiamRPN with backbone architectures, such as ResNet, AlexNet. |
| 4 | +### Add PySOT to your PYTHONPATH |
| 5 | +```bash |
| 6 | +export PYTHONPATH=/path/to/pysot:$PYTHONPATH |
| 7 | +``` |
| 8 | + |
| 9 | +## Prepare training dataset |
| 10 | +Prepare training dataset, detailed preparations are listed in [training_dataset](training_dataset) directory. |
| 11 | +* [VID](http://image-net.org/challenges/LSVRC/2017/) |
| 12 | +* [YOUTUBEBB](https://research.google.com/youtube-bb/) |
| 13 | +* [DET](http://image-net.org/challenges/LSVRC/2017/) |
| 14 | +* [COCO](http://cocodataset.org) |
| 15 | + |
| 16 | +## Download pretrained backbones |
| 17 | +Download pretrained backbones from [Google Driver](https://drive.google.com/drive/folders/1DuXVWVYIeynAcvt9uxtkuleV6bs6e3T9) and put them in `pretrained_models` directory |
| 18 | + |
| 19 | +## Training |
| 20 | + |
| 21 | +To train a model (SiamRPN++), run `train.py` with the desired configs: |
| 22 | + |
| 23 | +```bash |
| 24 | +cd experiments/siamrpn_r50_l234_dwxcorr_8gpu |
| 25 | +``` |
| 26 | + |
| 27 | +### Multi-processing Distributed Data Parallel Training |
| 28 | + |
| 29 | +#### Single node, multiple GPUs: |
| 30 | +```bash |
| 31 | +CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 \ |
| 32 | +python -m torch.distributed.launch \ |
| 33 | + --nproc_per_node=8 \ |
| 34 | + --master_port=2333 \ |
| 35 | + ../../tools/train.py --cfg config.yaml |
| 36 | +``` |
| 37 | + |
| 38 | +#### Multiple nodes: |
| 39 | +Node 1: (IP: 192.168.1.1, and has a free port: 2333) master node |
| 40 | +```bash |
| 41 | +CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 \ |
| 42 | +python -m torch.distributed.launch \ |
| 43 | + --nnodes=2 \ |
| 44 | + --node_rank=0 \ |
| 45 | + --nproc_per_node=8 \ |
| 46 | + --master_addr=192.168.1.1 \ # adjust your ip here |
| 47 | + --master_port=2333 \ |
| 48 | + ../../tools/train.py |
| 49 | +``` |
| 50 | +Node 2: |
| 51 | +```bash |
| 52 | +CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 \ |
| 53 | +python -m torch.distributed.launch \ |
| 54 | + --nnodes=2 \ |
| 55 | + --node_rank=1 \ |
| 56 | + --nproc_per_node=8 \ |
| 57 | + --master_addr=192.168.1.1 \ |
| 58 | + --master_port=2333 \ |
| 59 | + ../../tools/train.py |
| 60 | +``` |
| 61 | + |
| 62 | +## Testing |
| 63 | +After training, you can test snapshots on VOT dataset. |
| 64 | +For `AlexNet`, you need to test snapshots from 35 to 50 epoch. |
| 65 | +For `ResNet`, you need to test snapshots from 10 to 20 epoch. |
| 66 | + |
| 67 | +```bash |
| 68 | +START=10 |
| 69 | +END=20 |
| 70 | +seq $START 1 $END | \ |
| 71 | + xargs -I {} echo "snapshot/checkpoint_e{}.pth" | \ |
| 72 | + xargs -I {} \ |
| 73 | + python -u ../tools/test.py \ |
| 74 | + --snapshot {} \ |
| 75 | + --config config.py \ |
| 76 | + --dataset VOT2018 2>&1 | tee logs/test_dataset.log |
| 77 | +``` |
| 78 | + |
| 79 | +## Evaluation |
| 80 | +``` |
| 81 | +python ../../tools/eval.py \ |
| 82 | + --tracker_path ./results \ # result path |
| 83 | + --dataset VOT2018 \ # dataset name |
| 84 | + --num 4 \ # number thread to eval |
| 85 | + --tracker_prefix 'ch*' # tracker_name |
| 86 | +``` |
0 commit comments