From 9ca73458a401643363572f1c46c376b28cfcc9c8 Mon Sep 17 00:00:00 2001 From: Feng Ni Date: Wed, 3 Nov 2021 15:28:16 +0800 Subject: [PATCH] [MOT] fix mot readme and cfgs (#4440) * remove hardnet85 cfgs, fix readme of mot vehicle pedestrian * remove hardnet cfg, test=document_fix --- configs/mot/README.md | 3 -- configs/mot/README_cn.md | 3 -- configs/mot/fairmot/README.md | 3 -- configs/mot/fairmot/README_cn.md | 3 -- ...fairmot_enhance_hardnet85_30e_1088x608.yml | 49 ------------------- configs/mot/pedestrian/README_cn.md | 16 +++--- configs/mot/vehicle/README_cn.md | 22 +++++---- .../vehicle/tools/bdd100kmot/bdd100k2mot.py | 24 ++++----- .../bdd100kmot/gen_bdd100kmot_vehicle.sh | 6 +-- .../tools/bdd100kmot/gen_labels_MOT.py | 2 +- 10 files changed, 37 insertions(+), 94 deletions(-) delete mode 100644 configs/mot/fairmot/fairmot_enhance_hardnet85_30e_1088x608.yml diff --git a/configs/mot/README.md b/configs/mot/README.md index dd0f1d43b..e06405045 100644 --- a/configs/mot/README.md +++ b/configs/mot/README.md @@ -144,17 +144,14 @@ If you use a stronger detection model, you can get better results. Each txt is t | backbone | input shape | MOTA | IDF1 | IDS | FP | FN | FPS | download | config | | :--------------| :------- | :----: | :----: | :----: | :----: | :----: | :------: | :----: |:-----: | | DLA-34 | 1088x608 | 75.9 | 74.7 | 1021 | 11425 | 31475 | - |[model](https://paddledet.bj.bcebos.com/models/mot/fairmot_enhance_dla34_30e_1088x608.pdparams) | [config](./fairmot_enhance_dla34_30e_1088x608.yml) | -| HarDNet-85 | 1088x608 | 75.0 | 70.0 | 1050 | 11837 | 32774 | - |[model](https://paddledet.bj.bcebos.com/models/mot/fairmot_enhance_hardnet85_30e_1088x608.pdparams) | [config](./fairmot/fairmot_enhance_hardnet85_30e_1088x608.yml) | ### Results on MOT-17 Test Set | backbone | input shape | MOTA | IDF1 | IDS | FP | FN | FPS | download | config | | :--------------| :------- | :----: | :----: | :----: | :----: | :----: | :------: | :----: |:-----: | | DLA-34 | 1088x608 | 75.3 | 74.2 | 3270 | 29112 | 106749 | - |[model](https://paddledet.bj.bcebos.com/models/mot/fairmot_enhance_dla34_30e_1088x608.pdparams) | [config](./fairmot_enhance_dla34_30e_1088x608.yml) | -| HarDNet-85 | 1088x608 | 74.7 | 70.7 | 3210 | 29790 | 109914 | - |[model](https://paddledet.bj.bcebos.com/models/mot/fairmot_enhance_hardnet85_30e_1088x608.pdparams) | [config](./fairmot/fairmot_enhance_hardnet85_30e_1088x608.yml) | **Notes:** FairMOT enhance DLA-34 used 8 GPUs for training and mini-batch size as 16 on each GPU,and trained for 60 epoches. The crowdhuman dataset is added to the train-set during training. - FairMOT enhance HarDNet-85 used 8 GPUs for training and mini-batch size as 10 on each GPU,and trained for 30 epoches. The crowdhuman dataset is added to the train-set during training. ### FairMOT light model diff --git a/configs/mot/README_cn.md b/configs/mot/README_cn.md index 5af35b17c..ade9009a6 100644 --- a/configs/mot/README_cn.md +++ b/configs/mot/README_cn.md @@ -143,17 +143,14 @@ wget https://dataset.bj.bcebos.com/mot/det_results_dir.zip | 骨干网络 | 输入尺寸 | MOTA | IDF1 | IDS | FP | FN | FPS | 下载链接 | 配置文件 | | :--------------| :------- | :----: | :----: | :----: | :----: | :----: | :------: | :----: |:-----: | | DLA-34 | 1088x608 | 75.9 | 74.7 | 1021 | 11425 | 31475 | - |[下载链接](https://paddledet.bj.bcebos.com/models/mot/fairmot_enhance_dla34_60e_1088x608.pdparams) | [配置文件](./fairmot_enhance_dla34_60e_1088x608.yml) | -| HarDNet-85 | 1088x608 | 75.0 | 70.0 | 1050 | 11837 | 32774 | - |[下载链接](https://paddledet.bj.bcebos.com/models/mot/fairmot_enhance_hardnet85_30e_1088x608.pdparams) | [配置文件](./fairmot/fairmot_enhance_hardnet85_30e_1088x608.yml) | ### 在MOT-17 Test Set上结果 | 骨干网络 | 输入尺寸 | MOTA | IDF1 | IDS | FP | FN | FPS | 下载链接 | 配置文件 | | :--------------| :------- | :----: | :----: | :----: | :----: | :----: | :------: | :----: |:-----: | | DLA-34 | 1088x608 | 75.3 | 74.2 | 3270 | 29112 | 106749 | - |[下载链接](https://paddledet.bj.bcebos.com/models/mot/fairmot_enhance_dla34_60e_1088x608.pdparams) | [配置文件](./fairmot_enhance_dla34_60e_1088x608.yml) | -| HarDNet-85 | 1088x608 | 74.7 | 70.7 | 3210 | 29790 | 109914 | - |[下载链接](https://paddledet.bj.bcebos.com/models/mot/fairmot_enhance_hardnet85_30e_1088x608.pdparams) | [配置文件](./fairmot/fairmot_enhance_hardnet85_30e_1088x608.yml) | **注意:** FairMOT enhance DLA-34使用8个GPU进行训练,每个GPU上batch size为16,训练60个epoch,并且训练集中加入了crowdhuman数据集一起参与训练。 - FairMOT enhance HarDNet-85 使用8个GPU进行训练,每个GPU上batch size为10,训练30个epoch,并且训练集中加入了crowdhuman数据集一起参与训练。 ### FairMOT轻量级模型 diff --git a/configs/mot/fairmot/README.md b/configs/mot/fairmot/README.md index 9ec0cf8b6..8a077861e 100644 --- a/configs/mot/fairmot/README.md +++ b/configs/mot/fairmot/README.md @@ -42,17 +42,14 @@ English | [简体中文](README_cn.md) | backbone | input shape | MOTA | IDF1 | IDS | FP | FN | FPS | download | config | | :--------------| :------- | :----: | :----: | :----: | :----: | :----: | :------: | :----: |:-----: | | DLA-34 | 1088x608 | 75.9 | 74.7 | 1021 | 11425 | 31475 | - |[model](https://paddledet.bj.bcebos.com/models/mot/fairmot_enhance_dla34_60e_1088x608.pdparams) | [config](./fairmot_enhance_dla34_60e_1088x608.yml) | -| HarDNet-85 | 1088x608 | 75.0 | 70.0 | 1050 | 11837 | 32774 | - |[model](https://paddledet.bj.bcebos.com/models/mot/fairmot_enhance_hardnet85_30e_1088x608.pdparams) | [config](./fairmot_enhance_hardnet85_30e_1088x608.yml) | ### Results on MOT-17 Test Set | backbone | input shape | MOTA | IDF1 | IDS | FP | FN | FPS | download | config | | :--------------| :------- | :----: | :----: | :----: | :----: | :----: | :------: | :----: |:-----: | | DLA-34 | 1088x608 | 75.3 | 74.2 | 3270 | 29112 | 106749 | - |[model](https://paddledet.bj.bcebos.com/models/mot/fairmot_enhance_dla34_60e_1088x608.pdparams) | [config](./fairmot_enhance_dla34_60e_1088x608.yml) | -| HarDNet-85 | 1088x608 | 74.7 | 70.7 | 3210 | 29790 | 109914 | - |[model](https://paddledet.bj.bcebos.com/models/mot/fairmot_enhance_hardnet85_30e_1088x608.pdparams) | [config](./fairmot_enhance_hardnet85_30e_1088x608.yml) | **Notes:** FairMOT enhance DLA-34 used 8 GPUs for training and mini-batch size as 16 on each GPU,and trained for 60 epoches. The crowdhuman dataset is added to the train-set during training. - FairMOT enhance HarDNet-85 used 8 GPUs for training and mini-batch size as 10 on each GPU,and trained for 30 epoches. The crowdhuman dataset is added to the train-set during training. ### FairMOT light model diff --git a/configs/mot/fairmot/README_cn.md b/configs/mot/fairmot/README_cn.md index 72d259558..7948832d5 100644 --- a/configs/mot/fairmot/README_cn.md +++ b/configs/mot/fairmot/README_cn.md @@ -41,17 +41,14 @@ | 骨干网络 | 输入尺寸 | MOTA | IDF1 | IDS | FP | FN | FPS | 下载链接 | 配置文件 | | :--------------| :------- | :----: | :----: | :----: | :----: | :----: | :------: | :----: |:-----: | | DLA-34 | 1088x608 | 75.9 | 74.7 | 1021 | 11425 | 31475 | - |[下载链接](https://paddledet.bj.bcebos.com/models/mot/fairmot_enhance_dla34_60e_1088x608.pdparams) | [配置文件](./fairmot_enhance_dla34_60e_1088x608.yml) | -| HarDNet-85 | 1088x608 | 75.0 | 70.0 | 1050 | 11837 | 32774 | - |[下载链接](https://paddledet.bj.bcebos.com/models/mot/fairmot_enhance_hardnet85_30e_1088x608.pdparams) | [配置文件](./fairmot_enhance_hardnet85_30e_1088x608.yml) | ### 在MOT-17 Test Set上结果 | 骨干网络 | 输入尺寸 | MOTA | IDF1 | IDS | FP | FN | FPS | 下载链接 | 配置文件 | | :--------------| :------- | :----: | :----: | :----: | :----: | :----: | :------: | :----: |:-----: | | DLA-34 | 1088x608 | 75.3 | 74.2 | 3270 | 29112 | 106749 | - |[下载链接](https://paddledet.bj.bcebos.com/models/mot/fairmot_enhance_dla34_60e_1088x608.pdparams) | [配置文件](./fairmot_enhance_dla34_60e_1088x608.yml) | -| HarDNet-85 | 1088x608 | 74.7 | 70.7 | 3210 | 29790 | 109914 | - |[下载链接](https://paddledet.bj.bcebos.com/models/mot/fairmot_enhance_hardnet85_30e_1088x608.pdparams) | [配置文件](./fairmot_enhance_hardnet85_30e_1088x608.yml) | **注意:** FairMOT enhance DLA-34使用8个GPU进行训练,每个GPU上batch size为16,训练60个epoch,并且训练集中加入了crowdhuman数据集一起参与训练。 - FairMOT enhance HarDNet-85 使用8个GPU进行训练,每个GPU上batch size为10,训练30个epoch,并且训练集中加入了crowdhuman数据集一起参与训练。 ### FairMOT轻量级模型 diff --git a/configs/mot/fairmot/fairmot_enhance_hardnet85_30e_1088x608.yml b/configs/mot/fairmot/fairmot_enhance_hardnet85_30e_1088x608.yml deleted file mode 100644 index 1a7228cca..000000000 --- a/configs/mot/fairmot/fairmot_enhance_hardnet85_30e_1088x608.yml +++ /dev/null @@ -1,49 +0,0 @@ -_BASE_: [ - '../../datasets/mot.yml', - '../../runtime.yml', - '_base_/optimizer_30e.yml', - '_base_/fairmot_hardnet85.yml', - '_base_/fairmot_reader_1088x608.yml', -] -norm_type: sync_bn -use_ema: true -ema_decay: 0.9998 - -worker_num: 4 -TrainReader: - inputs_def: - image_shape: [3, 608, 1088] - sample_transforms: - - Decode: {} - - RGBReverse: {} - - AugmentHSV: {} - - LetterBoxResize: {target_size: [608, 1088]} - - MOTRandomAffine: {reject_outside: False} - - RandomFlip: {} - - BboxXYXY2XYWH: {} - - NormalizeBox: {} - - NormalizeImage: {mean: [0, 0, 0], std: [1, 1, 1]} - - RGBReverse: {} - - Permute: {} - batch_transforms: - - Gt2FairMOTTarget: {} - batch_size: 10 - shuffle: True - drop_last: True - use_shared_memory: True - -epoch: 30 -LearningRate: - base_lr: 0.0001 - schedulers: - - !PiecewiseDecay - gamma: 0.1 - milestones: [20,] - use_warmup: False - -OptimizerBuilder: - optimizer: - type: Adam - regularizer: NULL - -weights: output/fairmot_enhance_hardnet85_30e_1088x608/model_final diff --git a/configs/mot/pedestrian/README_cn.md b/configs/mot/pedestrian/README_cn.md index f7b247cf8..78c195c6f 100644 --- a/configs/mot/pedestrian/README_cn.md +++ b/configs/mot/pedestrian/README_cn.md @@ -20,7 +20,7 @@ | VisDrone | 1088x608 | 49.2 | 63.1 | - | [下载链接](https://paddledet.bj.bcebos.com/models/mot/fairmot_dla34_30e_1088x608_visdrone_pedestrian.pdparams) | [配置文件](./fairmot_dla34_30e_1088x608_visdrone_pedestrian.yml) | **注意:** - FairMOT均使用DLA-34为骨干网络,2个GPU进行训练,每个GPU上batch size为6,训练30个epoch。 + FairMOT均使用DLA-34为骨干网络,4个GPU进行训练,每个GPU上batch size为6,训练30个epoch。 ## 数据集准备和处理 @@ -48,8 +48,10 @@ tools/visdrone/visdrone2mot.py: 生成visdrone_pedestrian据集 │ ├── visdrone2mot.py │ ├── visdrone_pedestrian │ │ ├── images +│ │ │ ├── train │ │ │ ├── val │ │ ├── labels_with_ids +│ │ │ ├── train │ │ │ ├── val # 执行 python visdrone2mot.py --transMot=True --data_name=visdrone_pedestrian --phase=val @@ -61,36 +63,36 @@ python visdrone2mot.py --transMot=True --data_name=visdrone_pedestrian --phase=t ### 1. 训练 使用2个GPU通过如下命令一键式启动训练 ```bash -python -m paddle.distributed.launch --log_dir=./fairmot_dla34_30e_1088x608_pathtrack/ --gpus 0,1 tools/train.py -c configs/mot/pedestrian/fairmot_dla34_30e_1088x608_pathtrack.yml +python -m paddle.distributed.launch --log_dir=./fairmot_dla34_30e_1088x608_visdrone_pedestrian/ --gpus 0,1 tools/train.py -c configs/mot/pedestrian/fairmot_dla34_30e_1088x608_visdrone_pedestrian.yml ``` ### 2. 评估 使用单张GPU通过如下命令一键式启动评估 ```bash # 使用PaddleDetection发布的权重 -CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/pedestrian/fairmot_dla34_30e_1088x608_pathtrack.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/fairmot_dla34_30e_1088x608_pathtrack.pdparams +CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/pedestrian/fairmot_dla34_30e_1088x608_visdrone_pedestrian.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/fairmot_dla34_30e_1088x608_visdrone_pedestrian.pdparams # 使用训练保存的checkpoint -CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/pedestrian/fairmot_dla34_30e_1088x608_pathtrack.yml -o weights=output/fairmot_dla34_30e_1088x608_pathtrack/model_final.pdparams +CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/pedestrian/fairmot_dla34_30e_1088x608_visdrone_pedestrian.yml -o weights=output/fairmot_dla34_30e_1088x608_visdrone_pedestrian/model_final.pdparams ``` ### 3. 预测 使用单个GPU通过如下命令预测一个视频,并保存为视频 ```bash # 预测一个视频 -CUDA_VISIBLE_DEVICES=0 python tools/infer_mot.py -c configs/mot/pedestrian/fairmot_dla34_30e_1088x608_pathtrack.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/fairmot_dla34_30e_1088x608_pathtrack.pdparams --video_file={your video name}.mp4 --save_videos +CUDA_VISIBLE_DEVICES=0 python tools/infer_mot.py -c configs/mot/pedestrian/fairmot_dla34_30e_1088x608_visdrone_pedestrian.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/fairmot_dla34_30e_1088x608_visdrone_pedestrian.pdparams --video_file={your video name}.mp4 --save_videos ``` **注意:** 请先确保已经安装了[ffmpeg](https://ffmpeg.org/ffmpeg.html), Linux(Ubuntu)平台可以直接用以下命令安装:`apt-get update && apt-get install -y ffmpeg`。 ### 4. 导出预测模型 ```bash -CUDA_VISIBLE_DEVICES=0 python tools/export_model.py -c configs/mot/pedestrian/fairmot_dla34_30e_1088x608_pathtrack.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/fairmot_dla34_30e_1088x608_pathtrack.pdparams +CUDA_VISIBLE_DEVICES=0 python tools/export_model.py -c configs/mot/pedestrian/fairmot_dla34_30e_1088x608_visdrone_pedestrian.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/fairmot_dla34_30e_1088x608_visdrone_pedestrian.pdparams ``` ### 5. 用导出的模型基于Python去预测 ```bash -python deploy/python/mot_jde_infer.py --model_dir=output_inference/fairmot_dla34_30e_1088x608_pathtrack --video_file={your video name}.mp4 --device=GPU --save_mot_txts +python deploy/python/mot_jde_infer.py --model_dir=output_inference/fairmot_dla34_30e_1088x608_visdrone_pedestrian --video_file={your video name}.mp4 --device=GPU --save_mot_txts ``` **注意:** 跟踪模型是对视频进行预测,不支持单张图的预测,默认保存跟踪结果可视化后的视频,可添加`--save_mot_txts`表示保存跟踪结果的txt文件,或`--save_images`表示保存跟踪结果可视化图片。 diff --git a/configs/mot/vehicle/README_cn.md b/configs/mot/vehicle/README_cn.md index 70ce5ac63..5cd861185 100644 --- a/configs/mot/vehicle/README_cn.md +++ b/configs/mot/vehicle/README_cn.md @@ -40,16 +40,16 @@ tools/bdd100kmot/gen_labels_MOT.py:生成单类别的labels_with_ids文件 tools/visdrone/visdrone2mot.py:生成visdrone_vehicle ``` -### 2、bdd100k_vehicle数据集处理 +### 2、bdd100kmot_vehicle数据集处理 ``` # 复制tools/bdd100kmot里的代码到数据集目录下 # 生成bdd100kmot_vehicle MOT格式的数据,抽取类别classes=2,3,4,9,10 (car, truck, bus, trailer, other vehicle) <<--生成前目录-->> -├── bdd100k_path +├── bdd100k │ ├── images │ ├── labels <<--生成后目录-->> -├── bdd100k_path +├── bdd100k │ ├── images │ ├── labels │ ├── bdd100kmot_vehicle @@ -77,10 +77,12 @@ sh gen_bdd100kmot_vehicle.sh │ ├── annotations │ ├── sequences │ ├── visdrone2mot.py -│ ├── visdrone-vehicle +│ ├── visdrone_vehicle │ │ ├── images +│ │ │ ├── train │ │ │ ├── val │ │ ├── labels_with_ids +│ │ │ ├── train │ │ │ ├── val # 执行 python visdrone2mot.py --transMot=True --data_name=visdrone_vehicle --phase=val @@ -92,36 +94,36 @@ python visdrone2mot.py --transMot=True --data_name=visdrone_vehicle --phase=trai ### 1. 训练 使用2个GPU通过如下命令一键式启动训练 ```bash -python -m paddle.distributed.launch --log_dir=./fairmot_dla34_30e_1088x608_bdd100k_vehicle/ --gpus 0,1 tools/train.py -c configs/mot/vehicle/fairmot_dla34_30e_1088x608_bdd100k_vehicle.yml +python -m paddle.distributed.launch --log_dir=./fairmot_dla34_30e_1088x608_bdd100kmot_vehicle/ --gpus 0,1 tools/train.py -c configs/mot/vehicle/fairmot_dla34_30e_1088x608_bdd100kmot_vehicle.yml ``` ### 2. 评估 使用单张GPU通过如下命令一键式启动评估 ```bash # 使用PaddleDetection发布的权重 -CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/vehicle/fairmot_dla34_30e_1088x608_bdd100k_vehicle.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/fairmot_dla34_30e_1088x608_bdd100k_vehicle.pdparams +CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/vehicle/fairmot_dla34_30e_1088x608_bdd100kmot_vehicle.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/fairmot_dla34_30e_1088x608_bdd100kmot_vehicle.pdparams # 使用训练保存的checkpoint -CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/vehicle/fairmot_dla34_30e_1088x608_bdd100k_vehicle.yml -o weights=output/fairmot_dla34_30e_1088x608_bdd100k_vehicle/model_final.pdparams +CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/vehicle/fairmot_dla34_30e_1088x608_bdd100kmot_vehicle.yml -o weights=output/fairmot_dla34_30e_1088x608_bdd100kmot_vehicle/model_final.pdparams ``` ### 3. 预测 使用单个GPU通过如下命令预测一个视频,并保存为视频 ```bash # 预测一个视频 -CUDA_VISIBLE_DEVICES=0 python tools/infer_mot.py -c configs/mot/vehicle/fairmot_dla34_30e_1088x608_bdd100k_vehicle.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/fairmot_dla34_30e_1088x608_bdd100k_vehicle.pdparams --video_file={your video name}.mp4 --save_videos +CUDA_VISIBLE_DEVICES=0 python tools/infer_mot.py -c configs/mot/vehicle/fairmot_dla34_30e_1088x608_bdd100kmot_vehicle.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/fairmot_dla34_30e_1088x608_bdd100kmot_vehicle.pdparams --video_file={your video name}.mp4 --save_videos ``` **注意:** 请先确保已经安装了[ffmpeg](https://ffmpeg.org/ffmpeg.html), Linux(Ubuntu)平台可以直接用以下命令安装:`apt-get update && apt-get install -y ffmpeg`。 ### 4. 导出预测模型 ```bash -CUDA_VISIBLE_DEVICES=0 python tools/export_model.py -c configs/mot/vehicle/fairmot_dla34_30e_1088x608_bdd100k_vehicle.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/fairmot_dla34_30e_1088x608_bdd100k_vehicle.pdparams +CUDA_VISIBLE_DEVICES=0 python tools/export_model.py -c configs/mot/vehicle/fairmot_dla34_30e_1088x608_bdd100kmot_vehicle.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/fairmot_dla34_30e_1088x608_bdd100kmot_vehicle.pdparams ``` ### 5. 用导出的模型基于Python去预测 ```bash -python deploy/python/mot_jde_infer.py --model_dir=output_inference/fairmot_dla34_30e_1088x608_bdd100k_vehicle --video_file={your video name}.mp4 --device=GPU --save_mot_txts +python deploy/python/mot_jde_infer.py --model_dir=output_inference/fairmot_dla34_30e_1088x608_bdd100kmot_vehicle --video_file={your video name}.mp4 --device=GPU --save_mot_txts ``` **注意:** 跟踪模型是对视频进行预测,不支持单张图的预测,默认保存跟踪结果可视化后的视频,可添加`--save_mot_txts`表示保存跟踪结果的txt文件,或`--save_images`表示保存跟踪结果可视化图片。 diff --git a/configs/mot/vehicle/tools/bdd100kmot/bdd100k2mot.py b/configs/mot/vehicle/tools/bdd100kmot/bdd100k2mot.py index 2de3403dd..82ead01a3 100644 --- a/configs/mot/vehicle/tools/bdd100kmot/bdd100k2mot.py +++ b/configs/mot/vehicle/tools/bdd100kmot/bdd100k2mot.py @@ -19,6 +19,8 @@ import cv2 import random import numpy as np import argparse +import tqdm +import json def mkdir_if_missing(d): @@ -62,7 +64,7 @@ def bdd2mot_tracking(img_dir, label_dir, save_img_dir, save_label_dir): os.system('cp {} {}'.format(source_img, target_img)) -def transBBOx(bbox): +def transBbox(bbox): # bbox --> cx cy w h bbox = list(map(lambda x: float(x), bbox)) bbox[0] = (bbox[0] - bbox[2] / 2) * 1280 @@ -106,10 +108,9 @@ def genSingleImageMot(inputPath, classes=[]): mot_line = [] mot_line.append(id_line[-1]) mot_line.append(str(id_idx)) - id_line_temp = transBBOx(id_line[2:6]) + id_line_temp = transBbox(id_line[2:6]) mot_line.extend(id_line_temp) - mot_line.append('1') - # mot_line.append(id_line[0]) # origin class + mot_line.append('1') # origin class: id_line[0] mot_line.append('1') # permanent class => 1 mot_line.append('1') mot_gt.append(mot_line) @@ -211,7 +212,7 @@ def VisualGt(dataPath, phase='train'): img_list_path = sorted(glob.glob(osp.join(seqPath, 'img1', '*.jpg'))) imgIndex = random.randint(0, len(img_list_path)) img_Path = img_list_path[imgIndex] - # + frame_value = img_Path.split('/')[-1].replace('.jpg', '') frame_value = frame_value.split('-')[-1] frame_value = int(frame_value) @@ -290,18 +291,17 @@ def copyImg(fromRootPath, toRootPath, phase): if __name__ == "__main__": parser = argparse.ArgumentParser(description='BDD100K to MOT format') - parser.add_argument("--data_path", default='/path/to/bdd100k') + parser.add_argument("--data_path", default='bdd100k') parser.add_argument("--phase", default='train') parser.add_argument("--classes", default='2,3,4,9,10') - parser.add_argument("--img_dir", default="/path/to/bdd/image/") - parser.add_argument("--label_dir", default="/path/to/bdd/label/") - parser.add_argument("--save_path", default="/save/path") + parser.add_argument("--img_dir", default="bdd100k/images/track/") + parser.add_argument("--label_dir", default="bdd100k/labels/box_track_20/") + parser.add_argument("--save_path", default="bdd100kmot_vehicle") parser.add_argument("--height", default=720) parser.add_argument("--width", default=1280) args = parser.parse_args() - ### for bdd tracking dataset attr_dict = dict() attr_dict["categories"] = [{ "supercategory": "none", @@ -350,7 +350,7 @@ if __name__ == "__main__": }] attr_id_dict = {i['name']: i['id'] for i in attr_dict['categories']} - # create BDD training set tracking in MOT format + # create bdd100kmot_vehicle training set in MOT format print('Loading and converting training set...') train_img_dir = os.path.join(args.img_dir, 'train') train_label_dir = os.path.join(args.label_dir, 'train') @@ -361,7 +361,7 @@ if __name__ == "__main__": bdd2mot_tracking(train_img_dir, train_label_dir, save_img_dir, save_label_dir) - # create BDD validation set tracking in MOT format + # create bdd100kmot_vehicle validation set in MOT format print('Loading and converting validation set...') val_img_dir = os.path.join(args.img_dir, 'val') val_label_dir = os.path.join(args.label_dir, 'val') diff --git a/configs/mot/vehicle/tools/bdd100kmot/gen_bdd100kmot_vehicle.sh b/configs/mot/vehicle/tools/bdd100kmot/gen_bdd100kmot_vehicle.sh index de8447613..07b488df2 100644 --- a/configs/mot/vehicle/tools/bdd100kmot/gen_bdd100kmot_vehicle.sh +++ b/configs/mot/vehicle/tools/bdd100kmot/gen_bdd100kmot_vehicle.sh @@ -1,6 +1,6 @@ -data_path=bdd100k_path -img_dir=${data_path}/images -label_dir=${data_path}/labels +data_path=bdd100k +img_dir=${data_path}/images/track +label_dir=${data_path}/labels/box_track_20 save_path=${data_path}/bdd100kmot_vehicle phasetrain=train diff --git a/configs/mot/vehicle/tools/bdd100kmot/gen_labels_MOT.py b/configs/mot/vehicle/tools/bdd100kmot/gen_labels_MOT.py index e4d470e94..91aa800c3 100644 --- a/configs/mot/vehicle/tools/bdd100kmot/gen_labels_MOT.py +++ b/configs/mot/vehicle/tools/bdd100kmot/gen_labels_MOT.py @@ -26,7 +26,7 @@ def mkdirs(d): if __name__ == "__main__": parser = argparse.ArgumentParser(description='BDD100K to MOT format') parser.add_argument( - "--mot_data", default='/paddle/dataset/bdd100kmot/bdd100k_small') + "--mot_data", default='./bdd100k') parser.add_argument("--phase", default='train') args = parser.parse_args() -- GitLab