Explorar o código

Add image ID files to data

sfmig hai 1 ano
pai
achega
bbd8acc494

+ 10 - 1
test_data/README.md

@@ -62,6 +62,16 @@ A subset of the corresponding small bounding boxes datasets. If prefixed with `_
 | `small_bboxes_COCO_subset_plus.json` | bboxes | VIA | 3 | 3 | Same as `small_bboxes_COCO_subset.json` but with one additional annotation, different from any of the annotations in `small_bboxes_COCO.json`.|
 
 
+#### `small_bboxes_image_id_checks`
+
+Small size bounding boxes dataset to check if the image ID based on the alphabetical order of the filenames is assigned correctly by `ethology`.
+
+| File name | Type | Format | N annotations | N images | Comments |
+| --- | --- | --- | --- | --- | --- |
+| `small_bboxes_image_id_VIA.json` | bboxes | VIA | 3 | 3 | In the `_via_image_id_list` the keys for the three image filenames is not sorted alphabetically. So the image ID assigned based on the order of `_via_image_id_list` is different to the image ID assigned based on the alphabetically sorted list of filenames. |
+| `small_bboxes_image_id_COCO.json` | bboxes | COCO | 3 | 3 | The image IDs in the COCO file are different from the image IDs that would be assigned if based on the alphabetically sorted list of filenames. |
+
+
 #### `small_bboxes_dataset_errors`
 
 Small size bounding boxes datasets with errors to catch.
@@ -69,6 +79,5 @@ Small size bounding boxes datasets with errors to catch.
 | File name | Type | Format | N annotations | N images | Comments |
 | --- | --- | --- | --- | --- | --- |
 | `small_bboxes_non_unique_img_id_COCO.json` | bboxes | COCO | 4 | 4 | Two images have the same image ID and their filename differs only by the extension. This happens if two images have the same number-based filename, because the imageID is extracted using [`parseInt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt) when exporting as COCO in the VIA tool.|
-| `small_bboxes_non_unique_img_filename_VIA.json` | bboxes | VIA | 4 | 4 | Two images have the same filename. |
 
 

+ 127 - 0
test_data/test_annotations/small_bboxes_image_id_checks/small_bboxes_image_id_COCO.json

@@ -0,0 +1,127 @@
+{
+    "annotations": [
+        {
+            "area": 58712,
+            "bbox": [
+                432,
+                306,
+                328,
+                179
+            ],
+            "category_id": 1,
+            "id": 1,
+            "image_id": 1,
+            "iscrowd": 0,
+            "segmentation": [
+                [
+                    432,
+                    306,
+                    760,
+                    306,
+                    760,
+                    485,
+                    432,
+                    485
+                ]
+            ]
+        },
+        {
+            "area": 48672,
+            "bbox": [
+                363,
+                302,
+                338,
+                144
+            ],
+            "category_id": 1,
+            "id": 2,
+            "image_id": 2,
+            "iscrowd": 0,
+            "segmentation": [
+                [
+                    363,
+                    302,
+                    701,
+                    302,
+                    701,
+                    446,
+                    363,
+                    446
+                ]
+            ]
+        },
+        {
+            "area": 60602,
+            "bbox": [
+                950,
+                268,
+                314,
+                193
+            ],
+            "category_id": 1,
+            "id": 3,
+            "image_id": 3,
+            "iscrowd": 0,
+            "segmentation": [
+                [
+                    950,
+                    268,
+                    1264,
+                    268,
+                    1264,
+                    461,
+                    950,
+                    461
+                ]
+            ]
+        }
+    ],
+    "categories": [
+        {
+            "id": 1,
+            "name": "crab",
+            "supercategory": "animal"
+        }
+    ],
+    "images": [
+        {
+            "date_captured": "",
+            "file_name": "C35.jpg",
+            "height": 720,
+            "id": 1,
+            "license": 0,
+            "width": 1280
+        },
+        {
+            "date_captured": "",
+            "file_name": "B34.jpg",
+            "height": 720,
+            "id": 2,
+            "license": 0,
+            "width": 1280
+        },
+        {
+            "date_captured": "",
+            "file_name": "A33.jpg",
+            "height": 720,
+            "id": 3,
+            "license": 0,
+            "width": 1280
+        }
+    ],
+    "info": {
+        "contributor": "",
+        "date_created": "Thu Feb 13 2025 13:49:48 GMT+0000 (Greenwich Mean Time)",
+        "description": "VIA project exported to COCO format using VGG Image Annotator (http://www.robots.ox.ac.uk/~vgg/software/via/)",
+        "url": "http://www.robots.ox.ac.uk/~vgg/software/via/",
+        "version": "1.0",
+        "year": 2025
+    },
+    "licenses": [
+        {
+            "id": 0,
+            "name": "Unknown License",
+            "url": ""
+        }
+    ]
+}

+ 112 - 0
test_data/test_annotations/small_bboxes_image_id_checks/small_bboxes_image_id_VIA.json

@@ -0,0 +1,112 @@
+{
+    "_via_attributes": {
+        "file": {},
+        "region": {
+            "animal": {
+                "default_options": {
+                    "0": true
+                },
+                "description": "",
+                "options": {
+                    "0": "crab"
+                },
+                "type": "dropdown"
+            }
+        }
+    },
+    "_via_data_format_version": "2.0.10",
+    "_via_image_id_list": [
+        "C35.jpg324555",
+        "B34.jpg311221",
+        "A33.jpg322877"
+    ],
+    "_via_img_metadata": {
+        "A33.jpg322877": {
+            "file_attributes": {},
+            "filename": "A33.jpg",
+            "regions": [
+                {
+                    "region_attributes": {
+                        "animal": "0"
+                    },
+                    "shape_attributes": {
+                        "height": 193,
+                        "name": "rect",
+                        "width": 314,
+                        "x": 950,
+                        "y": 268
+                    }
+                }
+            ],
+            "size": 322877
+        },
+        "B34.jpg311221": {
+            "file_attributes": {},
+            "filename": "B34.jpg",
+            "regions": [
+                {
+                    "region_attributes": {
+                        "animal": "0"
+                    },
+                    "shape_attributes": {
+                        "height": 144,
+                        "name": "rect",
+                        "width": 338,
+                        "x": 363,
+                        "y": 302
+                    }
+                }
+            ],
+            "size": 311221
+        },
+        "C35.jpg324555": {
+            "file_attributes": {},
+            "filename": "C35.jpg",
+            "regions": [
+                {
+                    "region_attributes": {
+                        "animal": "0"
+                    },
+                    "shape_attributes": {
+                        "height": 179,
+                        "name": "rect",
+                        "width": 328,
+                        "x": 432,
+                        "y": 306
+                    }
+                }
+            ],
+            "size": 324555
+        }
+    },
+    "_via_settings": {
+        "core": {
+            "buffer_size": 18,
+            "default_filepath": "",
+            "filepath": {}
+        },
+        "project": {
+            "name": "via_project_13Feb2025_13h49m"
+        },
+        "ui": {
+            "annotation_editor_fontsize": 0.8,
+            "annotation_editor_height": 25,
+            "image": {
+                "on_image_annotation_editor_placement": "NEAR_REGION",
+                "region_color": "__via_default_region_color__",
+                "region_label": "__via_region_id__",
+                "region_label_font": "10px Sans"
+            },
+            "image_grid": {
+                "img_height": 80,
+                "rshape_fill": "none",
+                "rshape_fill_opacity": 0.3,
+                "rshape_stroke": "yellow",
+                "rshape_stroke_width": 2,
+                "show_image_policy": "all",
+                "show_region_shape": true
+            },
+            "leftsidebar_width": 18
+        }
+    }
+}