robot-learning-freiburg / CenterGrasp

GNU General Public License v3.0
12 stars 0 forks source link

RuntimeError: The size of tensor a (45) must match the size of tensor b (46) at non-singleton dimension 2 #3

Closed Jinbo-Zuo closed 6 days ago

Jinbo-Zuo commented 6 days ago

Based on your code, I wrote a simple program that inputs a depth-image and an rgb-image to get the grasp. When I use a simulated image, the program works fine, but when I change to the real image I get from a camera, the following error occurs: RuntimeError: The size of tensor a (45) must match the size of tensor b (46) at non-singleton dimension 2 The difference is the camera intrinsic parameters, the camera intrinsic parameters of the simulated image are CameraParams.from_ideal_params(width=960, height=512, f_xy=530) And the camera intrinsic parameters of my real image are CameraParams.from_ideal_params(width=1280, height=720, f_xy=748) I wonder if I need to do any additional processing when I change to a different format of image?

Jinbo-Zuo commented 6 days ago

Does your pre-trained model only support one resolution?

chisarie commented 6 days ago

Hi, yes this is because of the image size. The pre-trained model only support the resolution I used for training. If you train from scratch, you can of course change the size, but the backbone we use only supports image heights that are power of 2 (if I remember correctly)

Jinbo-Zuo commented 6 days ago

Thanks for your reply, I got the correct result by cropping the image, and I will retrain further if necessary.