trying to read frames for TFRcord file and in the last frame I get:
tensorflow.python.framework.errors_impl.InvalidArgumentError: Key: frame2. Data types don't match. Data >type: float but expected type: string
the code is:
''' def parse_function(proto): # define your tfrecord again. Remember that you saved your image as a string. keys_to_features = {'class': tf.io.FixedLenFeature([], tf.int64)}
for i in range(FRAMSE_PER_VIDEO-1):
keys_to_features['frame'+str(i)] = tf.io.FixedLenFeature([],tf.string)
print(keys_to_features)
# Load one example
parsed_features = tf.io.parse_single_example(proto, keys_to_features)
print(parsed_features)
#reading first frame and starting tensor
frame = (parsed_features['frame' + str(0)])
frame = tf.io.decode_raw(parsed_features['frame' + str(0)], tf.float32)
frame = tf.reshape(frame, [WIDTH1, WIDTH1, 3])
video = tf.expand_dims(frame,0)
# Turn saved image string into an array
for i in range(FRAMSE_PER_VIDEO-2):
frame = (parsed_features['frame' + str(i+1)])
print(frame)
frame = tf.io.decode_raw(frame, tf.float32)
frame = tf.reshape(frame, [WIDTH1, WIDTH1, 3])
frame = tf.expand_dims(frame,0)
video = tf.concat([video,frame],0)
return video, parsed_features["class"]
'''
When I write the TFRecord, I write all frames in the same method so there shouldn't be a difference
what could be the problem?