TensorFlow2.0-Examples
TensorFlow2.0-Examples copied to clipboard
deploy the yolov3 model to Android (convert the keras model to tflite)
ERROR: Check failed: start_indices_size <= num_input_axes (2 vs. 1) StridedSlice op requires no more than 1 start indices.
It is because the tflite does not support some lower level function of tensorflow. Such as tf.newaxis in tf.strided_slice.
So I modified the ./core/yolov3.py and replace all the tf.newaxis to tf.expand_dims
For example:
# original code
# y = tf.tile(tf.range(output_size, dtype=tf.int32)[:, tf.newaxis], [1, output_size])
# x = tf.tile(tf.range(output_size, dtype=tf.int32)[tf.newaxis, :], [output_size, 1])
# my version
y = tf.range(output_size, dtype=tf.int32)
y = tf.expand_dims(y, -1)
y = tf.tile(y, [1, output_size])
x = tf.range(output_size,dtype=tf.int32)
x = tf.expand_dims(x, 0)
x = tf.tile(x, [output_size, 1])