Skip to content

Commit

Permalink
[FIX] pixels outside the mask get value -1
Browse files Browse the repository at this point in the history
  • Loading branch information
BenCretois committed Oct 16, 2024
1 parent e57f734 commit 33ce66e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/dataset/rasterize_masks.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def rasterize_masks(

# Factorize the text labels to get numeric labels
gdf["label_encoded"], _ = pd.factorize(gdf[label_column])
gdf["label_encoded"] = gdf["label_encoded"]

# Ensure the output directory exists
os.makedirs(output_mask_dir, exist_ok=True)
Expand Down Expand Up @@ -86,8 +87,8 @@ def rasterize_masks(
shapes=shapes,
out_shape=(img_height, img_width),
transform=transform,
fill=0,
dtype="uint8",
fill=-1,
dtype="int16",
)

# Save the mask as a grayscale PNG
Expand Down

0 comments on commit 33ce66e

Please sign in to comment.