semantic-segmentation

How to create a binary mask from a yolo8 segmentation result

How to create a binary mask from a yolo8 segmentation result Question: I want to segment an image using yolo8 and then create a mask for all objects in the image with specific class. I have developed this code: img=cv2.imread(‘images/bus.jpg’) model = YOLO(‘yolov8m-seg.pt’) results = model.predict(source=img.copy(), save=False, save_txt=False) class_ids = np.array(results[0].boxes.cls.cpu(), dtype="int") for i in …

Total answers: 2

How to compute Topk IoU in semantic segmentation using PyTorch?

How to compute Topk IoU in semantic segmentation using PyTorch? Question: Given outputs of a neural network outputs and a ground-truth label. outputs.shape = (N, C, H, W) and label.shape = (N, H ,W), where N is the batch size, C is the number of classes, H and W are crop sizes. Each element of …

Total answers: 1

Resizing binary mask stored in numpy array

Resizing binary mask stored in numpy array Question: I have got numpy arrays consisting of only 0s and 1s. They are supposed to be the target for an Image Segmentation Model, so I am trying to resize them all so they have the same dimensions. The problem is that when resizing with the code below, …

Total answers: 1

In need of a Labelencoder code to fix the InvalidArgumentError: Graph execution error when Using deeplabv3+ for a 4 class semantic segmentation

In need of a Labelencoder code to fix the InvalidArgumentError: Graph execution error when Using deeplabv3+ for a 4 class semantic segmentation Question: Am running a 4 class semantic segmentation problem using Deeplabv3+ and I get the graph execution error as soon as the training starts. I have identified the problem after searching the web …

Total answers: 1

Tensorflow_io: ValueError: Cannot infer argument `num` from shape (None, None, None)

Tensorflow_io: ValueError: Cannot infer argument `num` from shape (None, None, None) Question: I am trying to read and decode tiff images in tensorflow. I am using tensrflow_io package as follows, I am getting this error that I cant figure out. import tensorflow as tf import tensorflow_io as tfio import os def process_image(image): image = tf.io.read_file(image) …

Total answers: 2

UNet loss is NaN + UserWarning: Warning: converting a masked element to nan

UNet loss is NaN + UserWarning: Warning: converting a masked element to nan Question: I’m training a UNet, which class looks like this: class UNet(nn.Module): def __init__(self): super().__init__() # encoder (downsampling) # Each enc_conv/dec_conv block should look like this: # nn.Sequential( # nn.Conv2d(…), # … (2 or 3 conv layers with relu and batchnorm), # …

Total answers: 1

Evaluate U-Net by layer

Evaluate U-Net by layer Question: I am coming from medical background and a newbie in this machine learning field. I am trying to train my U-Net model using keras and tensorflow for image segmentation. However, my loss value is all NaN and the prediction is all black. I would like to check the U-Net layer …

Total answers: 2

AttributeError: 'tuple' object has no attribute 'write' , instance segmentation python

AttributeError: 'tuple' object has no attribute 'write' , instance segmentation python Question: I have used code of this blog "https://learnopencv.com/deep-learning-based-object-detection-and-instance-segmentation-using-mask-r-cnn-in-opencv-python-c/" Titled Deep learning based Object Detection and Instance Segmentation using Mask R-CNN in OpenCV in python . I am using live stream and want to do object detection and instance segmentation on that and modified …

Total answers: 2

U net Multiclass segmentation image input dataset error

U net Multiclass segmentation image input dataset error Question: I am trying to do multiclass segmentation with U-net. In the previous trials I tried the binary segmentation and it works. But when I try to do multiclass I am facing this error. ValueError: ‘generator yielded an element of shape (128,192,1) where an element of shape …

Total answers: 1

Is there a function to create a UNET of custom depth in python/KERAS?

Is there a function to create a UNET of custom depth in python/KERAS? Question: I know one can be created manually, but wanted to know if someone has created a function (similar to MATLAB’s unet) where you can choose the number of steps along the encoder/decoder paths. Asked By: R0bots || Source Answers: I’ve done …

Total answers: 1