Hello all,
I have my input image segmented into water region and land region.
I have my masked image:
image = Image.open(image_path).convert(“RGB”)
mask = Image.open(mask_path) .convert(“L”)
Convert to numpy arrays
image_np = np.array(image)
mask_np = np.array(mask)
binary_mask = (mask_np > 0).astype(np.uint8)
Apply mask to the image
segmented_part = image_np * np.expand_dims(mask_np, axis=2)
segmented_part.astype(“float32”)
segmented_part_image = Image.fromarray(segmented_part)
I have a U-Net network and my input is the masked image the tensor size is (batch size, channels (I have 3), width, height) like below
How can I work with the features that are only in the water region, just predict the water region and have the loss for that region?
Thank you for your help