roboflow / notebooks

Examples and tutorials on using SOTA computer vision models and techniques. Learn everything from old-school ResNet, through YOLO and object-detection transformers like DETR, to the latest models like Grounding DINO and SAM.
https://roboflow.com/models
5.27k stars 814 forks source link

error in classification model which i had built a few days ago #240

Closed Piyush-nr-tiwari closed 8 months ago

Piyush-nr-tiwari commented 8 months ago

Search before asking

Notebook name

classModel = YOLO("/content/Good-bad-hw-classification.pt") img = '/content/drive/MyDrive/New HW models/Error message - Talk to expert.jpeg' classResults = classModel.predict(source=img, conf=0.1) bad = round((classResults[0].probs.data.cpu().numpy()[0])100) good = round((classResults[0].probs.data.cpu().numpy()[1])100)

Bug

classModel = YOLO("/content/Good-bad-hw-classification.pt") img = '/content/drive/MyDrive/New HW models/Error message - Talk to expert.jpeg' classResults = classModel.predict(source=img, conf=0.1) bad = round((classResults[0].probs.data.cpu().numpy()[0])100) good = round((classResults[0].probs.data.cpu().numpy()[1])100)

ERROR MESSAGE:

AttributeError Traceback (most recent call last) in <cell line: 3>() 1 classModel = YOLO("/content/Good-bad-hw-classification.pt") 2 img = '/content/drive/MyDrive/New HW models/Error message - Talk to expert.jpeg' ----> 3 classResults = classModel.predict(source=img, conf=0.1) 4 bad = round((classResults[0].probs.data.cpu().numpy()[0])100) 5 good = round((classResults[0].probs.data.cpu().numpy()[1])100)

8 frames /usr/local/lib/python3.10/dist-packages/PIL/Image.py in getattr(self, name) 527 deprecate("Image categories", 10, "is_animated", plural=True) 528 return self._category --> 529 raise AttributeError(name) 530 531 @property

AttributeError: shape

Environment

Google colab

Minimal Reproducible Example

classModel = YOLO("/content/Good-bad-hw-classification.pt") img = '/content/drive/MyDrive/New HW models/Error message - Talk to expert.jpeg' classResults = classModel.predict(source=img, conf=0.1) bad = round((classResults[0].probs.data.cpu().numpy()[0])100) good = round((classResults[0].probs.data.cpu().numpy()[1])100)

ERROR MESSAGE:

AttributeError Traceback (most recent call last) in <cell line: 3>() 1 classModel = YOLO("/content/Good-bad-hw-classification.pt") 2 img = '/content/drive/MyDrive/New HW models/Error message - Talk to expert.jpeg' ----> 3 classResults = classModel.predict(source=img, conf=0.1) 4 bad = round((classResults[0].probs.data.cpu().numpy()[0])100) 5 good = round((classResults[0].probs.data.cpu().numpy()[1])100)

8 frames /usr/local/lib/python3.10/dist-packages/PIL/Image.py in getattr(self, name) 527 deprecate("Image categories", 10, "is_animated", plural=True) 528 return self._category --> 529 raise AttributeError(name) 530 531 @property

AttributeError: shape

Additional


AttributeError Traceback (most recent call last) in <cell line: 3>() 1 classModel = YOLO("/content/Good-bad-hw-classification.pt") 2 img = '/content/drive/MyDrive/New HW models/Error message - Talk to expert.jpeg' ----> 3 classResults = classModel.predict(source=img, conf=0.1) 4 bad = round((classResults[0].probs.data.cpu().numpy()[0])100) 5 good = round((classResults[0].probs.data.cpu().numpy()[1])100)

8 frames /usr/local/lib/python3.10/dist-packages/PIL/Image.py in getattr(self, name) 527 deprecate("Image categories", 10, "is_animated", plural=True) 528 return self._category --> 529 raise AttributeError(name) 530 531 @property

AttributeError: shape

Are you willing to submit a PR?

Piyush-nr-tiwari commented 8 months ago

Had to create a new .pt file. The previous one got corrupted somehow