Bläddra i källkod

Add COCO file with non unique image ID

sfmig 1 år sedan
förälder
incheckning
9d2dbd7031

+ 2 - 1
files-registry.txt

@@ -1,4 +1,4 @@
-DATA_DESCRIPTION.md 7c262076ef5b13eae12d521763a05953a8ec78634b4f28e416a2a39f7ff02275
+DATA_DESCRIPTION.md 7898e104bac65573ccd96129404e57d05e5b3850fd288f78f707b790bfa1826c
 test_annotations/medium_bboxes_dataset_COCO/COCO_JSON_sample_1.json 8bdea1ed408aaf6ad5eb8deed2f47c16fcff35697ad4983f59afb7462de9c5df
 test_annotations/medium_bboxes_dataset_COCO/COCO_JSON_sample_2.json 7ea3d6d152921294e0ab71740249c87eb5aecbb95a2b6554ab3e89a1d4e59b82
 test_annotations/medium_bboxes_dataset_VIA/VIA_JSON_sample_1.json 3d197d8fbd6121a32d729486c7511eb6d8451371a67fbae791a2309f27c8fb19
@@ -7,6 +7,7 @@ test_annotations/small_bboxes_dataset/small_bboxes_COCO.json c68faaf3b51282841b8
 test_annotations/small_bboxes_dataset/small_bboxes_VIA.json 6780a3b3130a11b7de78c22d421dcf9507288320f596740309516f039e4292fa
 test_annotations/small_bboxes_dataset_duplicates/small_bboxes_duplicates_COCO.json e33cf26c130b338075254e878e82e6f1f05d6927385945903cb11ca4ca1a1e53
 test_annotations/small_bboxes_dataset_duplicates/small_bboxes_duplicates_VIA.json 90c0dfba401d62a168bda231709d899ee3314bd4c9ab5df6483674cf0a47585d
+test_annotations/small_bboxes_dataset_errors/small_bboxes_non_unique_img_id_COCO.json 8615bdf983e06aa18dc99c31734f7990923e42abb465b27ab61f66ef77bcd2fb
 test_annotations/small_bboxes_dataset_no_categories/small_bboxes_no_cat_COCO.json 56bb5934e3552a76dd512948d6e4b0ff93037d92b67549a571f10b1b597c2b7d
 test_annotations/small_bboxes_dataset_no_categories/small_bboxes_no_cat_VIA.json 4187c3a265aecd42010b77f6d09db68ea2369c20e2ab336877c079de990b0e14
 test_annotations/small_bboxes_dataset_no_categories/small_bboxes_null_catID_COCO.json 3e34ba1cfd6e176f96aeffe2d3dbe44ee4326c2368fb1c8beb7e1cdd069c7386

+ 10 - 5
test_data/DATA_DESCRIPTION.md

@@ -5,7 +5,7 @@ The test data is organised under subdirectories that match the tested modules in
 ### Test data for `ethology.annotations`
 
 #### `medium_bboxes_dataset_VIA`
-A medium size bounding boxess dataset in VIA format.
+A medium size bounding boxes dataset in VIA format.
 
 | File name | Type | Format | N annotations | N images | Comments |
 | --- | --- | --- | --- | --- | --- |
@@ -14,7 +14,7 @@ A medium size bounding boxess dataset in VIA format.
 
 
 #### `medium_bboxes_dataset_COCO`
-A medium size bounding boxess dataset in COCO format.
+A medium size bounding boxes dataset in COCO format.
 
 | File name | Type | Format | N annotations | N images | Comments |
 | --- | --- | --- | --- | --- | --- |
@@ -23,7 +23,7 @@ A medium size bounding boxess dataset in COCO format.
 
 
 #### `small_bboxes_dataset`
-A small size bounding boxess dataset in VIA, COCO and VIA-CSV formats.
+A small size bounding boxes dataset in VIA, COCO and VIA-CSV formats.
 
 | File name | Type | Format | N annotations | N images | Comments |
 | --- | --- | --- | --- | --- | --- |
@@ -32,7 +32,7 @@ A small size bounding boxess dataset in VIA, COCO and VIA-CSV formats.
 
 
 #### `small_bboxes_dataset_duplicates`
-A small size bounding boxess dataset in VIA, COCO and VIA-CSV formats with duplicate annotations.
+A small size bounding boxes dataset in VIA, COCO and VIA-CSV formats with duplicate annotations.
 
 | File name | Type | Format | N annotations | N images | Comments |
 | --- | --- | --- | --- | --- | --- |
@@ -41,7 +41,7 @@ A small size bounding boxess dataset in VIA, COCO and VIA-CSV formats with dupli
 
 
 #### `small_bboxes_dataset_no_categories`
-A small size bounding boxess dataset in VIA, COCO and VIA-CSV formats without categories.
+A small size bounding boxes dataset in VIA, COCO and VIA-CSV formats without categories.
 
 | File name | Type | Format | N annotations | N images | Comments |
 | --- | --- | --- | --- | --- | --- |
@@ -49,4 +49,9 @@ A small size bounding boxess dataset in VIA, COCO and VIA-CSV formats without ca
 | `small_bboxes_no_cat_COCO.json` | bboxes | COCO | 3 | 3 |  No categories are specified, so no annotations are exported in COCO format. This data should throw an error. |
 | `small_bboxes_null_catID_COCO.json` | bboxes | COCO | 3 | 3 | The category ID in the VIA tool is not an integer, so when exporting the annotations to COCO format the category ID is set to `null`. This data should throw an error. |
 
+#### `small_bboxes_dataset_errors`
+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 filename and image ID. 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.|

+ 160 - 0
test_data/test_annotations/small_bboxes_dataset_errors/small_bboxes_non_unique_img_id_COCO.json

@@ -0,0 +1,160 @@
+{
+    "annotations": [
+        {
+            "area": 54978,
+            "bbox": [
+                945,
+                272,
+                294,
+                187
+            ],
+            "category_id": 0,
+            "id": 1,
+            "image_id": 0,
+            "iscrowd": 0,
+            "segmentation": [
+                [
+                    945,
+                    272,
+                    1239,
+                    272,
+                    1239,
+                    459,
+                    945,
+                    459
+                ]
+            ]
+        },
+        {
+            "area": 46354,
+            "bbox": [
+                370,
+                288,
+                301,
+                154
+            ],
+            "category_id": 0,
+            "id": 2,
+            "image_id": 83,
+            "iscrowd": 0,
+            "segmentation": [
+                [
+                    370,
+                    288,
+                    671,
+                    288,
+                    671,
+                    442,
+                    370,
+                    442
+                ]
+            ]
+        },
+        {
+            "area": 60990,
+            "bbox": [
+                467,
+                315,
+                321,
+                190
+            ],
+            "category_id": 0,
+            "id": 3,
+            "image_id": 166,
+            "iscrowd": 0,
+            "segmentation": [
+                [
+                    467,
+                    315,
+                    788,
+                    315,
+                    788,
+                    505,
+                    467,
+                    505
+                ]
+            ]
+        },
+        {
+            "area": 908314,
+            "bbox": [
+                1027,
+                389,
+                1007,
+                902
+            ],
+            "category_id": 0,
+            "id": 4,
+            "image_id": 0,
+            "iscrowd": 0,
+            "segmentation": [
+                [
+                    1027,
+                    389,
+                    2034,
+                    389,
+                    2034,
+                    1291,
+                    1027,
+                    1291
+                ]
+            ]
+        }
+    ],
+    "categories": [
+        {
+            "id": 0,
+            "name": "crab",
+            "supercategory": "animal"
+        }
+    ],
+    "images": [
+        {
+            "date_captured": "",
+            "file_name": "00000.jpg",
+            "height": 720,
+            "id": 0,
+            "license": 0,
+            "width": 1280
+        },
+        {
+            "date_captured": "",
+            "file_name": "00083.jpg",
+            "height": 720,
+            "id": 83,
+            "license": 0,
+            "width": 1280
+        },
+        {
+            "date_captured": "",
+            "file_name": "00166.jpg",
+            "height": 720,
+            "id": 166,
+            "license": 0,
+            "width": 1280
+        },
+        {
+            "date_captured": "",
+            "file_name": "00000.png",
+            "height": 1964,
+            "id": 0,
+            "license": 0,
+            "width": 3024
+        }
+    ],
+    "info": {
+        "contributor": "",
+        "date_created": "Mon Feb 10 2025 18:34:57 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": ""
+        }
+    ]
+}