You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/mensuration_and_polling/README.md
+18-8
Original file line number
Diff line number
Diff line change
@@ -16,18 +16,26 @@ You will learn:
16
16
17
17
## Setup data
18
18
19
-
Any georeferenced raster can be used. For this demo, a georeferenced TIFF image of the Grand Canyon and a corresponding PNG image that can be loaded into Label Studio (TIFF is not supported in Label Studio) was generated using the following steps:
19
+
Any georeferenced raster images can be used. For this demo, two images are used:
20
20
21
-
1. Sign up at sentinel-hub.com for a trial account for access to [Sentinel-2](https://en.wikipedia.org/wiki/Sentinel-2) satellite images on demand. These have a resolution of 10 GSD (10 meters per pixel).
21
+
### Grand Canyon satellite image
22
+
23
+
a georeferenced TIFF image of the Grand Canyon and a corresponding PNG image that can be loaded into Label Studio (TIFF is not supported in Label Studio) was generated using the following steps:
24
+
25
+
1. Sign up at sentinel-hub.com for a trial account for access to [Sentinel-2](https://en.wikipedia.org/wiki/Sentinel-2) satellite images on demand. These have a resolution of 10m GSD (10 meters per pixel).
22
26
2. Use the included `grab_georeferenced_image.py` with your credentials to download the image in a [UTM coordinate system](https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system), where each pixel is a fixed area instead of a fixed fraction of longitude and latitude. This makes the image "square" with respect to the ground.
A UAV image of a city block was downloaded from [OpenAerialMap](https://openaerialmap.org/) and cropped to a reasonable size using [QGIS](https://www.qgis.org/en/site/). It has a resolution of 20cm GSD, so it started out as a huge file. Then it was exported to PNG in the same way.
35
+
28
36
## Load data into Label Studio
29
37
30
-
Create a new project and upload `data/response.png` to the project.
38
+
Create a new project and upload `data/response.png`and `666dbadcf1cf8e0001fb2f51_cropped.png`to the project.
31
39
32
40
Add a label config for image segmentation, slightly modified from the default template:
33
41
@@ -37,13 +45,13 @@ Add a label config for image segmentation, slightly modified from the default te
37
45
<Headervalue="Select label and click the image to start"/>
"and", # need 'and' instead of 'or', even though this is only one filter
50
-
[
51
-
Filters.item(
52
-
Column.updated_at,
53
-
Operator.GREATER_OR_EQUAL,
54
-
Type.Datetime,
55
-
Filters.value(last_poll_time),
56
-
)
57
-
],
58
-
)
68
+
filters=_filter_tasks(last_poll_time)
59
69
tasks=project.get_tasks(filters=filters)
60
70
yieldfromtasks
61
71
time.sleep(freq_seconds)
62
72
63
73
64
-
defperimeter_and_area(source_img_path, annot):
74
+
defcalculate_distances(source_img_path, annot):
65
75
"""
66
-
Calculate the perimeter and area of the polygon annotation in geographic coordinates given by the georeferenced TIFF source image the polygon was drawn on.
76
+
Calculate properties of the polygon annotation in geographic coordinates given by the georeferenced TIFF source image the polygon was drawn on.
67
77
"""
68
-
width=annot["result"][0]["original_width"]
69
-
height=annot["result"][0]["original_height"]
70
-
points=annot["result"][0]["value"]["points"]
78
+
try:
79
+
width=annot["result"][0]["original_width"]
80
+
height=annot["result"][0]["original_height"]
81
+
points=annot["result"][0]["value"]["points"]
71
82
72
-
# convert relative coordinates to pixel coordinates
Using the old SDK client, due to our workaround providing extra task columns and uploading single images instead of full task objects, PATCH /api/tasks/<id> requests will not complete correctly until the task has those columns populated.
123
+
"""
124
+
# look for tasks with missing values
125
+
old_tasks=project.get_tasks()
126
+
default_values= {
127
+
"perimeter_m": 0,
128
+
"area_m2": 0,
129
+
"major_axis_m": 0,
130
+
"minor_axis_m": 0,
131
+
}
132
+
tasks_to_recreate= []
133
+
fortaskinold_tasks:
134
+
forkindefault_values:
135
+
ifknotintask["data"]:
136
+
tasks_to_recreate.append(task)
137
+
break
138
+
# instead of updating tasks, need to delete and recreate tasks
0 commit comments