unet-neural-network

How to use pretrained encoder for customized Unet

How to use pretrained encoder for customized Unet Question: if you have a standard Unet encoder such as resnet50, then it’s easy to add pertaining to it. for example: ENCODER = ‘resnet50’ ENCODER_WEIGHTS = ‘imagenet’ CLASSES = class_names ACTIVATION = ‘sigmoid’ # could be None for logits or ‘softmax2d’ for multiclass segmentation # create segmentation …

Total answers: 1

model.parameters() alternative for TransUNet from transunet python library

model.parameters() alternative for TransUNet from transunet python library Question: I am trying to implement TransUNet for breakhis dataset I was making the optimizer like this optimizer = torch.optim.Adam(model.parameters(), lr=1e-4) my model is from transunet import TransUNet model = TransUNet(image_size=224, pretrain=True) But the parameter() function does not work with TransUNet This is the library I am …

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

Using U-net in Python with 3-channel input images for image segmentation

Using U-net in Python with 3-channel input images for image segmentation Question: I am using unet for image segmentation, using the code outlined herein. My input images are 256x256x3. while the corresponding segmentation masks are 256×256. I have changed the size for the input to Unet: def unet(pretrained_weights = None,input_size = (256,256,3)): and get a …

Total answers: 2

OpenCV (4.1.2) error !_src.empty() in function 'cvtColor'

OpenCV (4.1.2) error !_src.empty() in function 'cvtColor' Question: everyone. I`m trying to run a Unet script via Google Colab for training. But I have an error with cv2 function. Here is the part of the code where the error happened: def prepare_data(img_shape, ids, reader): img_count = len(ids) x_data = np.empty((img_count,) + img_shape, dtype=’uint8′) y_data = …

Total answers: 1

Semantic segmentation dataset organization

Semantic segmentation dataset organization Question: I am trying to segment 4 lesions with semantic segmentation. I follow this this great post My training folder has only 2 subfolders with patches: masks and images. Inside the folder with masks, ALL the classes are mixed. The other folder has the corresponding images. So, when I train the …

Total answers: 1

Size of y_true in custom loss function of Keras

Size of y_true in custom loss function of Keras Question: I am trying to write a custom loss function for U-net in Keras and the objective of it is to compute not only the mean square error (MSE) of the predicted image and the true image, but also the MSE of their gradients. I am …

Total answers: 1

TensorFlow MirroredStrategy() not working for multi-gpu training

TensorFlow MirroredStrategy() not working for multi-gpu training Question: I am trying to implement TensorFlows MirroredStrategy() to run a 3DUNet on 2 Nvidia Titan RTX graphics cards. The code is verified to work for 1 GPU. My OS is Red Hat Enterprise Linux 8 (RHEL8). The error comes at model.fit(). I have installed the appropriate NCCL …

Total answers: 2

How to implement LadderNet (2 U-Nets) in Keras? (With available PyTorch script as reference)

How to implement LadderNet (2 U-Nets) in Keras? (With available PyTorch script as reference) Question: I am trying to implement the architecture of LadderNet (https://arxiv.org/abs/1810.07810) in Keras, with only the PyTorch version available as reference. The architecture in the paper is comprised of 2 U-Nets: The codes for the PyTorch implementation of LadderNet’s architecture (obtained …

Total answers: 1

How to get a correct output predictions from unet_learner (fastai)?

How to get a correct output predictions from unet_learner (fastai)? Question: Please, I’m working on an image segmentation project and I used the fastai library (specifically the unet_learner). I’ve trained my model and very thing is fine here is my code (in the training phase): #codes = np.loadtxt(‘codes.txt’, dtype=str) codes = np.array([‘bg’, ‘edge’], dtype='<U4′)# bg= …

Total answers: 2