open-mmlab / mmtracking

OpenMMLab Video Perception Toolbox. It supports Video Object Detection (VID), Multiple Object Tracking (MOT), Single Object Tracking (SOT), Video Instance Segmentation (VIS) with a unified framework.
https://mmtracking.readthedocs.io/en/latest/
Apache License 2.0
3.5k stars 587 forks source link

IndexError: index 3 is out of bounds for dimension 0 with size 3 when running Tracktor with Custom Dataset #110

Open DableUTeeF opened 3 years ago

DableUTeeF commented 3 years ago

When I try running the Tracktor using a file modified from configs/mot/tracktor/tracktor_faster-rcnn_r50_fpn_4e_mot17-private-half.py by changing weights and num_class and run using a copy of demo_mot.py

    type='Tracktor',
    pretrains=dict(
        detector=  # noqa: E251
        'https://download.openmmlab.com/mmtracking/mot/faster_rcnn/faster-rcnn_r50_fpn_4e_mot17-half-64ee2ed4.pth', 
...
                clip_border=False), num_classes=1))),

To

    type='Tracktor',
    pretrains=dict(
        detector=  # noqa: E251
        '/home/palm/rcnn_1/epoch_48.pth', 
...
                clip_border=False), num_classes=3))),

Environment

sys.platform: linux
Python: 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 19:07:31) [GCC 7.3.0]
CUDA available: True
CUDA_HOME: /usr/local/cuda
NVCC: Build cuda_11.0_bu.TC445_37.28845127_0
GPU 0: GeForce GTX 1080
GCC: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
PyTorch: 1.7.1+cu101
PyTorch compiling details: PyTorch built with:
  - GCC 7.3
  - C++ Version: 201402
  - Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191122 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v1.6.0 (Git Hash 5ef631a030a6f73131c77892041042805a06064f)
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - NNPACK is enabled
  - CPU capability usage: AVX2
  - CUDA Runtime 10.1
  - 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_70,code=sm_70;-gencode;arch=compute_75,code=sm_75
  - CuDNN 7.6.3
  - Magma 2.5.2
  - Build settings: BLAS=MKL, BUILD_TYPE=Release, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DUSE_VULKAN_WRAPPER -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-variable -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, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, USE_CUDA=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, 

TorchVision: 0.8.2+cu101
OpenCV: 4.4.0
MMCV: 1.2.6
mmtrack: 0.5.0

Error traceback

  File "/home/palm/PycharmProjects/mmtracking/demo.py", line 71, in <module>
    main()
  File "/home/palm/PycharmProjects/mmtracking/demo.py", line 57, in main
    result = inference_mot(model, img, frame_id=i//5)
  File "/home/palm/PycharmProjects/mmtracking/mmtrack/apis/inference.py", line 94, in inference_mot
    result = model(return_loss=False, rescale=True, **data)
  File "/home/palm/miniconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/palm/miniconda3/lib/python3.6/site-packages/mmcv/runner/fp16_utils.py", line 84, in new_func
    return old_func(*args, **kwargs)
  File "/home/palm/PycharmProjects/mmtracking/mmtrack/models/mot/base.py", line 154, in forward
    return self.forward_test(img, img_metas, **kwargs)
  File "/home/palm/PycharmProjects/mmtracking/mmtrack/models/mot/base.py", line 131, in forward_test
    return self.simple_test(imgs[0], img_metas[0], **kwargs)
  File "/home/palm/PycharmProjects/mmtracking/mmtrack/models/mot/tracktor.py", line 148, in simple_test
    **kwargs)
  File "/home/palm/PycharmProjects/mmtracking/mmtrack/models/mot/trackers/tracktor_tracker.py", line 168, in track
    feats, img_metas, model.detector, frame_id, rescale)
  File "/home/palm/PycharmProjects/mmtracking/mmtrack/models/mot/trackers/tracktor_tracker.py", line 96, in regress_tracks
    ids = ids[valid_inds]
IndexError: index 3 is out of bounds for dimension 0 with size 3
OceanPang commented 3 years ago

Hi, as it is your custom datasets, I cannot reproduce your bug and help you directly.

Can you try to print more values in the forward process and give us more hints?

yonafalinie commented 3 years ago

Hi, did you manage to solve the error? I am having similar error and I think it is because of the number of class which is more than one. In original Tracktor repo it only can handle one class ('Pedestrian') and I was wondering if its the same cases as well here?

DableUTeeF commented 3 years ago

Hi, did you manage to solve the error? I am having similar error and I think it is because of the number of class which is more than one. In original Tracktor repo it only can handle one class ('Pedestrian') and I was wondering if its the same cases as well here?

Nope, I gave up and used Deepsort instead.

DableUTeeF commented 3 years ago

Although it did run when I stack ids equal to number of class, like I had 3 classes so I change from 5 ids to 15 ids.

But it instead didn't track and I stopped trying.

AndrewGuo0930 commented 2 years ago

Hi! Did you use DeepSORT in mmtracking to do multi-classes MOT? How did you realize that? I also encountered the problem caused by multi-classes and don't know how to use mmtracking to achieve this goal. Thank you so much!

Hi, did you manage to solve the error? I am having similar error and I think it is because of the number of class which is more than one. In original Tracktor repo it only can handle one class ('Pedestrian') and I was wondering if its the same cases as well here?

Nope, I gave up and used Deepsort instead.

DableUTeeF commented 2 years ago

It' been a year so I don't remember much and I don't know where the code is. But I remember used DeepSort and had no memorable issue.

AndrewGuo0930 commented 2 years ago

Oh thank you so much for your prompt reply!