KittiSeg icon indicating copy to clipboard operation
KittiSeg copied to clipboard

removing non compatible operations for tf lite conversion

Open StuvX opened this issue 6 years ago • 2 comments

I'm trying to covert my saved model to tf lite, but seem to run into issues with tf.split - can anybody explain why we need to split and reverse the image channels at the beginning of the network from RGB to BGR (under submodules/tensorflow-fcn/vgg8_fcn.py, lines 59 to 67)?

The code is as follows:

        red, green, blue = tf.split(rgb, 3, 3)
        # assert red.get_shape().as_list()[1:] == [224, 224, 1]
        # assert green.get_shape().as_list()[1:] == [224, 224, 1]
        # assert blue.get_shape().as_list()[1:] == [224, 224, 1]
        bgr = tf.concat([
            blue - VGG_MEAN[0],
            green - VGG_MEAN[1],
            red - VGG_MEAN[2],
        ], 3)

If I can simply remove the split operation and subtract the VGG mean using a matrix operation it will save me some headaches (apart from having to retrain my model).

StuvX avatar May 30 '18 11:05 StuvX

#172 I meet the similarity problem

zhanghanbin3159 avatar Jun 01 '18 11:06 zhanghanbin3159

Ok - the channel reversal is becuase the weights are loaded from the caffe model, but i took it out and my network learned as well as if it was reversed. However, the transpose function needed for FCN is not supported byTFlite

StuvX avatar Jun 01 '18 11:06 StuvX