Tensor flow: how to combine depth?

I have the following options defined to execute the maximum pool by image depth (rgb) for compression before a dense layer and reading ... and I fail with the error that I cannot combine depth and everything else

sunset_poolmax_1x1x3_div_2x2x3_params = \ {'pool_function':tf.nn.max_pool, 'ksize':[1,1,1,3], 'strides':[1,1,1,3], 'padding': 'SAME'} 

I changed the steps to [1,1,1,3] , so depth is the only size reduced by the pool ... but it still doesn't work. I can’t get good results with a tiny image that I have to compress in order to preserve the colors ...

Actual error:

ValueError: The current implementation does not support merging into batch size and depth.

+5
source share
1 answer

tf.nn.max_pool does not support depth aggregation, so you get an error.

Instead, you can use maximum abbreviation to achieve what you are looking for:

tf.reduce_max(input_tensor, reduction_indices=[3], keep_dims=True)

The keep_dims parameter above ensures that the tensor rank is maintained. This ensures that the maximum reduction behavior matches what the tf.nn.max_pool operation does if it supports aggregation by depth size.

+6
source

Source: https://habr.com/ru/post/1247792/


All Articles