From dc6fd347b7d7785852b02f1835bc4c1ab9feaae2 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 12 Nov 2024 19:57:11 -0500 Subject: [PATCH 1/3] init readme --- README.md | 51 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index bf65d0e..73d1039 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,17 @@ -# Template Extension Specification +# COCOJSON Extension Specification -- **Title:** Template -- **Identifier:** -- **Field Name Prefix:** template -- **Scope:** Item, Collection +- **Title:** COCOJSON +- **Identifier:** +- **Field Name Prefix:** coco +- **Scope:** Item - **Extension [Maturity Classification](https://github.com/radiantearth/stac-spec/tree/master/extensions/README.md#extension-maturity):** Proposal -- **Owner**: @your-gh-handles @person2 +- **Owner**: @jamesfisher-geo -This document explains the Template Extension to the [SpatioTemporal Asset Catalog](https://github.com/radiantearth/stac-spec) (STAC) specification. -This is the place to add a short introduction. +This document explains the COCOJSON Extension to the [SpatioTemporal Asset Catalog](https://github.com/radiantearth/stac-spec) (STAC) specification. + +The COCOJSON format (Common Objects in Context JSON) is a standardized format used to represent object annotations along with metadata including +segmentations masks, pixel bounding boxes, and annotation categories commonly used in computer vision. This extension integrates the standarized +COCOJSON fields into the STAC Item spec, enabling a practitioner to embed COCOJSON annotations within STAC Items. - Examples: - [Item example](examples/item.json): Shows the basic usage of the extension in a STAC Item @@ -21,16 +24,16 @@ This is the place to add a short introduction. The fields in the table below can be used in these parts of STAC documents: - [ ] Catalogs -- [x] Collections +- [ ] Collections - [x] Item Properties (incl. Summaries in Collections) -- [x] Assets (for both Collections and Items, incl. Item Asset Definitions in Collections) +- [ ] Assets (for both Collections and Items, incl. Item Asset Definitions in Collections) - [ ] Links | Field Name | Type | Description | | -------------------- | ------------------------- | -------------------------------------------- | -| template:new_field | string | **REQUIRED**. Describe the required field... | -| template:xyz | [XYZ Object](#xyz-object) | Describe the field... | -| template:another_one | \[number] | Describe the field... | +| coco:licenses | \[[License Object](#license-object)\] | **REQUIRED**. Describe the required field... | +| coco:categories | \[[Category Object](#category-object)\] | Describe the field... | +| coco:annotations | \[[Annotation Object](#annotation-object)\] | Describe the field... | ### Additional Field Information @@ -38,7 +41,27 @@ The fields in the table below can be used in these parts of STAC documents: This is a much more detailed description of the field `template:new_field`... -### XYZ Object +### License Object + +This is the introduction for the purpose and the content of the XYZ Object... + +| Field Name | Type | Description | +| ---------- | ------ | -------------------------------------------- | +| x | number | **REQUIRED**. Describe the required field... | +| y | number | **REQUIRED**. Describe the required field... | +| z | number | **REQUIRED**. Describe the required field... | + +### Category Object + +This is the introduction for the purpose and the content of the XYZ Object... + +| Field Name | Type | Description | +| ---------- | ------ | -------------------------------------------- | +| x | number | **REQUIRED**. Describe the required field... | +| y | number | **REQUIRED**. Describe the required field... | +| z | number | **REQUIRED**. Describe the required field... | + +### Annotation Object This is the introduction for the purpose and the content of the XYZ Object... From b73fc741a8df2b1ce2d134070ad3e97287ce1bb4 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 13 Nov 2024 09:47:26 -0500 Subject: [PATCH 2/3] item example --- README.md | 32 ++++++++++++++++---------------- examples/collection.json | 18 ++---------------- examples/item.json | 39 +++++++++++++++++++++++++++------------ 3 files changed, 45 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 73d1039..67f4470 100644 --- a/README.md +++ b/README.md @@ -47,9 +47,9 @@ This is the introduction for the purpose and the content of the XYZ Object... | Field Name | Type | Description | | ---------- | ------ | -------------------------------------------- | -| x | number | **REQUIRED**. Describe the required field... | -| y | number | **REQUIRED**. Describe the required field... | -| z | number | **REQUIRED**. Describe the required field... | +| `id` | number | **REQUIRED**. Integer ID of the license | +| `name` | string | **REQUIRED**. License name | +| `url` | string | **REQUIRED**. URL to the license text | ### Category Object @@ -57,9 +57,11 @@ This is the introduction for the purpose and the content of the XYZ Object... | Field Name | Type | Description | | ---------- | ------ | -------------------------------------------- | -| x | number | **REQUIRED**. Describe the required field... | -| y | number | **REQUIRED**. Describe the required field... | -| z | number | **REQUIRED**. Describe the required field... | +| `id` | number | **REQUIRED**. Integer ID of the category | +| `name` | string | **REQUIRED**. Name of the category (e.g. 'cat') | +| `supercategory` | string | **REQUIRED**. General category (e.g. 'animal') | + ### Annotation Object @@ -67,18 +69,16 @@ This is the introduction for the purpose and the content of the XYZ Object... | Field Name | Type | Description | | ---------- | ------ | -------------------------------------------- | -| x | number | **REQUIRED**. Describe the required field... | -| y | number | **REQUIRED**. Describe the required field... | -| z | number | **REQUIRED**. Describe the required field... | +| `id ` | number | **REQUIRED**. Integer ID of the annotation | +| `image_id` | number | **REQUIRED**. Integer ID of the associated images from the 'coco:images' field | +| `category_id` | number | **REQUIRED**. Integer ID of the associated category from the 'coco:categories' field | +| `bbox` | /[number/] | **REQUIRED**. Bounding box of the annotation in pixel coordinates | +| `segmentation` | /[/[number, number/]/] | Segmentation mask of the annotation as a list of image coordinates | +| `area` | number | The area of the segmentation mask in pixels | +| `iscrowd` | bool | Tag indicating if the segmentation mask is of a single object or many objects in an image | +| `score` | number | Score 0 - 1.0 indicating the annotation confidence level | -## Relation types -The following types should be used as applicable `rel` types in the -[Link Object](https://github.com/radiantearth/stac-spec/tree/master/item-spec/item-spec.md#link-object). - -| Type | Description | -| -------------- | ------------------------------------- | -| fancy-rel-type | This link points to a fancy resource. | ## Contributing diff --git a/examples/collection.json b/examples/collection.json index 2472ecc..6ea14c0 100644 --- a/examples/collection.json +++ b/examples/collection.json @@ -1,8 +1,7 @@ { "stac_version": "1.0.0", "stac_extensions": [ - "https://stac-extensions.github.io/item-assets/v1.0.0/schema.json", - "https://stac-extensions.github.io/template/v1.0.0/schema.json" + "https://stac-extensions.github.io/item-assets/v1.0.0/schema.json" ], "type": "Collection", "id": "collection", @@ -29,29 +28,16 @@ ] } }, - "template:new_field": "test", - "template:xyz": { - "x": 1, - "y": 2, - "z": 3 - }, - "template:another_one": [ - 1, - 2, - 3 - ], "assets": { "example": { "href": "https://example.com/examples/file.xyz", - "template:new_field": "test" } }, "item_assets": { "data": { "roles": [ "data" - ], - "template:new_field": "test" + ] } }, "summaries": { diff --git a/examples/item.json b/examples/item.json index cf19370..0b788c1 100644 --- a/examples/item.json +++ b/examples/item.json @@ -1,7 +1,7 @@ { "stac_version": "1.0.0", "stac_extensions": [ - "https://stac-extensions.github.io/template/v1.0.0/schema.json" + "https://stac-extensions.github.io/cocojson/v1.0.0/schema.json" ], "type": "Feature", "id": "item", @@ -40,16 +40,31 @@ }, "properties": { "datetime": "2020-12-11T22:38:32Z", - "template:new_field": "test", - "template:xyz": { - "x": 1, - "y": 2, - "z": 3 - }, - "template:another_one": [ - 1, - 2, - 3 + "coco:license": [ + { + "id": 1, + "name": "MIT License", + "url": "https://link/to/license/text" + } + ], + "coco:categories": [ + { + "id": 1, + "name": "locomotive", + "supercategory": "train cars" + } + ], + "coco:annotations": [ + { + "id": 1, + "image_id": 1, + "category_id": 1, + "bbox": [260, 177, 231, 199], + "segmentation": [[260, 177], [261, 178], [262, 179], ...], + "area": 45969, + "iscrowd": 0, + "score": 0.75 + } ] }, "links": [ @@ -64,4 +79,4 @@ "template:new_field": "test" } } -} +} \ No newline at end of file From f30ff0eca8649d58ee0343412098455fc3ae045d Mon Sep 17 00:00:00 2001 From: James Date: Wed, 13 Nov 2024 10:39:10 -0500 Subject: [PATCH 3/3] example formatting --- README.md | 8 +++----- examples/collection.json | 4 ++-- examples/item.json | 24 +++++++++++++++++++++--- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 67f4470..28fa21c 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ The fields in the table below can be used in these parts of STAC documents: | -------------------- | ------------------------- | -------------------------------------------- | | coco:licenses | \[[License Object](#license-object)\] | **REQUIRED**. Describe the required field... | | coco:categories | \[[Category Object](#category-object)\] | Describe the field... | -| coco:annotations | \[[Annotation Object](#annotation-object)\] | Describe the field... | +| coco:annotations | \[[Annotation Object](#annotation-object)\] | Describe the field... | ### Additional Field Information @@ -59,7 +59,7 @@ This is the introduction for the purpose and the content of the XYZ Object... | ---------- | ------ | -------------------------------------------- | | `id` | number | **REQUIRED**. Integer ID of the category | | `name` | string | **REQUIRED**. Name of the category (e.g. 'cat') | -| `supercategory` | string | **REQUIRED**. General category (e.g. 'animal') | +| `supercategory` | string | **REQUIRED**. General category (e.g. 'animal') | @@ -73,13 +73,11 @@ This is the introduction for the purpose and the content of the XYZ Object... | `image_id` | number | **REQUIRED**. Integer ID of the associated images from the 'coco:images' field | | `category_id` | number | **REQUIRED**. Integer ID of the associated category from the 'coco:categories' field | | `bbox` | /[number/] | **REQUIRED**. Bounding box of the annotation in pixel coordinates | -| `segmentation` | /[/[number, number/]/] | Segmentation mask of the annotation as a list of image coordinates | +| `segmentation` | /[/[number, number/]/] | Segmentation mask of the annotation as a list of image coordinates | | `area` | number | The area of the segmentation mask in pixels | | `iscrowd` | bool | Tag indicating if the segmentation mask is of a single object or many objects in an image | | `score` | number | Score 0 - 1.0 indicating the annotation confidence level | - - ## Contributing All contributions are subject to the diff --git a/examples/collection.json b/examples/collection.json index 6ea14c0..e7c2a6b 100644 --- a/examples/collection.json +++ b/examples/collection.json @@ -30,7 +30,7 @@ }, "assets": { "example": { - "href": "https://example.com/examples/file.xyz", + "href": "https://example.com/examples/file.xyz" } }, "item_assets": { @@ -56,4 +56,4 @@ "rel": "item" } ] -} +} \ No newline at end of file diff --git a/examples/item.json b/examples/item.json index 0b788c1..dffc87e 100644 --- a/examples/item.json +++ b/examples/item.json @@ -1,7 +1,7 @@ { "stac_version": "1.0.0", "stac_extensions": [ - "https://stac-extensions.github.io/cocojson/v1.0.0/schema.json" + "https://stac-extensions.github.io/template/v1.0.0/schema.json" ], "type": "Feature", "id": "item", @@ -59,8 +59,26 @@ "id": 1, "image_id": 1, "category_id": 1, - "bbox": [260, 177, 231, 199], - "segmentation": [[260, 177], [261, 178], [262, 179], ...], + "bbox": [ + 260, + 177, + 231, + 199 + ], + "segmentation": [ + [ + 260, + 177 + ], + [ + 261, + 178 + ], + [ + 262, + 179 + ] + ], "area": 45969, "iscrowd": 0, "score": 0.75