feed picture to model tensorflow for training

795 views Asked by At

I'm trying to import pictures to my model for training just like example "image_retraining" : https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/image_retraining but the import process image is in the classify_image_graph_def.pb so I don't know how it works

I found these ways:
Tensorflow multithreading image loading

https://stackoverflow.com/a/36947632/7040568

https://github.com/samjabrahams/tensorflow-workshop/blob/master/04%20Feedforward%20Network.ipynb

Would you mind telling me which is the standard way of tensorflow to import pictures for training model ? I haven't used tf.train.batch , tf.train.Coordinator and tf.train.start_queue_runners yet.

I really confused cause I'm still learning how to use tensorflow so I just need a simple or the standard way

thank you and regards,

1

There are 1 answers

6
chris On BEST ANSWER

One way is to load them yourself using PIL or OpenCV e.g. cv2.imread(filename.png), and then give them to your graph (in feed_dict) as an array with dimensions [number of images (batch size), height, width, channels (3 if RGB)].