mmtracking
mmtracking copied to clipboard
When I want to run demo.py with strongsort, I get the following error:
Thanks for your error report and we appreciate it a lot.
Checklist
- I have searched related issues but cannot get the expected help.
- The bug has not been fixed in the latest version.
Describe the bug When I want to run demo.py with strongsort, I get an error that the input data is missing something.
Reproduction
- What command or script did you run?
python -W ignore demo/demo_mot_vis.py configs/mot/strongsort/strongsort_yolox_x_8xb4-80e_crowdhuman-mot20train_test-mot20test.py --input demo/demo.mp4 --output mot.mp4
-
Did you make any modifications on the code or config? Did you understand what you have modified? NO, i dont mofify anything
-
What dataset did you use and what task did you run?
demo.mp4
Environment
- Please run
python mmtrack/utils/collect_env.pyto collect necessary environment information and paste it here.
sys.platform: linux
Python: 3.9.13 (main, Oct 13 2022, 21:15:33) [GCC 11.2.0]
CUDA available: True
numpy_random_seed: 2147483648
GPU 0,1: NVIDIA GeForce RTX 3090 Ti
CUDA_HOME: /usr/local/cuda-11.3
NVCC: Cuda compilation tools, release 11.3, V11.3.109
GCC: gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
PyTorch: 1.11.0
PyTorch compiling details: PyTorch built with:
- GCC 7.3
- C++ Version: 201402
- Intel(R) oneAPI Math Kernel Library Version 2021.4-Product Build 20210904 for Intel(R) 64 architecture applications
- Intel(R) MKL-DNN v2.5.2 (Git Hash a9302535553c73243c632ad3c4c80beec3d19a1e)
- OpenMP 201511 (a.k.a. OpenMP 4.5)
- LAPACK is enabled (usually provided by MKL)
- NNPACK is enabled
- CPU capability usage: AVX2
- CUDA Runtime 11.3
- NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_37,code=compute_37
- CuDNN 8.2
- Magma 2.5.2
- Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.3, CUDNN_VERSION=8.2.0, CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.11.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=OFF, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF,
TorchVision: 0.12.0
OpenCV: 4.6.0
MMEngine: 0.2.0
MMCV: 2.0.0rc1
MMCV Compiler: GCC 9.3
MMCV CUDA Compiler: 11.3
MMTracking: 1.0.0rc1+0824838
- You may add addition that may be helpful for locating the problem, such as
- How you installed PyTorch [e.g., pip]
Error traceback
Traceback (most recent call last):
File "/home/lzp/mmtracking/demo/demo_mot_vis.py", line 119, in <module>
main(args)
File "/home/lzp/mmtracking/demo/demo_mot_vis.py", line 88, in main
result = inference_mot(model, img, frame_id=i)
File "/home/lzp/mmtracking/mmtrack/apis/inference.py", line 128, in inference_mot
result = model.test_step(data)[0]
File "/home/ubuntu/anaconda3/envs/open-mmlab/lib/python3.9/site-packages/mmengine/model/base_model/base_model.py", line 145, in test_step
return self._run_forward(data, mode='predict') # type: ignore
File "/home/ubuntu/anaconda3/envs/open-mmlab/lib/python3.9/site-packages/mmengine/model/base_model/base_model.py", line 301, in _run_forward
results = self(**data, mode=mode)
File "/home/ubuntu/anaconda3/envs/open-mmlab/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/home/lzp/mmtracking/mmtrack/models/mot/base.py", line 108, in forward
return self.predict(inputs, data_samples, **kwargs)
File "/home/lzp/mmtracking/mmtrack/models/mot/deep_sort.py", line 99, in predict
det_results = self.detector.predict(img, data_samples)
File "/home/ubuntu/anaconda3/envs/open-mmlab/lib/python3.9/site-packages/mmdet/models/detectors/single_stage.py", line 110, in predict
results_list = self.bbox_head.predict(
File "/home/ubuntu/anaconda3/envs/open-mmlab/lib/python3.9/site-packages/mmdet/models/dense_heads/base_dense_head.py", line 197, in predict
predictions = self.predict_by_feat(
File "/home/ubuntu/anaconda3/envs/open-mmlab/lib/python3.9/site-packages/mmdet/models/dense_heads/yolox_head.py", line 317, in predict_by_feat
self._bbox_post_process(
File "/home/ubuntu/anaconda3/envs/open-mmlab/lib/python3.9/site-packages/mmdet/models/dense_heads/yolox_head.py", line 387, in _bbox_post_process
assert img_meta.get('scale_factor') is not None
AssertionError
Bug fix If you have already identified the reason, you can provide the information here. If you are willing to create a PR to fix it, please also leave a comment here and that would be much appreciated!
Hi,
The reason for the error is that the scale_factor is not found in the meta information of the image, which stores the scale of the image.
What is your mmdet version?
You can use mmdet.__ version__ to show.
你好,
报错的原因是
scale_factor图片的元信息中没有找到,存储了图片的比例尺。你的 mmdet 版本是多少? 你可以
mmdet.__ version__用来展示。
Hi, my version is '3.0.0rc2'
In my opinion, there should be no such error, can you make a breakpoint here to see what keys are in img_meta?
Ran into the same error for ByteTrack and StrongSort in the dev-1.x branch, while deepsort works OK.
Comparing the config files, val_dataloader is different in deepsort compared to the other two trackers. Deepsort inherit the val_dataloader from ../../base/datasets/mot_challenge.py, while ByteTrack and StrongSort overwrite val_dataloader with its own. Delete their own val_dataloader and everything works fine.
Here is the dev environment I am using:
mmcls 1.0.0rc5
mmcv 2.0.0rc3
mmdet 3.0.0rc5
mmengine 0.4.0
mmtrack 1.0.0rc1
Here is the error message:
Traceback (most recent call last):
File "demo/demo_mot_vis.py", line 119, in <module>
main(args)
File "demo/demo_mot_vis.py", line 88, in main
result = inference_mot(model, img, frame_id=i)
File "/home/tong/code/mmtracking-tomp/mmtrack/apis/inference.py", line 131, in inference_mot
result = model.test_step(data)[0]
File "/usr/local/lib/python3.8/dist-packages/mmengine/model/base_model/base_model.py", line 145, in test_step
return self._run_forward(data, mode='predict') # type: ignore
File "/usr/local/lib/python3.8/dist-packages/mmengine/model/base_model/base_model.py", line 314, in _run_forward
results = self(**data, mode=mode)
File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/home/tong/code/mmtracking-tomp/mmtrack/models/mot/base.py", line 108, in forward
return self.predict(inputs, data_samples, **kwargs)
File "/home/tong/code/mmtracking-tomp/mmtrack/models/mot/byte_track.py", line 104, in predict
det_results = self.detector.predict(img, data_samples)
File "/home/tong/code/mmdetection/mmdet/models/detectors/single_stage.py", line 110, in predict
results_list = self.bbox_head.predict(
File "/home/tong/code/mmdetection/mmdet/models/dense_heads/base_dense_head.py", line 197, in predict
predictions = self.predict_by_feat(
File "/home/tong/code/mmdetection/mmdet/models/dense_heads/yolox_head.py", line 317, in predict_by_feat
self._bbox_post_process(
File "/home/tong/code/mmdetection/mmdet/models/dense_heads/yolox_head.py", line 387, in _bbox_post_process
assert img_meta.get('scale_factor') is not None
AssertionError
I tried @shen-ttt suggestion and it seems to be working for me as well. Comment the following
val_dataloader = dict(
batch_size=1,
num_workers=2,
persistent_workers=True,
drop_last=False,
sampler=dict(type='VideoSampler'),
dataset=dict(
type=dataset_type,
data_root=data_root,
ann_file='annotations/half-val_cocoformat.json',
data_prefix=dict(img_path='train'),
ref_img_sampler=None,
load_as_video=True,
test_mode=True,
pipeline=test_pipeline))
And add the following
val_dataloader = dict(
dataset=dict(ann_file='annotations/train_cocoformat.json'))
def inference_mot(model: nn.Module, img: np.ndarray, frame_id: int) -> SampleList: remove the "LoadImageFromFile" and "LoadTrackAnnotations" in pipeline test_pipeline = Compose(cfg.test_dataloader.dataset.pipeline[2:]) data = test_pipeline(data)
problem is here
pipline in the config file did not define LoadTrackAnnotations so it is a bug and has not fixed yet
anyone