Production-grade MLOps pipeline for PPE (Personal Protective Equipment) detection using YOLO object detection.
SentinelOps aims to provide a robust, scalable, and automated MLOps pipeline for computer vision models. Moving from isolated Jupyter notebooks to a structured, reproducible environment is crucial for bringing AI models reliably into production.
graph TD
A[Raw Data] -->|DVC| B[Versioned Dataset]
B --> C[Training Pipeline]
C -->|MLflow| D[Experiment Tracking & Model Registry]
D --> E[FastAPI Inference]
E -->|Evidently| F[Monitoring]
| Layer | Technology |
|---|---|
| Data Versioning | DVC |
| Experiment Tracking | MLflow + DagsHub |
| Modeling | Ultralytics YOLO11 |
| Inference API | FastAPI, Uvicorn |
| Frontend App | Next.js, React, Tailwind CSS |
| Monitoring | Evidently |
| Testing & Formatting | Pytest, Black, Flake8 |
Model: YOLO11s (Fine-Tuned)
Classes:
- π¦Ί Reflective Jacket
- βοΈ Safety Helmet
Dataset:
- 4,864 labeled instances
- 1,427 validation images
| Metric | Value |
|---|---|
| Precision | 93.3% |
| Recall | 91.4% |
| mAP50 | 96.4% |
| mAP50-95 | 77.9% |
The model achieves near-production accuracy with a precisionβrecall balance above 90%, making it suitable for real-time safety monitoring.
| PrecisionβRecall Curve | F1 Curve |
|---|---|
![]() |
![]() |
| Standard | Normalised |
|---|---|
![]() |
![]() |
π For detailed explanations of each chart, see docs/training/README.md.
| Parameter | Value |
|---|---|
| Architecture | YOLO11s |
| Framework | Ultralytics |
| Tracking | MLflow + DagsHub |
| Training Time | 2.44 hours |
| GPU | NVIDIA Tesla T4 |
| Input Size | 640Γ640 |
| Epochs | 50 |
The models/ppe_detector/best.pt file contains the best-performing checkpoint selected by validation mAP during training. It can be loaded directly with the Ultralytics library:
from ultralytics import YOLO
model = YOLO("models/ppe_detector/best.pt")from ultralytics import YOLO
model = YOLO("models/ppe_detector/best.pt")
results = model.predict(
source="video.mp4",
conf=0.25,
show=True,
show=True,
save=True
)You can run SentinelOps locally by starting both the FastAPI backend and the Next.js frontend.
Open a terminal, activate your virtual environment, and run the FastAPI server:
# From the root of the SentinelOps project
source venv/bin/activate
uvicorn app.api.app:app --port 8001The API will be available at http://localhost:8001.
Open a new terminal, navigate to the frontend directory, and start the Next.js development server:
cd frontend
npm install
npm run devThe web application will be available at http://localhost:3000.
SentinelOps includes a production-ready multi-stage Dockerfile that runs the API as a non-root user.
docker build -t sentinelops:latest .docker run -d \
--name sentinelops \
-p 8000:8000 \
-e HOST=0.0.0.0 \
-e PORT=8000 \
-v $(pwd)/artifacts:/app/artifacts \
-v $(pwd)/config:/app/config \
sentinelops:latestThis maps port 8000, provides required environment variables, and mounts the artifacts and config directories so persistent data is retained outside the container.
SentinelOps uses pydantic-settings for robust, type-checked centralized configuration.
All settings are managed via the ENVIRONMENT variable (defaults to dev).
This variable automatically loads the corresponding .env file from the config/environments/ directory.
- Development (
ENVIRONMENT=dev): Loadsconfig/environments/.env.dev. Uses localartifacts/directories. - Production (
ENVIRONMENT=prod): Loadsconfig/environments/.env.prod. Connects to external databases (postgres/redis) and mounted volume paths.
If you are running the system outside of Docker Compose, ensure you copy .env.example to .env and set ENVIRONMENT=dev or your desired target.
SentinelOps includes a docker-compose.yml for standing up the full infrastructure stack (Backend API, PostgreSQL, Redis) simultaneously.
- Ensure you have populated your environment variables (see
.env.example). - Bring up the stack in detached mode:
docker-compose up -dThe services are configured with health checks and persistent volumes for databases and application artifacts.
To view logs:
docker-compose logs -f backendTo tear down the stack:
docker-compose down.
βββ app/ # Alert management system (API + service)
βββ config/ # Centralised settings
βββ frontend/ # Next.js web application (Dashboard & Live Streams)
βββ docs/ # Documentation & training artifacts
β βββ training/ # Evaluation curves & confusion matrices
βββ inference/ # Model loader, predictor, tracker, compliance
β βββ api/ # FastAPI inference service
βββ models/
β βββ ppe_detector/ # Production model weights
βββ monitoring/ # Data drift monitoring
βββ schemas/ # Typed data schemas
βββ scripts/ # Utility scripts
βββ src/ # Dataset validation, model registry
βββ tests/ # Unit & structural tests
βββ training/ # Training configs & presets
βββ utils/ # Logger, image validator
βββ .gitignore
βββ Makefile
βββ README.md
βββ requirements.txt
- Phase 0: Project Foundation (Setup, Environments, Boilerplate)
- Phase 1: Dataset Versioning & Preparation
- Phase 2: Model Training & Experiment Tracking
- Phase 3: Inference API (FastAPI)
- Phase 4: Monitoring Dashboard (Streamlit & Evidently)
- Phase 5: CI/CD and Cloud Deployment
- Cloud integration (AWS S3 / GCP Cloud Storage) for DVC remotes.
- Automated CI/CD pipelines with GitHub Actions.
- Dockerization of the inference and dashboard services.
- Advanced monitoring alerts and drift-triggered retraining.






