Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion Error (using images of a different size) #4

Closed
Wazaki-Ou opened this issue Aug 14, 2018 · 9 comments
Closed

Assertion Error (using images of a different size) #4

Wazaki-Ou opened this issue Aug 14, 2018 · 9 comments

Comments

@Wazaki-Ou
Copy link

It seems like using images with a different size throws this error. I would like to double check that modifying that part of the code to make it accept images with other size will not create an issue in calculating the flow. Also. if there is any specific part of the code I need to be careful with when modifying.

Thank you

@sniklaus
Copy link
Owner

I have tried in on different sizes as well without any issues. The important part is that the flow is being rescaled, just like in the official implementation.

tensorFlow[:, 0, :, :] *= float(intWidth) / float(intPreprocessedWidth)

@Wazaki-Ou
Copy link
Author

This is the error I get:
image

my picture is a jpg of size 1920*1080

@sniklaus
Copy link
Owner

I am afraid that I a little bit confused. It says remember that there is no guarantee for correctness, comment this line out if you acknowledge this and want to continue, have you tried commenting the line out?

@Wazaki-Ou
Copy link
Author

For anyone who faces the same issue, commenting the lines restricting the size can solve the issue. Thanks !!

@sniklaus
Copy link
Owner

I wouldn't necessarily call it an issue though, it is more like an acknowledgement.

@SystemErrorWang
Copy link

in fact, I used inputs with same size and got size mismatch problem in the middle of the network.

File "/home/wangxinrui/bbox_net/flow_net.py", line 104, in forward
tensorInput = torch.cat([ tensorInput, self.tensorPartial ], 1)
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 8 and 7 in dimension 2 at /opt/conda/conda-bld/pytorch_1535491974311/work/aten/src/THC/generic/THCTensorMath.cu:87

@sniklaus
Copy link
Owner

Would you mind sharing the images that cause this error? If not, what is their resolution?

@SystemErrorWang
Copy link

I tested again and found 224224 resolution caused this problem while 256256 worked well. I guess the image resolution should be divided by 64.

@sniklaus
Copy link
Owner

I am not exactly sure what happened in your case, see the following excerpt.

intPreprocessedWidth = int(math.floor(math.ceil(intWidth / 64.0) * 64.0))

Which ensures that the resolution is divisible by 64 and resizes 224x224 to 256x256 accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants