This project provides a Flask API for detecting TurtleBot objects using a custom-trained YOLOv5 model.
The API accepts an image file via a POST request and returns detected TurtleBots along with their bounding boxes, class IDs, and confidence scores.
The main repository for the course project can be found here: GitHub - TurtleBot Laser Tag.
-
Clone the repository
-
Install the necessary dependencies by running:
pip install -r requirements.txt
-
(Optional) If you have your own model, place it in the same directory as the script, or update the
model_pathvariable to reflect the correct path.
- Start the Flask server:
gunicorn --bind 0.0.0.0:5000 app:app
- The API will be available at
http://localhost:5000. - To detect TurtleBots, send a POST request to the
/detectendpoint with an image file attached. Example usage:curl -X POST -F "file=@your_image.jpg" http://localhost:5000/detect
The API will return a JSON response with the following structure:
{
"detections": [
{
"class_id": 0,
"confidence": 0.95,
"bounding_box": {
"x_center": 0.5,
"y_center": 0.5,
"width": 0.2,
"height": 0.3
}
}
]
}Or if there are no detections:
{
"message": "No objects detected."
}The model was trained on a dataset of TurtleBot images. It is available here: Dataset Link.