yulequan / ua-mt Goto Github PK
View Code? Open in Web Editor NEWcode for MICCAI 2019 paper 'Uncertainty-aware Self-ensembling Model for Semi-supervised 3D Left Atrium Segmentation'.
Home Page: https://arxiv.org/abs/1907.07034
code for MICCAI 2019 paper 'Uncertainty-aware Self-ensembling Model for Semi-supervised 3D Left Atrium Segmentation'.
Home Page: https://arxiv.org/abs/1907.07034
Dear @yulequan
Another question, why is the student model stored instead of a teacher model in the training phase. In the paper of "Mean Teacher", I found that the teacher model has better performance.
if iter_num % 1000 == 0: save_mode_path = os.path.join(snapshot_path, 'iter_' + str(iter_num) + '.pth') torch.save(model.state_dict(), save_mode_path) logging.info("save model to {}".format(save_mode_path))
Thanks,
Jianqiang Ma
Whether can I set the batch size of unlabeled data 3 times the batch size of labeled data? What is different between them?Thank you for your answer !!!
Hello, @yulequan
I read your code carefully and uncertainty is a new idea for me.
I see your implementation of Monte Carlo Dropout like below:
T = 8 volume_batch_r = unlabeled_volume_batch.repeat(2, 1, 1, 1, 1) stride = volume_batch_r.shape[0] // 2 preds = torch.zeros([stride * T, 2, 112, 112, 80]).cuda() for i in range(T//2): ema_inputs = volume_batch_r + torch.clamp(torch.randn_like(volume_batch_r) * 0.1, -0.2, 0.2) with torch.no_grad(): preds[2 * stride * i:2 * stride * (i + 1)] = ema_model(ema_inputs) preds = F.softmax(preds, dim=1) preds = preds.reshape(T, stride, 2, 112, 112, 80) preds = torch.mean(preds, dim=0) #(batch, 2, 112,112,80) uncertainty = -1.0*torch.sum(preds*torch.log(preds + 1e-6), dim=1, keepdim=True)
I wonder if this is the most common way to implement uncertainty and mean teacher method?
I think your implementation is to add perturbation to inputs but not dropout to network although both way is to add regularization.
Hi @yulequan ,
I did an ablation study on the uncertainty.
Specifically, if we do not use the uncertainty to select the most certain targets and use all the voxels during each iteration, will the performance degrade?
To disable the uncertainty based proposal, I simply increase the threshold to 100
, thus all the voxels will be used to guide the student learning.
UA-MT/code/train_LA_meanteacher_certainty_unlabel.py
Lines 173 to 175 in 3d40b0d
# my modification
threshold = 100 #(0.75+0.25*ramps.sigmoid_rampup(iter_num, max_iterations))*np.log(2)
However, the results are weird. The performance does not degrade (even little improvements) without using uncertainty.
I also did paired T-test, but I didn't find significant differences (p>0.05) between using uncertainty and without uncertainty.
The following are all my experiment results (code, trained model, logs...).
Download Link:https://pan.baidu.com/s/1tM6fc_hz3_LE23cLffnFBg
Password:5p1k
Regarding to the source code, I only change the default seeds to
12345
.
Best regards,
Jun
Run with your codes. The results reveals 87.19 77.64 5.00 17.02 , but your paper's results
88.88 80.21 2.26 7.32
What's the trick you use
Hi @yulequan,
I want to try your method with Atrial Segmentation Challenge dataset. However, it seems that I could not download the training and testing dataset since the Data Access Agreement Form was closed in http://atriaseg2018.cardiacatlas.org/. I wonder whether you still have this dataset and could you please share it with me?
Best regards!
Zhiqiang
Hi, @yulequan
Thank you for opening the source code, I viewed the code carefully and had a small question.
consistency_dist = torch.sum(mask*consistency_dist)/(2*torch.sum(mask)+1e-16) consistency_loss = consistency_weight * consistency_dist loss = supervised_loss + consistency_loss
You can see that, in calculating consistency_dist, the sum of mask needs to be multiplied by 2. I'm curious why do you multiply this by 2 here?
Looking forward to your reply.
Best,
Jianqiang Ma
This project is a great framework. But I have some question to ask.
Hi, thanks for your greak work!
I think there are some problems in the code of uncertainty computation. As stated in your paper, the uncertainty threshold should ramp up from 0.75 to 1, right? But in my experiement, the number of uncertainty easily comes up to 3.
I think we should renormalize the uncertainty to 0~1 under the code of uncertainty = -1.0 * torch.sum(preds * torch.log(preds + 1e-6), dim=1, keepdim=True)
Would you like to fix about this? Thank you!
@yulequan
I have noticed that in the preprocessing of the LA dataset, a patch with the size [112,112,80] is cropped according to the label center, and 20-40 is entended along the x, y axis, 10-20 is extended along the z axis.
There is a question that in my opinion, the position of the left atrial should not be known if the sample is used as the unlabeled data in the preprocessing. I wonder if you have considered using the whole scans as unlabeled data.
I can not download the LA dataset, but I have tried your method on other dataset, it seems that UA-MT just works when I use the label centered occasion, or the performance is worse than the vnet_dp using the whole scans (also random crop).
By the way, could you tell me the original spacing and scan size of the LA dataset, and is it changed in your experiments?
Thank you for the great code~I have a theoretical question to ask.
What is the significance of averaging the prediction results for T forward propagation?
This is a classification problem in which uncertainty can be calculated by predictive entropy without T forward propagation.
Since predictive entropy itself can represent uncertainty, I wanted to confirm the significance of averaging over T forward propagations.
Dear @yulequan ,
Thanks for sharing the great code. It's very clear and out-of-the-box.
My friend and I run the code (without any modification) and get the following results.
The results are a little diverse. Some metrics can be reproduced, some metrics (red) are even better than the paper reported results, but some metrics (blue) are degraded.
Could you share your insights on these diverse results? and what could be the possible reason for the degraded results?
We also try to re-run the code on the local server, however, the results are similar.
Here, the case folder name is missed, so all the saved results have the same name and will be overwritten during saving.
Lines 28 to 31 in da31df5
Finally, I really appreciate that you make the code publicly available. The code is well written, it would be great learning materials for me.
Looking forward to your reply.
Best,
Jun
RT
Hi,
Thanks so much for your qualitative approach.
I'm new to the 3D semi-supervised segmentation, and I'm wondering what visualization tool are you using in the paper?
Cheers,
Dear author,
Isn't this work about semi-supervised medical image segmentation? Why does the training set include noisy labels, and how are they handled?
Thank you for sharing your code. I have learned a lot from this project. I have some queries please answer them when available.
Can you share your best pre trained model,my experiment cannot achieve the accuracy mentioned in your paper。
Thank you for sharing your code. I have learned a lot from this project. I have some queries please answer them when available.
Hi, thanks for your sharing.
Did you do research in CT image segmentation using your proposed method? I try to run your coder on CT dataset but the performance is not very well.
Many tkanks,
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.