The purpose of this repo is to provoide complete pipeline from training to deployment in local machine as well as Amazon sagemaker and deployment of trained model in some embedded hardware like Rasberrypie using cpp and tflite as well as in cloud using amazon sagemaker.
- Train, Prediction and Evaluation scripts for classifcation model
- Conversion from tensorflow model to tensorflow lite
- cpp files to use tensorflow lite model with option of using CPU or GPU delegates (The script can be used in some embedded device for inference)
- Model training and deployment in AWS sagemaker for cloud training and deployment
The repostiry contains tensorflow implementation of fruits 360 classification dataset which contains 131 coategories of fruits (https://github.com/Horea94/Fruit-Images-Dataset)
- Download the dataset from the above link
- To train the model python train.py --train_dir [path to train set] --test_dir [path to test set] --out_dir [path to output dir]
After 30 epochs Inception V3 model achieves 99.418% accuracy on test set
To test on one image python pred_one.py --weights [path to weight file] --input [path to input image]
To convert to tflite model python convert_to_tflite.py --weights_dir [path to .hdf5 file] --test_dir [path to test set]
See cpp-inference for cpp inference files
- cpp inference (XNNPACK delegate for CPU)(1 thread)
- cpp inference (GPU delegate)(cpu 1 thread)
For more detailed benchmarking see https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/tools/benchmark