Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

about dict in Seg fuction #4

Open
whyandbecause opened this issue Feb 24, 2023 · 2 comments
Open

about dict in Seg fuction #4

whyandbecause opened this issue Feb 24, 2023 · 2 comments

Comments

@whyandbecause
Copy link

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
Copy link

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
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants