I am new to tensor flow, and I start with the official MNIST example code to find out the logic of tensor flow. However, one thing that I didnβt feel very well is that the MNIST example provides the source dataset as some compressed files whose format is not clear to beginners. This case also applies to Cifar10, which provides a dataset as a binary file. I think that in the deep learning practical task, our data set can have many image files, such as *.jpg or *.png in the directory, as well as a text file that records the label of each file (for example, an ImageNet data set). Let me use MNIST as an example.
MNIST contains 50k training images of 28 x 28 size. Now suppose these images are in jpg format and are stored in the ./dataset/ directory. In ./dataset/ we have a text file label.txt that stores the label of each image:
/path/to/dataset/ image00001.jpg image00002.jpg ... ... ... ... image50000.jpg label.txt
where label.txt as follows:
#label.txt: image00001.jpg 1 image00002.jpg 0 image00003.jpg 4 image00004.jpg 9 ... ... ... ... image50000.jpg 3
Now I would like to use Tensorflow to train a single-layer model with these datasets. Can someone help make a simple code snippet for this?
python tensorflow
C. Wang
source share