lzccccc / SMOKE

SMOKE: Single-Stage Monocular 3D Object Detection via Keypoint Estimation
MIT License
696 stars 177 forks source link

How is _C.MODEL.SMOKE_HEAD.DEPTH_REFERENCE calculated? #44

Open dantp-ai opened 3 years ago

dantp-ai commented 3 years ago

I want to train SMOKE on a custom dataset (with other classes), so I need to adapt _C.MODEL.SMOKE_HEAD.DEPTH_REFERENCE.

How do I calculate this value for my custom dataset?

dantp-ai commented 3 years ago

Is it simply calculating the mean and std over the z-coordinates ?

I computed exactly that on the training+testing KITTI dataset and got: (27.908786048804533 17.440216708073685)

The authors of SMOKE reference their values from this work https://arxiv.org/pdf/1905.12365.pdf, where the mean and std is for the depth reference is: μz= 28.01mandσz= 16.32m.

nikhil-nakhate commented 3 years ago

@plopd Were you able to start training. I got a cudaAssert error:

/opt/conda/conda-bld/pytorch_1573049306803/work/aten/src/ATen/native/cuda/IndexKernel.cu:60: lambda ->auto::operator()(int)->auto: block: [0,0,0], thread: [9,0,0] Asserti on index >= -sizes[i] && index < sizes[i] && "index out of bounds" failed. /opt/conda/conda-bld/pytorch_1573049306803/work/aten/src/ATen/native/cuda/IndexKernel.cu:60: lambda ->auto::operator()(int)->auto: block: [0,0,0], thread: [10,0,0] Assert ion index >= -sizes[i] && index < sizes[i] && "index out of bounds" failed. /opt/conda/conda-bld/pytorch_1573049306803/work/aten/src/ATen/native/cuda/IndexKernel.cu:60: lambda ->auto::operator()(int)->auto: block: [0,0,0], thread: [11,0,0] Assert ion index >= -sizes[i] && index < sizes[i] && "index out of bounds" failed. Traceback (most recent call last): File "tools/plain_train_net.py", line 100, in args=(args,), File "/home/nnn/3D_detection/SMOKE/smoke/engine/launch.py", line 56, in launch main_func(args) File "tools/plain_train_net.py", line 88, in main train(cfg, model, device, distributed) File "tools/plain_train_net.py", line 53, in train arguments File "/home/nnn/3D_detection/SMOKE/smoke/engine/trainer.py", line 66, in do_train loss_dict = model(images, targets) File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in call result = self.forward(input, *kwargs) File "/home/nnn/3D_detection/SMOKE/smoke/modeling/detector/keypoint_detector.py", line 37, in forward result, detector_losses = self.heads(features, targets) File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in call result = self.forward(input, **kwargs) File "/home/nnn/3D_detection/SMOKE/smoke/modeling/heads/smoke_head/smoke_head.py", line 22, in forward loss_heatmap, loss_regression = self.loss_evaluator(x, targets) File "/home/nnn/3D_detection/SMOKE/smoke/modeling/heads/smoke_head/loss.py", line 117, in call predict_boxes3d = self.prepare_predictions(targets_variables, pred_regression) File "/home/nnn/3D_detection/SMOKE/smoke/modeling/heads/smoke_head/loss.py", line 79, in prepare_predictions targets_variables["flip_mask"] File "/home/nnn/3D_detection/SMOKE/smoke/modeling/smoke_coder.py", line 219, in decode_orientation cos_pos_idx = (vector_ori[:, 1] >= 0).nonzero() RuntimeError: copy_if failed to synchronize: cudaErrorAssert: device-side assert triggered

dantp-ai commented 3 years ago

Specify the default dimensions in the config. If your images have a different size then the code automatically resizes to the default dimensions:

You can find the default values in smoke/config/defaults.py

_C.INPUT.HEIGHT_TRAIN = 384
# Maximum size of the side of the image during training
_C.INPUT.WIDTH_TRAIN = 1280
# Size of the smallest side of the image during testing
_C.INPUT.HEIGHT_TEST = 384
# Maximum size of the side of the image during testing
_C.INPUT.WIDTH_TEST = 1280