This project is using simple Tensorflow model and Flask to receive request from Restful API and give result whether object in image is dog or cat Database to store prediction value is SQLite.
Project is built using Python3.11 and above
- Setup Python virtual environment
python3 -m venv ./venv
source venv/bin/activate
- Install requirement package:
pip3 install -r requirements.txt
- Config threshold value for prediction:
flask_api/config/config.json
"model_idx": 0 // model will return 2 or more prediction score. Each score will be for 1 kind of animal
"threshold": 0.8 // Threshold value to detect of object is matched. Adjust it to reasonable value
- Start Restful API:
export PYTHONPATH="${PYTHONPATH}:./flask_api" && python3 flask_api/server.py
Wait until there is line * Running on http://127.0.0.1:5000
5. Run testing script: Add images to scripts/sample
cd scripts/
python3 sample_script.py
- Using webcam capture script:
cd scripts/
python3 webcam_capture.py
First run will always be failed due to permission for terminal to access Webcam.
Click Allow to access and re-run will give correct result
- Install SQLite driver and check database in
instance/dyneti.db