- FastAPI backend with async SQLAlchemy - Camera RTSP management (add, start, stop) - Vehicle detection (YOLO + fast-alpr) - Type: car, motorcycle, truck, jeepney - Color detection (HSV) - License plate OCR - Motorcycle person count - Face detection + InsightFace ArcFace embedding - pgvector identity grouping (auto-cluster same face) - Vehicle + person movement trail APIs - Docker Compose with pgvector/pg16 - Models: Camera, VehicleIdentity, VehicleEvent, PersonIdentity, FaceEvent
43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
from pydantic_settings import BaseSettings
|
|
from typing import Optional
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
APP_NAME: str = "BantayCam"
|
|
APP_VERSION: str = "0.1.0"
|
|
DEBUG: bool = False
|
|
|
|
# Database
|
|
DATABASE_URL: str = "postgresql+asyncpg://bantaycam:bantaycam@localhost:5432/bantaycam"
|
|
|
|
# Storage (MinIO / local)
|
|
STORAGE_TYPE: str = "local" # "local" or "minio"
|
|
STORAGE_PATH: str = "./snapshots"
|
|
MINIO_ENDPOINT: str = ""
|
|
MINIO_ACCESS_KEY: str = ""
|
|
MINIO_SECRET_KEY: str = ""
|
|
MINIO_BUCKET: str = "bantaycam"
|
|
|
|
# AI Models
|
|
YOLO_MODEL: str = "yolov8n.pt" # Vehicle + person detection
|
|
PLATE_MODEL: str = "yolov8n.pt" # Plate detection (custom PH)
|
|
FACE_MODEL: str = "buffalo_l" # InsightFace model
|
|
GPU_DEVICE: int = 0 # -1 for CPU, 0 for first GPU
|
|
|
|
# Processing
|
|
PROCESS_EVERY_N_FRAMES: int = 5 # Skip frames for performance
|
|
FACE_SIMILARITY_THRESHOLD: float = 0.5 # Cosine distance threshold
|
|
PLATE_CONFIDENCE_THRESHOLD: float = 0.6
|
|
DETECTION_CONFIDENCE_THRESHOLD: float = 0.5
|
|
|
|
# Alerts
|
|
TELEGRAM_BOT_TOKEN: Optional[str] = None
|
|
TELEGRAM_CHAT_ID: Optional[str] = None
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
case_sensitive = True
|
|
|
|
|
|
settings = Settings()
|