Back to Case Studies

MLOps Platform for Industrial Leak and Fire Detection

SageMaker Pipelines, MLflow and YOLOv8 for Edge Cameras

ProductionEnergy, Utilities & EnvironmentManufacturing & IndustryMay 2023 – Feb 2024MLOps, Infrastructure & Data Science
0.94
mAP@50 of the detection models
< 1 s
Alert latency from camera to detection
99.9%
System uptime
100% IaC
ML platform deployed with Terraform

My Role

Role
Sole MLOps engineer, consultant
Independent consulting
Team
Me + 2 ML engineers, lead, PM
Stage reached
In production, handed over
Key decisions
  • Whole ML platform as Terraform infrastructure as code
  • MLflow registry to select models by metric
  • Shared helper package for the ML engineers

Approach at a Glance

Details
  1. 1Infrastructure as Code
  2. 2SageMaker Training Pipelines
  3. 3Experiment Tracking and Model Registry
  4. 4ML Helper Package
  5. 5Detection Models
  6. 6CI/CD and Access

Executive Summary

The machine learning platform behind a camera-analytics system for industrial sites in the oil and gas sector. Cameras on site, regular PTZ and thermal optical gas imaging (OGI), watch equipment around the clock, and models on edge devices detect gas leaks, liquid leaks, fire and smoke, raising alerts within less than a second.

When I joined, models were trained by hand, with no shared way to track experiments, compare models or reproduce a training run. I designed and built the MLOps platform on AWS, fully in Terraform:

  • Pipelines: SageMaker training and evaluation pipelines, plus a hyperparameter-tuning pipeline with Ray Tune.
  • Tracking: MLflow for experiments and the model registry, and TensorBoard.
  • Shared tooling: a Python helper package for data access, model selection and video inference.

On that platform I fine-tuned YOLOv8 detection models for fire, smoke and gas leaks, which reached mAP@50 of 0.94, with precision 0.92 and recall 0.89. The system runs with 99.9% uptime. I was the only MLOps engineer, working as a consulting engineer through an outsourcing partner, and the client's ML team kept using the platform after handover.


Client Profile

The client builds AI camera analytics for industrial safety in oil and gas: detecting leaks of gas and liquids, fire and smoke at sites where an unnoticed leak means emissions, losses or danger. Detection runs at the edge, next to the cameras, on NVIDIA Jetson devices.

The ML side had outgrown its tooling:

  • No reproducibility: models were trained ad hoc, so it was hard to say which data and settings produced which model.
  • No model management: there was no central place to compare experiments, pick the best model by its metrics and promote it.
  • Hard-to-see targets: gas plumes in thermal OGI video are faint, change shape and blend with the background, and smoke looks like steam or clouds. The models needed careful, repeatable training and evaluation.
  • Security: a cloud environment with proper isolation, encryption and access control, managed by a small team.

Technical Approach

  1. Infrastructure as Code – The whole platform is defined in Terraform, with remote state in versioned, encrypted S3 and state locking, so each environment can be recreated from code.

  2. SageMaker Training Pipelines – A SageMaker pipeline runs a training step, fine-tuning YOLOv8, followed by a processing step that evaluates the model. A second pipeline runs hyperparameter tuning with Ray Tune. Each step runs in a custom container image, with configs, data, models and outputs organised in S3 per user.

  3. Experiment Tracking and Model Registry – An MLflow server on ECS Fargate behind a load balancer, with PostgreSQL as backend and S3 for artifacts, logs parameters, metrics, datasets and models for every run. TensorBoard runs alongside it. Credentials sit in AWS Systems Manager, and the platform runs in its own VPC with encryption keys and flow logs.

  4. ML Helper Package – A shared Python package, published to a private package repository, gives the ML engineers one toolkit:

    • connectors to S3 and the client's databases;
    • model selection from the MLflow registry by a chosen metric;
    • YOLOv8 video inference;
    • saving mispredictions for review and relabeling;
    • dataset splitting and cross-validation.
  5. Detection Models – Using the platform, I fine-tuned YOLOv8 models for fire and smoke and for gas leaks, including smoke data extended with manually labelled images. They reached precision 0.92, recall 0.89, mAP@50 0.94 and mAP@50-95 0.70.

  6. CI/CD and Access – Bitbucket Pipelines deploy the infrastructure and publish the package, authenticating to AWS with OIDC instead of stored keys. Network peering gives database clients secure access across accounts.


Business Outcome

The client's ML work moved from manual training runs to a reproducible, tracked process. Every experiment is logged, every model can be compared by its metrics, and the best one is selected from the registry. The detection models reached mAP@50 of 0.94, the system raises alerts in under a second, and it runs with 99.9% uptime. The platform was handed over, and the client's ML team continued to use it after the contract ended.

Technologies

MLOpsAWS SageMaker PipelinesMLflowTerraformRay TuneYOLOv8Computer VisionThermal / OGI CamerasNVIDIA JetsonECS FargateBitbucket Pipelines

Planning something similar?

Tell me about it on a short call. New projects can start within 2 weeks