Runtime error during model.predict() call
See original GitHub issueHi all, I have trained a detecto model to detect rectangles and squares in image. After training, when I call model.predict(image), the following runtime error occurs. Any guidance to get rid of this. Thanks I am using: python 3.6 torch: 1.5.0+cu101
here is the call traceback
3 image = utils.read_image('/color_matching/sample_photo/img.jpg')
----> 4 predictions = model.predict_top([image])
/usr/local/lib/python3.6/dist-packages/torchvision/models/detection/_utils.py in decode(self, rel_codes, boxes)
183 box_sum += val
184 pred_boxes = self.decode_single(
-->185 rel_codes.reshape(box_sum, -1), concat_boxes)
186
187 return pred_boxes.reshape(box_sum, -1, 4)
RuntimeError: cannot reshape tensor of 0 elements into shape [0, -1] because the unspecified dimension size -1 can be any value and is ambiguous.
*: The image has size(500, 500)
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
how to solve runtime error while predicting using onnx model?
When i try run the model using sess.run command, i am getting a error as RuntimeError: Input 'data' must not be empty.
Read more >STATIC PREDICTION OF RUNTIME ERRORS - OpenReview
The goal in the runtime error prediction task is to determine statically ... The model with the resource description recognizes that the input()...
Read more >how to use python predict on image? | Apple Developer Forums
I've converted model from caffe and trying to run predict like this: e = np.zeros((1,3,224,224)) d = {} d['data'] = e r =...
Read more >Am getting error trying to predict on a single image CNN pytorch
Traceback (most recent call last): File “pred.py”, line 134, in output = model(data) Runtime Error: Expected 4-dimensional input for ...
Read more >Fix Attribute Error and Runtime Error in tensorflow and keras
It is easily to encounter package problem for running first machine learning model. When you are playing around with tensorflow and keras, the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had the same issue with model.predict(). But once I switched to torch 1.4 and torchvision 0.5.0, it was alright. This seems to be limited to the recent releases of pytorch, atleast for me
Closing due to inactivity - if anyone else comes across this issue, feel free to re-open this or create a new one