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

About the folder of retina dataset #2

Closed 996237275 closed 1 year ago

996237275 commented 1 year ago

Thank you for your meaningful work. In the process of using the retine dataset as the demo, I noticed in ../datasets/retina.py, self.img_path = glob('%s/%s/*' % (base_path, image_folder)) cannot find .png files in the right way. So I would like to ask about whether the dataset I put in is right. Honestly, I unzip the dataset and put them in the /data. data retina image_with_GA label_with_GA

ChenLiu-1996 commented 1 year ago

I see. You shall put the unzipped folders inside retina.

My folders are arranged like the following.

Screenshot 2023-06-05 at 9 14 43 AM
996237275 commented 1 year ago

In fact, I had set the right folder in the begining while it still cannot work. 2571623bffd5c1092b28bff32039a46 Then, I tried to make some debug and found the glob function cannot receive any images.

90eda9990b256ccae96979e920bbe19 The problem is quite weired, anyway, thank you for your reply.

ChenLiu-1996 commented 1 year ago

It is a bit weird...

Wait why is the base_path set to /data/retina/?

I think it shall be ../../data/retina (if using relative path) or D:/pyCharmproject/UnsupervisedMedicalSeg-main/src/data/retina (if using absolute path)? (I am not very familiar with Windows Paths but it shall be something along these lines)

If base_path is set to /data/retina/, it's not surprising that no image is found there.

So why did this happen? Did you modify the config yaml? (which is designed such that you should not need to modify it) In the config yaml files, the string $CUTS_ROOT is put there intentionally.

For example, in retina_seed2021.yaml, dataset_path is set to $CUTS_ROOT/data/retina/. Then, when you run main.py, $CUTS_ROOT will be replaced by the actual root directory of the project, if the code I wrote works as expected. The actual string replacement is done in parse.py

996237275 commented 1 year ago

../../data/retina is used in the original code, and I also changed to the absolute path. However, both these two paths were wrong. b6537c78761dfb1a711f7260be1bad9 I do not change anything including yaml files and just unzip retina.

ChenLiu-1996 commented 1 year ago

I would recommend printing out the files being globed, for a sanity check:

print(self.img_path)

I would bet it is an empty list right now.

One problem I see in your current code is that base_path = ../../data/retina and image_folder = image_with_GA, so if you directly add them together with + you will get ../../data/retinaimage_with_GA where you miss a /.

But I am curious why the original code does not work.

Also, in case you haven't usedpdb before, I would recommend debugging by setting a breakpoint using

import pdb
pdb.set_trace()

right before the line you want to debug.

996237275 commented 1 year ago

Use + or '%s/%s/*' which used in your code received the same results. 36d3a628f781611ef0398ecefb490b5 Maybe the problem occured in the process of downloading the program? I git clone the whole program then unzip the retina. Ok, I will try to use pdb for further debugging.

ChenLiu-1996 commented 1 year ago

The process of downloading the program seems fine. I would expect you to git clone the repository and then unzip the retina dataset.

Can you perhaps print out the folder: print('%s/%s/' % (base_path, image_folder)) And double check those image files are actually in that folder?

996237275 commented 1 year ago

I think the problem on path had been solved but images still cannot be detected. f04fc7d9eb8ba5f13e3367fd9ea61ac

ChenLiu-1996 commented 1 year ago

I don't think the path issue is solved yet.

/data/ is a different directory from ../../data/. The former is an absolute path on your system directory. If you are using MacOS, it is the same level as /mnt/ for disks, /home/ for user home, etc. So I think the path is wrong at this moment.

If I print out the same path with print('%s/%s/' % (base_path, image_folder)), it will be the absolute path like /home/chenliu/UnsupervisedMedicalSeg/data/retina//image_with_GA/, instead of just /data/retina//image_with_GA/.

(By the way, in paths the double slash // is not a problem. It will be treated the same as a single slash /.)

This weird issue might be related to the Windows path problems but I am not sure... Never tried this on Windows before.

...

I would recommend going to parse.py and place your pdb break point there. You can see if the variable CUTS_ROOT finds your root directory correctly, when you run main.py.

996237275 commented 1 year ago

Got it. The peoblem may related with the Win. There goes something wrong with the computing platform in the lab so I just can use my own Win desktop for testing. I will try to solve the problem. Thank you for your patience and your time.

996237275 commented 1 year ago

Everything went fine when I worked in the Linux. Whatever, thank you for your patience and wish you best!