I'm getting that error, here's code I'm using to try and train my own model.
from imageai.Detection.Custom import DetectionModelTrainer
from IPython.core.debugger import set_trace
trainer = DetectionModelTrainer()
trainer.setModelTypeAsYOLOv3()
trainer.setDataDirectory(data_directory="/content/drive/MyDrive/test/")
trainer.setTrainConfig(object_names_array=["test_CB","test_SN","test_WS","test_LU"], batch_size=4, num_experiments=200, train_from_pretrained_model="/content/drive/MyDrive/yolov3.pt")
trainer.trainModel()
Here is the error:
ValueError Traceback (most recent call last)
in ()
5 trainer.setDataDirectory(data_directory="/content/drive/MyDrive/test/")
6 trainer.setTrainConfig(object_names_array=["test_CB","test_SN","test_WS","test_LU"], batch_size=2, num_experiments=200, train_from_pretrained_model="/content/drive/MyDrive/yolov3.pt")
----> 7 trainer.trainModel()
3 frames
/usr/local/lib/python3.10/dist-packages/imageai/Detection/Custom/yolo/dataset.py in __load_raw_label(self, label_path)
78 if os.path.isfile(label_path):
79 with warnings.catch_warnings():
---> 80 l = np.loadtxt(label_path).reshape(-1,5)
81 assert (l >= 0).all(), "bounding box values should be positive and in range 0 - 1"
82 assert (l[:, 1:] <= 1).all(), "bounding box values should be in the range 0 - 1"
ValueError: cannot reshape array of size 134 into shape (5)
A COUPLE OF THINGS I SHOULD MENTION:
When I classified my images I used polygons and not rectangles. Also, I had several items that had more than one thing in the picture and I highlighted both items in those pictures. Could either of those things be the source of the problem?
I'm getting that error, here's code I'm using to try and train my own model.
from imageai.Detection.Custom import DetectionModelTrainer from IPython.core.debugger import set_trace trainer = DetectionModelTrainer() trainer.setModelTypeAsYOLOv3() trainer.setDataDirectory(data_directory="/content/drive/MyDrive/test/") trainer.setTrainConfig(object_names_array=["test_CB","test_SN","test_WS","test_LU"], batch_size=4, num_experiments=200, train_from_pretrained_model="/content/drive/MyDrive/yolov3.pt") trainer.trainModel()
Here is the error: ValueError Traceback (most recent call last)