Closed Piyush-nr-tiwari closed 8 months ago
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)
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
Google colab
Had to create a new .pt file. The previous one got corrupted somehow
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?