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

FAD的三通道输入和LFS的灰度图输入 #20

Open
leeguandong opened this issue May 18, 2022 · 2 comments
Open

FAD的三通道输入和LFS的灰度图输入 #20

leeguandong opened this issue May 18, 2022 · 2 comments

Comments

@leeguandong
Copy link

leeguandong commented May 18, 2022

我比较疑惑的是,在FAD中的输入是3通道图做DCT,
x_freq = self._DCT_all @ x @ self._DCT_all_T # [N, 3, 299, 299]

但是在LFS时,却要先转成灰度图:
x_gray = 0.299x[:,0,:,:] + 0.587x[:,1,:,:] + 0.114*x[:,2,:,:]
x = x_gray.unsqueeze(1)

x = (x + 1.) * 122.5

文章中,两块应该都是RGB输入,请问为什么LFS时要灰度图输入啊??

@yyk-wew
Copy link
Owner

yyk-wew commented May 18, 2022

这个是我自己的一种实现方式。原文有提到:

Practically in our experiments, we empirically adopt the window size as 10, the sliding stride as 2, and the number of bands as M = 6, thus the size of the output matrix will be 149 × 149 × 6 if the input image is of size 299 × 299 × 3.

对于299 × 299 × 3的图像来说,直接对RGB三个通道分别做2D-DCT得到的频谱大小为 299 × 299 × 3,如果分6个频段,对三个通道的频谱分别做统计就得到 149 × 149 × 18,也就是 3 × 6 这么多通道,和原文不符。所以我实现的时候先转换为灰度图 299 × 299 × 1,分6个频段统计就是 149 × 149 × 6。

当然,先分别转换为频谱,然后在三个频谱的对应频段上综合统计取mean也能得到相应size的输出,这种情况也值得一试。

@kkpssr
Copy link

kkpssr commented Jun 26, 2022

这个是我自己的一种实现方式。原文有提到:

Practically in our experiments, we empirically adopt the window size as 10, the sliding stride as 2, and the number of bands as M = 6, thus the size of the output matrix will be 149 × 149 × 6 if the input image is of size 299 × 299 × 3.

对于299 × 299 × 3的图像来说,直接对RGB三个通道分别做2D-DCT得到的频谱大小为 299 × 299 × 3,如果分6个频段,对三个通道的频谱分别做统计就得到 149 × 149 × 18,也就是 3 × 6 这么多通道,和原文不符。所以我实现的时候先转换为灰度图 299 × 299 × 1,分6个频段统计就是 149 × 149 × 6。

当然,先分别转换为频谱,然后在三个频谱的对应频段上综合统计取mean也能得到相应size的输出,这种情况也值得一试。

是否可能是ycrbr的y通道?和图像压缩对应

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

3 participants