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

run with error #23

Open
hktxt opened this issue Aug 20, 2018 · 8 comments
Open

run with error #23

hktxt opened this issue Aug 20, 2018 · 8 comments

Comments

@hktxt
Copy link

hktxt commented Aug 20, 2018

totally use your code, does not change any thing. but error comes out....
here is error info
C:\Users\Max\Anaconda3\envs\Pytorch\lib\site-packages\torch\nn\modules\upsampling.py:122: UserWarning: nn.Upsampling is deprecated. Use nn.functional.interpolate instead.
warnings.warn("nn.Upsampling is deprecated. Use nn.functional.interpolate instead.")

RuntimeError Traceback (most recent call last)
in ()
1 model = Darknet("cfg/yolov3.cfg")
2 inp = get_test_input()
----> 3 pred = model(inp, torch.cuda.is_available())
4 print (pred)

~\Anaconda3\envs\Pytorch\lib\site-packages\torch\nn\modules\module.py in call(self, *input, **kwargs)
475 result = self._slow_forward(*input, **kwargs)
476 else:
--> 477 result = self.forward(*input, **kwargs)
478 for hook in self._forward_hooks.values():
479 hook_result = hook(self, input, result)

in forward(self, x, CUDA)
216 #Transform
217 x = x.data
--> 218 x = predict_transform(x, inp_dim, anchors, num_classes, CUDA)
219 if not write: #if no collector has been intialised.
220 detections = x

F:\condaDev\util.ipynb in predict_transform(prediction, inp_dim, anchors, num_classes, CUDA)

RuntimeError: invalid argument 2: size '[1 x 255 x 3025]' is invalid for input with 689520 elements at ..\aten\src\TH\THStorage.cpp:84

@cumtcsys
Copy link

I have encountered the same problem as you,after changed the third line "grid_size = inp_dim // stride" to "grid_size = prediction.size(2)" in function predict_transform,the problem fixed.

@ghostPath
Copy link

I have encountered the same problem as you,after changed the third line "grid_size = inp_dim // stride" to "grid_size = prediction.size(2)" in function predict_transform,the problem fixed.

but the result I got is different with the blog

wx20181025-231310 2x

@ghostPath
Copy link

I have encountered the same problem as you,after changed the third line "grid_size = inp_dim // stride" to "grid_size = prediction.size(2)" in function predict_transform,the problem fixed.

I konw why. Thx

@allenwu5
Copy link

I have encountered the same problem as you,after changed the third line "grid_size = inp_dim // stride" to "grid_size = prediction.size(2)" in function predict_transform,the problem fixed.

I konw why. Thx

Hi @ghostPath , I got the different result as well.
Would you mind to share your insight ?

@ghostPath
Copy link

I have encountered the same problem as you,after changed the third line "grid_size = inp_dim // stride" to "grid_size = prediction.size(2)" in function predict_transform,the problem fixed.

I konw why. Thx

Hi @ghostPath , I got the different result as well.
Would you mind to share your insight ?

我觉得是因为权重是随机初始化的?

@allenwu5
Copy link

I have encountered the same problem as you,after changed the third line "grid_size = inp_dim // stride" to "grid_size = prediction.size(2)" in function predict_transform,the problem fixed.

I konw why. Thx

Hi @ghostPath , I got the different result as well.
Would you mind to share your insight ?

我觉得是因为权重是随机初始化的?

Thank you @ghostPath .
I think you're right.
I just found related paragraph:

At this point, our network has random weights, and will not produce the correct output. We need to load a weight file in our network. We'll be making use of the official weight file for this purpose.

@pypeaday
Copy link

@ayooshkathuria can you please update the blog and close this issue? The code base and tutorial both have grid_size = inp_dim//stride which leads to the error mentioned in this issue.

@feng3245
Copy link

feng3245 commented Apr 7, 2019

I have encountered the same problem as you,after changed the third line "grid_size = inp_dim // stride" to "grid_size = prediction.size(2)" in function predict_transform,the problem fixed.

but the result I got is different with the blog

wx20181025-231310 2x

It's just random weights. It's expected to be random and different

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

6 participants