danfenghong / ECCV2020_CUCaNet

Cross-Attention in Coupled Unmixing Nets for Unsupervised Hyperspectral Super-Resolution, ECCV, 2020. (PyTorch)
92 stars 13 forks source link

Problem about the code #1

Open JingYu22 opened 2 years ago

JingYu22 commented 2 years ago

Here are line125 to line147 in \ECCV2020_CUCaNet-master\model\cu_nets.py:

def my_forward(self):
        # LrHSI, HrMSI to themselves
        self.my_rec_lr_s_1 = self.net_G_LR2s_1(self.real_lhsi)
        self.my_rec_msi_s_1 = self.net_G_MSI2S_1(self.real_hmsi)

        self.my_rec_lr_s_2 = self.net_G_LR2s_2(torch.cat([self.my_rec_lr_s_1, torch.mul(self.my_rec_lr_s_1, self.net_G_PSF_2(self.net_G_mut_spa(self.my_rec_msi_s_1)))], dim=1))
        self.my_rec_msi_s_2 = self.net_G_MSI2S_2(torch.cat([self.my_rec_msi_s_1, torch.mul(self.my_rec_msi_s_1, self.net_G_mut_spe(self.my_rec_lr_s_1))], dim=1))

        self.rec_lr_lr = self.net_G_s2img(self.my_rec_lr_s_2)
        self.rec_msi_msi = self.net_G_ms2img(self.my_rec_msi_s_2)

        # HrHSI to LrHSI, HrMSI
        self.rec_msi_hr = self.net_G_s2img(self.my_rec_msi_s_2)
        self.rec_msi_lrs_lr = self.net_G_PSF(self.rec_msi_hr)
        self.rec_msi_lrs_msi = self.net_G_HR2MSI(self.rec_msi_hr)

        # LrHSI, HrMSI to LrMSI
        self.rec_lrhsi_lrmsi = self.net_G_HR2MSI(self.real_lhsi)
        self.rec_hrmsi_lrmsi = self.net_G_PSF(self.real_hmsi)

        self.visual_corresponding_name['real_lhsi'] = 'rec_lr_lr'
       self.visual_corresponding_name['real_hmsi'] = 'rec_msi_msi'
       self.visual_corresponding_name['real_hhsi'] = 'rec_msi_hr'

Actually,"self.rec_msi_hr" is the same as "self.rec_msi_msi", which means the previous HrMSI result is regarded as HrHSI in the next part. I'm confused about it . Apart from that, I couldn't find the code corresponding to the part that fuses abundance map and endmembers and generates high-resolution hyperspectral image in Fig. 1. I wonder if the code is incomplete?

jingyao16 commented 2 years ago

Here are line125 to line147 in \ECCV2020_CUCaNet-master\model\cu_nets.py:

def my_forward(self):
        # LrHSI, HrMSI to themselves
        self.my_rec_lr_s_1 = self.net_G_LR2s_1(self.real_lhsi)
        self.my_rec_msi_s_1 = self.net_G_MSI2S_1(self.real_hmsi)

        self.my_rec_lr_s_2 = self.net_G_LR2s_2(torch.cat([self.my_rec_lr_s_1, torch.mul(self.my_rec_lr_s_1, self.net_G_PSF_2(self.net_G_mut_spa(self.my_rec_msi_s_1)))], dim=1))
        self.my_rec_msi_s_2 = self.net_G_MSI2S_2(torch.cat([self.my_rec_msi_s_1, torch.mul(self.my_rec_msi_s_1, self.net_G_mut_spe(self.my_rec_lr_s_1))], dim=1))

        self.rec_lr_lr = self.net_G_s2img(self.my_rec_lr_s_2)
        self.rec_msi_msi = self.net_G_ms2img(self.my_rec_msi_s_2)

        # HrHSI to LrHSI, HrMSI
        self.rec_msi_hr = self.net_G_s2img(self.my_rec_msi_s_2)
        self.rec_msi_lrs_lr = self.net_G_PSF(self.rec_msi_hr)
        self.rec_msi_lrs_msi = self.net_G_HR2MSI(self.rec_msi_hr)

        # LrHSI, HrMSI to LrMSI
        self.rec_lrhsi_lrmsi = self.net_G_HR2MSI(self.real_lhsi)
        self.rec_hrmsi_lrmsi = self.net_G_PSF(self.real_hmsi)

        self.visual_corresponding_name['real_lhsi'] = 'rec_lr_lr'
       self.visual_corresponding_name['real_hmsi'] = 'rec_msi_msi'
       self.visual_corresponding_name['real_hhsi'] = 'rec_msi_hr'

Actually,"self.rec_msi_hr" is the same as "self.rec_msi_msi", which means the previous HrMSI result is regarded as HrHSI in the next part. I'm confused about it . Apart from that, I couldn't find the code corresponding to the part that fuses abundance map and endmembers and generates high-resolution hyperspectral image in Fig. 1. I wonder if the code is incomplete?

Hi. Actually "self.rec_msi_hr" is the fused hsi result with high spatial resolution. "self.rec_msi_msi" is the reconstrcuted msi (same as input). "self.net_G_s2img" encodes the endmember signatures with hyperspectral resolution, and "self.my_rec_msi_s_2" reflects the abundances drawn from input msi. Maybe our namings make you confused. Hope this helps you get clear on our code :)

JingYu22 commented 2 years ago

Now I understand, thanks for the explanation!