I am trying to get values of tensor from function which is called by map function. But I am getting this error.
tensorflow.python.framework.errors_impl.InvalidArgumentError: You must feed a value for placeholder tensor 'args_0' with dtype string [[{{node args_0}}]]
my code is as follows
In my main function:
# created instance of Preprocess class
preprocess = Preprocessor(is_train, TOTAL_CLASSES, OUTPUT_SHAPE)
# all the tfrecords which is present in ./tfrecords folder we will gate
dataset = tf.data.Dataset.list_files("./tfrecords")
# we will comprises it into one
dataset = tf.data.TFRecordDataset(dataset)
# Here I am mapped __call__ method which is present in Preprocess class
dataset = dataset.map(preprocess, num_parallel_calls=tf.data.experimental.AUTOTUNE)
Now in Preprocess class call method I am getting error This is my preprocess class. In call function I am getting error.
class Preprocessor(object):
def __init__(self, is_train, num_classes, output_shape=(416, 416)):
self.is_train = is_train
self.num_classes = num_classes
self.output_shape = output_shape
def __call__(self, example):
features = self.parse_tfexample(example)
encoded = features['image/encoded']
image = tf.io.decode_jpeg(encoded)
image = tf.cast(image, tf.float32)
sess = tf.Session()
# at this line I am getting error
print(sess.run(image))
How I can resolve this problem. If I comment print(sess.run(image)) this line all the code work properly. But I want values of tensors in maped function.