Skip to content

Commit ef65649

Browse files
committed
Final Commit
1 parent 4f44dd0 commit ef65649

34 files changed

+8629
-2822
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,10 @@ old_data/
1313
experiments
1414
remove_experiment.py
1515
resample.py
16+
compare_decision_boundaries.py
17+
compare_models.py
18+
demonstrate_pct.py
19+
evaluate_models.py
20+
plot_learning_curves.py
21+
waterbody-data.tar.gz
1622

backend/callbacks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def get_callbacks(config: Dict[str, Any], val_data: ImgSequence, model: Model) -
4343
checkpoint = ModelCheckpoint(f"checkpoints/{model.name}/{model.name}", save_best_only=False, monitor='val_loss', mode='min', save_weights_only=True)
4444
prediction_logger = PredictionCallback(val_data, model)
4545
learning_rate_scheduler = LearningRateScheduler(lr_scheduler)
46-
early_stopping = EarlyStopping(monitor="val_loss", min_delta=0.0001, patience=10, verbose=1, mode="min")
46+
early_stopping = EarlyStopping(monitor="val_loss", min_delta=0.0001, patience=50, verbose=1, mode="min")
4747
return [tensorboard, csv, checkpoint, prediction_logger, learning_rate_scheduler, early_stopping] if get_create_logs(config) else [learning_rate_scheduler, early_stopping]
4848

4949

backend/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def get_input_channels(config: Dict[str, Any]) -> int:
5050
"SWIR": 1,
5151
"RGB+NIR": 4,
5252
"RGB+SWIR": 4,
53-
"RGB+NIR+SWIR": {"naive": 5, "depthwise": 128, "3D": 125, "paper": 128, "grayscale": 3}[get_fusion_head(config)],
53+
"RGB+NIR+SWIR": {"naive": 5, "depthwise": 128, "3D": 125, "paper": 128, "prism": 3}[get_fusion_head(config)],
5454
}
5555
return channels["+".join(get_bands(config))]
5656

backend/metrics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ def tf_round(x, decimals = 0):
77
return tf.round(x * multiplier) / multiplier
88

99

10-
def MIOU():
10+
def MIOU(decision_boundary=0.5):
1111
m = tf.keras.metrics.MeanIoU(num_classes=2)
1212
def MIoU(y_true, y_pred):
1313
m.reset_states()
14-
y_true, y_pred = y_true, tf.where(y_pred >= 0.5, 1.1, 0.0)
14+
y_true, y_pred = y_true, tf.where(y_pred >= decision_boundary, 1.1, 0.0)
1515
_ = m.update_state(y_true, y_pred)
1616
return m.result()
1717
return MIoU

backend/pipeline.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,10 @@ def load_dataset(config) -> Tuple[ImgSequence, ImgSequence, ImgSequence]:
208208

209209
# Read Batches From JSON File
210210
water_threshold = get_water_threshold(config)
211-
batch_filename = f"batches/transplanted_tiles_{water_threshold}.json" if get_waterbody_transfer(config) else "batches/tiles.json"
211+
batch_filename = f"batches/transplanted_tiles_{water_threshold}_timestamp_{get_timestamp(config)}.json" if get_waterbody_transfer(config) else "batches/tiles.json"
212212
with open(batch_filename) as f:
213213
batch_file = json.loads(f.read())
214214

215-
# Choose Type Of Data Pipeline Based On Project Config
216-
Constructor = WaterbodyTransferImgSequence if get_waterbody_transfer(config) else ImgSequence
217-
218215
# Create Train, Validation, And Test Data
219216
upscale_swir = get_fusion_head(config) != "paper"
220217
if get_waterbody_transfer(config):

batches/tiles.json

Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -302,43 +302,6 @@
302302
38
303303
],
304304
"validation": [
305-
102,
306-
90,
307-
275,
308-
111,
309-
166,
310-
216,
311-
68,
312-
158,
313-
209,
314-
260,
315-
366,
316-
240,
317-
325,
318-
254,
319-
295,
320-
362,
321-
135,
322-
2,
323-
88,
324-
274,
325-
393,
326-
28,
327-
280,
328-
261,
329-
354,
330-
218,
331-
203,
332-
106,
333-
170,
334-
108,
335-
36,
336-
205,
337-
157,
338-
288,
339-
76
340-
],
341-
"test": [
342305
140,
343306
308,
344307
147,
@@ -373,36 +336,73 @@
373336
247,
374337
246,
375338
251,
376-
143,
377-
350,
378-
113,
379-
187,
380-
289,
381-
265,
382-
78,
383-
249,
384-
47,
385-
13,
386-
164,
387-
394,
388-
307,
389-
332,
390-
92,
391-
390,
392-
165,
393-
194,
394-
370,
395-
61,
396-
287,
397-
133,
398-
16,
399-
163,
400-
317,
401-
156,
402-
206,
403-
178,
404-
375,
339+
143
340+
],
341+
"test": [
342+
102,
343+
90,
344+
275,
345+
111,
346+
166,
347+
216,
348+
68,
349+
158,
350+
209,
351+
260,
352+
366,
353+
240,
354+
325,
355+
254,
356+
295,
357+
362,
358+
135,
359+
2,
360+
88,
361+
274,
362+
393,
363+
28,
364+
280,
365+
261,
366+
354,
367+
218,
368+
203,
369+
106,
370+
170,
371+
108,
372+
36,
373+
205,
374+
157,
375+
288,
376+
76,
377+
278,
405378
177,
406-
278
379+
375,
380+
178,
381+
206,
382+
156,
383+
317,
384+
163,
385+
16,
386+
133,
387+
287,
388+
61,
389+
370,
390+
194,
391+
165,
392+
390,
393+
92,
394+
332,
395+
307,
396+
394,
397+
164,
398+
13,
399+
47,
400+
249,
401+
78,
402+
265,
403+
289,
404+
187,
405+
113,
406+
350
407407
]
408408
}
Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -302,43 +302,6 @@
302302
38
303303
],
304304
"validation": [
305-
140,
306-
308,
307-
147,
308-
242,
309-
304,
310-
270,
311-
33,
312-
189,
313-
179,
314-
67,
315-
19,
316-
230,
317-
37,
318-
282,
319-
180,
320-
344,
321-
351,
322-
197,
323-
46,
324-
181,
325-
373,
326-
196,
327-
229,
328-
358,
329-
334,
330-
40,
331-
32,
332-
379,
333-
75,
334-
292,
335-
128,
336-
247,
337-
246,
338-
251,
339-
143
340-
],
341-
"test": [
342305
102,
343306
90,
344307
275,
@@ -373,36 +336,73 @@
373336
205,
374337
157,
375338
288,
376-
76,
377-
278,
378-
177,
379-
375,
380-
178,
381-
206,
382-
156,
383-
317,
384-
163,
385-
16,
386-
133,
387-
287,
388-
61,
389-
370,
390-
194,
391-
165,
392-
390,
393-
92,
394-
332,
395-
307,
396-
394,
397-
164,
398-
13,
399-
47,
400-
249,
401-
78,
402-
265,
403-
289,
404-
187,
339+
76
340+
],
341+
"test": [
342+
140,
343+
308,
344+
147,
345+
242,
346+
304,
347+
270,
348+
33,
349+
189,
350+
179,
351+
67,
352+
19,
353+
230,
354+
37,
355+
282,
356+
180,
357+
344,
358+
351,
359+
197,
360+
46,
361+
181,
362+
373,
363+
196,
364+
229,
365+
358,
366+
334,
367+
40,
368+
32,
369+
379,
370+
75,
371+
292,
372+
128,
373+
247,
374+
246,
375+
251,
376+
143,
377+
350,
405378
113,
406-
350
379+
187,
380+
289,
381+
265,
382+
78,
383+
249,
384+
47,
385+
13,
386+
164,
387+
394,
388+
307,
389+
332,
390+
92,
391+
390,
392+
165,
393+
194,
394+
370,
395+
61,
396+
287,
397+
133,
398+
16,
399+
163,
400+
317,
401+
156,
402+
206,
403+
178,
404+
375,
405+
177,
406+
278
407407
]
408408
}

0 commit comments

Comments
 (0)