Git Product home page Git Product logo

chenliu-1996 / cuts Goto Github PK

View Code? Open in Web Editor NEW
24.0 2.0 2.0 53.42 MB

CUTS: A Framework for Multigranular Unsupervised Medical Image Segmentation

Home Page: https://arxiv.org/abs/2209.11359

Python 68.80% Jupyter Notebook 31.20%
image-segmentation medical-image-segmentation medical-imaging python pytorch unsupervised-learning unsupervised-segmentation deep-learning multiscale self-supervised-learning

cuts's Introduction

Greetings from Chen!

Hi, I am Chen Liu, a PhD student in Computer Science at Yale University.

I work on machine learning in healthcare. Lately I am diving into understanding the neural network manifold.

I am generally over-booked on projects, but feel free to reach out for collaboration.

Recent repositories

✔️ [ICML 2023 Workshop on TAG-ML] A novel method to compute entropy and mutual information in neural net representations

✔️ An on-the-fly evaluator for GANs, with a simple working example of DCGAN on SVHN

✔️ A framework for multi-granular unsupervised medical image segmentation

✔️ A guide to simulate bigger batch sizes beyond GPU capability

Technical Blogs

✔️ A Technical Deep Dive into Drag Your GAN (DragGAN)

Course Projects

✔️ Towards a Large-Scale Unbiased Machine Learning Benchmark for Cell Instance Segmentation: Final Report for CPSC 537 Intro to Database Systems

Contact information

Resume

https://chenliu-1996.github.io/CV/ChenLiu_resume.pdf

cuts's People

Contributors

chenliu-1996 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cuts's Issues

Expect more detailed step by step tutorials

Hello,

Thank you for sharing this great work. As a newbie, I really expect more detailed step by step tutorials.

  1. For training the convolutional encoder, how to prepare the dataset? Maybe I can use a labeling tool, like the one here, to label the interested object on the image?
  2. To be able to run the test it seems a model weights file is needed in Checkpoints folder?

Thanks

Utilizing GPU acceleration for PHATE and k-means calculations

Hello,

First of all, I would like to express my gratitude for creating and sharing this project - it has been immensely helpful in my work.

I've noticed that in the generate_kmeans and generate_diffusion functions, the primary computational load is handled on the CPU, specifically the PHATE and k-means algorithms. In the context of my use cases, these computations can take considerable time.

I'm wondering if it might be possible to shift these computational components to run on a GPU for accelerated processing time? I understand this could potentially involve additional work, like seeking out or implementing GPU-supported versions of the PHATE and k-means algorithms. Any guidance or recommendations would be greatly appreciated.

Additionally, if there were specific considerations or reasons for performing these calculations on the CPU, I'd be interested to learn more about that as well.

Thank you again for your work and assistance.

Best regards,
Max

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

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.

About the folder of retina dataset

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

issue

(cuts) root@autodl-container-925311b73c-07e7f518:~/CUTS/src/scripts_analysis# python plot_paper_figure_main.py --config ../../config/retina_seed2022.yaml --image-idx 4 7 18 --comparison --binary
0%| | 0/3 [00:00<?, ?it/s]Warning! baselines results not found. Placeholding with blank labels.
Warning! CUTS + diffusion condensation results not found. Placeholding with blank labels.
Warning! DFC results not found. Placeholding with blank labels.
Warning! STEGO results not found. Placeholding with blank labels.
Warning! SAM results not found. Placeholding with blank labels.
Warning! Supervised UNet results not found. Placeholding with blank labels.
Warning! Supervised nn-UNet results not found. Placeholding with blank labels.
0%| | 0/3 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/root/CUTS/src/scripts_analysis/plot_paper_figure_main.py", line 470, in
labels_diffusion.reshape((B, H, W)))
ValueError: cannot reshape array of size 16384 into shape (128,128,128)

Retina-generate_kmeans

Hello!
I finished training the encoder on retina dataset, however, there went some problem when I wanted to use generate_kmeans and generate_diffusion.
I tried the tips that you mentioned about the 'deadlock', but it still cannot work. The only script can work is generate_baseline.py.

STEGO

2 | cluster_probe | ClusterLookup | 700
3 | linear_probe | Conv2d | 710
4 | decoder | Conv2d | 27.3 K
5 | cluster_metrics | UnsupervisedMetrics | 0
6 | linear_metrics | UnsupervisedMetrics | 0
7 | test_cluster_metrics | UnsupervisedMetrics | 0
8 | test_linear_metrics | UnsupervisedMetrics | 0
9 | linear_probe_loss_fn | CrossEntropyLoss | 0
10 | crf_loss_fn | ContrastiveCRFLoss | 0
11 | contrastive_corr_loss_fn | ContrastiveCorrelationLoss | 0

231 K Trainable params
21.7 M Non-trainable params
21.9 M Total params
87.606 Total estimated model params size (MB)
Epoch 0: 100%|██████████████████████████████████████████████████████████████████████████████████| 4/4 [00:02<00:00, 1.92it/s, v_num=2]Attempted to log scalar metric test/linear/mIoU:█████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 4.47it/s]
nan
Attempted to log scalar metric test/linear/Accuracy:
nan
Attempted to log scalar metric test/cluster/mIoU:
nan
Attempted to log scalar metric test/cluster/Accuracy:
nan
Hello, I encountered this problem in STEGO.

Datasets

Hello,

I recently came across your research project on GitHub and was truly impressed by it. I am particularly interested in the dataset mentioned in your paper titled "CUTS: A Fully Unsupervised Framework for Medical Image Segmentation".

Would it be possible for you to share the dataset with me? It would greatly assist my academic research. I assure you that I will only use it for academic purposes and will adhere to any terms and conditions you might have regarding its use.

If you're comfortable sharing, could you please send it to my email at [email protected]?

Thank you very much for considering my request. I genuinely appreciate your contribution to the academic community and look forward to diving deeper into the insights your dataset might offer.

Best regards,
wwzz-max

issue

(cuts) [acfozxhek4@ae1510f9a80c scripts_analysis]$ python run_metrics.py --config ../../config/Tongue_seed2023.yaml
Computing the metrics in a single experiment.
0%| | 0/300 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/work/home/acfozxhek4/UnsupervisedMedicalSeg/src/scripts_analysis/run_metrics.py", line 578, in
range_aware_ssim(label_true=hashmap[p1],
File "/work/home/acfozxhek4/UnsupervisedMedicalSeg/src/scripts_analysis/../utils/metrics.py", line 43, in range_aware_ssim
data_range = label_true.max() - label_true.min()
TypeError: numpy boolean subtract, the - operator, is not supported, use the bitwise_xor, the ^ operator, or the logical_xor function instead.
(cuts) [acfozxhek4@ae1510f9a80c scripts_analysis]$ python run_metrics.py --config ../../config/Tongue_seed2023.yaml
Computing the metrics in a single experiment.
0%| | 0/300 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/work/home/acfozxhek4/UnsupervisedMedicalSeg/src/scripts_analysis/run_metrics.py", line 578, in
range_aware_ssim(label_true=hashmap[p1],
File "/work/home/acfozxhek4/UnsupervisedMedicalSeg/src/scripts_analysis/../utils/metrics.py", line 43, in range_aware_ssim
data_range = label_true.max() - label_true.min()
TypeError: numpy boolean subtract, the - operator, is not supported, use the bitwise_xor, the ^ operator, or the logical_xor function instead.
I encountered this error when using my own dataset.

issue

(cuts) root@autodl-container-a648119852-7408203c:/cuts/src/scripts_analysis# cd ..
(cuts) root@autodl-container-a648119852-7408203c:
/cuts/src# python main_supervised.py --mode train --config ../retina_seed2022.yaml
Traceback (most recent call last):
File "/root/cuts/src/main_supervised.py", line 514, in
config = AttributeHashmap(yaml.safe_load(open(args.config)))
FileNotFoundError: [Errno 2] No such file or directory: '../retina_seed2022.yaml'
(cuts) root@autodl-container-a648119852-7408203c:~/cuts/src#
Hello, how should I solve this problem? I encountered this issue when allowing the code.

issue

Traceback (most recent call last):
File "/public/home/accran5j3j/UnsupervisedMedicalSeg_1/src/scripts_analysis/generate_diffusion.py", line 82, in
labels_pred, granularities = generate_diffusion(
File "/public/home/accran5j3j/UnsupervisedMedicalSeg_1/src/scripts_analysis/generate_diffusion.py", line 30, in generate_diffusion
labels_pred, granularities = diffusion_condensation(
File "/public/home/accran5j3j/UnsupervisedMedicalSeg_1/src/scripts_analysis/../utils/diffusion_condensation.py", line 42, in diffusion_condensation
levels = catch_op.transform()
File "/public/home/accran5j3j/.local/lib/python3.9/site-packages/CATCH/catch.py", line 80, in transform
for c in range(len(self.NxTs)):
TypeError: object of type 'NoneType' has no len()

train_config for STEGO

Hi,
would you mind sharing example of train_config to run STEGO ?
python step02_precompute_knns.py --train-config ./train_config/train_config_retina_seed2022.yaml

Thank you

datasets

Hello, thank you very much for your work. I have a question: with only 56 images in the retinal dataset, will reviewers have doubts about the results obtained from such a small dataset? I am also researching in this direction and am a beginner, so I don't understand much about this. Could you please clarify my doubts?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.