pytorch-yolo-v3
pytorch-yolo-v3 copied to clipboard
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0.
I am not sure how this path is specified there are no folders C:\a\w.....
C:\test\yv3pytak\imgs\messi.jpg predicted in 0.047 seconds
Objects Detected: person person person sports ball
C:\test\yv3pytak\imgs\person.jpg predicted in 0.047 seconds
Objects Detected: person dog horse
Traceback (most recent call last):
File "detect.py", line 234, in <module>
output = torch.cat((output,prediction))
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 86 and 8 in dimension 1 at c:\a\w\1\s\tmp_conda_3.7_061434\conda\conda-bld\pytorch_1544163540495\work\aten\src\thc\generic/THCTensorMath.cu:83
i got the same error.
Same error here
I fixed this problem in a ugly solution. The error was always reporting when detecting the image named "scream.jpg". Specifically, the right dimension returned from function "write_results" was [N, 8], however, the wrong dimension was [N, 86]. In addition, the result returned from function "write_results" contained many strange values, e.g. 6.9610e-45, -1.3956e+23, etc. Therefore, I add the following codes end the function "write_results":
output[(output > 0) & (output < 0.00001)] = 0
output[output < -10000] = 0
output[output > 10000] = 0
if len(torch.nonzero(output)) < 1:
return torch.zeros((1, 8))
return output
Finally, it worked!
@sakets594 @predictwise @take2rohit @156aasdfg @apiszcz highly recommend this repository. MultiGPU, multithreaded training, and comes with a very cool realtime-yolov3 iPhone app. https://github.com/ultralytics/yolov3
still not working seems like it happens only for some images
some advance on this issue?
The same error.................
You might add if output.size()[1] == prediction.size()[1]:
condition, beforeoutput = torch.cat((output,prediction))
, inside detect.py
I fixed this problem in a ugly solution. The error was always reporting when detecting the image named "scream.jpg". Specifically, the right dimension returned from function "write_results" was [N, 8], however, the wrong dimension was [N, 86]. In addition, the result returned from function "write_results" contained many strange values, e.g. 6.9610e-45, -1.3956e+23, etc. Therefore, I add the following codes end the function "write_results": output[(output > 0) & (output < 0.00001)] = 0 output[output < -10000] = 0 output[output > 10000] = 0 if len(torch.nonzero(output)) < 1: return torch.zeros((1, 8))
return output
Finally, it worked!
Hello, I've got the same issue, but I can not find where the implement of "write_result" function it is. Can you help me? Thanks too much!
@iPersevere it is in the util.py
epm157's comment should be accepted as a pull request.
I just deleted the scream image. That is the one giving the problem. All the other images seem to work.
I just deleted the scream image. That is the one giving the problem. All the other images seem to work.
how should I know witch image drives this problem?thank u
I fixed this problem in a ugly solution. The error was always reporting when detecting the image named "scream.jpg". Specifically, the right dimension returned from function "write_results" was [N, 8], however, the wrong dimension was [N, 86]. In addition, the result returned from function "write_results" contained many strange values, e.g. 6.9610e-45, -1.3956e+23, etc. Therefore, I add the following codes end the function "write_results":
output[(output > 0) & (output < 0.00001)] = 0 output[output < -10000] = 0 output[output > 10000] = 0 if len(torch.nonzero(output)) < 1: return torch.zeros((1, 8)) return output
Finally, it worked!
Hello, In which line do I add the code?
do not set the batch size to 1, you may try 2 or more
a better choice would be apply "if prediction.shape == (1,5+1+len(classes)):" instead of "#if type(prediction) == int:"
do not set the batch size to 1, you may try 2 or more
a better choice would be apply "if prediction.shape == (1,5+1+len(classes)):" instead of "#if type(prediction) == int:"
Thanks a lot!