Image processing using tensorflow, useful script stored in utils.
Unpack MNIST_data/mnist_data.zip to MNIST_data directory
Labels:
genFileList.py
Labels to dict:
labelFile2Map.py
Gen training datasets:
imnist.py
Using TFRecord data:
tfrecord.py
- Using images data.
classification.py - Using TFRecord data type.
classifier.py
Prediction and export_inference_graph in evaluation.py.
evaluation.py
If you need inference graph for OpenCV dnn using, you can see example of export_inference_graph at this code.
Predict single image example as
def predict(image_path):
...
return result
Also for predict batch images as
def predict_batch(images_dir):
...
return results
Notice that predict_batch returns a matrix, you can see it's shape by
print(np.asarray(results).shape)
Lenet:
lenet.py
Training Lenet by classifier.py
$ cd ImageProcessing
$ python classifier.py