PhotoRecall.YoloRunner is a component of the larger PhotoRecall project, which aims to develop an intelligent gallery app. The purpose of YoloRunner is to run various YOLO (You Only Look Once) implementations within Docker containers. Communication with these containers is done through HTTP. Each container features its own FastAPI interface and a YoloRunner class for getting predictions. Additionally, a base package named yolo_runner_base provides reusable code for each YoloRunner implementation.
- Ultralytics: Supports YOLO versions 3, 5, 6, 8, 9, 10.
- YOLOv7: Supports YOLO version 7.
To run the YoloRunner containers, you need to have Docker installed. Follow these steps to set up the containers:
-
Clone the repository:
git clone https://github.com/bartekbiz/PhotoRecall.YoloRunner.git cd PhotoRecall.YoloRunner
-
Start the containers using Docker Compose:
docker compose up -d
You can build the Docker images yourself.
docker build --tag 'photorecall-yolo_ultralytics_runner' -f yolo_ultralytics_runner/Dockerfile .
docker build --tag 'photorecall-yolo_7_runner' -f yolo_7_runner/Dockerfile .
To get predictions from the YoloRunner containers, you can make HTTP requests to the respective endpoints:
Example for the yolo_ultralytics_runner
:
curl -X 'GET' \
'http://localhost:8001/predict?photo_url=https%3A%2F%2Fultralytics.com%2Fimages%2Fbus.jpg&model_name=yolov10n.pt' \
-H 'accept: application/json'
Example for the yolo_7_runner
:
curl -X 'GET' \
'http://localhost:8002/predict?photo_url=https%3A%2F%2Fultralytics.com%2Fimages%2Fbus.jpg&model_name=yolov7.pt' \
-H 'accept: application/json'
The prediction results will be returned in JSON format as follows:
[
{
"name": "bus", // Name of the detected object class
"class": 5, // YOLO class ID
"confidence": 0.963834, // Confidence score
"box": { // Bounding box coordinates relative to the top-left corner of the image
"x1": 12.00015, // X-coordinate of the top-left corner
"y1": 230.99958, // Y-coordinate of the top-left corner
"x2": 804.00033, // X-coordinate of the bottom-right corner
"y2": 734.99994 // Y-coordinate of the bottom-right corner
}
}
]
GNU General Public License v3.0 or later. See LICENSE to see the full text.