Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

polygon annotation to object detection #12931

Closed
1 task done
Cho-Hong-Seok opened this issue Apr 17, 2024 · 2 comments
Closed
1 task done

polygon annotation to object detection #12931

Cho-Hong-Seok opened this issue Apr 17, 2024 · 2 comments
Labels
question Further information is requested Stale

Comments

@Cho-Hong-Seok
Copy link

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

@Cho-Hong-Seok Cho-Hong-Seok added the question Further information is requested label Apr 17, 2024
@glenn-jocher
Copy link
Member

Hello! 👋

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/.

Happy coding! 😊

Copy link
Contributor

👋 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 ⭐

@github-actions github-actions bot added the Stale label May 18, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested Stale
Projects
None yet
Development

No branches or pull requests

2 participants