Reputation: 43
So basically I want to train a cnn using tensorflow. To cover a large area in the image, I would ideally want a large filter. However, large filter means larger number of variables which could lead to more sever overfitting. So, I'm thinking about using a sampling filter which has a lot of constant zeros and the rest weights being trainable.
Is there a way to do this? I know tf.get_variable will just make all the weights inside the filter trainable. How do I fix some of the weights to zero during training?
Upvotes: 0
Views: 141
Reputation: 10474
There might be a way to do this via some sort of masking operation, however I think your best bet would be to use dilated convolutions. These insert "holes" between the filter values which sounds like what you are looking for. The standard convolution ops in Tensorflow support this; tf.nn.conv2d
has a dilations
argument and tf.layers.conv2d
uses dilation_rate
.
It is best to understand this with pictures so here is a blog post that has some.
Upvotes: 1