question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Possible overlay bug with binary segmentation masks

See original GitHub issue
  • Weights and Biases version: wandb, version 0.8.32

  • Python version: Python 3.6.8

  • Operating System: Linux

Description

Semantic Segmentation usecase for binary image masks feature for 3D volumes in grayscale

What I Did

Here’s the code to reproduce:

Malfunctioning code: The dashboard shows overlays only for class with label 0.

import numpy as np
import wandb


wandb.init(project='prototyping', entity='maastro-clinic')


target = np.random.randint(2, size=(32, 256, 256)).astype(np.uint8)
output = np.random.randint(2, size=(32, 256, 256)).astype(np.uint8)
data = np.random.randint(256, size=(32, 256, 256)).astype(np.uint8)


images = []

idx = 0
class_labels = {
    0: 'background',
    1: "nodule"
}

for im, t, o in zip(data, target, output):
    idx += 1        
    images.append(wandb.Image(im, masks={"predictions": {"mask_data": o, "class_labels": class_labels}, \
        "ground_truth": {"mask_data": t, "class_labels": class_labels}}, caption='CT'))


wandb.log({"Predictions": images})

Changing the masks to have values from 0 to 2 and adding a class label makes all the 3 overlays work fine.

import numpy as np
import wandb


wandb.init(project='prototyping', entity='maastro-clinic')


target = np.random.randint(3, size=(32, 256, 256)).astype(np.uint8)
output = np.random.randint(3, size=(32, 256, 256)).astype(np.uint8)
data = np.random.randint(256, size=(32, 256, 256)).astype(np.uint8)


images = []

idx = 0
class_labels = {
    0: 'background',
    1: "nodule",
    2: "nodule2"

}

for im, t, o in zip(data, target, output):
    idx += 1        
    images.append(wandb.Image(im, masks={"predictions": {"mask_data": o, "class_labels": class_labels}, \
        "ground_truth": {"mask_data": t, "class_labels": class_labels}}, caption='CT'))


wandb.log({"Predictions": images})

Am I missing something here?

image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
nbardycommented, Apr 21, 2020

Hey @surajpaib thanks for reporting these bugs. I want to get both of these fixed for you.

I’ve got a PR up to fix the binary image masks issue #985. I’m looking at the other issue and I’ll get a fix out this week.

0reactions
nbardycommented, May 11, 2020

@surajpaib I’m going to close this issue. Feel free to open a new ticket if you find the other issue causing problems.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Image Sequence Display and Overlay with Binary Mask
The GUI will help to display single or multiple images in a single window overlaying with binary masks. Very useful for displaying segmented ......
Read more >
How to overlay segmented image on top of main image in ...
I had a go at this using four different methods: OpenCV; PIL/Pillow and Numpy; command-line with ImageMagick; morphology from skimage ...
Read more >
Paint ground-truth mask on image (without training a classifier)
Hi all, In order to evaluate the quality of an automated segmentation, I am looking for a way to generate a manual segmentation...
Read more >
Script to overlay binary segmentation masks over the image. If ...
Script to overlay binary segmentation masks over the image. If masks are overlaying, they colors will blend. Prepare the list of boolean masks,...
Read more >
An overview of semantic image segmentation. - Jeremy Jordan
When we overlay a single channel of our target (or prediction), we refer to this as a mask which illuminates the regions of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found