Skip to content

Commit 90e9d63

Browse files
committed
research
1 parent 0a7b23c commit 90e9d63

File tree

2 files changed

+30
-31
lines changed

2 files changed

+30
-31
lines changed

make_buildings.py

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,42 +13,37 @@
1313
def mil(fp):
1414
return math.floor(fp*1000000)
1515

16-
if __name__ == "__main__":
16+
if __name__ == "__main__":
1717
# box = (27.4631,53.9359,27.4989,53.9566)
1818
box_minsk = (27.4013,53.8157,27.7827,53.9739)
19-
# box_linetype = (27.643,53.843,27.647,53.846)
20-
# box_hrodna = (23.7483,53.5909,23.9145,53.7544)
21-
22-
irl_destroyed = []
23-
irl_completed = []
19+
# box_hrodna = (23.7483,53.5909,23.9145,53.7544)
2420

2521
q = loaders.Querier()
2622
ways = q.query_buildings(*box_minsk)
2723

2824
IMZ = 18
29-
# target = helpers.cleandir(f"buildings/yes")
30-
# for wayid,nodes in ways:
31-
# print(wayid)
32-
#
33-
# # fetch every tile the building touches
34-
# for i,node in enumerate(nodes):
35-
# fname = layers.maxar.gettile_wgs(node, IMZ, skipedge=True, edge=16)
36-
# if fname is None:
37-
# continue
38-
# dst = str(target)
39-
# shutil.copy(fname, dst)
25+
target = helpers.cleandir(f"buildings/yes")
26+
for wayid,nodes in ways:
27+
print(wayid)
28+
29+
# fetch every tile the building has a node at
30+
for i,node in enumerate(nodes):
31+
fname = layers.maxar.gettile_wgs(node, IMZ, skipedge=True, edge=16)
32+
if fname is None:
33+
continue
34+
dst = str(target)
35+
shutil.copy(fname, dst)
4036

4137
# OR focus on the building and crop
4238
# image = layers.maxar.tiles_way(nodes, IMZ, pad_pct=0.25, pad_px=48)
4339
# dst = str(target / f"m{wayid}.jpg")
4440
# cv2.imwrite(dst, image)
4541

4642
mp = helpers.MercatorPainter(layers.maxar, *box_minsk, IMZ)
47-
for wayid,nodes in ways:
43+
for _, nodes in ways:
4844
mp.add_polyline_wgs(nodes, width=1)
49-
# mp.show_fixedwindow(600, 600)
50-
# mp.random_check(151202,84361)
51-
# cv2.destroyAllWindows()
45+
# TODO: add restricted zones where imagery is outdated
46+
# use cv2.polyline(is_closed=True)
5247

5348
target = helpers.cleandir(f"buildings/no")
5449

readme.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Task: classify [roof:shape](https://wiki.openstreetmap.org/wiki/Simple_3D_buildi
110110

111111
![Roofshapes](readme-images/roofshapes.png)
112112

113-
Input: varies (see table)
113+
Input: varies (see table). As expected, the more the better!
114114

115115
| Input size | Frozen, 8 epoch train | Unfreeze, 8 epochs | 8 more epochs |
116116
| ------------- | --------------------- | ------------------ | ------------- |
@@ -127,13 +127,17 @@ Task: classify tiles with any type of building(s) vs. tiles with no buildings at
127127

128128
![Buildings: yes/no](readme-images/buildings_yes_no.png)
129129

130-
Input: 5700 images of both categories, 20% validation
130+
Input: 5700 images of both categories, 20% validation.
131131

132-
| | Frozen, 4 epoch train | Unfreeze, 6 epochs | 8 more epochs |
133-
| ---------------------------- | --------------------- | ------------------ | ------------- |
134-
| 256 no flip no rotation | 3.0% | 3.0% | |
135-
| 256 no flip full 20 rotation | 2.3% | 2.7% | |
136-
| 256 no flip full 40 rotation | | | |
137-
| | | | |
138-
| | | | |
139-
| | | | |
132+
## First attempt
133+
134+
For every node of every building, fetch the tile it belongs to. Don't use the tile if the node is closer than 16px to the edge (that would present only a tiny part of the building).
135+
136+
| | Frozen, 4 epoch train | Unfreeze, 6 epochs | 8 more epochs |
137+
| -------------------------------- | --------------------- | ------------------ | ------------- |
138+
| size=256 no flip, max_rotate=0 | 3.0% | 3.0% | |
139+
| size=256 no flip, max_rotate=20 | 2.3% | 2.7% | |
140+
| size=256, no flip, max_rotate=40 | 3.3% | 3.3% | |
141+
| | | | |
142+
| | | | |
143+
| | | | |

0 commit comments

Comments
 (0)