I'm working on a machine learning project with convolutional neural networks using TF/Keras in Python, and my goal is to split up an image up into patches, run a convolution on each one separately, and then put it back together.
What I can't figure out how to do is run a convolution for each slice of a 3D array.
For example, if I have a tensor of size (500,100,100) I want to do a separate convolution for all 500 slices of size (100 x 100). I'm implementing this within a custom Keras layer and want these to be trainable weights I've tried a few different things:
- Using
map.fn()to run a convolution for each slice of the array- This doesn't seem to attach weights to each layer separately.
- Using the
DepthwiseConv2Dlayer:- This works well for the first call of the layer, but fails when I call the layer the second time with more filters because it wants to perform the
depthwiseconvolution on each of the previous filtered layers - This, of course isn't what I want because I want one convolution for each of the previous sets of filters from the previous layer.
- This works well for the first call of the layer, but fails when I call the layer the second time with more filters because it wants to perform the
Any ideas are appreciated, as I'm truly stuck here. Thank you!
