mcg-nku / scnet Goto Github PK
View Code? Open in Web Editor NEWThe official PyTorch implementation of CVPR 2020 paper "Improving Convolutional Networks with Self-Calibrated Convolutions"
License: MIT License
The official PyTorch implementation of CVPR 2020 paper "Improving Convolutional Networks with Self-Calibrated Convolutions"
License: MIT License
Thanks for sharing the code!
First, I'm wondering whether any outfit could be obtained if the proposed SCNet is introduced into anchor-free architecture object detection method.
Besides, could you please tell how can I modified the RetinaNet by SCNet?
Just to replace the ResNet50+FPN with SCNet?
THANKS!! :)
I try to add scconv in resnet18.
As show in th pic, conv4 and conv7 can be seen as the two split blobs.
Compare to resnet50, it seems lacking F1 conv as shown in your paper.
And this architecture hasn't got better performance, maybe it seems I don't get a better pretrained model.
Is there any better way to add this trick please?
Hello to you all, thank you for the implementation. I dont have much experience on the deep learning area. I tried to implement the self calibrated conv layer on Keras 2, but i dont know if it is correct or not. Also, i added relu activation after the concatenation, i wonder if it is good practice or should i add relu activation after every conv2d layers. Any feedback is appreciated, thanks.
def build_selfcalibrated_conv_graph(depth,layer_name,split_ratio=0.5,filters=64):
input_layer = KL.Input(shape=[None,None,depth])
split_idx = int(depth * split_ratio)
x1 = KL.Lambda(lambda x: x[:,:,:,:split_idx])(input_layer)
x2 = KL.Lambda(lambda x: x[:,:,:,split_idx:])(input_layer)
# x1 path
identity = x1
output_x1_a = KL.Conv2D(filters,(3,3),padding="same",name=f"{layer_name}_k3_conv")(x1)
output_x1_a = KL.BatchNormalization(name=f"{layer_name}_k3_bn")(output_x1_a)
output_x1_b = KL.AveragePooling2D(pool_size=(4, 4), strides=4,name=f"{layer_name}_k2_avg")(x1)
output_x1_b = KL.Conv2D(filters,(3,3),padding="same",name=f"{layer_name}_k2_conv")(output_x1_b)
output_x1_b = KL.BatchNormalization(name=f"{layer_name}_k2_bn")(output_x1_b)
output_x1_b = KL.UpSampling2D(size=(4,4))(output_x1_b)
output_x1_b = KL.Activation('sigmoid')(KL.add([output_x1_b,identity]))
output_x1_ab = KL.Multiply()([output_x1_a,output_x1_b])
output_x1_ab = KL.Conv2D(filters,(3,3),padding="same",name=f"{layer_name}_k4_conv")(output_x1_ab)
y1 = KL.BatchNormalization(name=f"{layer_name}_k4_bn")(output_x1_ab)
# x2 path
y2 = KL.Conv2D(filters,(3,3),padding="same",name=f"{layer_name}_k1_conv")(x2)
y2 = KL.BatchNormalization(name=f"{layer_name}_k1_bn")(y2)
# concatenate y1 and y2
output = KL.Concatenate(axis=-1)([y1,y2])
output = KL.Activation('relu')(output)
return KM.Model(inputs=input_layer, outputs=output, name=layer_name) ```
Thanks for sharing the code!
I'm wondering whether any outfit could be obtained if the proposed SCNet is introduced into depth completion.
Hi, I'm new to classification, do you have any plan to release training code?
如题,我将SCConv卷积加到了ENET上(一个深度补全的网络),想用2个GPU训练,提示有错
RuntimeError: Caught KeyError in replica 0 on device 0.
经过搜索可能是SCConv不能并行运算,请问是是这个原因吗,并且怎么修改呢
Hello, there is a small bug in SCNet.py
.
In Downloading URLs, the 'scnet50' link is provided as 'scnet101'. It's a small mistake, since I can't access the AliYunCS due to the Permission Deny, I hope you can fix this.
And by the way, would 'scnet154' pretrained model be available in up-coming days?
If I want to use it in other networks, such as VGG ,ALexNet,and so on, I just need to replace the standard convolution blocks with this SCConv module whether or not?
when output channel number C‘ are not equal to input channel number C,there is different channel numbers between identity with self.k2(x). So how to deal with this problem? The code as follows:
out = torch.sigmoid(torch.add(identity, F.interpolate(self.k2(x), identity.size()[2:])))
In Figure2 in the paper, it seems you directly get two new feature('X1','X2'
) by split the 'InputX'
in two portions without extra params. But in the code, you get them by two convolutions.
Line 103 in c0b5bd6
First of all, thank you very much for your open source work!But,I noticed in (scnet.py, SCBottleneck ) :
residual = x
self.conv3 = nn.Conv2d(group_width * 2, planes * 4, kernel_size=1, bias=False)
out = self.conv3(torch.cat([out_a, out_b], dim=1))
out = self.bn3(out)
out += residual
it seems makes out expand 4 scales.However,it(out) directly add to residual(make the tensor is mismatch in dimension 1).Could you tell me how to solve it?
Could you release the SCNeXt code? 50-layer or 101-layer?
下载scnet50_v1d-4109d1e1.pth之后只有参数没有模型呀,模型怎么获得?
Hi,
If I want to use scconv which inplanes = 64, planes = 3, there is an error in code:
out = torch.sigmoid(torch.add(identity, F.interpolate(self.k2(x), identity.size()[2:]))) # sigmoid(identity + k2)
示例代码会报题目中的错误,因为输入图片只有一张,训练时如果batch size为1的话batch norm会报错,建议model = model.cuda(0)
改成model = model.eval().cuda(0)
您好,请问您使用的是ILSVRC数据集吗?具体是哪一年的呢?
Hello, are you using the ILSVRC dataset? What year is it exactly?
感谢您的杰出工作。
我想使用scnet50替换我的网络中的resnet。但是我发现貌似不能直接替换,这让我手足无措了好久。请问您有什么好的建议吗,或者注意事项?
十分期待您的回复!!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.