minghanz / trafcam_3d

Repository for the paper "Monocular 3D Vehicle Detection Using Uncalibrated Traffic Camerasthrough Homography"
GNU General Public License v3.0
55 stars 10 forks source link

ValueError: file not recognized: videos/bev.avi #1

Closed dpwolfe closed 3 years ago

dpwolfe commented 3 years ago

Hi @minghanz,

Thank you for publishing this GitHub project. I was attempting to run the sample referenced in the yolo submodule commit README.md, the subset of the BrnoCompSpeed dataset. After pointing to the videos directory in the run_detect.sh, I'm getting the following error:

Namespace(cfg='./cfg/yolov3-spp-rboxttdv180.cfg', names='./data/bev_network.names', weights='weights/best_ra_tail_180_dv.pt', source='videos', output='output', img_size=448, conf_thres=0.2, iou_thres=0.2, fourcc='mp4v', half=False, device='', view_img=False, save_txt=True, classes=None, agnostic_nms=False, augment=False, single_cls=True, rotated=True, rotated_anchor=True, half_angle=True, tail=True, tail_inv=False, dual_view=True, use_mask=True)
Using CPU

Initialize preceding Conv2d() bias (https://arxiv.org/pdf/1708.02002.pdf section 3.3)
Initialize preceding Conv2d() bias (https://arxiv.org/pdf/1708.02002.pdf section 3.3)
Initialize preceding Conv2d() bias (https://arxiv.org/pdf/1708.02002.pdf section 3.3)
Model Summary: 354 layers, 8.23524e+07 parameters, 8.23524e+07 gradients
self.img_size 448
self.img_size 448
  0%|                                                                                                                                                 | 0/205584 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "/home/dpwolfe/repo/trafcam_3d/yolov3/detect.py", line 295, in <module>
    detect()
  File "/home/dpwolfe/repo/trafcam_3d/yolov3/detect.py", line 106, in detect
    for frame_i, sample_batch in enumerate(pbar):
  File "/home/dpwolfe/miniforge3/envs/trafcam2/lib/python3.9/site-packages/tqdm/std.py", line 1185, in __iter__
    for obj in iterable:
  File "/home/dpwolfe/repo/trafcam_3d/yolov3/utils/datasets.py", line 76, in __next__
    path_bev, img_bev, img0_bev, invalid_mask, cap_bev, H_world_bev = next(self.dual_first)
  File "/home/dpwolfe/repo/trafcam_3d/yolov3/utils/datasets.py", line 233, in __next__
    raise ValueError("file not recognized: {}".format(path))
ValueError: file not recognized: videos/bev.avi

From looking at the code, it seems to be using parts of the filepath. I tried nesting it in a directory named BrnoCompSpeed, which then progressed it to where it was expecting to find 'session' in the path from which to pull a video tag.

Before I go any further with trying to reverse engineer a happy path, I wanted to check with you. Is there anything else I'm missing or should do differently at this point?

I think I'm really close to getting the example to run and greatly appreciate your guidance. Thank you!

minghanz commented 3 years ago

Thanks for your interest in the project.

Unzip the example data zip file into a path ending with BrnoCompSpeed/session5_left and you should be good to go!

dpwolfe commented 3 years ago

Thank you @minghanz! That worked! I was just about to try creating a file structure based off the example commented out at the bottom of the run_detect.sh script when I saw your reply. In hindsight, I also see that this was hinted in the name of the zip file with the subset.

It started to process and then I got a new error, but I think it probably has to do with the way I installed d3d:

Namespace(cfg='./cfg/yolov3-spp-rboxttdv180.cfg', names='./data/bev_network.names', weights='weights/best_ra_tail_180_dv.pt', source='/home/dpwolfe/repo/trafcam_3d/yolov3/BrnoCompSpeed/session5_left/videos/bev.avi', output='/home/dpwolfe/repo/trafcam_3d/yolov3/BrnoCompSpeed/session5_left/outputs/best_ra_tail_180_dv__l_C_K_KA2000_correct_texturedqs_strip_giout', img_size=448, conf_thres=0.2, iou_thres=0.2, fourcc='mp4v', half=False, device='', view_img=False, save_txt=True, classes=None, agnostic_nms=False, augment=False, single_cls=True, rotated=True, rotated_anchor=True, half_angle=True, tail=True, tail_inv=False, dual_view=True, use_mask=True)
Using CPU

Initialize preceding Conv2d() bias (https://arxiv.org/pdf/1708.02002.pdf section 3.3)
Initialize preceding Conv2d() bias (https://arxiv.org/pdf/1708.02002.pdf section 3.3)
Initialize preceding Conv2d() bias (https://arxiv.org/pdf/1708.02002.pdf section 3.3)
Model Summary: 354 layers, 8.23524e+07 parameters, 8.23524e+07 gradients
self.img_size 448
self.img_size 448
  0%|                                                                                                                                                                                                                                                   | 0/205584 [00:00<?, ?it/s]/home/dpwolfe/miniforge3/envs/trafcam2/lib/python3.9/site-packages/torch/nn/functional.py:718: UserWarning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (Triggered internally at  /pytorch/c10/core/TensorImpl.h:1156.)
  return torch.max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode)
448x288 Done. (0.436s):   0%|                                                                                                                                                                                                               | 33/205584 [00:15<26:35:34,  2.15it/s]
Traceback (most recent call last):
  File "/home/dpwolfe/repo/trafcam_3d/yolov3/detect.py", line 295, in <module>
    detect()
  File "/home/dpwolfe/repo/trafcam_3d/yolov3/detect.py", line 151, in detect
    pred = non_max_suppression(pred, opt.conf_thres, opt.iou_thres,
  File "/home/dpwolfe/repo/trafcam_3d/yolov3/utils/utils.py", line 1016, in non_max_suppression
    i_mask = d3d.box.box2d_nms(boxes_d3d, scores, iou_method="rbox", iou_threshold=iou_thres)
AttributeError: module 'd3d' has no attribute 'box'

I had trouble installing this dependency with pip, so I cloned the d3d repo, built the wheel from it and installed that with pip. I've tried running python setup.py develop on the d3d project, but I'm still getting this error with run_detect. If you have any advice with how to correctly install d3d, I'll be happy to try!

dpwolfe commented 3 years ago

Hi @minghanz! I figured out the d3d issue. I was able to put together a conda environment on Python 3.6 which built a wheel I could use. An important part of that was for me to checkout the earliest d3d release tag. Worked great after that. Thank you!

Next, I'll try using a custom video in place of the example just to see what it produces. Thanks again!