Skip to content
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
Binary file added docs/img/onnx_landclassificationexample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/onnx_landclassificationexampletool.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/onnx_objectdetection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/onnx_objectdetectiontool.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions examples/onnx/image_classification/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Instructions
This examples uses the model fron the CNTK model from the [Deep Learning - CNTK for Land Cover Classification](https://www.arcgis.com/home/item.html?id=e8bc272d1ce2456fa4b87c9af749a57f) example.

The CNTK model file was converted to ONNX using the [CNTK to ONNX Export](https://github.com/onnx/tutorials/blob/master/tutorials/CntkOnnxExport.ipynb) instructions.

```
import cntk as C
model_path = "trained.model"
z = C.Function.load(model_path, device=C.device.cpu())
z.save("trained.onnx", format=C.ModelFormat.ONNX)
```

## Running the Model

Step 0. Download the test deep learning model and image [here](https://www.arcgis.com/home/item.html?id=e8bc272d1ce2456fa4b87c9af749a57f). You can also use your own trained model and test image.

Step 1. Open "Classify Pixels Using Deep Learning" geoprocessing tool.

Step 2. Fill in the parameters.

![](https://github.com/gbrunner/raster-deep-learning/blob/master/docs/img/onnx_landclassificationexampletool.png)

Step 3. Run the tool.

![](https://github.com/gbrunner/raster-deep-learning/blob/master/docs/img/onnx_landclassificationexample.png)
44 changes: 44 additions & 0 deletions examples/onnx/image_classification/trained.emd
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"Framework":"Onnx",
"ModelConfiguration":"CntkLandClassification",
"ModelType":"ImageClassification",
"ModelFile":"trained.onnx",
"ExtractBands":[0,1,2,3],
"DataRange":[0.0,1.0],
"ImageHeight":256,
"ImageWidth":256,
"ModelPadding":64,

"Classes": [
{
"Value":0,
"Name":"Evergreen Forest",
"Color":[0, 51, 0]
},
{
"Value":1,
"Name":"Grassland/Herbaceous",
"Color":[241, 185, 137]
},
{
"Value":2,
"Name":"Bare Land",
"Color":[236, 236, 0]
},
{
"Value":3,
"Name":"Open Water",
"Color":[0, 0, 117]
},
{
"Value":4,
"Name":"Scrub/Shrub",
"Color":[102, 102, 0]
},
{
"Value":5,
"Name":"Impervious Surface",
"Color":[236, 236, 236]
}
]
}
Binary file added examples/onnx/image_classification/trained.onnx
Binary file not shown.
41 changes: 41 additions & 0 deletions examples/onnx/object_detection/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Instructions
The ONNX model was converted from the [XView](http://xviewdataset.org/) TensorFlow model, multires.pb. For more tools to work with the XView dataset, please see the [XView Github page](https://github.com/DIUx-xView).

# XView Model Conversion Using ```tf2onnx```
On Windows, the ONNX model was generated with

```
tensorflow=1.13.1
onnx=1.6.0
tf2onnx=1.5.3
```

and

```
tensorflow=1.14.0
onnx=1.6.0
tf2onnx=1.5.3
```

Some errors are seen when converting to ONNX that will effect it's accuracy.

Conversion to ONNX can be done through the command line using the following statement:

```
python -m tf2onnx.convert --input C:\XVIEW\multires.pb --inputs "image_tensor:0" --outputs "detection_boxes:0,detection_scores:0,detection_classes:0" --output C:\XVIEW\ONNX\saved_model.onnx --opset 10
```

# Running the Model

Step 0. Download the test deep learning model and the XView training or validation images.

Step 1. Open "Detect Object Using Deep Learning" geoprocessing tool.

Step 2. Fill in the parameters.

![](https://github.com/gbrunner/raster-deep-learning/blob/master/docs/img/onnx_objectdetectiontool.png)

Step 3. Run the Model.

![](https://github.com/gbrunner/raster-deep-learning/blob/master/docs/img/onnx_objectdetection.png)
Loading