Skip to content
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

Updates to allow multiple label types in one item #11

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ to be contained with a GeoJSON FeatureCollection:
| label:properties | \[string]\|null | **REQUIRED** These are the names of the property field(s) in each `Feature` of the label asset's `FeatureCollection` that contains the classes (keywords from `label:classes` if the property defines classes). If labels are rasters, use `null` . |
| label:classes | \[[Class Object](#class-object)] | **REQUIRED** if using categorical data. A Class Object defining the list of possible class names for each `label:properties` . (e.g., tree, building, car, hippo) |
| label:description | string | **REQUIRED** A description of the label, how it was created, and what it is recommended for |
| label:type | string | **REQUIRED** An ENUM of either `vector` label type or `raster` label type |
| label:types | \[string] | **REQUIRED** An array of the types of labels present in this item. Either `vector`, `raster`, or both. |
| label:tasks | \[string] | Recommended to be a subset of 'regression', 'classification', 'detection', or 'segmentation', but may be an arbitrary value |
| label:methods | \[string] | Recommended to be a subset of 'automated' or 'manual', but may be an arbitrary value. |
| label:overviews | \[[Label Overview Object](#label-overview-object)] | An Object storing counts (for classification-type data) or summary statistics (for continuous numerical/regression data). |
Expand Down Expand Up @@ -131,13 +131,13 @@ to be contained with a GeoJSON FeatureCollection:

One or more assets will contain references to the label data. These assets have these requirements:

- if the `label:type` is "vector", the labels must be a GeoJSON FeatureCollection.
- if the `label:type` is "raster", it is recommended to also have an asset of a GeoJSON FeatureCollection
- if the `label:types` property contains "vector", the labels must be a GeoJSON FeatureCollection.
- if the `label:types` property contains "raster", it is recommended to also have an asset of a GeoJSON FeatureCollection
defining the extent.
- Asset Roles should be used to indicate which assets are the labels. It is recommended that all Assets
referencing labels have the role `labels`. Other labels such as `labels-vector` (for vector labels),
- Asset Roles should be used to indicate which assets are the labels. It is recommended that all Assets
referencing labels have the role `labels`. Other labels such as `labels-vector` (for vector labels),
`labels-raster` (for raster labels), `labels-extent` (for the vector extent of raster labels), `labels-training`
(for ML training data), and `labels-testing` (for ML testing data) may also be added to further indicate what
(for ML training data), and `labels-testing` (for ML testing data) may also be added to further indicate what
specific assets reference.
- if `label:tasks` is tile_classification, object_detection, or segmentation,
each feature should have one or more properties containing the label(s) for the
Expand All @@ -149,7 +149,7 @@ One or more assets will contain references to the label data. These assets have

#### Asset names

The Label Extension recommends assets be named with the keys "raster_labels" or "vector_labels". However,
The Label Extension recommends assets be named with the keys "raster_labels" or "vector_labels". However,
this is just a recommendation, and the names are entirely at the discretion of the implementer.

#### Raster Label Notes
Expand All @@ -161,6 +161,9 @@ The raster label file (e.g. a GeoTIFF) should be included as an asset under the
Along with the image file, a GeoJSON `FeatureCollection` asset should be included.
That `FeatureCollection` should contain a single `Feature` , ideally a polygon geometry defining the extent of the raster.

The [classification](https://github.com/stac-extensions/classification) extension should be used to
show the mapping of raster pixel values to human-readable class names.

#### Rendered images (optional)

The source imagery used for creating the label is linked to under `links` (see below).
Expand Down Expand Up @@ -195,10 +198,10 @@ for running tests are copied here for convenience.

### Running tests

The same checks that run as checks on PR's are part of the repository and can be run locally to verify that changes are valid.
The same checks that run as checks on PR's are part of the repository and can be run locally to verify that changes are valid.
To run tests locally, you'll need `npm`, which is a standard part of any [node.js installation](https://nodejs.org/en/download/).

First you'll need to install everything with npm once. Just navigate to the root of this repository and on
First you'll need to install everything with npm once. Just navigate to the root of this repository and on
your command line run:
```bash
npm install
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@
"label:tasks": [
"segmentation"
],
"label:type": "vector",
"label:types": [
"vector"
],
"label:methods": [
"manual"
],
Expand Down Expand Up @@ -104,4 +106,4 @@
]
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@
"label:tasks": [
"segmentation"
],
"label:type": "vector",
"label:types": [
"vector"
],
"label:methods": [
"manual"
],
Expand Down Expand Up @@ -104,4 +106,4 @@
]
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@
"label:tasks": [
"segmentation"
],
"label:type": "vector",
"label:types": [
"vector"
],
"label:methods": [
"manual"
],
Expand Down Expand Up @@ -104,4 +106,4 @@
]
}
]
}
}
6 changes: 4 additions & 2 deletions examples/multidataset/zanzibar/znz001.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@
"label:tasks": [
"segmentation"
],
"label:type": "vector",
"label:types": [
"vector"
],
"label:methods": [
"manual"
],
Expand Down Expand Up @@ -118,4 +120,4 @@
]
}
]
}
}
6 changes: 4 additions & 2 deletions examples/multidataset/zanzibar/znz029.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@
"label:tasks": [
"segmentation"
],
"label:type": "vector",
"label:types": [
"vector"
],
"label:methods": [
"manual"
],
Expand Down Expand Up @@ -118,4 +120,4 @@
]
}
]
}
}
4 changes: 3 additions & 1 deletion examples/spacenet-roads/roads_item.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
"lane_number",
"paved"
],
"label:type": "vector",
"label:types": [
"vector"
],
"label:description": "sample SpaceNet roads label",
"label:classes": [
{
Expand Down
21 changes: 12 additions & 9 deletions json-schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"required": [
"label:properties",
"label:description",
"label:type"
"label:types"
]
},
{
Expand Down Expand Up @@ -171,13 +171,16 @@
"type": "string",
"minLength": 1
},
"label:type": {
"label:types": {
"title": "Type",
"type": "string",
"enum": [
"raster",
"vector"
]
"type": "array",
"items": {
"type": "string",
"enum": [
"raster",
"vector"
]
}
},
"label:tasks": {
"title": "Task",
Expand Down Expand Up @@ -243,7 +246,7 @@
},
"if": {
"properties": {
"label:type": {
"label:types": {
"const": "raster"
}
}
Expand Down Expand Up @@ -281,4 +284,4 @@
"additionalProperties": false
}
}
}
}