Closed 996237275 closed 1 year ago
I see. You shall put the unzipped folders inside retina
.
My folders are arranged like the following.
In fact, I had set the right folder in the begining while it still cannot work. Then, I tried to make some debug and found the glob function cannot receive any images.
The problem is quite weired, anyway, thank you for your reply.
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
../../data/retina is used in the original code, and I also changed to the absolute path. However, both these two paths were wrong. I do not change anything including yaml files and just unzip retina.
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.
Use + or '%s/%s/*' which used in your code received the same results. 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.
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?
I think the problem on path had been solved but images still cannot be detected.
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
.
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.
Everything went fine when I worked in the Linux. Whatever, thank you for your patience and wish you best!
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