Skip to content

Commit 776d638

Browse files
committed
Merge remote-tracking branch 'upstream/master' into jy-release-notes-17
2 parents b7b56c6 + 3665f92 commit 776d638

10 files changed

+2123
-278
lines changed

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Feature request
33
about: Suggest an idea for this project
44
title: ''
5-
labels: bug
5+
labels: enhancement
66
assignees: ''
77

88
---

guide/14-deep-learning/feature_categorization.ipynb

Lines changed: 893 additions & 0 deletions
Large diffs are not rendered by default.

guide/14-deep-learning/how-ssd-works.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
"\n",
167167
"The grids parameter specifies the size of the grid cell, in this case 4x4. Additionally, we are specifying a zoom level of 1.0 and aspect ratio of 1.0:1.0. What this essentially means is that the network will create an anchor box for each grid cell, which is the same size as the grid cell (zoom level of 1.0) and is square in shape with an aspect ratio of 1.0:1.0. The output activations along the depth of the final feature map are used to shift and scale (within a reasonable limit) this anchor box so it can approach the actual bounding box of the object even if it doesn’t exactly match with the anchor box. \n",
168168
"\n",
169-
"For more information about the API, please go to the [API reference](https://esri.github.io/arcgis-python-api/apidoc/html/arcgis.learn.html#singleshotdetector)."
169+
"For more information about the API, please go to the [API reference](https://esri.github.io/arcgis-python-api/apidoc/html/arcgis.learn.html#singleshotdetector). As `arcgis.learn` is built upon fast.ai, more explanation about SSD can be found at fast.ai's Multi-object detection lesson [5]. "
170170
]
171171
},
172172
{
@@ -177,7 +177,8 @@
177177
"- [1] Joseph Redmon, Santosh Divvala, Ross Girshick, Ali Farhadi: “You Only Look Once: Unified, Real-Time Object Detection”, 2015; <a href='https://arxiv.org/abs/1506.02640'>arXiv:1506.02640</a>.\n",
178178
"- [2] Wei Liu, Dragomir Anguelov, Dumitru Erhan, Christian Szegedy, Scott Reed, Cheng-Yang Fu: “SSD: Single Shot MultiBox Detector”, 2016; <a href='http://arxiv.org/abs/1512.02325'>arXiv:1512.02325</a>.\n",
179179
"- [3] Zeiler, Matthew D., and Rob Fergus. \"Visualizing and understanding convolutional networks.\" In European conference on computer vision, pp. 818-833. springer, Cham, 2014.\n",
180-
"- [4] Dang Ha The Hien. A guide to receptive field arithmetic for Convolutional Neural Networks. https://medium.com/mlreview/a-guide-to-receptive-field-arithmetic-for-convolutional-neural-networks-e0f514068807"
180+
"- [4] Dang Ha The Hien. A guide to receptive field arithmetic for Convolutional Neural Networks. https://medium.com/mlreview/a-guide-to-receptive-field-arithmetic-for-convolutional-neural-networks-e0f514068807\n",
181+
"- [5] Howard Jeremy. Lesson 9: Deep Learning Part 2 2018 - Multi-object detection. https://docs.fast.ai/vision.models.unet.html#Dynamic-U-Net. Accessed 2 September 2019."
181182
]
182183
}
183184
],

guide/14-deep-learning/how-unet-works.ipynb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"- The decoder is the second half of the architecture. The goal is to semantically project the discriminative features (lower resolution) learnt by the encoder onto the pixel space (higher resolution) to get a dense classification. The decoder consists of **upsampling** and **concatenation** followed by regular convolution operations. \n",
6767
"\n",
6868
"<center><img src=\"../../static/img/unet.png\" height=\"600\" width=\"600\"></center>\n",
69-
"<center>Figure 2. U-net architecture. Blue boxes represent multi-channel feature maps, while while boxes represent copied feature maps. The arrows of different colors represent different operations</center>"
69+
"<center>Figure 2. U-net architecture. Blue boxes represent multi-channel feature maps, while while boxes represent copied feature maps. The arrows of different colors represent different operations [1]</center>"
7070
]
7171
},
7272
{
@@ -92,7 +92,7 @@
9292
"\n",
9393
"`data` is the returned data object from prepare_data function. `backbone` is used for creating the base of the UnetClassifier, which is resnet34 by default, while `pretrained_path` points to where pre-trained model is saved.\n",
9494
"\n",
95-
"The `UnetClassifier` builds a dynamic U-Net from any backbone pretrained on ImageNet, automatically inferring the intermediate sizes. As you might have noticed, U-net has a lot fewer parameters than SSD, this is because all the parameters such as dropout are specified in the encoder and UnetClassifier creates the decoder part using the given encoder. You can tweak everything in the encoder and our U-net module creates decoder equivalent to that.\n",
95+
"The `UnetClassifier` builds a dynamic U-Net from any backbone pretrained on ImageNet, automatically inferring the intermediate sizes. As you might have noticed, U-net has a lot fewer parameters than SSD, this is because all the parameters such as dropout are specified in the encoder and UnetClassifier creates the decoder part using the given encoder. You can tweak everything in the encoder and our U-net module creates decoder equivalent to that [2]. With that, the creation of Unetclassifier requires fewer parameters.\n",
9696
"\n",
9797
"For more information about the API, please go to the [API reference](https://esri.github.io/arcgis-python-api/apidoc/html/arcgis.learn.html#unetclassifier)."
9898
]
@@ -102,7 +102,8 @@
102102
"metadata": {},
103103
"source": [
104104
"## References\n",
105-
"- [1] Olaf Ronneberger, Philipp Fischer, Thomas Brox: U-Net: Convolutional Networks for Biomedical Image Segmentation, 2015; <a href='https://arxiv.org/abs/1505.04597'>arXiv:1505.04597</a>."
105+
"- [1] Olaf Ronneberger, Philipp Fischer, Thomas Brox: U-Net: Convolutional Networks for Biomedical Image Segmentation, 2015; <a href='https://arxiv.org/abs/1505.04597'>arXiv:1505.04597</a>.\n",
106+
"- [2] Howard Jeremy. Fastai - Dynamic U-Net. https://www.youtube.com/watch?v=0frKXR-2PBY. Accessed 2 September 2019."
106107
]
107108
}
108109
],
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# How feature classifier works?"
8+
]
9+
},
10+
{
11+
"cell_type": "markdown",
12+
"metadata": {},
13+
"source": [
14+
"## Introduction"
15+
]
16+
},
17+
{
18+
"cell_type": "markdown",
19+
"metadata": {},
20+
"source": [
21+
"The goal of feature classification is to determine the class of each feature (e.g. building). For instance, it could be used to determine when a building is damaged or not after a natural disaster. Feature classification requires two input data: \n",
22+
"- A input raster that contains the spectral bands,\n",
23+
"- A feature class that defines the location (e.g. outline or bounding box) of each feature."
24+
]
25+
},
26+
{
27+
"cell_type": "markdown",
28+
"metadata": {},
29+
"source": [
30+
"There are two major steps in feature classification. We first export training samples based on the geographical extent of each feature. Once the training samples are exported, it can be used as the training input for the deep learning based classification algorithm to train a feature classifier."
31+
]
32+
},
33+
{
34+
"cell_type": "markdown",
35+
"metadata": {},
36+
"source": [
37+
"## Export training samples\n",
38+
"\n",
39+
"The process of exporting training samples is slightly different from pixel-based classification and object detection. In feature classification, we extract training samples based on the extent of each individual feature defined by the feature class. For each training sample, there is an associated class label that comes from the feature class attribute table. Optionally, we can also define a buffer size to extract a larger neighbourhood around the feature so that more spatial context is available to the classification model, which makes distinguishing different classes easier."
40+
]
41+
},
42+
{
43+
"cell_type": "markdown",
44+
"metadata": {},
45+
"source": [
46+
"<center><img src=\"../../static/img/feature_classify_example.png\" height=\"700\" width=\"700\"></center>\n",
47+
"<center>Figure 1. An example of export training data for feature classifier</center>"
48+
]
49+
},
50+
{
51+
"cell_type": "markdown",
52+
"metadata": {},
53+
"source": [
54+
"In the example above, there are three buildings in the original data. The one on the top is damaged and the other two is undamanged. Therefore, the export results would be three training samples with the corresponding labels. Here we used a buffer size of 50 meters so we can have more surrounding context to feed to the model next."
55+
]
56+
},
57+
{
58+
"cell_type": "markdown",
59+
"metadata": {},
60+
"source": [
61+
"## Deep learning based classification algorithm"
62+
]
63+
},
64+
{
65+
"cell_type": "markdown",
66+
"metadata": {},
67+
"source": [
68+
"Once the training samples are ready, it becomes a standard multi-class image classification problem in computer vision, which is a process of taking an input image and outputting a class. Image classification can be solved through convolutional neural networks (CNN) and there are many CNN based image classification algorithms. Most of them have a backbone CNN architecture (e.g. Resnet, LeNet-5, AlexNet, VGG 16) followed by a [softmax layer](https://en.wikipedia.org/wiki/Softmax_function). Again, You can refresh your CNN knowledge by going through this short paper “[A guide to convolution arithmetic for deep learning](https://arxiv.org/pdf/1603.07285.pdf)”."
69+
]
70+
},
71+
{
72+
"cell_type": "markdown",
73+
"metadata": {},
74+
"source": [
75+
"## Implementation in `arcgis.learn`"
76+
]
77+
},
78+
{
79+
"cell_type": "markdown",
80+
"metadata": {},
81+
"source": [
82+
"`arcgis.learn` allows us to define a feature classifier architecture just through a single line of code. For example:\n",
83+
"\n",
84+
" feature_classifier = arcgis.learn.FeatureClassifier(data, backbone=None, pretrained_path=None)\n",
85+
"\n",
86+
"`data` is the returned data object from prepare_data function. `backbone` is used for creating the base of the classifier, which is resnet34 by default, while `pretrained_path` points to where pre-trained model is saved.\n",
87+
"\n",
88+
"For more information about the API, please go to the [API reference](https://esri.github.io/arcgis-python-api/apidoc/html/arcgis.learn.html#featureclassifier)."
89+
]
90+
}
91+
],
92+
"metadata": {
93+
"kernelspec": {
94+
"display_name": "Python 3",
95+
"language": "python",
96+
"name": "python3"
97+
},
98+
"language_info": {
99+
"codemirror_mode": {
100+
"name": "ipython",
101+
"version": 3
102+
},
103+
"file_extension": ".py",
104+
"mimetype": "text/x-python",
105+
"name": "python",
106+
"nbconvert_exporter": "python",
107+
"pygments_lexer": "ipython3",
108+
"version": "3.7.2"
109+
},
110+
"toc": {
111+
"base_numbering": 1,
112+
"nav_menu": {},
113+
"number_sections": true,
114+
"sideBar": true,
115+
"skip_h1_title": false,
116+
"title_cell": "Table of Contents",
117+
"title_sidebar": "Contents",
118+
"toc_cell": false,
119+
"toc_position": {},
120+
"toc_section_display": true,
121+
"toc_window_display": false
122+
}
123+
},
124+
"nbformat": 4,
125+
"nbformat_minor": 2
126+
}

guide/14-deep-learning/pixel_based_classification.ipynb

Lines changed: 89 additions & 101 deletions
Large diffs are not rendered by default.

samples/04_gis_analysts_data_scientists/Wildfire_analysis_using_Sentinel-2_imagery.ipynb

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

samples/04_gis_analysts_data_scientists/building_damage_assessment_using_feature_classifier.ipynb

Lines changed: 904 additions & 0 deletions
Large diffs are not rendered by default.

samples/04_gis_analysts_data_scientists/land_cover_classification_using_unet.ipynb

Lines changed: 102 additions & 171 deletions
Large diffs are not rendered by default.
2.35 MB
Loading

0 commit comments

Comments
 (0)