AI Safety Monitoring System for Mines and Quarries

We design and deploy artificial intelligence systems: from prototype to production-ready solutions. Our team combines expertise in machine learning, data engineering and MLOps to make AI work not in the lab, but in real business.
Showing 1 of 1All 1564 services
AI Safety Monitoring System for Mines and Quarries
Medium
~2-4 weeks
Frequently Asked Questions

AI Development Areas

AI Solution Development Stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1358
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1250
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    956
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1188
  • image_logo-advance_0.webp
    B2B Advance company logo design
    646
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    929

Mining is the second deadliest sector after construction. In underground mines, the risk of fatal incidents is 3 times higher than in open pits. A typical challenge: PPE monitoring in poor lighting (down to 10 lux), dust, hazardous zone control, personnel tracking, and emergency detection. Automating PPE and danger zone monitoring can reduce accidents by 30–50%. Classical CV systems fail: helmet detection accuracy in darkness drops to 50%. We use modern neural network detectors like YOLO, fine-tuned on specialized datasets, achieving stable 85–95% accuracy even in harsh conditions.

We develop end-to-end AI solutions: from dataset collection to deployment on video servers. Our experience: over 5 years in industrial CV, 30+ projects for mining companies. We guarantee a compliance rate of at least 85% at the acceptance stage.

Problems We Solve

Underground mines are an extreme environment for computer vision. Low light (down to 10 lux), coal dust suspensions, high humidity. Traditional detectors based on Haar cascades or color thresholding give 50–60% accuracy — unacceptable. Another challenge: false positives on mining equipment. Tracking errors when people cross paths with machinery. Without SCADA integration, it's impossible to automatically block dangerous zones. We implement OPC-UA / Modbus TCP with a latency of no more than 500 ms.

What AI Models Do We Use for Violation Detection?

Our base stack is YOLOv8/9 with ByteTrack tracking. For low-light underground conditions, we apply CLAHE preprocessing (1.5–2x contrast boost) and optionally LWIR thermal cameras. Our proprietary Mine Safety Dataset contains 15,000+ annotated frames with 8 classes: person, mining_helmet, headlamp, reflective_jacket, dust_mask, safety_boots, no_helmet, no_headlamp, mining_equipment.

import numpy as np
import cv2
from ultralytics import YOLO
from dataclasses import dataclass
import time
from typing import Optional

@dataclass
class MineWorkerStatus:
    worker_id: int
    bbox: list
    has_helmet: bool
    has_lamp: bool
    has_reflective_vest: bool
    has_mask: bool
    in_danger_zone: bool
    proximity_to_machinery: bool
    compliance: bool

class MineMonitoringSystem:
    """
    Mining safety monitoring system.
    Accounts for specifics: low light, smoke/dust, IR cameras.
    Mine Safety Dataset (custom):
    - mining_helmet, lamp_headlamp, reflective_jacket
    - mining_equipment, person, danger_zone_marker
    """
    MINE_PPE_CLASSES = {
        0: 'person',
        1: 'mining_helmet',     # helmet with lamp
        2: 'headlamp',          # lamp separately
        3: 'reflective_jacket', # reflective vest
        4: 'dust_mask',
        5: 'safety_boots',
        6: 'no_helmet',         # violation
        7: 'no_headlamp',       # violation
        8: 'mining_equipment',  # combine, loader
    }

    CRITICAL_ZONES = ['roof_instability', 'gas_presence', 'machinery_working']

    def __init__(self, model_path: str,
                  thermal_model_path: Optional[str] = None,
                  danger_zones: Optional[dict] = None,
                  device: str = 'cuda'):
        self.model = YOLO(model_path)
        self.thermal_model = YOLO(thermal_model_path) if thermal_model_path else None
        self.danger_zones = danger_zones or {}
        self.device = device
        self._worker_tracks: dict[int, dict] = {}

    def process_frame(self, frame: np.ndarray,
                       camera_id: str,
                       timestamp: float = None) -> dict:
        if timestamp is None:
            timestamp = time.time()

        # Enhancement for dark/dusty conditions
        enhanced = self._enhance_low_light(frame)

        results = self.model.track(
            enhanced, persist=True, conf=0.40,
            verbose=False, tracker='bytetrack.yaml'
        )

        workers_status = []
        violations = []

        if results[0].boxes is None:
            return self._empty_result(camera_id, timestamp)

        persons = {}
        ppe_items = {}

        for box in results[0].boxes:
            cls_id = int(box.cls.item())
            cls_name = self.MINE_PPE_CLASSES.get(cls_id, 'unknown')
            x1, y1, x2, y2 = map(int, box.xyxy[0])
            cx, cy = (x1+x2)//2, (y1+y2)//2
            tid = int(box.id.item()) if box.id is not None else -1

            if cls_name == 'person':
                persons[tid] = {
                    'bbox': [x1,y1,x2,y2], 'center': (cx,cy),
                    'has_helmet': False, 'has_lamp': False,
                    'has_vest': False, 'has_mask': False,
                    'violations': []
                }
            elif cls_name in ('no_helmet', 'no_headlamp'):
                ppe_items[tid] = {
                    'type': cls_name, 'center': (cx, cy),
                    'violation': True
                }
            elif cls_name in ('mining_helmet', 'headlamp',
                               'reflective_jacket', 'dust_mask'):
                ppe_items[tid] = {
                    'type': cls_name, 'center': (cx, cy),
                    'violation': False
                }

        # Associate PPE with workers
        for item_tid, item_data in ppe_items.items():
            nearest = self._find_nearest(item_data['center'], persons)
            if nearest is None:
                continue
            p = persons[nearest]
            if item_data['violation']:
                p['violations'].append(item_data['type'])
            else:
                t = item_data['type']
                if t == 'mining_helmet':
                    p['has_helmet'] = True
                elif t == 'headlamp':
                    p['has_lamp'] = True
                elif t == 'reflective_jacket':
                    p['has_vest'] = True
                elif t == 'dust_mask':
                    p['has_mask'] = True

        # Evaluate each worker
        for pid, pdata in persons.items():
            in_danger = self._check_danger_zone(pdata['center'])
            compliance = (pdata['has_helmet'] and
                          not pdata['violations'] and
                          not in_danger)

            ws = MineWorkerStatus(
                worker_id=pid, bbox=pdata['bbox'],
                has_helmet=pdata['has_helmet'],
                has_lamp=pdata['has_lamp'],
                has_reflective_vest=pdata['has_vest'],
                has_mask=pdata['has_mask'],
                in_danger_zone=in_danger,
                proximity_to_machinery=False,
                compliance=compliance
            )
            workers_status.append(ws)

            if not compliance or pdata['violations']:
                violations.append({
                    'worker_id': pid,
                    'bbox': pdata['bbox'],
                    'issues': pdata['violations'] + (['danger_zone'] if in_danger else []),
                    'severity': 'critical' if in_danger else 'warning'
                })

        total = len(workers_status)
        compliant = sum(1 for w in workers_status if w.compliance)

        return {
            'camera_id': camera_id,
            'timestamp': timestamp,
            'workers': [w.__dict__ for w in workers_status],
            'violations': violations,
            'compliance_rate_pct': round(compliant/max(total,1)*100, 1),
            'critical_alert': any(v['severity']=='critical' for v in violations)
        }

    def _enhance_low_light(self, frame: np.ndarray) -> np.ndarray:
        """Enhance visibility in dark mine conditions"""
        lab = cv2.cvtColor(frame, cv2.COLOR_BGR2LAB)
        clahe = cv2.createCLAHE(clipLimit=4.0, tileGridSize=(8,8))
        lab[:,:,0] = clahe.apply(lab[:,:,0])
        enhanced = cv2.cvtColor(lab, cv2.COLOR_LAB2BGR)
        # Slight brightness boost
        enhanced = cv2.convertScaleAbs(enhanced, alpha=1.2, beta=20)
        return enhanced

    def _check_danger_zone(self, center: tuple) -> bool:
        for zone_id, polygon in self.danger_zones.items():
            poly = np.array(polygon, dtype=np.int32)
            if cv2.pointPolygonTest(poly,
                                     (float(center[0]), float(center[1])), False) >= 0:
                return True
        return False

    def _find_nearest(self, center: tuple, persons: dict) -> Optional[int]:
        min_dist = 150
        nearest = None
        cx, cy = center
        for pid, p in persons.items():
            px, py = p['center']
            dist = np.sqrt((cx-px)**2 + (cy-py)**2)
            if dist < min_dist:
                min_dist = dist
                nearest = pid
        return nearest

    def _empty_result(self, camera_id: str, timestamp: float) -> dict:
        return {
            'camera_id': camera_id, 'timestamp': timestamp,
            'workers': [], 'violations': [],
            'compliance_rate_pct': 100.0, 'critical_alert': False
        }

How We Collect the Dataset and Train the Model

Data collection is done from cameras on site under various conditions: day, night, dust. Labeling is performed in LabelStudio by safety experts (8 classes). During training, we apply augmentations: brightness variation, adding noise, simulating dust (motion blur + Gaussian noise). We use YOLOv8/9 with pretrained weights on COCO, fine-tuned on our Mine Safety Dataset (15,000+ frames). Training is done on GPU A100 or RTX 4090 for 2–3 days. The final model is validated on a holdout set — target mAP50 0.85+.

How We Test and Guarantee Accuracy

We compare detection with expert video analysis. Typical metrics:

Condition Detection Rate False Positive
Normal lighting (open pit) 93–97% 2–4%
Dark mine (CLAHE enhanced) 82–89% 6–12%
Dust/smoke (degradation factor 15–30%) 72–82% 10–18%
LWIR thermal (any conditions) 88–94% 3–7%

LWIR thermal cameras outperform RGB cameras in dust and smoke by 2–3 times in detection accuracy. We recommend an RGB+LWIR combination for underground sections. Project cost is calculated individually based on the number of cameras and control zones. Savings on fines and downtime amount to up to 40% annually.

What Is Included in the Work?

We handle the full cycle: audit of existing surveillance systems, dataset collection (labeling considering mine specifics), model training, tracker configuration, SCADA and MES integration, server supply or inference on existing equipment.

  • Documentation: ETL flow diagrams, API documentation (REST/RTSP), operation manual.
  • Access to a web dashboard with real-time compliance_rate_pct, heat map of danger zones.
  • Operator training (2 days, online or on-site).
  • Technical support for 3 months after launch.
SCADA Integration Details Integration is implemented via OPC-UA or Modbus TCP. The system sends alarm signals (danger_zone, violation) directly to the SCADA server, allowing automatic equipment blocking when PPE is violated in a danger zone. Response time: no more than 500 ms from detection to signal output.

Indicative Deployment Timelines

Task Duration
PPE monitoring for open pit (good lighting) 4–6 weeks
Underground mine + IR + SCADA integration 10–16 weeks
Enterprise mine safety platform 18–28 weeks

Exact estimate after audit. We visit the site or analyze camera recordings. We will evaluate your project for free — contact us to get a consultation.

Guarantees and Support

Over 5 years in industrial CV, 30+ implementations, a team of senior AI/ML engineers. Our systems operate in mines in Kazakhstan, Russia, and South Africa. We guarantee a compliance rate of at least 85% at the acceptance stage. According to National Institute for Occupational Safety and Health, automated PPE monitoring reduces injuries by 35–50%. Contact us for a free audit of your facility. Request a demo of the system.

How Distribution Shift Kills CV Model Metrics in Industry

On a production line, a camera is installed to control product quality. The model is trained on 10,000 labeled images—test accuracy mAP 0.84. Deployed to production, and in the first week it misses 30% of defects. Lighting on the line changes between shifts; distribution shift nullifies the metrics. This is a classic story with computer vision in industry, where pattern recognition fails without proper drift handling.

Our engineers, with experience from 60+ computer vision projects, know how to eliminate such scenarios. We guarantee stable model performance under real conditions.

Object Detection: YOLO, RT-DETR, and Everything in Between

YOLO is the standard for real-time detection. YOLOv8 and YOLOv11 from Ultralytics are the most used versions in production: simple API, active community, built-in validation, and export to ONNX/TensorRT. For tasks with high accuracy requirements and less critical latency, RT-DETR, a transformer-based architecture without NMS, gives better mAP on COCO at comparable speed to YOLOv8l.

Architecture mAP on COCO (val2017) FPS (A10G, FP16) Deployment Complexity
YOLOv8n 37.3 700+ Low (ONNX/TensorRT)
YOLOv8m 50.2 250 Low
RT-DETR-L 53.0 140 Medium (requires PyTorch)
Mask R-CNN 38.2 (bbox) 30 High

A typical mistake when training a detector: dataset of 8000 images, 3 classes, fine-tune YOLOv8m—F1 0.73 on validation. Look at confusion matrix—one class is almost never detected. Cause: imbalance 1:23. Solution: oversampling rare class, focal loss for objectness, augmentations (Mosaic, MixUp disabled for rare class as they "blur" it). Transfer learning is mandatory: pretrained on COCO weights reduces data requirement by 10 times. Fine-tuning on 500–2000 domain images yields a working model in 1–2 days on a single GPU.

For edge deployment: export to ONNX → TensorRT engine. YOLOv8n in TensorRT FP16 on Jetson AGX Orin gives 150+ FPS at P99 latency < 8 ms—3 times faster than ONNX Runtime without TensorRT. On server A10G: 700+ FPS for YOLOv8n in TensorRT INT8.

How Does Fine-Tuning YOLO Help in Pattern Recognition?

Suppose you need to find micro-defects on a metal surface—a task with high resolution and class imbalance. We use YOLOv8m pretrained on COCO and fine-tune on 2000 proprietary images. Apply augmentations Mosaic, MixUp, random perspective. After 200 epochs, mAP 0.5 reaches 0.93. Key techniques:

  • Focal loss for the objectness head—reduces contribution of easily classified examples.
  • Class-balanced sampling—equalizes representation of rare classes.
  • Test Time Augmentation (TTA)—increases recall by 5–7% through averaging over flips and scales.

Get a consultation on architecture selection for your task—contact us.

Segmentation: SAM, Mask R-CNN, and Instance Segmentation

SAM (Segment Anything Model) from Meta changed the approach to segmentation. SAM 2 works with video, supports object tracking across frames—for interactive object selection by point or bbox, it's the best out-of-the-box choice. For production instance segmentation without interactive prompting, Mask R-CNN or YOLOv8-seg are used. YOLOv8-seg trains like a regular detector with additional masks, convenient in the same pipelines. Semantic segmentation (each pixel is a class) uses SegFormer, DeepLabV3+. SegFormer-B5 provides a good balance of accuracy and speed for satellite imagery or medical segmentation.

Case study: cell segmentation on microscopic images. Dataset of 400 images with manual annotation. Training Mask R-CNN on ResNet-50 backbone gave IoU 0.61—poor. Problem: objects (cells) overlap; standard NMS kills overlapping predictions. Solution: switch to cellpose (specialized architecture for biomedical tasks) + soft-NMS. IoU increased to 0.79.

OCR: When Tesseract Fails

Tesseract is a starting point for simple tasks: printed text, good lighting, straight layout. As soon as there are handwritten elements, non-standard fonts, perspective distortions, or multi-column layouts, Tesseract degrades quickly.

PaddleOCR is a production-grade solution: text block detection + recognition + structural analysis. Works out of the box for 80+ languages, including Russian. Supports tables and complex document structures. TrOCR (Microsoft) is a transformer OCR with strong results on handwritten text. For Russian handwritten text, fine-tuning is needed: the base model is trained mostly on Latin script.

What to Do When Tesseract Cannot Handle Pattern Recognition on Documents?

For tasks like "extract data from invoices/contracts/passports," we use LayoutLMv3 or Donut—these models understand document layout, not just text. Integration via Hugging Face Transformers, fine-tuning on 200–500 annotated documents. Typical pipeline:

  1. Preprocessing: deskew, denoising, binarization via OpenCV.
  2. Text block detection: PaddleOCR detection or CRAFT.
  3. Recognition: PaddleOCR recognition or TrOCR.
  4. Post-processing: normalization, validation via regex or LLM for structured fields.

For documents with fixed structure, template matching + OCR by coordinates is often more reliable than an end-to-end solution.

Face Recognition: Identification and Verification

Face recognition = detection + alignment + embedding + matching. Each stage matters.

Detection: RetinaFace or InsightFace for accurate face localization and keypoints. MTCNN is older but reliable. Embedding: ArcFace (InsightFace) is state-of-the-art for face recognition embeddings. Models iresnet50/iresnet100 pretrained on MS1MV3 (5M identities). Embedding vector 512 float32, comparison by cosine similarity. Threshold tuning: decision threshold is a critical parameter. At threshold 0.6, typical FPR on LFW benchmark is 0.001, TPR is 0.985. In production, threshold must be calibrated to the real distribution: people in masks, with changed appearance, different lighting conditions. Liveness detection is mandatory: MiniFASNet—lightweight model on CPU; FaceX-Zoo contains several pretrained liveness detectors.

Video Analytics

Video is a sequence of frames plus a temporal dimension. A naive approach—detecting on every frame—is expensive.

Tracking: ByteTrack and BoT-SORT are the standard for multi-object tracking. They work on top of any detector, adding persistent IDs to objects across frames—enabling object counting, motion tracking, velocity.

Optimization: not every frame needs processing. For static scenes, detect every 5–10 frames, with tracking in between. For event detection (person entering a zone), background subtraction (OpenCV MOG2) serves as a lightweight pre-filter before neural detection. Action recognition: SlowFast, VideoMAE for action classification. Heavy models—for production use ONNX export + TensorRT or offline processing.

How to Measure Pattern Recognition Model Quality in Production?

Quality monitoring is key to MLOps. We track:

  • Prediction confidence distribution.
  • Share of low-confidence predictions (indicator of OOD data).
  • Drift of input images via feature distribution (embeddings from backbone).

A drop in average confidence from 0.87 to 0.71 over a week is an early signal of distribution shift. NVIDIA Triton Inference Server recommends tracking these metrics via Prometheus. Our certified engineers set up monitoring and guarantee SLA for inference quality.

Deployment of CV Models

For online inference, we use Triton Inference Server (NVIDIA)—production standard for serving CV models. Supports TensorRT, ONNX, PyTorch, dynamic batching, multiple instances. REST and gRPC API. We guarantee stable operation under load.

Edge deployment: ONNX Runtime on ARM/x86 CPU. TensorFlow Lite for mobile devices. OpenVINO for Intel CPU/GPU/VPU—gives 2–3× speedup on Intel hardware compared to ONNX Runtime. After deployment, we hand over the model with documentation and train personnel.

What Is Included in the Work

Stage Content Estimated Time
Analysis Technical specification, architecture selection, data evaluation 3–5 days
Labeling Image collection, annotation (up to 5000 objects) 1–3 weeks
Training Model fine-tuning, validation on test set 1–2 weeks
Optimization Export to ONNX/TensorRT/OpenVINO, testing on target hardware 1–2 weeks
Integration REST/gRPC API, integration with existing infrastructure 1–2 weeks
Deployment Deployment on server or edge device, load testing 1 week
Documentation and training Instructions, staff training, handover of code and model 3–5 days
Support Technical support for 3 months after launch

Deadlines and Cost

A prototype detector on existing data takes 1–2 weeks. Production system with optimization for target hardware takes 4–8 weeks. Full cycle including data labeling (1000–5000 images) takes 2–4 months. Cost is calculated individually for each task. Typical savings from implementing a quality control system can be significant per production line.

We have been in the market for over 5 years and completed 60+ computer vision projects. We will evaluate your project end-to-end—request a consultation to get a quote and technical proposal.