Mingze commited on
Commit
b221043
·
verified ·
1 Parent(s): c151b49

Use OpenEarthMap semantic class names

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -43,6 +43,17 @@ SEGMENTATION_MODEL_ID = "mfaytin/mask2former-satellite"
43
  DETECTION_MODEL_ID = "bluelabel/satellite-equipment-detection-yolov8n-vhr10"
44
  DETECTION_FILENAME = "best.pt"
45
  OUTPUT_ROOT = Path("/tmp/satellite-vision-toolkit")
 
 
 
 
 
 
 
 
 
 
 
46
 
47
 
48
  @lru_cache(maxsize=1)
@@ -55,8 +66,7 @@ def load_segmenter():
55
  .to(device)
56
  .eval()
57
  )
58
- id2label = {int(key): str(value) for key, value in model.config.id2label.items()}
59
- return processor, model, id2label, device
60
 
61
 
62
  @lru_cache(maxsize=1)
@@ -266,4 +276,3 @@ RGB PNG/JPEG/WebP/TIFF images work best. Results are image-space estimates, not
266
 
267
  if __name__ == "__main__":
268
  demo.queue(default_concurrency_limit=2).launch()
269
-
 
43
  DETECTION_MODEL_ID = "bluelabel/satellite-equipment-detection-yolov8n-vhr10"
44
  DETECTION_FILENAME = "best.pt"
45
  OUTPUT_ROOT = Path("/tmp/satellite-vision-toolkit")
46
+ OPEN_EARTH_MAP_LABELS = {
47
+ 0: "background",
48
+ 1: "bareland",
49
+ 2: "grass",
50
+ 3: "pavement",
51
+ 4: "road",
52
+ 5: "tree",
53
+ 6: "water",
54
+ 7: "cropland",
55
+ 8: "building",
56
+ }
57
 
58
 
59
  @lru_cache(maxsize=1)
 
66
  .to(device)
67
  .eval()
68
  )
69
+ return processor, model, OPEN_EARTH_MAP_LABELS, device
 
70
 
71
 
72
  @lru_cache(maxsize=1)
 
276
 
277
  if __name__ == "__main__":
278
  demo.queue(default_concurrency_limit=2).launch()