TransUNet icon indicating copy to clipboard operation
TransUNet copied to clipboard

something about custom dataset

Open David-zaiwang opened this issue 4 years ago • 5 comments

Thanks for your excellent work. While I try to make my own dataset, I meet some troubles.

My first question is that what the dimensions of "image" and "label" in the Dataloader module.

def __getitem__(self, idx):
        if self.split == "train":
            slice_name = self.sample_list[idx].strip('\n')
            data_path = os.path.join(self.data_dir, slice_name+'.npz')
            data = np.load(data_path)
            image, label = data['image'], data['label']
        else:
            vol_name = self.sample_list[idx].strip('\n')
            filepath = self.data_dir + "/{}.npy.h5".format(vol_name)
            data = h5py.File(filepath)
            image, label = data['image'][:], data['label'][:]

        sample = {'image': image, 'label': label}
        if self.transform:
            sample = self.transform(sample)
        sample['case_name'] = self.sample_list[idx].strip('\n')
        return sample   

In the above code, could you tell me the shape of the sample['image'] and sample['label'] ?

David-zaiwang avatar Feb 24 '21 09:02 David-zaiwang

Sorry for the late reply. For slice, the shape of ['image'] and sample['label'] is the original shape (512, 512). For volume (e.g. testing cases with ".h5" format), the shape should be (512, 512, Z) where Z is not fixed.

Beckschen avatar Feb 28 '21 23:02 Beckschen

I have the same question,Can I used this code on 2d dataset

Acmenwangtuo avatar Mar 01 '21 02:03 Acmenwangtuo

I have the same question,Can I used this code on 2d dataset

Yes it can, in this paper, the resolution of input image is 512*512.

Cassieyy avatar Mar 02 '21 11:03 Cassieyy

I have the same question,Can I used this code on 2d dataset

Yes it can, in this paper, the resolution of input image is 512*512.

Emm, in the original paper, I see that image size is cropped into 224*224?

Cassieyy avatar Mar 02 '21 12:03 Cassieyy

I have the same question,Can I used this code on 2d dataset

Yes it can, in this paper, the resolution of input image is 512*512.

but, in the test ,h5 format file is need, how to solve it? please

wanghangege avatar Jul 21 '21 01:07 wanghangege