ChenLiu-1996 / CUTS

[MICCAI 2024] CUTS: A Deep Learning and Topological Framework for Multigranular Unsupervised Medical Image Segmentation
https://arxiv.org/abs/2209.11359
Other
33 stars 2 forks source link

self.data_image = np.moveaxis(self.data_image, -1, 1) #13

Closed ocizvlpuswiubridge closed 4 months ago

ocizvlpuswiubridge commented 7 months ago

Hello, when I was training main.py, I encountered this error: 'numpy.exceptions.AxisError: destination: axis 1 is out of bounds for array of dimension 1'
at this line in retina.py: 'self.data_image = np.moveaxis(self.data_image, -1, 1)'. Why would this error occur? And it seems that when I run it in PyCharm, statements like 'sys.path' in the text don't take effect, resulting in errors where many '.py' files from different folders under the same root directory cannot be referenced successfully.

ChenLiu-1996 commented 7 months ago

Sorry I was late to respond this issue. Did you figure it out? Please let me know if you have further issues.

DerrickGuu commented 4 months ago

I also encountered this when training the model on my custom dataset. Are there any solutions to resolve this?

ChenLiu-1996 commented 4 months ago

I am fairly sure that has something to do with the dataloading part of the code. I will try to write a few example dataset.py files for common data, but for now you can try to write your own.

DerrickGuu commented 4 months ago

Thanks for replying to this issue! Here's more information on the error: I have organized my custom dataset with labels in the proper form (similar to retina dataset you provided). And I wrote my custom dataset class in src/datasets/***.py, similar to the existing example retina.py. Than I've got the error as attached figure. 圖片_2024-06-25_014709076 Note that I had added a couple of debug line print("Number of image files:", len(self.imgs)) and print("Number of label files:", len(self.labels)) , according to the output, it seems the function failed to load my custom dataset so the error occurred.

Thanks for your reply, any further suggestions is also appreciated!

ChenLiu-1996 commented 4 months ago

Hi De-Yu Guu,

Did you follow the instruction in the main Readme (pasted below)? If you are still having this problem after following the guideline, please shoot me an email (chen.liu.cl2482@yale.edu) and we can try to schedule a debugging session.

Screenshot 2024-06-24 at 5 58 42 PM
ChenLiu-1996 commented 4 months ago

Quoting the email from @DerrickGuu:

%%% I wanted to inform you that I managed to resolve the issue I encountered previously. The problem stemmed from mismatched file names between the images and labels in my custom dataset. After renaming the files and restarting the training script, everything worked perfectly!

Regarding the instructions for reproducing the experiment on GitHub, I have a suggestion: it would be helpful to provide more detailed guidance on how to properly prepare the dataset, especially for custom datasets. For instance, specifying that the label format should be saved in npy format could significantly assist other developers and researchers. %%%

I will update the Readme soon.