Skip to content

Commit 6721177

Browse files
committed
test for overzoom
1 parent db9611f commit 6721177

12 files changed

+43
-3
lines changed

test/fixtures/integration/config_3way.integration.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@
1919
"ml_type": "classification",
2020
"seed": 19,
2121
"split_names": ["train", "test", "val"],
22-
"split_vals": [0.7, 0.2, 0.1]
23-
}
22+
"split_vals": [0.7, 0.2, 0.1]}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{"country": "portugal",
2+
"bounding_box": [
3+
-9.4575,
4+
38.8467,
5+
-9.4510,
6+
38.8513
7+
],
8+
"zoom": 17,
9+
"classes": [
10+
{ "name": "Water Tower", "filter": ["==", "man_made", "water_tower"] },
11+
{ "name": "Building", "filter": ["has", "building"] },
12+
{ "name": "Farmland", "filter": ["==", "landuse", "farmland"] },
13+
{ "name": "Ruins", "filter": ["==", "historic", "ruins"] },
14+
{ "name": "Parking", "filter": ["==", "amenity", "parking"] },
15+
{ "name": "Roads", "filter": ["has", "highway"] }
16+
],
17+
"imagery": "https://api.mapbox.com/v4/mapbox.satellite/{z}/{x}/{y}.jpg?access_token=TOKEN",
18+
"background_ratio": 1,
19+
"ml_type": "classification",
20+
"seed": 19,
21+
"split_names": ["train", "test", "val"],
22+
"split_vals": [0.7, 0.2, 0.1],
23+
"over_zoom": 1
24+
}
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

test/integration/test_classification_package.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,15 @@ def setUpClass(cls):
2121
copyfile('test/fixtures/integration/labels-cl.npz', 'integration-cl-split/labels.npz')
2222
copytree('test/fixtures/integration/tiles', 'integration-cl-split/tiles')
2323

24+
makedirs('integration-cl-overzoom')
25+
copyfile('test/fixtures/integration/labels-cl.npz', 'integration-cl-overzoom/labels.npz')
26+
copytree('test/fixtures/integration/tiles_overzoom', 'integration-cl-overzoom/tiles')
27+
2428
@classmethod
2529
def tearDownClass(cls):
2630
rmtree('integration-cl')
2731
rmtree('integration-cl-split')
32+
rmtree('integration-cl-overzoom')
2833

2934
def test_cli(self):
3035
"""Verify data.npz produced by CLI"""
@@ -73,4 +78,16 @@ def test_cli_3way_split(self):
7378
# validate label data with shapes
7479
self.assertEqual(data['y_train'].shape, (5, 7))
7580
self.assertEqual(data['y_test'].shape, (2, 7))
76-
self.assertEqual(data['y_val'].shape, (1, 7))
81+
self.assertEqual(data['y_val'].shape, (1, 7))
82+
83+
def test_overzoom(self):
84+
"""Verify data.npz produced by CLI when overzoom is used"""
85+
cmd = 'label-maker package --dest integration-cl-overzoom --config test/fixtures/integration/config_overzoom.integration.json'
86+
cmd = cmd.split(' ')
87+
subprocess.run(cmd, universal_newlines=True)
88+
89+
data = np.load('integration-cl-overzoom/data.npz')
90+
91+
self.assertEqual(data['x_train'].shape, (6, 512, 512, 3))
92+
self.assertEqual(data['x_test'].shape, (2, 512, 512, 3))
93+
self.assertEqual(data['x_val'].shape, (1, 512, 512, 3))

0 commit comments

Comments
 (0)