change the input type of an existing tensorflow graph

Viewed 25

I have a tensorflow graph checkpoint that takes the raw images in this way:

input_data  =np.array( tf.compat.v1.gfile.FastGFile(image_filename, 'rb').read())

a part of the input is something like this :

b'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x84\x00\n\x07\x08\x15\x15\x12\x18\x11\x15\x15\x18\x18\x18\x18\x12\x18\x18\x18\x18\x18\x18\x18\x11\x19\x12\x18\x18\x18\x19\x19\x18\x18\x18\x18\x1c!.%\x1c\x1e+\x1f\x18\x18&8&+/1555\x1a$;@;3?.651\x01\x0c\x0c\x0c\x10\x0f\x10\x1e\x12\x

However, I want to change the input type to float32 or uint8, I do not want to remove anything from the graph, I want to add an operation to the beginning of the graph and take the image as float32 and then convert to byte as above. Is it possible? if so, which operation should I use and how?

0 Answers
Related