This example creates a SVM classifier for the digits dataset using scikit-learn, and predicts the values of hand-written digits of an input image.
The original experiment is composed by two steps:
- Classification: the SVM classifier is created.
- Prediction: the values of hand-written digits from the input file are predicted and recognized (output.jpg).
To run this experiment without ReproZip, you will need to first install scikit-learn and OpenCV 3.0.0, and then run each script with Python, in the aforementioned order.
The ReproZip package is available here (79.0 MB).
The experiment can be reproduced as follows:
$ reprounzip vagrant setup digits_sklearn_opencv.rpz digit-recognition/
$ reprounzip vagrant run digit-recognition/ classification
$ reprounzip vagrant run digit-recognition/ prediction
The input image with the predictions can be retrieved as follows:
$ reprounzip vagrant download digit-recognition/ output.jpg
You can also perform the same prediction with an alternate input file as follows:
$ reprounzip vagrant upload digit-recognition/ photo_2.jpg:photo.jpg
$ reprounzip vagrant run digit-recognition/ prediction
And finally download the results as follows:
$ reprounzip vagrant download digit-recognition/ output.jpg
If you are using our demo VM image, you can run the following:
$ vagrant ssh
$ workon digits-sklearn-opencv
$ cd reprozip-examples/digits-sklearn-opencv/
$ python generateClassifier.py
$ python performRecognition.py