Commit
·
c22debf
1
Parent(s):
40967d9
Debug unreachable centres as gray
Browse files
app.py
CHANGED
|
@@ -444,10 +444,6 @@ def _pipeline(uid,img_path):
|
|
| 444 |
seg = cv2.resize(seg_tensor.numpy(), (640, 640), interpolation=cv2.INTER_NEAREST)
|
| 445 |
print(f"🧪 [{uid}] segmentation input shape: {inputs['pixel_values'].shape}")
|
| 446 |
water_mask, garbage_mask, movable_mask = build_masks(seg) # movable zone = water and garbage masks
|
| 447 |
-
for cx, cy in centres:
|
| 448 |
-
cv2.circle(movable_mask, (cx, cy), 3, 127, -1) # gray center dots
|
| 449 |
-
cv2.imwrite(f"{OUTPUT_DIR}/{uid}_movable_with_centres.png", movable_mask * 255)
|
| 450 |
-
print(f"🧩 Saved debug movable_mask: {OUTPUT_DIR}/{uid}_movable_mask.png")
|
| 451 |
|
| 452 |
# 2- Garbage detection (3 models) → keep centres on water
|
| 453 |
detections=[]
|
|
@@ -493,6 +489,11 @@ def _pipeline(uid,img_path):
|
|
| 493 |
# add chunk centres and deduplicate
|
| 494 |
centres.extend(chunk_centres)
|
| 495 |
centres = [list(c) for c in {tuple(c) for c in centres}]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 496 |
if not centres: # No garbages within travelable zone
|
| 497 |
print(f"🛑 [{uid}] no reachable garbage"); video_ready[uid]=True; return
|
| 498 |
else: # Garbage within valid travelable zone
|
|
|
|
| 444 |
seg = cv2.resize(seg_tensor.numpy(), (640, 640), interpolation=cv2.INTER_NEAREST)
|
| 445 |
print(f"🧪 [{uid}] segmentation input shape: {inputs['pixel_values'].shape}")
|
| 446 |
water_mask, garbage_mask, movable_mask = build_masks(seg) # movable zone = water and garbage masks
|
|
|
|
|
|
|
|
|
|
|
|
|
| 447 |
|
| 448 |
# 2- Garbage detection (3 models) → keep centres on water
|
| 449 |
detections=[]
|
|
|
|
| 489 |
# add chunk centres and deduplicate
|
| 490 |
centres.extend(chunk_centres)
|
| 491 |
centres = [list(c) for c in {tuple(c) for c in centres}]
|
| 492 |
+
for cx, cy in centres:
|
| 493 |
+
cv2.circle(movable_mask, (cx, cy), 3, 127, -1) # gray center dots
|
| 494 |
+
cv2.imwrite(f"{OUTPUT_DIR}/{uid}_movable_with_centres.png", movable_mask * 255)
|
| 495 |
+
print(f"🧩 Saved debug movable_mask: {OUTPUT_DIR}/{uid}_movable_mask.png")
|
| 496 |
+
|
| 497 |
if not centres: # No garbages within travelable zone
|
| 498 |
print(f"🛑 [{uid}] no reachable garbage"); video_ready[uid]=True; return
|
| 499 |
else: # Garbage within valid travelable zone
|