traveller59 / second.pytorch

SECOND for KITTI/NuScenes object detection
MIT License
1.72k stars 722 forks source link

Question about data augment for targets #34

Open godspeed1989 opened 5 years ago

godspeed1989 commented 5 years ago

Hi, I have two questions about data augmentation. First, In config file, I notice you set target random rotation at range [-45,45]. https://github.com/traveller59/second.pytorch/blob/fb28d7b606dc0dcfbe73b78df285b9d8cd3df34a/second/configs/car.config#L123 and random shifting at https://github.com/traveller59/second.pytorch/blob/fb28d7b606dc0dcfbe73b78df285b9d8cd3df34a/second/configs/car.config#L121 My question is whether these two ranges are a little too wide which may cause the collision of targets. Second, I notice you do not switch on this flag https://github.com/traveller59/second.pytorch/blob/fb28d7b606dc0dcfbe73b78df285b9d8cd3df34a/second/configs/car.config#L129 But i think this operation will help to generate samples closer to real. Have you ever try it?

Thank you in advance.

traveller59 commented 5 years ago

sorry for late reply.

  1. target collision is estimated in noise_per_object, if collision happens, current noise is dropped and try next noise until valid noise is found.
  2. I haven't tried this because I don't think this can increase performance.
godspeed1989 commented 5 years ago

Thanks! For question 1, do you mean the function noise_per_object_v3_ in second.core.preprocess file? I am afraid can't figure out your explanation from it. Could you give me a little more tips?

traveller59 commented 5 years ago

the function noise_per_object_v3_ first generate noises with shape [num_boxes, num_try, noise_ndim], then apply noise sequentially. For every box, this function firstly compute location after apply noise, then test collision between this box and other boxes, if collision exists, then drop this noise and try next one.

godspeed1989 commented 5 years ago

Thank you very much. The collision detection and selection are done in function noise_per_box_v2_

godspeed1989 commented 5 years ago

Sorry to bother you again.

I notice in all .config files, global_random_rotation_range_per_object under database_sampler are all set to [0,0] Which means _enable_global_rot are always False.

https://github.com/traveller59/second.pytorch/blob/93e5bb7164b3f3ee649337b38111c7048dca0644/second/core/sample_ops.py#L80-L88

and prep.noise_per_object_v3_ will never be called. https://github.com/traveller59/second.pytorch/blob/93e5bb7164b3f3ee649337b38111c7048dca0644/second/core/sample_ops.py#L249-L258

That's wired. Does this function really useful?

Thank you in advance.

godspeed1989 commented 5 years ago

Sorry to bother you again. But i still want to know the answer about my last question. :)