PaddlePaddle / Paddle

PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice (『飞桨』核心框架,深度学习&机器学习高性能单机、分布式训练和跨平台部署)
http://www.paddlepaddle.org/
Apache License 2.0
22.24k stars 5.58k forks source link

MTMCT 跨镜跟踪出现问题 #52251

Closed 3250446980 closed 3 months ago

3250446980 commented 1 year ago

请提出你的问题 Please ask your question

运行百度飞桨跨境追踪的项目,项目地址https://aistudio.baidu.com/bd-cpu-01/user/210401/5763913/notebooks/5763913.ipynb运行这一步, 跨镜跟踪预测 在完成模型下载后,需要修改PaddleDetection/deploy/pptracking/python路径下的mtmct_cfg.yml,这份配置文件中包含了跨镜跟踪中轨迹融合的相关参数。首先需要确定cameras_bias中对应的名称与输入视频名称对应;其次,我们本次项目使用轨迹融合中的通用方法,将zone和camera相关的方法设置为False。

代码为:

config for MTMCT

MTMCT: True cameras_bias: c003: 0 c004: 0

1.zone releated parameters

use_zone: False #True zone_path: dataset/mot/aic21mtmct_vehicle/S06/zone

2.tricks parameters, can be used for other mtmct dataset

use_ff: False use_rerank: False #True

3.camera releated parameters

use_camera: False #True use_st_filter: False

4.zone releated parameters

use_roi: False #True roi_dir: dataset/mot/aic21mtmct_vehicle/S06

出现错误提示: File "/tmp/ipykernel_135/3845623459.py", line 3 cameras_bias: ^ SyntaxError: invalid syntax 这是在百度飞桨自己的jupyter notebook中运行出现的错误。

然后运行下一个步骤 !cd ~/PaddleDetection && python deploy/pptracking/python/mot_sde_infer.py --model_dir=output_inference/ppyolov2_r50vd_dcn_365e_aic21mtmct_vehicle/ --reid_model_dir=output_inference/deepsort_pplcnet_vehicle/ --mtmct_dir=/home/aistudio/mtmct-demo --device=GPU --mtmct_cfg=deploy/pptracking/python/mtmct_cfg.yml --scaled=True --save_mot_txts --save_images 运行这个代码出现错误提示: Traceback (most recent call last): File "deploy/pptracking/python/mot_sde_infer.py", line 952, in main() File "deploy/pptracking/python/mot_sde_infer.py", line 912, in main mtmct_dir=FLAGS.mtmct_dir, ) File "deploy/pptracking/python/mot_sde_infer.py", line 164, in init assert tracker_config is not None, 'Note that tracker_config should be set.' AssertionError: Note that tracker_config should be set.

这个是原本项目的问题还是参数设置的问题,这个样子应该怎么修改,或是需要调整哪些代码

nemonameless commented 1 year ago

你好,请使用最新PaddleDetection的develop分支或最新2.6分支的代码,最新请按这个文档跑 https://github.com/PaddlePaddle/PaddleDetection/tree/release/2.6/deploy/pptracking/python#4-%E8%BD%A6%E8%BE%86%E8%B7%A8%E9%95%9C%E5%A4%B4%E8%B7%9F%E8%B8%AA%E6%A8%A1%E5%9E%8B%E5%AF%BC%E5%87%BA%E5%92%8C%E9%A2%84%E6%B5%8B 。 也可前往https://github.com/PaddlePaddle/PaddleDetection/issues 提问

3250446980 commented 1 year ago

我现在想复现一下这个跨境追踪的代码,先下载了百度飞桨(https://aistudio.baidu.com/aistudio/projectdetail/5763913)上的AIStudio项目在jupyte中运行出错,然后放到自己的服务器上运行也出现了错误,通过github(https://github.com/PaddlePaddle/PaddleDetection/tree/release/2.6/deploy/pptracking/python#4-%E8%BD%A6%E8%BE%86%E8%B7%A8%E9%95%9C%E5%A4%B4%E8%B7%9F%E8%B8%AA%E6%A8%A1%E5%9E%8B%E5%AF%BC%E5%87%BA%E5%92%8C%E9%A2%84%E6%B5%8B)的提示进行了检测模型和ReID模型的替换,还是出现问题,如下,应该怎么解决

使用上面链接将 Step 1:下载导出的检测模型

下载车辆检测PPYOLOE导出的模型:

wget https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_ppvehicle.zip unzip mot_ppyoloe_l_36e_ppvehicle.zip Step 2:下载导出的ReID模型

wget https://paddledet.bj.bcebos.com/models/mot/deepsort/deepsort_pplcnet_vehicle.tar tar -xvf deepsort_pplcnet_vehicle.tar 这两个步骤进行之前文件的替换,然后再次运行

用导出的PPYOLOE车辆检测模型和PPLCNet车辆ReID模型

python deploy/pptracking/python/mot_sde_infer.py --model_dir=mot_ppyoloe_l_36e_ppvehicle/ --reid_model_dir=deepsort_pplcnet_vehicle/ --tracker_config=deploy/pptracking/python/tracker_config.yml --mtmct_dir=mtmct-demo --mtmct_cfg=deploy/pptracking/python/mtmct_cfg.yml --device=GPU --threshold=0.5 --save_mot_txts --save_images 这个命令还是会出现之前的错误,错误提示: ----------- Running Arguments ----------- batch_size: 1 camera_id: -1 cpu_threads: 1 device: GPU do_break_in_counting: False do_entrance_counting: False draw_center_traj: False enable_mkldnn: False image_dir: None image_file: None model_dir: output_inference/mot_ppyoloe_l_36e_ppvehicle/ mtmct_cfg: deploy/pptracking/python/mtmct_cfg.yml mtmct_dir: mtmct-demo output_dir: output region_polygon: [] region_type: horizontal reid_batch_size: 50 reid_model_dir: output_inference/deepsort_pplcnet_vehicle/ run_benchmark: False run_mode: paddle save_images: True save_mot_txt_per_img: False save_mot_txts: True scaled: False secs_interval: 2 skip_frame_num: -1 threshold: 0.5 tracker_config: deploy/pptracking/python/tracker_config.yml trt_calib_mode: False trt_max_shape: 1280 trt_min_shape: 1 trt_opt_shape: 640 use_dark: True use_gpu: False video_file: None warmup_frame: 50

----------- Model Configuration ----------- Model Arch: YOLO Transform Order: --transform op: Resize --transform op: Permute

----------- Model Configuration ----------- Model Arch: DeepSORT Transform Order: --transform op: LetterBoxResize --transform op: NormalizeImage --transform op: Permute

Traceback (most recent call last): File "deploy/pptracking/python/mot_sde_infer.py", line 952, in main() File "deploy/pptracking/python/mot_sde_infer.py", line 912, in main mtmct_dir=FLAGS.mtmct_dir ) File "deploy/pptracking/python/mot_sde_infer.py", line 166, in init tracker_cfg = yaml.safe_load(open(self.tracker_config)) File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/init.py", line 125, in safe_load return load(stream, SafeLoader) File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/init.py", line 81, in load return loader.get_single_data() File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/constructor.py", line 49, in get_single_data node = self.get_single_node() File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/composer.py", line 36, in get_single_node document = self.compose_document() File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/composer.py", line 55, in compose_document node = self.compose_node(None, None) File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/composer.py", line 84, in compose_node node = self.compose_mapping_node(anchor) File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/composer.py", line 133, in compose_mapping_node item_value = self.compose_node(node, item_key) File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/composer.py", line 84, in compose_node node = self.compose_mapping_node(anchor) File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/composer.py", line 127, in compose_mapping_node while not self.check_event(MappingEndEvent): File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/parser.py", line 98, in check_event self.current_event = self.state() File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/parser.py", line 428, in parse_block_mapping_key if self.check_token(KeyToken): File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/scanner.py", line 115, in check_token while self.need_more_tokens(): File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/scanner.py", line 152, in need_more_tokens self.stale_possible_simple_keys() File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/scanner.py", line 292, in stale_possible_simple_keys "could not find expected ':'", self.get_mark()) yaml.scanner.ScannerError: while scanning a simple key in "deploy/pptracking/python/tracker_config.yml", line 57, column 1 could not find expected ':' in "deploy/pptracking/python/tracker_config.yml", line 71, column 1

按照readme提示修改tracker_config.yml的跟踪器类型为type: DeepSORTTracker,跨镜头跟踪仅支持DeepSORT。其他的文件都没有修改,

nemonameless commented 1 year ago

请再仔细检查下你的 tracker_config.yml 文件的改动,或者贴出来看看。或者重新git clone 最新代码,全部重新操作一遍再试试。

3250446980 commented 1 year ago

这个是tracker_config.yml文件,复制的最新代码的内容放进去的,改了一下type:DeepSORTTracker

config of tracker for MOT SDE Detector, use 'OCSORTTracker' as default, 'JDETracker' here is just BYTETracker.

The tracker of MOT JDE Detector (such as FairMOT) is exported together with the model.

Here 'min_box_area' and 'vertical_ratio' are set for pedestrian, you can modify for other objects tracking.

type: DeepSORTTracker # choose one tracker in ['JDETracker', 'OCSORTTracker', 'DeepSORTTracker','BOTSORTTracker']

When using for MTMCT(Multi-Target Multi-Camera Tracking), you should modify to 'DeepSORTTracker'

just as BYTETracker, used for FairMOT in PP-Tracking project and for ByteTrack in PP-Humanv1 project

JDETracker: use_byte: True det_thresh: 0.3 conf_thres: 0.6 low_conf_thres: 0.1 match_thres: 0.9 min_box_area: 0 vertical_ratio: 0 # 1.6 for pedestrian

used for OC-SORT in PP-Humanv2 project and PP-Vehicle project

OCSORTTracker: det_thresh: 0.4 max_age: 30 min_hits: 3 iou_threshold: 0.3 delta_t: 3 inertia: 0.2 min_box_area: 0 vertical_ratio: 0 use_byte: False use_angle_cost: False

used for DeepSORT and MTMCT in PP-Tracking project

DeepSORTTracker: input_size: [64, 192] # An unique operation to scale the sub-image of the selected detected boxes to a fixed size min_box_area: 0 vertical_ratio: -1 budget: 100 max_age: 70 n_init: 3 metric_type: cosine matching_threshold: 0.2 max_iou_distance: 0.9

BOTSORTTracker: track_high_thresh: 0.3 track_low_thresh: 0.2 new_track_thresh: 0.4 match_thresh: 0.7 track_buffer: 30 min_box_area: 0 camera_motion: False cmc_method: 'sparseOptFlow' # only camera_motion is True,

sparseOptFlow | files (Vidstab GMC) | orb | ecc

还是提示错误: image

Traceback (most recent call last): File "deploy/pptracking/python/mot_sde_infer.py", line 952, in main() File "deploy/pptracking/python/mot_sde_infer.py", line 912, in main mtmct_dir=FLAGS.mtmct_dir ) File "deploy/pptracking/python/mot_sde_infer.py", line 166, in init tracker_cfg = yaml.safe_load(open(self.tracker_config)) File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/init.py", line 125, in safe_load return load(stream, SafeLoader) File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/init.py", line 81, in load return loader.get_single_data() File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/constructor.py", line 49, in get_single_data node = self.get_single_node() File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/composer.py", line 36, in get_single_node document = self.compose_document() File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/composer.py", line 55, in compose_document node = self.compose_node(None, None) File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/composer.py", line 84, in compose_node node = self.compose_mapping_node(anchor) File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/composer.py", line 133, in compose_mapping_node item_value = self.compose_node(node, item_key) File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/composer.py", line 84, in compose_node node = self.compose_mapping_node(anchor) File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/composer.py", line 127, in compose_mapping_node while not self.check_event(MappingEndEvent): File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/parser.py", line 98, in check_event self.current_event = self.state() File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/parser.py", line 428, in parse_block_mapping_key if self.check_token(KeyToken): File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/scanner.py", line 115, in check_token while self.need_more_tokens(): File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/scanner.py", line 152, in need_more_tokens self.stale_possible_simple_keys() File "/opt/conda/envs/MTMCT/lib/python3.7/site-packages/yaml/scanner.py", line 292, in stale_possible_simple_keys "could not find expected ':'", self.get_mark()) yaml.scanner.ScannerError: while scanning a simple key in "deploy/pptracking/python/tracker_config.yml", line 57, column 1 could not find expected ':' in "deploy/pptracking/python/tracker_config.yml", line 71, column 1

如果重新下载代码运行的话,新代码部分还需要添加旧代码多出来的那部分吗?还是说把新代码的那个deploy的那个文件夹下载更新进去就可以了?或者是百度飞桨上面有没有已经更新的可运行的项目可以做参考

3250446980 commented 1 year ago

换新代码出现错误: image 是什么的原因应该怎么解决

nemonameless commented 1 year ago

in "deploy/pptracking/python/tracker_config.yml", line 71, column 1

这个报错是yml文件里多了些字符导致读取出错,你自己再仔细检查71行,把多余空字符啥的去掉,这个yml里的代码总才56行。

你换新代码应该避免了以上报错了吧。然后的报错,是numba numpy库的版本的问题,numba本身是加速用的可选的,你可以不装,卸载了吧,不影响使用。 遇到问题注意看报错的信息,都有比较明显的提示。

3250446980 commented 1 year ago

我想用这个代码去换为自己的数据集,怎么做自己的数据集,应该怎么去训练模型、测试模型,有没有文档或是教程?

FrankMMMMMM commented 1 year ago

@3250446980 您好 您实现用自己数据集进行跨摄像头跟踪了吗? 是否可以分享详细过程?

paddle-bot[bot] commented 3 months ago

Since you haven\'t replied for more than a year, we have closed this issue/pr. If the problem is not solved or there is a follow-up one, please reopen it at any time and we will continue to follow up. 由于您超过一年未回复,我们将关闭这个issue/pr。 若问题未解决或有后续问题,请随时重新打开,我们会继续跟进。