-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
annotation type #12784
Comments
@faridamousa hello! For YOLOv8 with object detection tasks, you'll primarily use bounding box annotations rather than point annotations. The annotation file format should generally be in YAML or plain text format. JSON is not directly supported for this purpose. If your annotations are in JSON containing point data, you'll need to convert these into bounding box formats that typically consist of x_center, y_center, width, and height relative to image size. Here’s a quick Python snippet on how you might convert your point annotations to a compatible format: # Example to convert a single point to a bounding box
def point_to_bbox(x, y, box_size=10):
x1 = x - box_size // 2
y1 = y - box_size // 2
return [x1, y1, box_size, box_size]
# Assuming 'x' and 'y' are your point coordinates
bbox = point_to_bbox(x, y)
print("Bounding Box:", bbox) This will create a small box around the point. Adjust For further conversion and usage, consider using the robust tools and documents provided by Ultralytics, or if it's a single common scenario, manually prepare the dataset to match the required input structure for YOLOv8. Happy detecting! 😊 |
when i normalize the bounding boxes, the bounding boxes move from their correct places, what should i do? |
Hello @faridamousa, It sounds like there might be an issue with the normalization process. Ensure that you are correctly dividing the bounding box coordinates by the image dimensions. Here’s a quick example: # Assuming bbox is [x1, y1, x2, y2] and img_width, img_height are the dimensions of your image
x1, y1, x2, y2 = bbox
x1 /= img_width
y1 /= img_height
x2 /= img_width
y2 /= img_height
normalized_bbox = [x1, y1, x2, y2] Make sure to apply this normalization consistently across all bounding boxes. If the issue persists, double-check the image dimensions and ensure they match the ones used during normalization. If you need further assistance, feel free to ask! 😊 |
i did that but when i visualize them, they appear as line on top of each other
|
Hello @faridamousa, Thank you for sharing your code snippet. It looks like you're on the right track with visualizing the bounding boxes. The issue you're describing, where the boxes appear as lines on top of each other, might be due to incorrect scaling or coordinate calculations. Here are a few suggestions to troubleshoot and fix this:
If the issue persists, feel free to share more details, and we can further investigate. Happy coding! 😊 |
Search before asking
Question
if i have point annotation in json
will it work with yolov8 or does the annotation file have to be in txt?
can yolov8 even work with point annotation or does it have to be bounding box?
i am using yolov8 for object detection
Additional
if i have point annotation in json
The text was updated successfully, but these errors were encountered: