A project to classify images containing vernacular text using the Nanonets Image classification api. The code is in python
You need to clone the repository using the command:
git clone https://github.com/nanonets/vernacular_demo.git
- python 2.7
- pip
- requests
On ubuntu run:
sudo apt-get install python-setuptools python-dev build-essential
sudo pip install requests
project
│ README.md
│
└───code
│ │ create_model.py
│ │ get_model_state.py
│ │ predict_file.py
│ │ predict_url.py
│
│
└───images
│
└───HindiJokes
│ │ 1.jpg
│ │ 2.jpg
│ │ ...
│
└───TeluguJokes
│ │ 1.jpg
│ │ 2.jpg
│ │ ...
│
└───MarathiJokes
│ │ 1.jpg
│ │ 2.jpg
│ │ ...
│
└───BengaliJokes
│ 1.jpg
│ 2.jpg
│ ...
There are 3 steps:
- Creating a model
- Checking the model state
- Testing the model
To create a model run:
python code/create_model.py
This will create a model, upload the data and train the model. This will take a while to run. This will also print a MODEL_ID you need this for the next step.
To test the state of the model run:
python code/get_model_state.py MODEL_ID
This will output the state of the model. Once the state of the model is trained we can begin using the model. Trained is a MODEL_STATE = 5
To test the model once the image has been trained either pass a file or pass a url:
python code/predict_file.py MODEL_ID path/of/image/file.jpg
python code/predict_file.py MODEL_ID https://myurl.domain.com/image.jpg
The training data we used had the following images:
- HindiJokes - 152
- MarathiJokes - 150
- BengaliJokes - 146
- TeluguJokes - 146
The accuracy of the model was 90%
For api documentation please visit https://nanonets.com/documentation/
This project is licensed under the MIT License