facebookresearch / 3detr

Code & Models for 3DETR - an End-to-end transformer model for 3D object detection
Apache License 2.0
612 stars 76 forks source link

training on my own data in sunrgbd format raises error #50

Open madinwei opened 1 year ago

madinwei commented 1 year ago

Hello @likethesky , @Celebio , @colesbury , @pdollar , @minqi ,

thank you for this is amazing work of 3detr. I have built my dataset with sunrgbd format and it already worked with Votenet, but when i use it with 3detr it raises the following issue:

Training started at epoch 0 until 720.
One training epoch = 18 iters.
One eval epoch = 2 iters.
Traceback (most recent call last):
  File "main.py", line 435, in <module>
    launch_distributed(args)
  File "main.py", line 423, in launch_distributed
    main(local_rank=0, args=args)
  File "main.py", line 416, in main
    best_val_metrics,
  File "main.py", line 191, in do_train
    logger,
  File "/home/mad/3detr/engine.py", line 87, in train_one_epoch
    outputs = model(inputs)
  File "/home/mad/miniconda3/envs/3detr/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/mad/3detr/models/model_3detr.py", line 327, in forward
    query_xyz, query_embed = self.get_query_embeddings(enc_xyz, point_cloud_dims)
  File "/home/mad/3detr/models/model_3detr.py", line 179, in get_query_embeddings
    pos_embed = self.pos_embedding(query_xyz, input_range=point_cloud_dims)
  File "/home/mad/miniconda3/envs/3detr/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/mad/3detr/models/position_embedding.py", line 134, in forward
    return self.get_fourier_embeddings(xyz, num_channels, input_range)
  File "/home/mad/3detr/models/position_embedding.py", line 112, in get_fourier_embeddings
    xyz_proj = torch.mm(xyz2d.view(-1, d_in), self.gauss_B[:, :d_out]).view(
RuntimeError: expected scalar type Double but found Float

i have also used the sunrgbd dataset and it works fine, i have built my dataloader from the sunrgbd loader and customized it according to my data.

Pablesky commented 2 months ago

I don't know if you solved already but basically add these two lines after you read the files.

point_cloud = point_cloud.astype(np.float32)
bboxes = bboxes.astype(np.float64)