0

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,

Community
  • 1
  • 1
Nguyen Khoi
  • 75
  • 1
  • 10

1 Answers1

0

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)].

chris
  • 1,831
  • 18
  • 33
  • I'm not sure - does it run? – chris Dec 13 '16 at 18:04
  • `image_data = ndimage.imread(image_file).astype(float) image_data = (image_data - 255/ 2) / (255/ 2)` is it right ? – Nguyen Khoi Dec 13 '16 at 18:09
  • yes, but i'm not sure about image_data = (image_data - 255/ 2) / (255/ 2) – Nguyen Khoi Dec 13 '16 at 18:10
  • So that subtracts 127.5 from the image, and then divides by 127.5. I guess that sets your images to be between -1 and 1. I think I have read that "whitening" your data like that is a good idea. You may want to subtract the actual mean of the data (or of each channel or something) and then divide by the max. I don't know what is best. – chris Dec 13 '16 at 18:15
  • do you know any architecture or model for OCR using neural network ?. I mean I want to recognize each letters and numbers (0-9 , a-z) but I always found result of mnist digits. Another question: the return of tf.decode_jpg and ndimage.imread is the same ,right ? – Nguyen Khoi Dec 13 '16 at 18:18
  • I would be googling for one like you at this point. :) Sorry. I'm not sure if they are the same. You can check real quick and see. – chris Dec 13 '16 at 18:23