mattmacy / vnet.pytorch

A PyTorch implementation for V-Net: Fully Convolutional Neural Networks for Volumetric Medical Image Segmentation
https://mattmacy.github.io/vnet.pytorch
BSD 3-Clause "New" or "Revised" License
688 stars 201 forks source link

axes don't match array error while training #11

Open svabhishek29 opened 7 years ago

svabhishek29 commented 7 years ago

Hi, I was playing around with the code to better understand how things work. when i was trying to train the luna 16 images i keep getting the error 'axes don't match array' on the line

for batch_idx, (data, target) in enumerate(trainLoader):

in both train_nll and train_dice.

i normalised the images using normalise function in the torchbiomed library with 512, 512, 500, 0.7 as parameters for normalisation.

i am not understanding why i am getting this error hence not able to fix it.

it'll be a great help if you can help me get past this point.

Thanks Abhishek Venkataram

abhiML commented 6 years ago

Hi @svabhishek29 did you resolve this issue?

svabhishek29 commented 6 years ago

yes, i did find where the problem was.

it was in the def __getitem_dev(self, index): method of torchbiomed library, specifically the Luna16.py file.

if i remember right the issues was in one of the the 3 if conditions starting at line 417.

if self.transform is not None:
    img = self.transform(img)
if self.target_transform is not None:
    target = self.target_transform(target)
if self.co_transform is not None:
    img, target = self.co_transform(img, target)

I realised that i needed it to behave a bit differently so i wrote my own code, did not fix that problem specifically.

sorry i can't be of much help.

abhiML commented 6 years ago

Actually I am having some difficulty on getting the code to run on the dataset (Luna16). Could you very kindly clear a few queries for me? Does the code do some preprocessing on the dataset or is the script for preprocessing not provided in the code? How do I run the code on the dataset? Do I use the same directory structure as the Luna16 dataset? What are the changes in the code I have to make to start the training?

Thanks in advance.