Web platform for sharing free image data for ML and research

Homepage: https://datasets.roundabout-host.com

By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

 picture.html

View raw Download
text/html • 17.79 kiB
HTML document, ASCII text
        
            
1
{% extends "default.html" %}
2
{% import "small-annotation-display.html" as annotation_display %}
3
4
{% block nav_title %}{{ resource.title }}{% endblock %}
5
{% block title %}Picture {{ resource.title }} | {{ site_name }}{% endblock %}
6
{% macro shape_label(x, y, text) %}
7
{% if text %}
8
<a class="shape-label" style="left: {{ x * 100 }}%; top: {{ y * 100 }}%" href="/object/{{ text | urlencode }}">
9
{{ text }}
10
</a>
11
{% endif %}
12
{% endmacro %}
13
{% block content %}
14
<div id="picture-view">
15
<x-frame id="picture-actions">
16
<ul class="action-list">
17
<li><a href="/raw/picture/{{ resource.id }}" download="GigadataPicture_{{ resource.id }}{{ file_extension }}">
18
<iconify-icon icon="mdi:download"></iconify-icon>Download
19
</a></li>
20
<li><a href="/picture/{{ resource.id }}/get-annotations">
21
<iconify-icon icon="ic:baseline-account-tree"></iconify-icon>JSON annotations
22
</a></li>
23
<li><a href="/raw/picture/{{ resource.id }}" target="_blank">
24
<iconify-icon icon="mdi:image"></iconify-icon>View separately
25
</a></li>
26
{% if have_permission %}
27
<li><a href="/picture/{{ resource.id }}/annotate">
28
<iconify-icon icon="mdi:vector-point-select"></iconify-icon>Annotate
29
</a></li>
30
{% endif %}
31
{% if resource.origin_url %}
32
<li><a href="{{ resource.origin_url }}">
33
<iconify-icon icon="mdi:web"></iconify-icon>Original source
34
</a></li>
35
{% endif %}
36
{% if resource.replaced_by %}
37
<li><a href="/picture/{{ resource.replaced_by.id }}">
38
<iconify-icon icon="mdi:new-releases"></iconify-icon>Replacement
39
</a></li>
40
{% endif %}
41
{% if resource.replaces %}
42
<li><a href="/picture/{{ resource.replaces.id }}">
43
<iconify-icon icon="mdi:archive"></iconify-icon>Old version
44
</a></li>
45
{% endif %}
46
{% if current_user %}
47
<li><a href="/picture/{{ resource.id }}/copy">
48
<iconify-icon icon="mdi:content-copy"></iconify-icon>Copy
49
</a></li>
50
{% endif %}
51
{% if have_permission %}
52
<li><a href="/picture/{{ resource.id }}/put-annotations-form">
53
<iconify-icon icon="mdi:file-edit"></iconify-icon>Submit JSON annotations
54
</a></li>
55
<li><a href="/picture/{{ resource.id }}/edit-metadata">
56
<iconify-icon icon="mdi:edit"></iconify-icon>Edit metadata
57
</a></li>
58
{% endif %}
59
{% if have_permission %}
60
<li><details>
61
<summary>
62
<iconify-icon icon="mdi:delete"></iconify-icon>Delete
63
</summary>
64
<a href="/picture/{{ resource.id }}/delete">Confirm deletion</a>
65
</details></li>
66
{% endif %}
67
</ul>
68
</x-frame>
69
<x-frame style="--width: 768px">
70
<h1>{{ resource.title }}</h1>
71
<p>by <a href="/profile/{{ resource.author.username }}">{{ resource.author.formatted_name }}</a></p>
72
<p>{{ resource.description }}</p>
73
{% if resource.replaced_by %}
74
<div class="warning">
75
<h2>Obsolete</h2>
76
<p>
77
This picture has been replaced by <a href="/picture/{{ resource.replaced_by.id }}">{{ resource.replaced_by.title }}</a>.
78
</p>
79
{% if have_permission %}
80
<form method="POST" action="/picture/{{ resource.id }}/remove-replacement">
81
<button class="button-flat button-neutral" type="submit">Remove replacement</button>
82
</form>
83
{% endif %}
84
</div>
85
{% endif %}
86
<x-vbox>
87
<div id="annotation-zone">
88
<img id="annotation-image" src="/raw/picture/{{ resource.id }}" alt="{{ resource.title }}">
89
{% for region in resource.regions %}
90
{% if region.json.type == "bbox" %}
91
<svg class="shape-container-viewonly" viewBox="0 0 1 1" preserveAspectRatio="none">
92
<rect x="{{ region.json.shape.x }}"
93
y="{{ region.json.shape.y }}"
94
width="{{ region.json.shape.w }}"
95
height="{{ region.json.shape.h }}"
96
fill="none" class="shape-bbox shape"
97
></rect>
98
{% set centre_x = region.json.shape.x + region.json.shape.w / 2 %}
99
{% set centre_y = region.json.shape.y + region.json.shape.h / 2 %}
100
</svg>
101
{% elif region.json.type == "polygon" %}
102
<svg class="shape-container-viewonly" viewBox="0 0 1 1" preserveAspectRatio="none">
103
<polygon points="{% for point in region.json.shape %}{{ point.x }},{{ point.y }} {% endfor %}" fill="none" class="shape-polygon shape"></polygon>
104
{% set top = region.json.shape | sort(attribute='y') | last %}
105
{% set left = region.json.shape | sort(attribute='x') | first %}
106
{% set bottom = region.json.shape | sort(attribute='y') | first %}
107
{% set right = region.json.shape | sort(attribute='x') | last %}
108
{% set centre_x = (left.x + right.x) / 2 %}
109
{% set centre_y = (top.y + bottom.y) / 2 %}
110
</svg>
111
{% elif region.json.type == "polyline" %}
112
<svg class="shape-container-viewonly" viewBox="0 0 1 1" preserveAspectRatio="none">
113
<polyline points="{% for point in region.json.shape %}{{ point.x }},{{ point.y }} {% endfor %}" fill="none" class="shape-polyline shape"></polyline>
114
{# Median point #}
115
{% set centre_x = region.json.shape | map(attribute="x") | median %}
116
{% set centre_y = region.json.shape | map(attribute="y") | median %}
117
</svg>
118
{% elif region.json.type == "point" %}
119
<svg class="shape-container-viewonly" viewBox="0 0 1 1" preserveAspectRatio="none">
120
<circle cx="{{ region.json.shape.x }}" cy="{{ region.json.shape.y }}" r="0" fill="none" class="shape-point shape"></circle>
121
{% set centre_x = region.json.shape.x %}
122
{% set centre_y = region.json.shape.y %}
123
</svg>
124
{% endif %}
125
{{ shape_label(centre_x, centre_y, region.object_id) }}
126
{% endfor %}
127
</div>
128
<x-buttonbox id="annotation-view-controls">
129
<label>
130
<input type="checkbox" id="show-shapes" checked>
131
Show shapes
132
</label>
133
<label>
134
<input type="checkbox" id="show-objects" checked>
135
Show objects
136
</label>
137
</x-buttonbox>
138
{% set licences = resource.licences | map(attribute="licence") | list %}
139
{% set contains = resource.regions | map(attribute="object_id") | set | select | sort | list %}
140
<h2>Ratings ({{ resource.rating_totals.values() | sum }})</h2>
141
<x-hbox>
142
<x-vbox>
143
{% if resource.average_rating %}
144
<div class="rating-bar">
145
{% for i in range(1, 6) %}
146
<div class="rating-bar-segment">
147
<div class="rating-bar-filling" style="width: {{ resource.stars[i-1] }}%"></div>
148
</div>
149
{% endfor %}
150
</div>
151
<p>
152
<span>Average rating:</span>
153
<span>{{ resource.average_rating | round(2) }}</span>
154
from {{ resource.rating_totals.values() | sum }} ratings
155
</p>
156
{% endif %}
157
{% if current_user %}
158
<h3>Your rating</h3>
159
<form id="rating-form" method="POST" action="/picture/{{ resource.id }}/rate">
160
<label>
161
<input name="rating" type="radio" value="0" {% if not own_rating.rating %}checked{% endif %}>
162
Clear rating
163
</label>
164
<div class="star-rating-container">
165
<input type="radio" id="stars-5" name="rating" value="5" title="Perfect" {% if own_rating.rating == 5 %}checked{% endif %}>
166
<label for="stars-5" tabindex="0"><iconify-icon icon="mdi:star" class="star">5 stars</iconify-icon></label>
167
<input type="radio" id="stars-4" name="rating" value="4" title="Good" {% if own_rating.rating == 4 %}checked{% endif %}>
168
<label for="stars-4" tabindex="0"><iconify-icon icon="mdi:star" class="star">4 stars</iconify-icon></label>
169
<input type="radio" id="stars-3" name="rating" value="3" title="OK" {% if own_rating.rating == 3 %}checked{% endif %}>
170
<label for="stars-3" tabindex="0"><iconify-icon icon="mdi:star" class="star">3 stars</iconify-icon></label>
171
<input type="radio" id="stars-2" name="rating" value="2" title="Poor" {% if own_rating.rating == 2 %}checked{% endif %}>
172
<label for="stars-2" tabindex="0"><iconify-icon icon="mdi:star" class="star">2 stars</iconify-icon></label>
173
<input type="radio" id="stars-1" name="rating" value="1" title="Awful" {% if own_rating.rating == 1 %}checked{% endif %}>
174
<label for="stars-1" tabindex="0"><iconify-icon icon="mdi:star" class="star">1 star</iconify-icon></label>
175
</div>
176
<button type="submit">Rate</button>
177
</form>
178
{% endif %}
179
</x-vbox>
180
{% if resource.average_rating %}
181
<ul class="rating-list flexible-space">
182
{% for i in range(5, 0, -1) %}
183
<li style="grid-column-end: {{ resource.rating_totals[i] + 2 }}; background: var(--{{ i }}-star);">
184
<span>{{ i }}:</span>
185
<span>{{ resource.rating_totals[i] }}</span>
186
</li>
187
{% endfor %}
188
</ul>
189
{% else %}
190
<p>No ratings yet.</p>
191
{% endif %}
192
</x-hbox>
193
<h2>Details</h2>
194
<div class="icon-explainer">
195
<span>Type</span>
196
<span>{{ resource.nature.id }}</span>
197
<span>File format</span>
198
<span>{{ resource.file_format }}</span>
199
<span>Size</span>
200
<span>{{ size[0] }}&times;{{ size[1] }}</span>
201
<span>Number of regions</span>
202
<span>{{ resource.regions | length }}</span>
203
<span>Number of labelled regions</span>
204
<span>{{ resource.regions | selectattr("object_id") | list | length }}</span>
205
<span>Date uploaded</span>
206
<span>{{ resource.timestamp }}</span>
207
</div>
208
{% if contains %}
209
<p>
210
Contains objects: {% for object_id in contains %}
211
<a href="/object/{{ object_id | urlencode }}">{{ object_id }}</a>{% if not loop.last %}, {% endif %}{% endfor %}
212
</p>
213
{% else %}
214
<p>No labelled regions.</p>
215
{% endif %}
216
<h2>Licensing</h2>
217
<x-hbox style="justify-content: space-between">
218
<small class="picture-licensing-info">
219
Available under:
220
{% for licence in licences %}
221
<a href="{{ licence.info_url }}" target="_blank">
222
{{ licence.title }}
223
</a>
224
{% if not loop.last %}, {% endif %}
225
{% endfor %}
226
</small>
227
<x-vbox class="picture-licence-logos">
228
{% for licence in licences[:6] %}
229
{% if licence.logo_url %}
230
{% if licence.info_url %}
231
<a href="{{ licence.info_url }}" target="_blank" tabindex="-1">
232
{# An equivalent link already exists, only one is focusable #}
233
<img src="{{ licence.logo_url }}" alt="{{ licence.title }}" class="licence-logo">
234
</a>
235
{% else %}
236
<img src="{{ licence.logo_url }}" alt="{{ licence.title }}" class="licence-logo">
237
{% endif %}
238
{% endif %}
239
{% endfor %}
240
{% if licences | length > 6 %}
241
<details>
242
<summary>More</summary>
243
<x-vbox>
244
{% for licence in licences[6:] %}
245
{% if licence.logo_url %}
246
{% if licence.info_url %}
247
<a href="{{ licence.info_url }}" target="_blank" tabindex="-1">
248
{# An equivalent link already exists, only one is focusable #}
249
<img src="{{ licence.logo_url }}" alt="{{ licence.title }}" class="licence-logo">
250
</a>
251
{% else %}
252
<img src="{{ licence.logo_url }}" alt="{{ licence.title }}" class="licence-logo">
253
{% endif %}
254
{% endif %}
255
{% endfor %}
256
</x-vbox>
257
</details>
258
{% endif %}
259
</x-vbox>
260
</x-hbox>
261
<h2>Copies</h2>
262
{% if resource.copies %}
263
<ul class="thumbnail-list">
264
{% for copy in resource.copies %}
265
<li>
266
<a href="/picture/{{ copy.id }}">
267
{{ annotation_display.annotation_display(copy) }}
268
<div class="list-detail">
269
{{ copy.title }}
270
</div>
271
</a>
272
<div class="list-more">
273
<form method="POST" action="/picture/{{ copy.id }}/mark-replacement">
274
<button type="submit">Designate replacement</button>
275
</form>
276
</div>
277
</li>
278
{% endfor %}
279
</ul>
280
{% else %}
281
<p>This picture hasn't got any copies.</p>
282
{% endif %}
283
284
<h2>Galleries</h2>
285
{% if resource.galleries %}
286
<ul class="thumbnail-list">
287
{% for gallery in resource.galleries %}
288
<li>
289
<a href="/gallery/{{ gallery.gallery.id }}">
290
<div class="list-detail">
291
{{ gallery.gallery.title }}
292
</div>
293
</a>
294
</li>
295
{% endfor %}
296
</ul>
297
{% else %}
298
<p>This picture isn't in any galleries.</p>
299
{% endif %}
300
</x-vbox>
301
</x-frame>
302
</div>
303
<svg width="0" height="0">
304
<defs>
305
<clipPath id="star-clip">
306
<path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.62L12 2L9.19 8.62L2 9.24l5.45 4.73L5.82 21z"></path>
307
</clipPath>
308
</defs>
309
</svg>
310
{% endblock %}