Replies: 1 comment
-
Hi @JuanHA00, perhaps check whether you add the channel dim correctly after If you don't have a channel, you can specify it in the transform like: MONAI/monai/transforms/utility/dictionary.py Line 254 in ff43028 Hope it helps, thanks. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have CT images (512x512x84) and the labels are those CT images but segmented after I used ITK_snap to "Paint" an specific tissue (Ocular tissue) , the image files are stored in train_images and the labels in Train_Labels, then i create a dictionary to which i create a dataset and apply the MONAI transforms
, the issue is when i try to use densenet 121 or any other model, after the transforms I get that the tensor size is [1,1,512,512,1] , when i introduce this datasets into the model i get the error that input image size (T:128,H:128,W:1) cant be smaller than kernel size (KT:2,KH:2,KW:2) so i tried UNET which it kind of works because i have to use squeeze due to UNET changes de value in the last position of the tensor from [1,1,512,512,1] to [1,1,512,512,2] and i get error but using squeeze i turn the 2 into a 1 , im using confusion matrix as a metric in the model.eval() section , i create a list where i store the values from the matrix after each EPOCH and i get this TN metatensor(1073321133, device='cuda:0')
FP metatensor(24578667, device='cuda:0')
FN metatensor(3014885, device='cuda:0')
TP metatensor(90115, device='cuda:0')
metatensor(1101004800, device='cuda:0')(FP+FN+TP+TN), which is weird because for what i understand it should be 512x512x84 = 22020096 pixel value
So ill be very grateful if someone can help me, and im sorry if my explanation isn´t good, im new in this. The MONAI verion is 1.3.0 and im using vscode
import logging
import os
import monai
import sys
from glob import glob
import numpy as np
import torch
from torch import squeeze
from torchmetrics.classification import Recall
from torchmetrics.classification import Accuracy
from torchmetrics.classification import BinaryRecall
from torchmetrics.classification import BinaryPrecision
from torchmetrics.classification import BinaryAUROC
from torchmetrics.classification import BinarySpecificity
from torchmetrics.classification import Dice
from torchmetrics.classification import BinaryConfusionMatrix
import matplotlib.pyplot as plt
import torch.nn.functional as F
from torch.utils.tensorboard import SummaryWriter
from monai.utils import first
#from torchmetrics.classification import BinaryF1Score
from torchmetrics.functional.classification import binary_f1_score
from monai.data import decollate_batch, DataLoader,Dataset
from monai.metrics import ROCAUCMetric
from torchmetrics.classification import BinaryF1Score
from monai.transforms import SqueezeDimd, Activations,ToTensord, AsDiscrete, Compose, LoadImaged, RandRotate90d, Resized, ScaleIntensityd,EnsureChannelFirstd,RandFlipd,RandZoomd,RandGaussianNoised,SqueezeDimd
from monai.networks.nets import DenseNet121,UNet,RegUNet,VNet
from monai.networks.blocks import UnetResBlock,ResBlock
def main():
monai.config.print_config()
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
data_dir="C:/Users/ACER/Desktop/POSGRADO VIU/Prácticas/Datasets/archive/files/aneurismamonai"
if name == "main":
main()
Beta Was this translation helpful? Give feedback.
All reactions