V2AI / Det3D

World's first general purpose 3D object detection codebse.
https://arxiv.org/abs/1908.09492
Apache License 2.0
1.49k stars 298 forks source link

Ground truth velocities are left uninitialized as NaNs #46

Closed peiyunh closed 4 years ago

peiyunh commented 4 years ago

I believe this is related to #6 #42 #43 and #19 .

I followed INSTALL.md and installed nuscenes from https://github.com/poodarchu/nuscenes.git. I have also run create_data.py accordingly. From what I have seen, ground truth velocities that are cached in infos_train_10sweeps_withvelo.pkl are all NaN. I believe this is at least one of the issues that results in NaN losses.

I think line 516 in nusc_common.py

velocity = np.array([b.velocity for b in ref_boxes]).reshape(-1, 3)

should be:

velocity = np.array([
    nusc.box_velocity(token) for token in sample['anns']
]).reshape((-1, 3))

Otherwise the function (box_velocity) that computes velocity will never be called and b.velocity will stay uninitialized as NaNs.

peiyunh commented 4 years ago

Closing this issue as b.velocity are no longer NaNs once I properly installed the customized nuscenes.

muzi2045 commented 4 years ago

the author use the their fork version of nuscens-devkit. you can just modify this file ~/.local/lib/python3.6/site-packages/nuscenes/nuscenes.py

# Cannot estimate velocity for a single annotation.
if not has_prev and not has_next:
     return np.array([0.0, 0.0, 0.0])
if time_diff > max_time_diff:
    # If time_diff is too big, don't return an estimate.
    return np.array([0.0, 0.0, 0.0])
else:
    return pos_diff / time_diff
peiyunh commented 4 years ago

Interesting. Thanks for pointing this out!

hz3014 commented 4 years ago

Closing this issue as b.velocity are no longer NaNs once I properly installed the customized nuscenes.

Hi, I have both official and customized nuscenes devkit installed. How do you make sure that the customized version is used?

peiyunh commented 4 years ago

I think the easiest way is to create a virtual environment with only the customized devkit installed.