SysCV / qd-3dt

Official implementation of Monocular Quasi-Dense 3D Object Tracking, TPAMI 2022
https://eborboihuc.github.io/QD-3DT/
BSD 3-Clause "New" or "Revised" License
517 stars 98 forks source link

AttributeError When Evaluating on nuScenes data #28

Closed CWAndersn closed 2 years ago

CWAndersn commented 2 years ago

I am currently trying to reproduce the nuScenes results as shown in the Getting Started page, but am running into an error when I try to run the run_eval_nusc.sh script. See the output trace below.

+ python3 -u ./tools/test_eval_video_exp.py nuscenes configs/Nusc/quasi_r101_dcn_3dmatch_multibranch_conv_dep_dim_cen_clsrot_sep_aug_confidence_scale_no_filter.py ./work_dirs/Nusc/quasi_r101_dcn_3dmatch_multibranch_conv_dep_dim_cen_clsrot_sep_aug_confidence_scale_no_filter/latest.pth ./work_dirs/Nusc/quasi_r101_dcn_3dmatch_multibranch_conv_dep_dim_cen_clsrot_sep_aug_confidence_scale_no_filter/output/output.pkl --data_split_prefix val --full_frames
Using agg as matplotlib backend
Starting ./work_dirs/Nusc/quasi_r101_dcn_3dmatch_multibranch_conv_dep_dim_cen_clsrot_sep_aug_confidence_scale_no_filter/output_val_box3d_deep_depth_motion_lstm_3dcen ...
loading annotations into memory...
Done (t=0.00s)
creating index...
index created!
Traceback (most recent call last):
  File "./tools/test_eval_video_exp.py", line 987, in <module>
    main()
  File "./tools/test_eval_video_exp.py", line 960, in main
    best_model(args, out_path)
  File "./tools/test_eval_video_exp.py", line 295, in best_model
    best_model_Nusc(args, out_path)
  File "./tools/test_eval_video_exp.py", line 380, in best_model_Nusc
    run_inference_and_evaluate(args, cfg, out_path_exp)
  File "./tools/test_eval_video_exp.py", line 80, in run_inference_and_evaluate
    run_inference(cfg, args.checkpoint, out_path, show_time=args.show_time)
  File "./tools/test_eval_video_exp.py", line 109, in run_inference
    dataset = build_dataset(cfg.data.test)
  File "/qd-3dt/qd3dt/datasets/builder.py", line 36, in build_dataset
    dataset = build_from_cfg(cfg, DATASETS)
  File "/qd-3dt/qd3dt/utils/registry.py", line 74, in build_from_cfg
    return obj_type(**args)
  File "/qd-3dt/qd3dt/datasets/video/bdd_vid_3d.py", line 20, in __init__
    super(BDDVid3DDataset, self).__init__(**kwargs)
  File "/qd-3dt/qd3dt/datasets/video/video_dataset.py", line 61, in __init__
    super(VideoDataset, self).__init__(*args, **kwargs)
  File "/qd-3dt/qd3dt/datasets/custom.py", line 69, in __init__
    self.img_infos = self.load_annotations(ann_file)
  File "/qd-3dt/qd3dt/datasets/video/video_dataset.py", line 131, in load_annotations
    self.cat_ids = api.getCatIds()
AttributeError: 'NoneType' object has no attribute 'getCatIds'

A series of other errors occur as the script attempts to execute subsequent commands after test_eval_video_exp.py errors out.

I am currently using Docker and have followed the installation and dataset setup instructions, which seem to have succeeded with no issues. Any ideas as to what is causing this error? Thanks.

CWAndersn commented 2 years ago

I believe I have discover the cause of this error. The conversion script uses a function named _get_available_scenes(nusc), which returns the scene dict objects corresponding to the current split. However, for some reason the code checks that the path to the Lidar pointcloud exists in the data directory, otherwise it does not append the scene dict object to the result. See the relevant code segment below

            lidar_path, boxes, _ = nusc.get_sample_data(sd_rec["token"])
            if not Path(lidar_path).exists():
                scene_not_exist = True
                break
            else:
                break

I did not download the Lidar pointclouds since this model only uses the camera images, so the conversion code sees that no lidar_paths exist, and thus doesn't include the scenes and doesn't convert any annotations. By simply removing this segment and replacing it with a single line break it seems to run the conversion as intended(However, the conversion process did encounter a second error seen in issue #29, which I have yet to find the cause for).

Is there a reason why it checks that the Lidar path exists? It is my impression that the lidar data is not used, and the dataset setup does not note that lidar data is required.

RoyYang0714 commented 2 years ago

Hi, you're right. Our work doesn't need lidar data. The _get_available_scenes() function is doing the sanity check to make sure that each scene (sequence) has corresponding lidar data and labeled bounding boxes. It is like a standard preprocessing and thus you can skip this function if you only download the camera data. I will close these two issues and feel free to discuss more in the Discussion.