Skip to content

Commit 40ae204

Browse files
committed
[webapp] Add Tanzania dataset to the Flask application
1 parent 69b1d9c commit 40ae204

File tree

5 files changed

+148
-12
lines changed

5 files changed

+148
-12
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ deeposlandia/webapp/static/aerial
88
deeposlandia/webapp/static/shapes
99
deeposlandia/webapp/static/mapillary
1010
deeposlandia/webapp/static/mapillary_agg
11+
deeposlandia/webapp/static/tanzania
1112
deeposlandia/webapp/static/predicted
1213
deeposlandia/webapp/static/bower/
1314
deeposlandia.egg-info/

deeposlandia/webapp/main.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
app.config['ERROR_404_HELP'] = False
4747

4848
MODELS = ('feature_detection', 'semantic_segmentation')
49-
DATASETS = ('mapillary', 'shapes', 'aerial')
49+
DATASETS = ('mapillary', 'shapes', 'aerial', 'tanzania')
5050
ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'tif'])
5151

5252
def check_model(model):
@@ -63,7 +63,7 @@ def check_model(model):
6363

6464
def check_dataset(dataset):
6565
"""Check if `dataset` is valid, *i.e.* equal to `shapes`,
66-
`mapillary` or `aerial`
66+
`mapillary`, `aerial` or `tanzania`
6767
6868
Parameters
6969
----------
@@ -112,11 +112,13 @@ def recover_image_info(dataset, filename):
112112
size_aggregation = "400_aggregated"
113113
elif dataset == "aerial":
114114
size_aggregation = "250_full"
115+
elif dataset == "tanzania":
116+
size_aggregation = "384_full"
115117
elif dataset == "shapes":
116118
size_aggregation = "64_full"
117119
else:
118120
raise ValueError(("Unknown dataset. Please choose 'mapillary', "
119-
"'aerial' or 'shapes'."))
121+
"'aerial', 'tanzania' or 'shapes'."))
120122
with open(os.path.join("data", dataset, "preprocessed", size_aggregation
121123
, "validation.json")) as fobj:
122124
config = json.load(fobj)
@@ -151,7 +153,7 @@ def demo_homepage(model, dataset):
151153
model : str
152154
Considered research problem (either `feature_detection` or `semantic_segmentation`)
153155
dataset : str
154-
Considered dataset (either `shapes`, `mapillary` or `aerial`)
156+
Considered dataset (either `shapes`, `mapillary`, `aerial` or `tanzania`)
155157
156158
Returns
157159
-------
Loading

deeposlandia/webapp/templates/index.html

+23-8
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,25 @@ <h5><a href="https://www.mapillary.com/dataset/vistas">Mapillary</a> (13 labels)
4242
</div>
4343
</div>
4444
</div>
45+
<div class="one-half column home-widget">
46+
<div class="panel panel-default">
47+
<div class="panel-header">
48+
<h5>Random shapes (3 labels)</h5>
49+
</div>
50+
<div class="panel-body">
51+
<p>
52+
<a href="{{ url_for('demo_homepage', model='feature_detection', dataset='shapes') }}" title="feature detection">
53+
<img src="{{url_for('static', filename='sample_image/shapes_fd.png')}}" width="48%" height="200px">
54+
</a>
55+
<a href="{{ url_for('demo_homepage', model='semantic_segmentation', dataset='shapes') }}" title="semantic segmentation">
56+
<img src="{{url_for('static', filename='sample_image/shapes_ss.png')}}" width="48%" height="200px">
57+
</a>
58+
<br>
59+
Toy dataset :-)
60+
</p>
61+
</div>
62+
</div>
63+
</div>
4564
<div class="one-half column home-widget">
4665
<div class="panel panel-default">
4766
<div class="panel-header">
@@ -60,18 +79,14 @@ <h5><a href="https://project.inria.fr/aerialimagelabeling/">Aerial image</a> (2
6079
<div class="one-half column home-widget">
6180
<div class="panel panel-default">
6281
<div class="panel-header">
63-
<h5>Random shapes (3 labels)</h5>
82+
<h5><a href="https://blog.werobotics.org/2018/08/06/welcome-to-the-open-ai-tanzania-challenge/">Open AI Tanzania</a> (4 labels)</h5>
6483
</div>
6584
<div class="panel-body">
6685
<p>
67-
<a href="{{ url_for('demo_homepage', model='feature_detection', dataset='shapes') }}" title="feature detection">
68-
<img src="{{url_for('static', filename='sample_image/shapes_fd.png')}}" width="48%" height="200px">
69-
</a>
70-
<a href="{{ url_for('demo_homepage', model='semantic_segmentation', dataset='shapes') }}" title="semantic segmentation">
71-
<img src="{{url_for('static', filename='sample_image/shapes_ss.png')}}" width="48%" height="200px">
86+
<a href="{{ url_for('demo_homepage', model='semantic_segmentation', dataset='tanzania') }}" title="semantic segmentation">
87+
<img src="{{url_for('static', filename='sample_image/tanzania_ss.png')}}" width="96%" height="200px">
7288
</a>
73-
<br>
74-
Toy dataset :-)
89+
<br>Aerial imagery
7590
</p>
7691
</div>
7792
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
{% extends 'layout.html' %}
2+
3+
{% block content %}
4+
5+
<script>
6+
const dataset = "tanzania";
7+
const model = "{{ model }}";
8+
</script>
9+
10+
<div class="od-header">
11+
<h1>Tanzania: {{ model }}</h1>
12+
</div>
13+
14+
<nav aria-label="breadcrumb">
15+
<ol class="breadcrumb">
16+
<li class="breadcrumb-item"
17+
aria-current="page"><a href="{{url_for('index')}}">Home</a>
18+
</li>
19+
<li class="breadcrumb-item"
20+
aria-current="page">Tanzania</a>
21+
</li> </ol>
22+
</ol>
23+
</nav>
24+
25+
<h2>Demo</h2>
26+
27+
<p>Click on the below button to generate a random picture from Open AI
28+
Tanzania, and to display the corresponding label predictions.</p>
29+
30+
<button id="predict_labels" value="Generate a new image" dataset="tanzania">Generate a new image</button>
31+
32+
<div class="container">
33+
<div class="row widget">
34+
35+
<div class="one-third column home-widget dataset">
36+
<div class="panel panel-default">
37+
<div class="panel-header">
38+
<h5>Raw image</h5>
39+
</div>
40+
<div class="panel-body">
41+
<img id="raw_image" height="70%" width="100%" src="{{url_for('static', filename=image_filename)}}">
42+
</div>
43+
</div>
44+
</div>
45+
46+
<div class="one-third column home-widget dataset">
47+
<div class="panel panel-default">
48+
<div class="panel-header">
49+
<h5>Ground-truth</h5>
50+
</div>
51+
<div class="panel-body">
52+
<img id="ground_truth" height="70%" width="100%" src="{{url_for('static', filename=label_filename)}}">
53+
<br>
54+
{% for value, color in ground_truth_labels %}
55+
{% if value!="background" %}
56+
<span class="color-label" style="background-color: {{ color }}">{{ value }}</span>
57+
{% else %}
58+
<span class="color-label" style="background-color: {{ color }}"><font color="#ffffff">{{ value }}</font></span>
59+
{% endif %}
60+
{% endfor %}
61+
</div>
62+
</div>
63+
</div>
64+
65+
<div class="one-third column home-widget dataset">
66+
<div class="panel panel-default">
67+
<div class="panel-header">
68+
<h5>Prediction</h5>
69+
</div>
70+
<div class="panel-body">
71+
<img id="predictions" height="70%" width="100%" src="{{url_for('static', filename=predicted_filename)}}">
72+
<br>
73+
{% for value, color in predicted_labels %}
74+
{% if value!="background" %}
75+
<span class="color-label" style="background-color: {{ color }}">{{ value }}</span>
76+
{% else %}
77+
<span class="color-label" style="background-color: {{ color }}"><font color="#ffffff">{{ value }}</font></span>
78+
{% endif %}
79+
{% endfor %}
80+
</div>
81+
</div>
82+
</div>
83+
84+
</div>
85+
</div>
86+
87+
88+
<h2>Training procedure</h2>
89+
90+
<p>
91+
We preprocessed the dataset images by subdividing raw images in 384*384-pixel
92+
tiles. The tiling process makes us getting around 131k training images, 15k
93+
validation images, and 137k testing images. The model used here is
94+
a <a href="https://arxiv.org/pdf/1505.04597.pdf">U-net</a> trained during 20
95+
epochs, with validation phases.
96+
</p>
97+
98+
<h2>Dataset description</h2>
99+
100+
<p>
101+
The <a href="https://blog.werobotics.org/2018/08/06/welcome-to-the-open-ai-tanzania-challenge/">Open
102+
AI Tanzania</a> dataset describes a building footprint recognition use case,
103+
where 3 types of buildings are discriminated: <em>complete
104+
buildings</em>, <em>incomplete buildings</em> and <em>foundations</em>. Doing
105+
semantic segmentation here means to define if a given pixel belongs to a
106+
building, and if required, the involved building type. The dataset contains
107+
13 high-resolution images (6 to 8cm/pixel), amongst which 2 images are
108+
assigned to validation purpose. As a remark, there are 9 additionnal images
109+
without labelling information that may be used for testing models.
110+
</p>
111+
112+
{% endblock %}
113+
114+
{% block appjs %}
115+
116+
<script src="{{ url_for('static', filename='demo_predictor.js') }}" type="text/javascript"></script>
117+
118+
{% endblock %}

0 commit comments

Comments
 (0)