Home > Net >  How can I resize a image to shape=(None, 321, 321, 3) with name name=None and dtype=tf.float32
How can I resize a image to shape=(None, 321, 321, 3) with name name=None and dtype=tf.float32

Time:06-28

Problem: I am trying to reshape a image to size (None,321,321,3) and also set the name of image to None. I want to match the image dimension requirements to train a machine learning model of specs,

TensorSpec(shape=(None, 321, 321, 3), dtype=tf.float32, name=None)

What I have done: I am using PIL to reshape the image. I can convert the image to the required size and RGB band, but have no idea how to make the first argument in the size as None and also how to set the name of image to None. Please help me find a solution to this problem.

CodePudding user response:

Try adding the batch dimension to your PIL image and it should work:

image = np.asarray(image)[None, ...]
  • Related