This is a Custom Image Classification API built from scratch. The Custom Neural network is built with TensorFlow v1.
Don't forget to β this repo!
- Use this command to clone this repository:
https://github.com/siddheshgunjal/TF-Image-Classifier-API.git
- Create environment with your environ management tool, Virtualenv or Conda
- Install packages with pip using
pip install -r requirements.txt
To download training images for your classes you can utilise the python script from this gist. Procedure to use it is as below:
- Download chrome driver for your system from this link: chromedriver
- Open python script and add path to chromedriver at
line 11
or just uncomment the path for already included chromedriver for linux/windows. - Run scrapper with
python img_scrapper.py
in terminal. - Enter the search term (For example: Tiger)
- Enter the number of images to download (For example: 50)
- The script will then launch Google Chrome and start scrapping process. Wait till the scrapping process is complete.
- You can find the all the scrapped images in
./Data/Train_data/search_term
- You can download as many images as you want for as many classes.
- Put all your training data with folder for each class in
./Data/Train_data/class_name
- Start training with
python train.py
. Default epochs to train are set to 100. you can change it as per your need fromline 48
intrain.py
- You can also visualize training progress with tensorboard using
tensorboard --logdir Checkpoints/logs
- After training finishes, you'll get 2 files
model.json
: Neural Network architectureweights.h5
: Updated weights of neural network after training
Use python app.py
in terminal. This will start our application at localhost:8188
Use gunicorn -b :8188 -c gunicorn.conf.py app:app
in terminal. This will start our application at localhost:8188
Visit this URL in browser and you should see the message, Image Classification API is running. This verifies that our API is running at server side.
Go to localhost:8188/classification
for prediction task:
Drag your image in the drop zone or upload it and click Run Prediction, which will then run the prediction and show you the result with below screen:
Your Custom Image classification API is ready!
Please Refer AWS docker setup guide to deploy this application on AWS EC2 instance with docker.
If you get stuck, weβre here to help. The following are the best ways to get assistance working through your issue:
- Use our Github Issue Tracker for reporting bugs or requesting features. Contribution are the best way to keep this repo amazing πͺ
- If you want to contribute please refer Contributor's Guide for how to contribute in a helpful and collaborative way π