This is a repository for an object detection inference API using YOLOv8
and FastAPI
This repository is used for 스마트해상물류 ICT project.
There are three operations: estimate_distance
, custom_model
, and area_intrusion
.
Each of these operations can be used to detect different anomalies in video.
Operation | Description |
---|---|
estimate_distance | GitHub Container Registry Token |
custom_model | Remote server IP |
area_intrusion | Remote server user name |
In this system, a publisher (camera) sends frames to multiple subscribers (users) via WebSocket. Subscribers receive processed frames based on the operation specified. For example:
{host}/ws/publishers/{location_name}?op={operation_name}
{host}
: APAP AI server address{location_name}
: Camera location or context{operation_name}
: Operation to apply (e.g., estimate_distance)
{host}/ws/subscribers/{location_name}
{host}
: APAP AI server address{location_name}
: Camera location or context
![image](https://private-user-images.githubusercontent.com/38815540/367493061-3993ee1a-af1e-46a4-aea9-951a74fb76b5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwMDYwNDksIm5iZiI6MTczOTAwNTc0OSwicGF0aCI6Ii8zODgxNTU0MC8zNjc0OTMwNjEtMzk5M2VlMWEtYWYxZS00NmE0LWFlYTktOTUxYTc0ZmI3NmI1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDA5MDkwOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWEyYjcxMDE0NWJiMWVkNzJlMjg3ZGU5ZDAyZDZmODMyMDk1NWYyOGE2NThiN2UxNDNiNjZhNDI4ZjZiNGJkODQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.j84fWX0gB4IajbFuAumKfXV2kiuYTpzUa2BO6SjHPo4)
Dependencies are managed using Poetry
.
pip install poetry
poetry install
poetry run uvicorn --host=127.0.0.1 app.main:app
Environment variables are managed through dotenv.
The defined variables are referenced from the .env
file in the root directory.
Documentation is provided through SwaggerUI
, which is built into FastAPI
by default.
http://localhost:8080/docs
poetry run pytest
The following variables need to be defined in the Environment secrets
:
Variable | Description |
---|---|
GHCR_TOKEN | GitHub Container Registry Token |
REMOTE_IP | Remote server IP |
REMOTE_USER | Remote server user name |
REMOTE_PRIVATE_KEY | Remote server private key |
REMOTE_SSH_PORT | 22 |