This API detects whether the input image has a car or not
This API use CNN to predict whether input image contains a car or not.
Prediction model is written and trained in Keras and API is written in Python Flask.
This project use OpenCV for image manipulation and Keras + Tensorflow for model training and Prediction.
This project also use Flask for API.
Other required packages are documented in requirements.txt
python setup.py install
Pretrained models have been compressed and stored in project for space saving.
Next step is to unzip the model and copy to car_detection directory.
tar -xzvf car_detection_using_cnn.tar.gz
cp car_detection_using_cnn.h5 ./car_detection/
unzip the car_detection_using_cnn.zip file and copy the car_detection_using_cnn.h5 to car_detection folder.
python api.py
Prediction of car in an image is 2 step process.
- Upload image file on server
- Predict the image
Make a POST API call to below address with multipart file parameter.
http://[host]:[port]/upload
Here is sample example from Insomnia -
The image id for uploaded file which is returned in upload api will be used for prediction.
Make get API call to below address with imgid.
http://[host]:[port]/predict