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
@Mary14-design hello! 😊 It seems like there's an issue with accessing the bbox attribute in your annotations. This could happen if the JSON structure doesn't match what the script expects.
First, double-check the JSON file to ensure that it follows the COCO format, where each annotation should include a bbox field. The error might also occur if certain annotations are missing this field due to variability in the dataset.
If the structure is correct and the issue persists, you might want to add a check before accessing the bbox field to skip annotations without it:
if'bbox'inann:
box=np.array(ann['bbox'], dtype=np.float64)
# Proceed with your processingelse:
print("Skipping annotation without bbox.")
This way, you can avoid the KeyError and handle annotations missing the bbox more gracefully.
For more detailed guidance on working with datasets and annotations, you might find the Ultralytics Docs helpful: https://docs.ultralytics.com
I am trying to convert
instances_train2017.json
from https://cocodataset.org/#home and it returns the following errorTraceback (most recent call last): File "/tmp/workspace/codes/JSON2YOLO/general_json2yolo.py", line 393, in <module> convert_coco_json( File "/tmp/workspace/codes/JSON2YOLO/general_json2yolo.py", line 286, in convert_coco_json box = np.array(ann["bbox"], dtype=np.float64) KeyError: 'bbox'
Any idea on how to solve this error?
The text was updated successfully, but these errors were encountered: