hilab-git / ssl4mis Goto Github PK
View Code? Open in Web Editor NEWSemi Supervised Learning for Medical Image Segmentation, a collection of literature reviews and code implementations.
License: MIT License
Semi Supervised Learning for Medical Image Segmentation, a collection of literature reviews and code implementations.
License: MIT License
Hi,
Thanks for your great work! I met some questions.
On line 24 of file "train_uncertainty_rectified_pyramid_consistency_3D.py":from dataloaders.GTV import..., it seems that there miss the file “GTV.py”. Could you provide it ?
Best wish!
Hello. The link to the paper Contrastive Semi-Supervised Learning for 2D Medical Image Segmentation by P. Pandey and Mausam published on miccai2021 has expired. The currently available Arxiv link is: https://arxiv.org/pdf/2106.06801v1.pdf
The class UpBlock is defined as:
class UpBlock(nn.Module):
"""Upssampling followed by ConvBlock"""
def __init__(self, in_channels1, in_channels2, out_channels, dropout_p,
bilinear=True):
, where the default value of bilinear is "True".
However, the real value of bilinear is not fed into the UpBlock class, as follows:
self.up1 = UpBlock(
self.ft_chns[4], self.ft_chns[3], self.ft_chns[3], dropout_p=0.0)
Therefore, the 'nn.Upsample' is always selected in the UpBlock.
You can check whether the bug exists or not.
Thank you for the work!
These is a quesiton I would like to ask about, I am trying to run the train_adversarial_network_2D.
I am confused about the input of DAN, which shown in the following line,
DAN_outputs = DAN(outputs_soft[args.labeled_bs:], volume_batch[args.labeled_bs:])
SSL4MIS/code/train_adversarial_network_2D.py
Lines 158 to 159 in e8c8b5c
In your code, you took the output of model(softmax prediction) and unlabeled data as input for FCDiscriminator, but would you pls tell me why?
Thank you.
Hi,
Have you compared the result of 2D and 3D image for the same dataset, like ACDC dataset or BraTS?
Thank you in advance.
Best wish.
Hello, when I changed batchsz=4, labelde_batchsz=2, the val set accuracy improved a lot, I don't know the reason
Hi Xiangde,
I checked the official implementation of mean teacher and found that consistency loss is calculated on the samples in the entire batch, not just unlabeled samples.
cons_logit
is assigned from logit1
or logit2
according to different settings of args.logit_distance_cost
, and they are calculated through different fully connected layers to loosen the link between the classification prediction and the consistency cost.
I was wondering if my understanding of the code is biased, or if there is a bug in the implementation.
Sincerely,
tea
Hi,
Thanks for your great work!
I would like to know if there are some relevant description or paper for the BraTs dataset preprocessing setting?
Thanks,
Jack
Thanks for your code.
I tested your code and learned a lot from it. Now I am trying to use it for other datasets for medical imaging and while implementation to one problem I am getting really bad results using the URPC method. I am new to semi-supervised learning so didn't have proper knowledge of how to train for new datasets and which hyperparameters we can tune like consistency ramp up or other training techniques. Can you suggest how to tune for others datasets?
Secondly, if I include more unlabeled data, can it help to gain better performance than the fully supervised method? Like If I train with 100 labeled images and similar results can be obtained using 20-80 label-unlabeled settings. And If I include 50 more unlabeled data from another source can I get better performance than 100 labeled image results?
Hi, thank you so much for your efforts in implementing all these methods.
After training on ACDC with labeled_num=3, the testing code on ACDC gives me this error "The first supplied array does not contain any binary object", which is raised near:
The problem is that the trained model does not predict labeled 2 and label 3, which can be seen here:
The visualized dice on validation set shows that there is a performance peak at 600th step
The test performance on the validation set (at 600th step) looks normal
It's confusing that on a test set image the same model does not prediction label 2 and 3 at all. Have you met this issue and could you give me some advice?
Many thanks.
hello, why is the data in .h5 format?How do I visualize it?
Hello,
I just noticed that the paper you added recently "Shape-aware Multi-task Learning for Semi-supervised 3D Medical Image Segmentation" was the one that appeared one year ago. I am wondering whether it would be better to order the articles by their post date instead of the accepted date.
Best,
Table 2: Mean 3D DSC and HD95 (mm) on the ACDC dataset. All results are based on
the same backbone (UNet) with a fixed seed. Mean and standard variance (in
parentheses) are presented in this table. Red numbers denote the p-value < 0.05
based on paired t-test when comparing with the others
How to get the Mean and standard variance (in parentheses) are presented in this table? And how to generate the Red numbers denote the p-value < 0.05 based on paired t-test when comparing with the others? Could your please share the code? Thank you.
@Luoxd1996 Looking forward to your reply.
Thanks for your wonderful work. When I run the test for the 2D Uncertainty_Rectified_Pyramid_Consistency according to your advice. I met the problem 'Traceback (most recent call last):
File "/home/b417/xb/5_SSL4MIS-master/SSL4MIS-master/code/test_2D_fully.py", line 121, in
metric = Inference(FLAGS)
File "/home/b417/xb/5_SSL4MIS-master/SSL4MIS-master/code/test_2D_fully.py", line 110, in Inference
case, net, test_save_path, FLAGS)
File "/home/b417/xb/5_SSL4MIS-master/SSL4MIS-master/code/test_2D_fully.py", line 64, in test_single_volume
out_main, dim=1), dim=1).squeeze(0)
TypeError: softmax() received an invalid combination of arguments - got (tuple, dim=int), but expected one of:
Hi,
Is there provide a 2D "test_urpc.py".
I try to use your work:"train_uncertainty_rectified_pyramid_consistency_2D.py", but I don't know how to test it.
Thanks!
Thank you a lot for releasing the code. Could you please also specify how to resample pancreas images to a resolution of 1.01.01.0mm?
As we can see from the meta-info, the SliceThickness is missing from Pancreas dataset. In that case, how do you sample over Z-axis?
By the way, Is it possible to release the data preprocessing of Pancreas-CT dataset too?
Hello, I preprocessed ACDC using acdc_data_processing.py and then checked my h5 file with yours by using np.allclose. It seems after patient 90 my data is different from yours some even does not match in shape for example patient 91.
May I know how exactly you processed the test set?
Hi,
Thanks for your great work!
On line 7 of file "efficient_encoder.py":from efficientnet_pytorch import EfficientNet, it seems that there miss the file “efficientnet_pytorch.py”. Could you provide it ?
Best wish!
为什么我运行trainxx2D.py 很多都会出来这个错误呢,我我确信每个文件没有错误,但是运行就会出错ModuleNotFoundError: No module named 'vision_transformer'
Hello, I have seen many semi-supervised segmentation models of 3D medical images recently, and found that almost all the data sets used are 2018LA and the input format is H5 file. I would like to know whether the input is niI format, or whether the current 3D semi-supervised medical image segmentation can only use H5 input。thanks
train_mean_teachers_3D + BraTs2019,Dataset默认将所有数据的image和label都读入了,实际semi-supervise大多数数据unlabel,后面的transform也是作用于label
Dear Luoxd1996:
When I try to run your code train_2D_fully_supervised.py, it said KeyError, and here is the error information, could you help solve it?
Traceback (most recent call last):
File "D:/github/Medical/SSL4MIS-master/SSL4MIS-master/code/train_unet_2D_fully_supervised.py", line 218, in
train(args, snapshot_path)
File "D:/github/Medical/SSL4MIS-master/SSL4MIS-master/code/train_unet_2D_fully_supervised.py", line 73, in train
labeled_slice = patients_to_slices(args.root_path, args.labeled_num)
File "D:/github/Medical/SSL4MIS-master/SSL4MIS-master/code/train_unet_2D_fully_supervised.py", line 64, in patients_to_slices
return ref_dict[str(patiens_num)]
KeyError: '50'
It is fine with train_2D_adversarial_network.py and train_unet_2D_entropy_minimization.py. As for others, it got the similar wrong information, such as
Traceback (most recent call last):
File "D:/github/Medical/SSL4MIS-master/SSL4MIS-master/code/train_unet_2D_interpolation_consistency_training.py", line 301, in
train(args, snapshot_path)
File "D:/github/Medical/SSL4MIS-master/SSL4MIS-master/code/train_unet_2D_interpolation_consistency_training.py", line 121, in train
labeled_slice = patients_to_slices(args.root_path, args.labeled_num)
File "D:/github/Medical/SSL4MIS-master/SSL4MIS-master/code/train_unet_2D_interpolation_consistency_training.py", line 79, in patients_to_slices
return ref_dict[str(patiens_num)]
KeyError: '300'
Could you help me?
Thanks for your great work, I want to know which parts of codes are for the paper Cross Teaching between CNN and Transformer
because there are so many train files and networks files.
Thanks
Hello, I want to add all the four modes of the BRATS data set to the data set. How can I modify the code?
Hi, Xiangde
Recently, I want to use 'train_uncertainty_rectified_pyramid_consistency_3D.py' for the segmentation on my own data (heart CT). I have converted my own data to '.h5', as you did. I found maybe it's not suitable for me to do the RandomCrop, therefore, I abandon the RandomCrop. Then the code showed the mistake 'RuntimeError: stack expects each tensor to be equal size, but got [1, 191, 512, 512] at entry 0 and [1, 181, 512, 512] at entry 1'.
I searched the Internet for answers, and I found others Resize the data in the preprocessing. However, for the heart CT, the dimension of data for person A is 191512512, and for person B maybe is 181512512, and for C is 200512512. I do not know how to resize or solve the problem. Could you give me some advice? Thanks so much.
Thanks for the excellent job!
I have some problems with the train-uncertainty-rectified-pyramid consistency experiment, and the experimental results are poor when I transform the code to my datasets. It is very insteresting to realize semi-supervised segmentation using a single model, but one single model cannot correct the training errors for the unlabeled data. I have upload some intermediate predictions for the unlabeled training data from epoch 60 and epoch 75. It is observed that p0 is not good and it tends to learning the serrated edges because of the low resolution of the outputs_aux1, outputs_aux2 and outputs_aux3.
It would be very grateful if you could clear up my confusion.
imgs.zip
Whether can I set the batch size of unlabeled data 3 times with the batch size of labeled data? What is different between them?Thank you for your answer !!!
Could you tell me which paper the concept of "unet_2D_dv" come from?
Hello,
Suppose I have datasets with RGB channels, should I use the 3d models? I simply changed in_chns to 3 and feed data with shape (bs, 3, 256, 256) but it would give errors, for both unet_3d and attention unet:
RuntimeError: Given groups=1, weight of size [16, 3, 3, 3, 3], expected input[32, 1, 9, 256, 256] to have 3 channels, but got 1 channels instead
This error came from conv1 = self.conv1(inputs)
Is there anything that I missed? It would be greatly appreciated if you could provide training/testing scripts for RGB images since they are more usual.
Thank you very much.
您好~我最近刚开始接触半监督的东西。很感谢您提供的论文及代码资源,但是在尝试的时候发现我跑train_efficient_unet_2D_mean_teacher.py这个代码的时候在有MSE那一项consistency loss的时候反而使得结果变差了,我对比了在有和没有MSE这一项(其他保持一样)的情况下,用各自最后一次迭代的模型使用test_efficient_unet_2D_acdc.py进行测试,发现在使用MSE的时候测试结果感觉已经崩溃了(使用您提供的ACDC数据)。最差的一类dice只有0.5左右。同时也发现,这个存下来的best模型通常都在迭代次数的靠前位置,而这时通常mse这一项本身就比较小,是不是mse这一项引入反而造成训练不对了。不知道您那边跑代码的过程中是否有类似的情况?或者是我运行的时候有什么需要额外注意的地方。现在都是使用默认参数直接跑了一次。
Thank you so much for releasing the code and dataset. Is it possible to show the performance comparison of these methods in your environment? or at least the best performance of your proposal on acdc and Brats?
Hi,
Thank you very much for sharing your work, but I do not find the test file for ' Cross Teaching between CNN and Transformer'. Is it convenient for you to upload the test file? Thanks again.
good luck
代码中的ACDC数据集是什么类型MRI数据集,没有查到,求大佬告知
Hi, I found some problem in 2ed step as following:
Traceback (most recent call last): File "train_unet_2D_dv_fully_supervised.py", line 23, in <module> from val_unet_2D_dv import test_single_volume ModuleNotFoundError: No module named 'val_unet_2D_dv'
I cant find the module "val_unet_2D_dv" in your repository or pypi, How can I get it?
Hi,
Thanks for your fantastic work. One question is why we preprocess the BRaST2019 into a binary problem. According to your paper (https://arxiv.org/pdf/2105.09511v3.pdf), the dataset has four classes (including b.g.). Did anyone do it before? Please share the reference.
Cheers,
Hello
How are you?
Thanks for contributing to this project.
Could u support the code for DMT method (https://arxiv.org/pdf/2004.08514.pdf)?
Thanks
Hello, I find that when I use nibabel to read a picture as numpy, numpy will rotate 90 degrees, but when I finally save numpy as nibabel, the picture direction is correct again, is this ok? What is the reason for this? SimpleITK is pronounced numpy and I find the orientation is normal
Thank you very much
Thanks for your wonderful work. I have learned a lot from it. I'm a little confused about the calculation of the metrics (e.g., Dice, ASD) in test_3D_utils on line 106 (metric = calculate_metric_percase(label == 1, prediction == 1)). I am wondering the order of 'label == 1' and 'prediction == 1' could be changed.
Hello
How are you?
Thanks for contributing to this project.
I can NOT find the code for the paper "Efficient Semi-Supervised Gross Target Volume of Nasopharyngeal Carcinoma Segmentation via Uncertainty Rectified Pyramid Consistency" (https://arxiv.org/pdf/2012.07042.pdf).
But the author of this paper said that the code is avaiable in this project.
How should I understand this?
Thanks
My dataset just have two classes to segmentation.When I train the dataset using your code,I got abnormal result.Could you update the code for two classes segmentation? Thanks in advanced.
Hello, thanks for your nice repository, however, I tried to download the two datasets from Baidu repository but the links are not working. Can you please look into this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.