This repository holds our backend for serving our Tensorflow2 object detection model.
While Sustainability relies on community efforts to validate images submitted by the users, we can reduce the amount of effort required by the community and increase the accuracy of the data collected.
When a user takes a photo, the AI can run inference on these images. For each image, if the users' validation result correspond to the AI's result, it eliminates the need for other users to look at the image again. Hence, we can reduce the number of users needed to validate per image taken.
Furthermore, as more data are collected, these images can be used to retrain the AI and improve its performance. Eventually, we foresee a future where community validation is no longer needed when the trained model is robust enough, and its error rate is acceptable.
Tech | Version |
---|---|
TensorFlow | 2.12.0 |
Flask | 2.2.2 |
The server only exposes a single POST request on {hostname}/api/upload
curl -X POST -F file=@"<path to img>" {hostname}/api/upload
This setup was only tested on python 3.10.8
- Install python dependencies
pip install -r requirements.txt
- Install TensorFlow's object detection api
Follow instructions here
- (Optional) Setup environment variables
ENV | Example |
---|---|
PIPELINE_CONFIG_PATH | configs/ssd_efficientdet_d2_768x768_coco17_tpu-8.config |
CHKPT_DIR | trained_models/efficientdet_d2_coco17_tpu-32/checkpoint |
LABEL_MAP_PATH | label_maps/labels.pbtxt |
DETECT_THRESHOLD | 0.7 |
- Run server
flask run