Open ahuxjz opened 5 years ago
Got a similar error, but mine is happens in the predict_transform
method, when calling prediction.view
RuntimeError: shape '[1, 255, 3025]' is invalid for input of size 689520
Printing the inputs to prediction.view
I get:
batch_size, bbox_attrs, num_anchors, grid_size
1 85 3 13
1 85 3 26
1 85 3 55 <--- crashes here
I think the issue is in the cfg
file. The original height and width was 416
but now is 608
. So
stride = in_dim // prediction.size(2)
went from 416 // 52 = 8
to 608 // 52 = 11
. Therefore:
grid_size = in_dim // stride
went from 416 // 8 = 52
to 608 // 11 = 55
. The latter has the incorrect grid size this causing the shape error here:
prediction = prediction.view(batch_size, bbox_attrs num_anchors, grid_size grid_size)
Would the correct thing to do be changing the height and width back to 416
?
@harpalsahota The most important thing is that the input image dimensions which you resize in the function:
get_test_input()
matches with the dimensions of the image in the cfg file. I've tried it myself and it worked fine.
prediction[:,:,:2]+=x_y_offset RuntimeError: The expanded size of the tensor (507) must match the existing size (13520) at non-singleton dimension 1