Skip to content

Commit

Permalink
feat: fallback to not using seathru when seathru fails
Browse files Browse the repository at this point in the history
  • Loading branch information
ccrutchf committed Nov 14, 2024
1 parent efcaa9d commit 7fffd82
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions fishsense_lite/commands/label_studio.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,17 @@ def execute_fishial(
)
ml_depth_map.rescale(scale)

color_correction = ColorCorrection()
img = uint16_2_uint8(color_correction.correct_color(img, ml_depth_map))
try:
color_correction = ColorCorrection()
img8 = uint16_2_uint8(color_correction.correct_color(img, ml_depth_map))
except:
pass

fish_segmentation_inference = FishSegmentationFishialPyTorch(device)
segmentations: np.ndarray = fish_segmentation_inference.inference(img)
segmentations: np.ndarray = fish_segmentation_inference.inference(img8)

output_file.parent.mkdir(parents=True, exist_ok=True)
cv2.imwrite(output_file.absolute().as_posix(), img)
cv2.imwrite(output_file.absolute().as_posix(), img8)

debug_output = (segmentations.astype(float) / segmentations.max() * 255).astype(
np.uint8
Expand Down

0 comments on commit 7fffd82

Please sign in to comment.