qgao21/CoreDiff

if context is False, the code needs change

Opened this issue · 18 comments

class Network(nn.Module):
    def __init__(self, in_channels=3, out_channels=1):
        super(Network, self).__init__()
        self.unet = UNet(in_channels=in_channels, out_channels=out_channels)

    def forward(self, x, t, y, x_end, adjust=True):
        if x.size(1) == 1: 
            x_adjust = torch.cat((y, x_end), dim=1)
            out = self.unet(x, t, x_adjust, adjust=adjust) + x
        else:
            x_middle = x[:, 1].unsqueeze(1)
            x_adjust = torch.cat((y, x_end), dim=1)
            out = self.unet(x, t, x_adjust, adjust=adjust) + x_middle
        return out
qgao21 commented

Sorry, I defaulted to "context=True" in this project, so I removed the "if context" condition check in the network part. The code has been modified. Thanks for the correction.

qgao21 commented

Your understanding is correct. In the training phase, we train a conditional network for one-step prediction. Since the potential oversmoothing of the one-step prediction, we use the multi-step sampling algorithm proposed by Cold Diffusion during the inference phase to retain more details.

qgao21 commented

Yes, I am a Chinese PhD student at Fudan University. There is no necessity to enlarge the training loss. Once the training process stabilizes, the loss value hovers around 1e-5. For training, I utilized over 4,000 1mm images from nine patients, ranging from L067 to L333.

qgao21 commented

客气客气,稳定在1e-5后还需要训练较长一段时间,有问题欢迎随时讨论

qgao21 commented

如果要复现与论文相似的结果,应该使用本项目提供的指标计算代码,不同的计算代码可能存在微小的差距。计算指标使用的CT窗为[-1000, 1000]HU,不同的计算窗对结果有较大影响。我更新了预处理Mayo 2016原始DICOM数据的代码和训练demo,同样也更新了我训练时的Loss曲线和在测试集上的指标曲线,你可以对照检查一下。

If you want to reproduce experiment results similar to those in the paper, you should use the metric calculation code provided by this project. There may be slight differences in different calculation codes. The CT window used to calculate the metrics is [-1000, 1000]HU. Different calculation windows have a greater impact on the results. I updated the code and training demo for preprocessing the Mayo 2016 original DICOM data. I also updated the training loss curve and the evaluation metric curve. You can check your code against them.

qgao21 commented

出现这个现象有两种可能的原因:

  1. 训练不充分。采样步数越多,训练时需要遍历的t越多,因此需要更充足的训练步数。
  2. 一步预测的图像很平滑,故计算得到的PSNR、RMSE等指标更高,但是图像细节存在损失。扩散模型的优势在于恢复图像的精细结构,因此多步预测有助于生成更接近Normal-dose图像的纹理细节。你可以使用SSIM、FSIM和perceptual loss等指标进行评测,此外定性评测对于评价CT图像指标也很重要。具体关于T的消融及指标的选择在论文也有详细介绍,可以参考。
qgao21 commented

客气客气

哥们你们太牛了TwT,我在做本科毕业论文,刚开始接触低剂量CT重建这块,什么都不会,也不知道怎么开始,头大TwT

qgao21 commented

慢慢来,有问题欢迎交流

好的,谢谢TwT