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

stu_feature_adap #2

Open
chumingqian opened this issue Aug 15, 2020 · 1 comment
Open

stu_feature_adap #2

chumingqian opened this issue Aug 15, 2020 · 1 comment

Comments

@chumingqian
Copy link

chumingqian commented Aug 15, 2020

@HqWei
您好, Wei:
请问一下您的 ,
stu_feature_adap=model_adap(stu_feature) 是如何实现的,
是1 * 1 的卷积 , padding = , 因为看了 distillation with fine grained 中代码 , 有点 疑惑; 原文的 github 放的 如图,通道数前后未变化。
stu_adap

@HqWei
Copy link
Owner

HqWei commented Apr 1, 2021

我这是也是一个卷积层进行通道和featuremap大小变化,大小一样就可以计算相似度了:
`import torch.nn as nn
import torch.nn.functional as F

class Stu_Feature_Adap(nn.Module):

def __init__(self,input_channel=256, output_channel=1024,kernel_size=2,padding=0):
	super(Stu_Feature_Adap, self).__init__()

	self.conv1 = nn.Conv2d(input_channel, output_channel, kernel_size=kernel_size, padding=padding)
	self.relu = nn.ReLU()




def forward(self, x):
	x = self.conv1(x)
	x = self.relu(x)
	# x = self.leaky_relu(x)
	# x = self.conv2(x)

	

	return x

`

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