You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the YOLOv5 issues and discussions and found no similar questions.
Question
I want to run object detection with segmentation labeling data, but I got an error.
As far as I know, object detection is possible with segmentation labeled data, but is it a labeling issue?
python tools/train.py --batch 32 --conf configs/yolov6s_finetune.py --epoch 50 --data ./FST1/data.yaml --fuse_ab --device 0 img record infomation path is:./FST1/train/.images_cache.json Traceback (most recent call last): File "tools/train.py", line 143, in <module> main(args) File "tools/train.py", line 128, in main trainer = Trainer(args, cfg, device) File "/media/HDD/조홍석/YOLOv6/yolov6/core/engine.py", line 91, in __init__ self.train_loader, self.val_loader = self.get_data_loader(self.args, self.cfg, self.data_dict) File "/media/HDD/조홍석/YOLOv6/yolov6/core/engine.py", line 387, in get_data_loader train_loader = create_dataloader(train_path, args.img_size, args.batch_size // args.world_size, grid_size, File "/media/HDD/조홍석/YOLOv6/yolov6/data/data_load.py", line 46, in create_dataloader dataset = TrainValDataset( File "/media/HDD/조홍석/YOLOv6/yolov6/data/datasets.py", line 82, in __init__ self.img_paths, self.labels = self.get_imgs_labels(self.img_dir) File "/media/HDD/조홍석/YOLOv6/yolov6/data/datasets.py", line 435, in get_imgs_labels *[ File "/media/HDD/조홍석/YOLOv6/yolov6/data/datasets.py", line 438, in <listcomp> np.array(info["labels"], dtype=np.float32) ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.
Additional
No response
The text was updated successfully, but these errors were encountered:
It seems like you're encountering an issue with label formats. YOLOv5 requires bounding box information in a specific format, usually in plain text files with one row per object, each containing class x_center y_center width height format, normalized to image size.
However, from your message, you're attempting to use segmentation labeled data, which often comes in polygon formats for each object rather than the rectangular bounding boxes expected by YOLOv5.
Unfortunately, YOLOv5 does not directly support polygon annotations for training out of the box. You would need to convert your segmentation labels to bounding boxes that fit around your polygons. This conversion often involves calculating the minimum bounding rectangle that can encapsulate your polygon annotations.
A simple conversion could be calculating the minimum and maximum x,y coordinates of your polygon points to form the bounding box corners. Then, you would normalize these coordinates to the input size of your YOLO model.
Remember, accurate conversion depends on ensuring the bounding boxes accurately represent your segmented objects for effective training.
For further details on YOLOv5's requirements for training data, feel free to refer to the documentation here: https://docs.ultralytics.com/yolov5/.
👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.
For additional resources and information, please see the links below:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!
Thank you for your contributions to YOLO 🚀 and Vision AI ⭐
Search before asking
Question
I want to run object detection with segmentation labeling data, but I got an error.
As far as I know, object detection is possible with segmentation labeled data, but is it a labeling issue?
python tools/train.py --batch 32 --conf configs/yolov6s_finetune.py --epoch 50 --data ./FST1/data.yaml --fuse_ab --device 0
img record infomation path is:./FST1/train/.images_cache.json Traceback (most recent call last): File "tools/train.py", line 143, in <module> main(args) File "tools/train.py", line 128, in main trainer = Trainer(args, cfg, device) File "/media/HDD/조홍석/YOLOv6/yolov6/core/engine.py", line 91, in __init__ self.train_loader, self.val_loader = self.get_data_loader(self.args, self.cfg, self.data_dict) File "/media/HDD/조홍석/YOLOv6/yolov6/core/engine.py", line 387, in get_data_loader train_loader = create_dataloader(train_path, args.img_size, args.batch_size // args.world_size, grid_size, File "/media/HDD/조홍석/YOLOv6/yolov6/data/data_load.py", line 46, in create_dataloader dataset = TrainValDataset( File "/media/HDD/조홍석/YOLOv6/yolov6/data/datasets.py", line 82, in __init__ self.img_paths, self.labels = self.get_imgs_labels(self.img_dir) File "/media/HDD/조홍석/YOLOv6/yolov6/data/datasets.py", line 435, in get_imgs_labels *[ File "/media/HDD/조홍석/YOLOv6/yolov6/data/datasets.py", line 438, in <listcomp> np.array(info["labels"], dtype=np.float32) ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.
Additional
No response
The text was updated successfully, but these errors were encountered: