VisibleShadow / Implementation-of-Detecting-Camouflaged-Object-in-Frequency-Domain

An unofficial implementation for Detecting Camouflaged Object in Frequency Domain, CVPR 2022 in PyTorch.
70 stars 9 forks source link

about dict in Seg fuction #4

Open whyandbecause opened 1 year ago

whyandbecause commented 1 year ago

Hi, your reproduction is very helpful to me, But I have a question, where does the definition of dict in Seg() come from, or what is the theory-based? thank you. dict = {0: 0, 1: 1, 2: 8, 3: 16, 4: 9, 5: 2, 6: 3, 7: 10, 8: 17, 9: 24, 10: 32, 11: 25, 12: 18, 13: 11, 14: 4, 15: 5, 16: 12, 17: 19, 18: 26, 19: 33, 20: 40, 21: 48, 22: 41, 23: 34, 24: 27, 25: 20, 26: 13, 27: 6, 28: 7, 29: 14, 30: 21, 31: 28, 32: 35, 33: 42, 34: 49, 35: 56, 36: 57, 37: 50, 38: 43, 39: 36, 40: 29, 41: 22, 42: 15, 43: 23, 44: 30, 45: 37, 46: 44, 47: 51, 48: 58, 49: 59, 50: 52, 51: 45, 52: 38, 53: 31, 54: 39, 55: 46, 56: 53, 57: 60, 58: 61, 59: 54, 60: 47, 61: 55, 62: 62, 63: 63}

Moushumi9medhi commented 1 year ago

The dict in seg refers to the indices of DCT coefficients when encoded in the zigzag manner. But if this is so, I think there is an issue with the following lines of code:

high = torch.cat([feat_y[:, 32:, :, :], feat_Cb[:, 32:, :, :], feat_Cr[:, 32:, :, :]], 1)
low = torch.cat([feat_y[:, :32, :, :], feat_Cb[:, :32, :, :], feat_Cr[:, :32, :, :]], 1) 

As in the above, the high and low frequency bands are simply extracted from the last 32 and the first 32 frequencies, which does not follow the zigzag pattern.

whyandbecause commented 1 year ago

The dict in seg refers to the indices of DCT coefficients when encoded in the zigzag manner. But if this is so, I think there is an issue with the following lines of code:

high = torch.cat([feat_y[:, 32:, :, :], feat_Cb[:, 32:, :, :], feat_Cr[:, 32:, :, :]], 1)
low = torch.cat([feat_y[:, :32, :, :], feat_Cb[:, :32, :, :], feat_Cr[:, :32, :, :]], 1) 

As in the above, the high and low frequency bands are simply extracted from the last 32 and the first 32 frequencies, which does not follow the zigzag pattern.

Hi, thank you for your answer. I think i have got the meaning of this dict. About 'does not follow the zigzag pattern', my simple understand is that the 288-290 lines have made the high frequency extraction through self.seg in a zigzag manner,so we can simply split the channels to get high/low frequency. I hope it's useful for you. Thank you.