diff --git a/configs/mot/README.md b/configs/mot/README.md index b6f7615922a8b309d26f77490188b01c4afb227e..5497195644961c435cf59f5edd6c650a9244fe24 100644 --- a/configs/mot/README.md +++ b/configs/mot/README.md @@ -186,9 +186,21 @@ Evaluating the track performance of FairMOT on val dataset in single GPU with fo CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/fairmot/fairmot_dla34_30e_1088x608.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/fairmot_dla34_30e_1088x608.pdparams # use saved checkpoint in training -CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/fairmot/fairmot_dla34_30e_1088x608.yml -o weights=output/fairmot_dla34_30e_1088x608/model_final +CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/fairmot/fairmot_dla34_30e_1088x608.yml -o weights=output/fairmot_dla34_30e_1088x608/model_final.pdparams ``` +### 3. Inference + +Inference a vidoe on single GPU with following command: + +```bash +# inference on video and save a video +CUDA_VISIBLE_DEVICES=0 python tools/infer_mot.py -c configs/mot/fairmot/fairmot_dla34_30e_1088x608.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/fairmot_dla34_30e_1088x608.pdparams --video_file={your video name}.mp4 --save_videos +``` +**Notes:** + Please make sure that [ffmpeg](https://ffmpeg.org/ffmpeg.html) is installed first, on Linux(Ubuntu) platform you can directly install it by the following command:`apt-get update && apt-get install -y ffmpeg`. + + ## Citations ``` @article{wang2019towards, diff --git a/configs/mot/README_cn.md b/configs/mot/README_cn.md index 15fac03a2e0f9930ca4da7658482e87033def8d2..53f8e4db42fd4c79a569cf9d1b87618b67db798d 100644 --- a/configs/mot/README_cn.md +++ b/configs/mot/README_cn.md @@ -184,9 +184,21 @@ FairMOT使用单张GPU通过如下命令一键式启动评估 CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/fairmot/fairmot_dla34_30e_1088x608.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/fairmot_dla34_30e_1088x608.pdparams # 使用训练保存的checkpoint -CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/fairmot/fairmot_dla34_30e_1088x608.yml -o weights=output/fairmot_dla34_30e_1088x608/model_final +CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/fairmot/fairmot_dla34_30e_1088x608.yml -o weights=output/fairmot_dla34_30e_1088x608/model_final.pdparams ``` +### 3. 预测 + +使用单个GPU通过如下命令预测一个视频,并保存为视频 + +```bash +# 预测一个视频 +CUDA_VISIBLE_DEVICES=0 python tools/infer_mot.py -c configs/mot/fairmot/fairmot_dla34_30e_1088x608.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/fairmot_dla34_30e_1088x608.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`。 + ## 引用 ``` @article{wang2019towards, diff --git a/configs/mot/deepsort/README.md b/configs/mot/deepsort/README.md index 4847be341cf3c02306ed0f7793b47b6b0afc1192..237d3bd70e2ee1f83de898b77c1b41e9674fce29 100644 --- a/configs/mot/deepsort/README.md +++ b/configs/mot/deepsort/README.md @@ -53,7 +53,7 @@ Each txt is the detection result of all the pictures extracted from each video, CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/jde/jde_darknet53_30e_1088x608_track.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/jde_darknet53_30e_1088x608.pdparams # use saved checkpoint after training -CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/jde/jde_darknet53_30e_1088x608_track.yml -o weights=output/jde_darknet53_30e_1088x608/model_final +CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/jde/jde_darknet53_30e_1088x608_track.yml -o weights=output/jde_darknet53_30e_1088x608/model_final.pdparams ``` ### 2. Tracking diff --git a/configs/mot/deepsort/README_cn.md b/configs/mot/deepsort/README_cn.md index 81af5f6c1e0be964d4f51b8d9a0127992f366778..203df6a811e8453072b19f41ee36a1e9e2f4d84d 100644 --- a/configs/mot/deepsort/README_cn.md +++ b/configs/mot/deepsort/README_cn.md @@ -53,7 +53,7 @@ det_results_dir CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/jde/jde_darknet53_30e_1088x608_track.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/jde_darknet53_30e_1088x608.pdparams # 使用训练保存的checkpoint -CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/jde/jde_darknet53_30e_1088x608_track.yml -o weights=output/jde_darknet53_30e_1088x608/model_final +CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/jde/jde_darknet53_30e_1088x608_track.yml -o weights=output/jde_darknet53_30e_1088x608/model_final.pdparams ``` ### 2. 跟踪预测 diff --git a/configs/mot/fairmot/README.md b/configs/mot/fairmot/README.md index 0254ef340e967135ec6cac1f7c6899b97c2a8a23..e6b7d74910cc4814d3fa4a76c359b0d7c9ebbb5d 100644 --- a/configs/mot/fairmot/README.md +++ b/configs/mot/fairmot/README.md @@ -53,8 +53,7 @@ Evaluating the track performance of FairMOT on val dataset in single GPU with fo CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/fairmot/fairmot_dla34_30e_1088x608.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/fairmot_dla34_30e_1088x608.pdparams # use saved checkpoint in training -CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/fairmot/fairmot_dla34_30e_1088x608.yml -o weights=output/fairmot_dla34_30e_1088x608/model_final -``` +CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/fairmot/fairmot_dla34_30e_1088x608.yml -o weights=output/fairmot_dla34_30e_1088x608/model_final.pdparams ## Citations ``` diff --git a/configs/mot/fairmot/README_cn.md b/configs/mot/fairmot/README_cn.md index 8bab81c78ae397cfbc17583cc3522de75bbba210..f6b4fac48dd032c67a6a1df57f9a5b17905fe70f 100644 --- a/configs/mot/fairmot/README_cn.md +++ b/configs/mot/fairmot/README_cn.md @@ -50,7 +50,7 @@ python -m paddle.distributed.launch --log_dir=./fairmot_dla34_30e_1088x608/ --gp CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/fairmot/fairmot_dla34_30e_1088x608.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/fairmot_dla34_30e_1088x608.pdparams # 使用训练保存的checkpoint -CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/fairmot/fairmot_dla34_30e_1088x608.yml -o weights=output/fairmot_dla34_30e_1088x608/model_final +CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/fairmot/fairmot_dla34_30e_1088x608.yml -o weights=output/fairmot_dla34_30e_1088x608/model_final.pdparams ``` ## 引用 diff --git a/configs/mot/fairmot/_base_/fairmot_reader_1088x608.yml b/configs/mot/fairmot/_base_/fairmot_reader_1088x608.yml index 6dadac3a32f8fe46a06d73374ce147e553a21db2..5c0d4824a83cf0d82d6f2be59a99c63ca13d22e1 100644 --- a/configs/mot/fairmot/_base_/fairmot_reader_1088x608.yml +++ b/configs/mot/fairmot/_base_/fairmot_reader_1088x608.yml @@ -28,3 +28,14 @@ EvalMOTReader: - NormalizeImage: {mean: [0, 0, 0], std: [1, 1, 1]} - Permute: {to_rgb: True} batch_size: 1 + + +TestMOTReader: + inputs_def: + image_shape: [3, 608, 1088] + sample_transforms: + - Decode: {to_rgb: False} + - LetterBoxResize: {target_size: [608, 1088]} + - NormalizeImage: {mean: [0, 0, 0], std: [1, 1, 1]} + - Permute: {to_rgb: True} + batch_size: 1 diff --git a/configs/mot/jde/README.md b/configs/mot/jde/README.md index d8ace647b9ebe97a9e288043bd0dada42d4e4a68..4e3893d1c6e4b1dac8fc77c78b6a9aeaa37d1d43 100644 --- a/configs/mot/jde/README.md +++ b/configs/mot/jde/README.md @@ -48,20 +48,9 @@ Evaluating the track performance of JDE on val dataset in single GPU with follow CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/jde/jde_darknet53_30e_1088x608.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/jde_darknet53_30e_1088x608.pdparams # use saved checkpoint in training -CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/jde/jde_darknet53_30e_1088x608.yml -o weights=output/jde_darknet53_30e_1088x608/model_final +CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/jde/jde_darknet53_30e_1088x608.yml -o weights=output/jde_darknet53_30e_1088x608/model_final.pdparams ``` -### 3. Inference - -Inference a vidoe in single GPU with following commands. - -```bash -# inference on video and save a video -CUDA_VISIBLE_DEVICES=0 python tools/infer_mot.py -c configs/mot/jde/jde_darknet53_30e_1088x608.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/jde_darknet53_30e_1088x608.pdparams --video_file={your video name}.mp4 --save_videos -``` -**Notes:** - Please make sure that [ffmpeg](https://www.ffmpeg.org) is installed first. - ## Citations ``` @article{wang2019towards, diff --git a/configs/mot/jde/README_cn.md b/configs/mot/jde/README_cn.md index 50672cf4e4c583e96876e507120ec88c90a3e63c..f2577268285b0c565e7163978a9c2ea84800b318 100644 --- a/configs/mot/jde/README_cn.md +++ b/configs/mot/jde/README_cn.md @@ -47,20 +47,9 @@ python -m paddle.distributed.launch --log_dir=./jde_darknet53_30e_1088x608/ --gp CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/jde/jde_darknet53_30e_1088x608.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/jde_darknet53_30e_1088x608.pdparams # 使用训练保存的checkpoint -CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/jde/jde_darknet53_30e_1088x608.yml -o weights=output/jde_darknet53_30e_1088x608/model_final +CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/jde/jde_darknet53_30e_1088x608.yml -o weights=output/jde_darknet53_30e_1088x608/model_final.pdparams ``` -### 3. 预测 - -使用单个GPU通过如下命令预测一个视频,并保存为视频 - -```bash -# 预测一个视频 -CUDA_VISIBLE_DEVICES=0 python tools/infer_mot.py -c configs/mot/jde/jde_darknet53_30e_1088x608.yml -o weights=https://paddledet.bj.bcebos.com/models/mot/jde_darknet53_30e_1088x608.pdparams --video_file={your video name}.mp4 --save_videos -``` -**注意:** - 请先确保已经安装了[ffmpeg](https://www.ffmpeg.org)。 - ## 引用 ``` @article{wang2019towards, diff --git a/ppdet/engine/tracker.py b/ppdet/engine/tracker.py index 153db303b640edf561ac18d1dffd5a6baa3ff3d0..4040d9200158c747249eaaf4d48a2cd88712d47b 100644 --- a/ppdet/engine/tracker.py +++ b/ppdet/engine/tracker.py @@ -280,8 +280,9 @@ class Tracker(object): timer_calls.append(tc) if save_videos: - output_video_path = os.path.join(save_dir, '{}.mp4'.format(seq)) - cmd_str = 'ffmpeg -f image2 -i {}/%05d.jpg -c:v copy {}'.format( + output_video_path = os.path.join(save_dir, '..', + '{}_vis.mp4'.format(seq)) + cmd_str = 'ffmpeg -f image2 -i {}/%05d.jpg {}'.format( save_dir, output_video_path) os.system(cmd_str) logger.info('Save video in {}.'.format(output_video_path)) @@ -367,8 +368,9 @@ class Tracker(object): raise ValueError(model_type) if save_videos: - output_video_path = os.path.join(save_dir, '{}.mp4'.format(seq)) - cmd_str = 'ffmpeg -f image2 -i {}/%05d.jpg -c:v copy {}'.format( + output_video_path = os.path.join(save_dir, '..', + '{}_vis.mp4'.format(seq)) + cmd_str = 'ffmpeg -f image2 -i {}/%05d.jpg {}'.format( save_dir, output_video_path) os.system(cmd_str) logger.info('Save video in {}'.format(output_video_path))