Skip to content

Why does the generator use conv2d layers with size 1? #13

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

Open
Kanbe-Kotori opened this issue Dec 11, 2023 · 3 comments
Open

Why does the generator use conv2d layers with size 1? #13

Kanbe-Kotori opened this issue Dec 11, 2023 · 3 comments

Comments

@Kanbe-Kotori
Copy link

Kanbe-Kotori commented Dec 11, 2023

In demo_CrossDatasetOpenSet_training.ipynb [3]:

My understanding of the model is that the output of the Generator should be equal in shape to the output of the classifier (ResNet-18), i.e., a [512, 1, 1] tensor after GAP. In this case, as you said, the actual structure of the Generator is just a MLP. So, what does conv2d layers do? Or to put it another way, if I use a normal network of nn.Linear + nn.BatchNorm1d as a generator, and then reshape the output to a shape of [512, 1, 1], are they equal?

If so, what's your actual meaning of the annotations like "state size: (self.ngf*8) x 4 x 4"? Shouldn't the actual shape of the output of this layer be (self.ngf*8) x 1 x 1?

Looking forward to your reply.

@mywsmjj
Copy link

mywsmjj commented Jan 25, 2024

Hello, can I take a look at the OTS characteristics generated by your resnet18 network. If you can know the structure of your resnet18 network, thank you very much and I wish you all the best in your work!

@mywsmjj
Copy link

mywsmjj commented Jan 25, 2024

你好,请问我可以看看你的resnet18网络生成的OTS特征吗。如果可以知道您的resnet18网络的结构的话,那万分感谢您,祝您工作顺利!

@Kanbe-Kotori
Copy link
Author

Kanbe-Kotori commented Jan 26, 2024

你好,请问我可以看看你的resnet18网络生成的OTS特征吗。如果可以知道您的resnet18网络的结构的话,那万分感谢您,祝您工作顺利!

你好,ResNet18的结构是高度固定的,即[2, 2, 2, 2]的BasicBlock->平均池化->FC(输出)。

我理解文章中使用的OTS特征是ResNet18的池化层的输出
self.pooling = nn.Sequential(
nn.AdaptiveAvgPool1d(1),
nn.Flatten(),
)
,形状为[batchsize, 512]

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