I've been learning Tensorflow from a variety of tutorials and am wondering if it's possible to define a custom filter for convolution nets to use. For example, if I know there is meaningful structure in the features, such that every other feature is related, I want to define a filter that looks like [0 1 0 1 0 1].
tf.nn.conv2d(input, filter, strides, padding, use_cudnn_on_gpu=None, data_format=None, name=None)
All the examples I've seen so far use:
tf.random_normal
or
tf.truncated_normal
for the filter argument. Can I and does it make sense for me to put [0 1 0 1] in the filter argument instead?
You most certainly can! You can put any (floating-point) values you like in the convolution filter.
However, usually the values in the convolution filter are variables whose values Tensorflow learns during training, not constants. The "tf.random_normal" and "tf.truncated_normal" values are used just for setting the initial values of the filter. The values of those variables will be updated during training by the gradient descent algorithm.
For an example of training with a convolutional neural network, take a look at the tutorial here: https://www.tensorflow.org/versions/r0.9/tutorials/deep_cnn/index.html
Hope that helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With