Click here to Skip to main content
15,502,868 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I'm currently trying to improve the performance of a CycleGAN model which has a couple of downsampling layers and upsampling layers combined with 6 ResNet blocks for the bottleneck.

I've added the Depthwise separable convolution implementation in the What have I tried section.

Currently, I've swapped every possible conv1d and conv2d layer with these layers and it was able to reduce parameters from 22059265 to 7906710 and I gained a boost of performance.

So my question is, is it a good practice to replace all conv layers with Depthwise separable convolutions and reduce this much of parameters, or is it better to only change the bottleneck layers with this? will it hurt the accuracy?

What I have tried:

I used the following implementation for it,
class DSConv1D(nn.Module):
def __init__(self, in, out, kernel, stride, padding, bias=False):
    super(DSConv1D, self).__init__()
    self.d = nn.Conv1d(in, in, kernel_size=kernel, stride=stride, padding=padding, groups=in, bias=bias)
    self.p = nn.Conv1d(in, out, kernel_size=1, stride=stride, bias=bias)

def forward(self, x):
    out = self.d(x)
    out = self.p(out)
    return out

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900