175 questions
0
votes
0
answers
42
views
How can I visualize the segmentation masks predicted by my U-Net model in a Tkinter-based GUI?
I'm using CustomTkinter to build a GUI for medical image segmentation. I have a button to load the images, and I’ve previously saved my trained model as "unet_model.h5". I want to display ...
0
votes
1
answer
58
views
TPU for Pix-to-Pix possible?
I have model Pix-to-Pix. Not segmentation. Transfer from texture to texture. Loss = 'mse'.
And it works properly with GPU. But if i try to use TPU i get loss = 'nan'
I simplified the model by cutting ...
0
votes
0
answers
70
views
Checkerboard Mosaic When Merging Prediction Tiles from TensorFlow UNet
I’m running a TensorFlow UNet model on geospatial imagery. I split the image into overlapping 500×500 pixel tiles using a custom function (get_tiles) and use a stride of 460 (i.e. 500 – 2×padding) so ...
0
votes
0
answers
16
views
U-Net model: incorrect number of inputs and outputs, find error in class code / architecture
I am trying to get a custom version of the EelSpecNet model working, which is based on the Unet architecture. The original large version can be found here:
text
The model ist used to reconstruct an ...
1
vote
1
answer
75
views
Unet pytorch dimension mismatch
I got the following U-net architecture causing problems:
class UNet(nn.Module):
def __init__(self, in_channels, out_channels):
super(UNet, self).__init__()
self.encoder1 = self....
2
votes
1
answer
94
views
MethodError in Training Minimal U-Net
I need to implement a U-Net in Julia using Flux.jl. The ultimate goal is to train a neural network for a scientific problem. As a first step, I decided to experiment with the KITTI benchmark dataset.
...
1
vote
1
answer
160
views
Differences in no of ResNet blocks in up blocks and no of channels for Unet2D model of diffusers
I have been reading about Unets and Stable diffusion and want to train one. I understand the original architecture for unets and how its channels, height and width evolve over down blocks and up ...
0
votes
1
answer
74
views
Difficulty fixing the code for DDPM with unet using Pyorch
I am studying Deep learning and have an assignment for training a DDPM with UNet on the MNIST handwritten digits dataset. Three ipynb files (model, unet and train_mnist) and one pdf for unet diagram ...
0
votes
1
answer
115
views
ValueError: Invalid input shape when combining image, mask, and CSV data in Keras model
I’m working on a deep learning model using Keras where I’m trying to combine three inputs: images, masks, and CSV data. The goal of my model is to predict the presence and type of brain hemorrhage ...
0
votes
1
answer
73
views
Add out_channel to pretrained model
I have trained a model fish.pth with 2 channels (fish and background). I want to add a layer so that I train a new model spine.pth which segments 3 classes fish, spine and background. Yes, I can do it ...
0
votes
0
answers
49
views
Cascade Segmentation - Are the channels set up correctly?
I want to train a machine learning model for fine masked details in 2D DICOM images. I have 500 images ready for labeling/annotating. Can I use this technique or have I misunderstood?
Annotation of ...
1
vote
1
answer
159
views
Instant accuracy increase while dice increasing slowly (U-Net)
I am training a model for brain extraction on MR images. I use 2D U-Net architecture and pretrained EfficientNetV2B3.
def dice_coefficients(y_true, y_pred, smooth=0):
intersection = K.sum(y_true *...
0
votes
1
answer
154
views
Issues trying to load saved Keras U-Net model from h5 file
I've been assigned a task in my company to try to hydrate a model that was trained for a previous project, and while I can load it again, I'm failing to try it and I don't know why.
The model follows ...
-1
votes
1
answer
56
views
In UNet3+: RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation
when i try to use the UNet3+ i get an error:
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [1, 1024, 64, 64]], ...
0
votes
0
answers
30
views
Keep getting the error: "ValueError: A `Concatenate` layer requires inputs with matching shapes except for the concatenation axis"
I've tried to implement a U-Net model to classify audio, and after preprocessing, I've converted the data into a dataset of float values. These are the shapes of my X and Y
X_train shape: (3806, 2809)
...
0
votes
1
answer
58
views
Passing ImageDataGenerator to segmentation model's U-net for multiclas classification
How can I pass an ImageDataGenerator to segmentation_model's U-net,
data_generator = ImageDataGenerator(
rescale = 1./255.
)
train_dataset_images = data_generator....
0
votes
1
answer
102
views
down quality of mask with json data for train u net model
I want mask my images with json formats as data for training model of u net.
I use this below code to mask them:
import json
import numpy as np
import cv2
import os
# Path to the folder containing ...
0
votes
0
answers
212
views
ValueError: as_list() is not defined on an unknown TensorShape. Image and mask shape looks correct
I am trying to adapt Tensorflow's example UNet for my purposes. The main difference is this UNet takes 128x128 images and masks and my images are 512x512 and my masks are 100x100.
I am getting this ...
0
votes
1
answer
210
views
Tensor size does not match batch size
I have used this code below to train an unet model. My dataset at first consisted of 10000 images, shape=(256,256,3), what was working fine. However, ofter enlargening it to 14000 images i encountered ...
1
vote
0
answers
158
views
Consistency loss don't work and total loss increase
I try to use Mean-Teacher architecture with two U-Net in a semi-supervised setup but I have a strange behaviour with the loss during the training. I have a supervised loss and a consistency loss ...
0
votes
2
answers
114
views
Deep Learning _ Keep getting Channel Error mismatch for my U-Net Model
As i try to run my y prediction to my model of x batch , it shows me a mismatch.
This is the error I get:
RuntimeError: Given groups=1, weight of size [512, 1024, 3, 3], expected input[16, 1536, 16, ...
0
votes
0
answers
103
views
U-Net Accuracy is not increasing
I have implemented a U-Net model to perform self supervised learning on images (spectrograms; dim=(376, 128)) to learn background/foreground masks. I am very new to self supervised learning but after ...
0
votes
1
answer
500
views
Facing an issue while training UNet for Image Segmentation
I am using the keras_unet_collection python library's U-Net model to perform self supervised learning on images (spectrograms; dim=(376, 128)) to learn background/foreground masks. I am very new to ...
1
vote
1
answer
167
views
nnunetv2 been stuck preprocessed dataset [closed]
there are 704 graphs in our dataset when we use command nnUnetV2_plan_and_preprocess -d 201 --verify__integrity The program is stuck in enter image description here immobility.but when we reduce ...
0
votes
2
answers
149
views
Runtime Error: The size of tensor a (524288) must match the size of tensor b (131072) at non-singleton dimension 0
I'm trying to perform leaf disease image segmentation using Github code. Here is the code, i am facing this issue "The size of tensor a (524288) must match the size of tensor b (131072) at non-...
0
votes
1
answer
58
views
How can I reduce the amount of GPU used by my tensorflow model?
So I am currently using the Kaggle notebook environment. I am trying to build a U-Net model for image segmentation. When I build the model, it shows that the mode size is 2.17mb, but this takes model ...
0
votes
1
answer
32
views
Keep Getting ValueError : Shapes (None, None) and (None, None, None, 1174) are incompatible when fitting UNet
I'm building my first u-net, and having a bit of trouble matching the output to the labels.
My code is as follows:
import tensorflow as tf
from keras import layers, models
from keras.preprocessing....
0
votes
1
answer
246
views
Upsample followed by Conv2d
In the decoder part of UNet architecture, Upsampling layer is often followed by a Conv2d.
Here is an example:
class UpConv(nn.Module):
def __init__(self, in_chans, out_chans):
super()....
0
votes
1
answer
122
views
Error in Unet due to mismatch in input format or None values (?)
I am doing a Unet to make segmentation, in this file https://github.com/erickfmm/ML-experiments/blob/master/test/butterfly.py
The shape of xtrain and ytrain are
x_train shape (557, 100, 100, 3)
...
0
votes
0
answers
93
views
Output of Unet multi-class segmentation
I have several questions concerning a multi class image segmentation model pipeline.
1 - Influence of images masks
I have created masks for each image according to this template :
(0,0,0) is the ...
0
votes
1
answer
178
views
'UNet2DOutput' object has no attribute 'size'
net = UNet2DModel(sample_size=28,
in_channels=1,
out_channels=1,
layers_per_block=2,
block_out_channels=(32, 64, 64),
...
0
votes
1
answer
668
views
Input Size for UNet3D
First and foremost, I want to precise that I am a begginer in torch. I am struggling with the following code (found on github), I want to know what should be the input size of a such UNet.
""...
0
votes
0
answers
233
views
RuntimeError: mat1 and mat2 shapes cannot be multiplied in Unet2DConditionModel
Today i try to use Unet2DConditionModel and CLIPTextModel from Transformer Library with my text to image dataset, but i have error "RuntimeError: mat1 and mat2 shapes cannot be multiplied (...
1
vote
0
answers
490
views
How VAE and UNet sample size work in HF Diffusers?
Does anyone know how sample size work in SD's VAE and UNet?
All I know is the SD v1.5 was trained with 512*512, so it can generate 512*512 more properly. But when I set the pipeline like 384*384 or ...
0
votes
1
answer
568
views
Diffusion - UNet - RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 4 but got size 7 for tensor number 1 in the list
Newbee here:) I am trying to copying the course code from How Diffusion Models Work provided by DeepLearning.AI. The source code works on RGB images (if i remember correctly, size [3,28,28]) while I ...
0
votes
0
answers
155
views
Unet Medical Image- Prediction Mask not getting displayed
I am trying to implement Unet based segmentation for Medical Histopathology classification for single class problem. I get the loss and accuracy of the model but predicted masks are not getting ...
1
vote
1
answer
17k
views
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 128 but got size 256.I always get "mismatch error:" Always factor of 2
I have this code:
import logging
import os
import sys
import tempfile
from glob import glob
import torch
from torch.cuda.amp import autocast, GradScaler
from PIL import Image
from torch.utils....
0
votes
0
answers
721
views
Graph execution error when using model.fit
I am a beginner for machine learning, and currently trying the retina-unet. There's a couple errors when processing model.fit
model.fit(patches_imgs_train, patches_masks_train, epochs=20, batch_size=...
0
votes
1
answer
1k
views
Converting UNet model outputs from logits to segmentation masks
I've been recently working on segmentation task on certain CT scans. I decided to use Python as the language, ResidualUNet model architecture implemented in MONAI, evaluated by DiceLoss.
Everything ...
2
votes
1
answer
225
views
Sequential model error in unet keras image segmentation
I'm currently learning U net and i am trying to run the example code from: https://colab.research.google.com/github/keras-team/keras-io/blob/master/examples/vision/ipynb/oxford_pets_image_segmentation....
0
votes
0
answers
49
views
Training Neural Network with Keras and Large Array Numpy
I want to train an UNET Network and my data is already normalized in an Array, I saved it in my disk in bin format, it's about 12GB of data. My memory is limited so I need to load a batch of the data ...
0
votes
1
answer
158
views
Pytorch CE Loss evaluating to nan
I am training U-net with 3 channels, input data 40x40x40 set of voxels and using CELoss followed by ReLU activation. Also, there is only one convolution layer unlike the original U-net. For many ...
0
votes
1
answer
193
views
Thresholding output from semantic segmentaiton?
I am segmenting microscopy images using a model I built with a UNet architecture. I get reasonable results after training my model, so I know it's working. As outputs, I obtain arrays with predicted ...
0
votes
1
answer
2k
views
RuntimeError: Expected 3D (unbatched) or 4D (batched) input to conv2d
Hey together,
i wrote a code with pytorch to segment satellite-images with a unet.
If I test every block seperatly (unet, dataloader, train()), it works perfectly and it gives me the correct sizes ...
1
vote
1
answer
840
views
How to merge image of many channels?
I'm trying use multi-channel file to training unet classify.
My dataset is 5 * 1-channel & 1 * 3-channel image, and I expected it can be 8-channel .npy file.
I use np.concatenate to merge, but it ...
1
vote
1
answer
1k
views
How to use pretrained encoder for customized Unet
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'...
-1
votes
1
answer
796
views
How can l solve my padding issue in my Unet?
Hello l am creating my Unet model. However l got weird issues they are a size missing on my third decoder line. l don't understand why. l am using a padding method in my UpBlock Class to get the same ...
-1
votes
1
answer
284
views
image segmentation with vgg16 and randomforest
according to the below link, the writer has implemented the image segmentation with vgg16 as the encoder and the random forest as the classifier.
https://github.com/bnsreenu/python_for_microscopists/...
0
votes
0
answers
43
views
My model is giving a classification report for only one class
Classification Report:
precision recall f1-score support
discbulge 1.00 0.96 0.98 5898240
herniation 0.00 0.00 0.00 0
normal 0.00 0.00 0....
1
vote
1
answer
649
views
How do I can reconstructing stft to audio?
In order to train an autoencoder model using audio data as a first step, I need to understand the different representations of audio found in the literature, such as STFT(not spectrogram i mean by ...