I want to know how to process images before being fed as an input to a Bidirectional LSTM. I always get this error whenever I run me code:
AttributeError: 'list' object has no attribute 'get_shape'
from this line:
outputs, _, _ = tf.nn.bidirectional_dynamic_rnn(lstm_fw_cell, lstm_bw_cell, x, dtype=tf.float32)
Here's a part of my code relevant to the problem:
def bi_rnn(features, labels, mode):
x = tf.unstack(features, num_inputs, 1)
... # cell initialization
# Get lstm cell output
try:
outputs, _, _ = tf.nn.bidirectional_dynamic_rnn(lstm_fw_cell, lstm_bw_cell, x, dtype=tf.float32)
...
def serving_input_fn():
feature_placeholders = {
'features': tf.placeholder(tf.float32, [None, num_inputs])
}
features = {
key: tf.expand_dims(tensor, -1) for key, tensor in feature_placeholders.items()
}
features = tf.squeeze(features, axis=[2])
return InputFnOps(features, None, feature_placeholders)
def read_dataset(img_paths, labels):
def _input_fn():
... # reading image paths omitted
image_files = tf.image.decode_png(image_files)
image_files = tf.image.resize_images(image_files, [1024, 128])
image_files = evaluate_images(image_files)
... # labels part omitted
return tf.convert_to_tensor(np.array(image_files)), labels2
return _input_fn