Skip to content

Commit

Permalink
fix: don't encode the prefix.
Browse files Browse the repository at this point in the history
  • Loading branch information
ccrutchf committed Nov 13, 2024
1 parent 5dde8bf commit 7d1a8b4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
6 changes: 4 additions & 2 deletions fishsense_lite/commands/label_studio.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ def execute_nn_laser(
cv2.imwrite(output_file.absolute().as_posix(), image_dark)

json_objects = LaserLabelStudioJSON(
f"{prefix}{output_file.relative_to(output.absolute()).as_posix()}",
prefix,
output_file.relative_to(output.absolute()).as_posix(),
laser_image_coord,
width,
height,
Expand Down Expand Up @@ -110,7 +111,8 @@ def execute_fishial(
cv2.imwrite(mask_file.absolute().as_posix(), debug_output)

json_objects = SegmentationLabelStudioJSON(
f"{prefix}{output_file.relative_to(output.absolute()).as_posix()}",
prefix,
output_file.relative_to(output.absolute()).as_posix(),
segmentations,
fish_segmentation_inference.name,
)
Expand Down
4 changes: 2 additions & 2 deletions fishsense_lite/commands/label_studio_models/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@


class Data:
def __init__(self, img: str):
self.img = urllib.parse.quote(img)
def __init__(self, prefix: str, img: str):
self.img = f"{prefix}{urllib.parse.quote(img)}"
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ def __init__(
class LaserLabelStudioJSON:
def __init__(
self,
prefix: str,
img: str,
laser_image_coord: np.ndarray,
width: int,
height: int,
model_name: str,
):
self.data = Data(img)
self.data = Data(prefix, img)
self.predictions = (
[LaserPrediction(laser_image_coord, width, height, model_name)]
if laser_image_coord is not None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,12 @@ def __init__(self, mask: np.ndarray, model_name: str):
class SegmentationLabelStudioJSON:
def __init__(
self,
prefix: str,
img: str,
mask: np.ndarray,
model_name: str,
):
self.data = Data(img)
self.data = Data(prefix, img)
self.predictions = (
[SegmentationPrediction(mask, model_name)] if mask.sum() > 0 else []
)

0 comments on commit 7d1a8b4

Please sign in to comment.