kreyesp commited on
Commit
c227be5
Β·
verified Β·
1 Parent(s): b2816b6

Upload config

Browse files
Files changed (1) hide show
  1. config.py +49 -0
config.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dotenv import load_dotenv
2
+ import os
3
+
4
+ load_dotenv()
5
+ os.environ["HF_TOKEN"] = os.getenv("HF_TOKEN")
6
+
7
+ # ── Camera & optics (single source of truth) ───────────────────────────────────
8
+ SPECS = {
9
+ "s2": {"pixel_m": 7.5e-6, "focal_m": 0.600, "alt_m": 786_000.0},
10
+ "bc2": {"pixel_m": 6.0e-6, "focal_m": 0.016, "alt_m": 410_000.0,
11
+ "f_number": 2.8},
12
+ }
13
+
14
+ def gsd(cam):
15
+ return cam["pixel_m"] * cam["alt_m"] / cam["focal_m"]
16
+
17
+ GSD_S2 = gsd(SPECS["s2"]) # 9.83 m
18
+ GSD_BC2 = gsd(SPECS["bc2"]) # 153.75 m
19
+ SCALE_FACTOR = GSD_BC2 / GSD_S2 # ~15.65 (replaces old altitude-only ratio)
20
+
21
+ # ── Camera sensor dimensions ───────────────────────────────────────────────────
22
+ CAMERA_W = 752 # physical BlueFOX sensor width (inference frame size)
23
+ CAMERA_H = 480 # physical BlueFOX sensor height (inference frame size)
24
+ PATCH_SIZE = 33 # output size of each training patch after GSD downsampling
25
+ # = floor(512 / SCALE_FACTOR)
26
+
27
+ # ── Paths ──────────────────────────────────────────────────────────────────────
28
+ SAVE_DIR = "data/bluefox"
29
+ CHECKPOINT = "best_model.pth"
30
+
31
+ # ── Dataset ────────────────────────────────────────────────────────────────────
32
+ MAX_SAMPLES = 8490
33
+ SEED = 42
34
+
35
+ TRAIN_RATIO = 0.70
36
+ VAL_RATIO = 0.15
37
+ TEST_RATIO = 0.15
38
+
39
+ # ── Model ──────────────────────────────────────────────────────────────────────
40
+ NUM_CLASSES = 4
41
+ CLASS_NAMES = ["clear", "thick_cloud", "thin_cloud", "shadow"]
42
+
43
+ # ── Training ───────────────────────────────────────────────────────────────────
44
+ BATCH_SIZE = 512 # 33Γ—33 patches are tiny -- can afford larger batches
45
+ NUM_WORKERS = 0
46
+ NUM_EPOCHS = 50
47
+ PATIENCE = 8
48
+ LEARNING_RATE = 2e-4 # bumped up slightly from 2e-5 -- fine for a small CNN
49
+ WEIGHT_DECAY = 0.01