Reputation: 2923
I have a list of images and labels in a txt file, in this format:
file1.jpg 1
file2.jpg 0
file3.jpg 1
file4.jpg 1
where the labels are binary.
How could I convert the image data to a TFRecord file without assigning my images to a subdirectory of labels (which is used in the inception model data preparation), and through simply reading jpg images? I have seen the TFRecords tutorials from tensorflow but it seems that the images are already all constructed in a tensor form.
I have tried a solution from: How do I convert a directory of jpeg images to TFRecords file in tensorflow?
But it didn't seem to work.
Upvotes: 2
Views: 1279
Reputation: 2312
Follow the code in the following link to solve your problem. I did exactly what you are asking for. (Converting a set of png, or jpeg, images to TfRecords (binary images). And I provided the way to read out the tfrecords. In addition, In my case, I have a a set of features which are stored in a string, and I stored them into the tfrecords.
Creating TfRecords from a list of strings and feeding a Graph in tensorflow after decoding
Hope this code will help you.
Upvotes: 1