matterport / Mask_RCNN

Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow
Other
24.54k stars 11.68k forks source link

Getting error while converting Mask R-CNN model to Google Colab TPU #1036

Open Sgmoid opened 5 years ago

Sgmoid commented 5 years ago

This is the code

TPU_WORKER = 'grpc://' + os.environ['COLAB_TPU_ADDR']

import tensorflow as tf
tpu_model = tf.contrib.tpu.keras_to_tpu_model(
model.keras_model,
strategy=tf.contrib.tpu.TPUDistributionStrategy(
tf.contrib.cluster_resolver.TPUClusterResolver(TPU_WORKER)))

Which is giving below error

ValueError: Layer <keras.engine.topology.InputLayer object at 0x7f58574f1940> has a variable shape in a non-batch dimension. TPU models must have constant shapes for all operations.

You may have to specify input_length for RNN/TimeDistributed layers.

Layer: <keras.engine.topology.InputLayer object at 0x7f58574f1940> Input shape: (None, None, None, 3) Output shape: (None, None, None, 3)

bishesh16 commented 5 years ago

+1 @Sgmoid Did you manage to solve this issue ?

Sgmoid commented 5 years ago

+1 @Sgmoid Did you manage to solve this issue ?

No. We have moved to AWS GPU. Google Colab GPUs are slow. We wanted to use Google Colab TPUs. But we are running into above issue.

h-ann commented 5 years ago

Hi @Sgmoid , Could you please advise, which Instance type on aws you chose?