`AttributeError: 'JpegImageFile' object has no attribute 'shape'`
See original GitHub issueI was trying the code with the random image but I need to print the image I am passing nottouch.rand
my_image = load_img("127074.jpg")
v = Vit()
img = torch.randn(1, 3, 256, 256)
preds = v(img)
print(preds)
p=v(my_image)
print(p)
the code worked with using random but when i pass my_image i got
AttributeError: 'JpegImageFile' object has no attribute 'shape'
Issue Analytics
- State:
- Created 2 years ago
- Comments:14
Top Results From Across the Web
AttributeError: 'JpegImageFile' object has no attribute 'shape' #2
I run code in Python 3.6, I haven't 3.7 available, When I run python optimize_anchors.py annotations.csv I get the error: Using TensorFlow ...
Read more >AttributeError: 'JpegImageFile' object has no attribute 'read'
This is the error that I need to fix now. AttributeError: 'JpegImageFile' object has no attribute 'read'. Code: # Imports here import pandas ......
Read more >“AttributeError: 'JpegImageFile' object has no attribute 'shape ...
The problem is that pimg is in PIL image format. While imutils.resize function expects the image in Numpy array format.
Read more >AttributeError: 'JpegImageFile' object has no attribute 'read'
I am a beginner and I am learning to code an image classifier. My goal is to create a predict function. In this...
Read more >AttributeError: 'JpegImageFile' object has no attribute 'read'
Coding example for the question AttributeError: 'JpegImageFile' object has no attribute 'read'-Opencv.
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
Hi @ersamo Yes exactly. In the above, from the error…your image is on gpu, your model is on cpu. To fix model.to(pred_device)
Then both are on gpu and you should be cruising.
dinner was delayed…so here you go: