0

I am newbie of tensorflow.

I have installed and setup tensorflow with docker, also launch some example well (such as mnist, and "How to Retrain" to retrain Inception-v3.

Now, I try to find the method to input my own image as new train sample (not retrain inspect-v3 model), but I am not sure how to convert my own image(JPG) of the directory to tenslfow as new tfrecords (or byte stream?)

I have found some tutorial such as Imageflow (https://github.com/HamedMP/ImageFlow), but I still don't know how to convert my own massive jpg files on the directory for tensorflow.

Also, is it I need output these my own image directory as a label.txt and image filename.txt etc...?

Thank you very much ! I know this may a stupid question ! Please, could somebody help me to resolve this question, thank you !!!

  • Maybe read images directly using `decode_jpg` as done in CIFAR tutorial? https://www.tensorflow.org/versions/r0.8/tutorials/deep_cnn/index.html – Yaroslav Bulatov May 04 '16 at 23:14
  • Thanks, I have downloaded the dataset of this tutorial "CIFAR-10". cifar-100-python.tar which include train, test, meta etc ... I think my problem is how to convert my jpg files to those file type ? imageflow ? or another toolkit ? – TonTon Hsien-De Huang May 05 '16 at 07:06

2 Answers2

1

I have resolve this stubid question by myself, thanks everyone.

http://blog.twman.org/2016/06/tensorflow.html

bazel build inception/build_image_data

bazel-bin/inception/build_image_data   --train_directory="${TRAIN_DIR}"  \
--validation_directory="${VALIDATION_DIR}"   \
--output_directory="${OUTPUT_DIRECTORY}"   \
--labels_file="${LABELS_FILE}"   \
--train_shards=128   \
--validation_shards=24   \
--num_threads=8
0

In addition to @Yaroslav's URL, you can read image from a file something like this:

img_file = tf.read_file('image.jpg')
img = tf.image.decode_jpeg(img_file)
Sung Kim
  • 8,417
  • 9
  • 34
  • 42
  • Thanks, I have downloaded the dataset of this tutorial "CIFAR-10". cifar-100-python.tar which include train, test, meta etc ... I think my problem is how to convert my jpg files to those file type ? imageflow ? or another toolkit ? – TonTon Hsien-De Huang May 05 '16 at 07:09
  • @TonTon Hsien-De Huang See the format at https://www.cs.toronto.edu/~kriz/cifar.html, <1 x label><3072 x pixel> ... <1 x label><3072 x pixel>. Basically, you can make the samething using tf.image.decode_jpeg. Try to print the img: sess.run(img). – Sung Kim May 05 '16 at 10:45
  • Could you please provide how to convert image files of directory, step by step ?! and use python ? shell ? or ? etc ... Thanks ! – TonTon Hsien-De Huang May 05 '16 at 11:15