DEV Community

Kenechukwu Anoliefo
Kenechukwu Anoliefo

Posted on

Project Review: AI-Powered Oil Spill Detection Using Deep Learning

Oil spills remain one of the most damaging environmental disasters affecting marine ecosystems, coastal communities, and global economies. Early detection is critical, but traditional monitoring methods are often slow, expensive, and limited in coverage. This is where artificial intelligence and satellite imagery come in.

In this post, I’m reviewing an AI-powered Oil Spill Detection system built to automatically identify and segment oil spills from satellite images using deep learning, and deployable at scale in production environments.


Project Overview

This project implements an end-to-end oil spill detection pipeline using a U-Net deep learning model trained on satellite imagery. The model detects oil spill regions in ocean environments and returns a visual output where detected spill areas are highlighted with a transparent red overlay on the original image.

What makes this project stand out is not just the model, but the production-ready architecture. The trained model is exported to ONNX, served via a FastAPI REST API, containerized with Docker, and designed for scalable deployment on Kubernetes.

In short, this is not just a research project—it’s a deployable AI system.


Key Features

1. Automated Oil Spill Detection

At the core of the system is a U-Net segmentation network, a proven architecture for pixel-level image segmentation. The model analyzes satellite images and produces a binary mask indicating oil spill regions.

2. Visual Segmentation Overlay

After inference, the system overlays the predicted mask on the original image using a transparent red color. This makes the results immediately interpretable by humans, which is especially useful for environmental monitoring teams and decision-makers.

3. FastAPI REST API

The model is exposed through a FastAPI-based REST endpoint, allowing easy integration with other systems. Users simply send an image URL and receive a processed image in response.

4. ONNX Model for Efficient Inference

By exporting the trained model to ONNX, the system benefits from faster inference, cross-platform compatibility, and easier deployment across different environments.

5. Docker & Kubernetes Ready

The application is fully containerized with Docker and includes Kubernetes manifests for:

  • Deployment
  • Service exposure
  • Horizontal Pod Autoscaling (HPA)

This makes it suitable for cloud-scale, production workloads.

6. Real-Time Inference

The API supports near real-time inference, accepting image URLs and returning segmentation results quickly, making it viable for continuous monitoring pipelines.


Project Structure

The repository is cleanly organized, separating concerns clearly:

  • Model training (train.ipynb)
  • Inference & API logic (main.py)
  • Testing (test.py)
  • Deployment artifacts (Dockerfile and Kubernetes manifests)

This structure makes the project easy to understand, extend, and maintain.


Model Details

  • Architecture: U-Net (segmentation network)
  • Input: 128×128 grayscale satellite images
  • Output: 128×128 binary segmentation mask
  • Format: ONNX
  • Preprocessing: Normalization with mean = 0.5, std = 0.5
  • Inference Threshold: 0.5 (sigmoid output)

The choice of U-Net is appropriate for this task, given its strength in preserving spatial context while segmenting fine-grained regions like oil slicks.


API Usage

The system exposes two main endpoints:

Health Check

A simple GET endpoint for monitoring and readiness checks.

Prediction Endpoint

A POST endpoint that accepts an image URL and returns a PNG image with oil spill regions highlighted.

This design makes the system easy to integrate into dashboards, alerting systems, or downstream analytics pipelines.


Deployment & Scalability

The Kubernetes configuration supports:

  • Multiple replicas for high availability
  • Resource limits for CPU and memory
  • Horizontal Pod Autoscaling based on load

The project has been tested on AWS EKS, but the setup is portable to other Kubernetes environments with minimal changes.


Performance & Evaluation

Model performance evaluation and validation workflows are documented in the training notebook. This ensures transparency in how the model was trained, validated, and tested—an important aspect for any AI system used in environmental decision-making.


Why This Project Matters

This project demonstrates how AI can be responsibly applied to environmental monitoring. By combining deep learning, modern API design, and cloud-native deployment, it bridges the gap between research and real-world impact.

Potential applications include:

  • Continuous ocean monitoring
  • Early warning systems for oil spills
  • Support for environmental agencies and NGOs
  • Integration into maritime surveillance platforms

Final Thoughts

This oil spill detection system is a strong example of a production-ready AI solution. It goes beyond model training and addresses deployment, scalability, and usability—key factors often missing in AI projects.

With further enhancements such as multi-spectral inputs, larger datasets, or real-time satellite feeds, this system could play a meaningful role in protecting marine environments.

Well executed, well packaged, and highly relevant.

Top comments (0)