Skip to content

A deep learning model for detecting underwater objects in sonar images, leveraging the YOLOv8m architecture for final deployment. This AI-powered model achieved a mean Average Precision ([email protected]) of approximately 83%, outperforming previous benchmarks in underwater object detection.

Notifications You must be signed in to change notification settings

ahmad-kaif/UnderWaterObjectDetection

Repository files navigation

🎯 Underwater Object Detection in Sonar Imagery

πŸ“Š Project Highlights

  • πŸš€ Final Model: YOLOv8n (You Only Look Once)
  • 🎯 Task: Object Detection, Bounding boxes and Lables & Classification
  • πŸ“ˆ Performance: State-of-the-art detection capabilities
  • πŸ”„ Multiple Approaches: From Traditional ML to Deep Learning
  • πŸ› οΈ Comprehensive Pipeline: Data preprocessing to end to end Project

🌟 Key Features

  • Multi-Model Comparison: Traditional ML vs Deep Learning approaches
  • Automated Preprocessing: Standardized image processing pipeline
  • Format Conversion: Handles multiple annotation formats (XML, YOLO txt)
  • Performance Metrics: Detailed evaluation and visualization
  • Modular Architecture: Easy to extend and modify

πŸ“‚ Project Structure

1. Traditional ML Approach (traditionalML/)

flowchart LR
    A[Images + XML] -->|Feature Extraction| B[CSV Format]
    B -->|ML Training| C[Traditional Models]
Loading

2. Data Preprocessing (data_preprocessing/)

flowchart LR
    A[Raw Images] -->|Convert & Resize| B[Standardized Images]
    C[XML Annotations] -->|Update| D[Adjusted Annotations]
    B --> E[Processed Dataset]
    D --> E
Loading
  • πŸ”„ Converts .bmp to .jpg
  • πŸ“ Resizes images to 640x640
  • 🎯 Updates bounding box annotations

3. Deep Learning Models

3.1 Faster R-CNN (objectDetectionDL_FASTER-RCNN/)

  • Two-stage detector architecture
  • Region proposal network
  • Feature pyramid network integration

3.2 Image Classification (imageClassificationDL/)

  • ResNet18 architecture
  • Transfer learning approach
  • Single-label classification

3.3 YOLOv8n - Final Model πŸ† (objectDetectionDL_YOLOv8n/)

flowchart LR
    A[Input Image] -->|YOLOv8n| B[Detection]
    B -->|Post-processing| C[Final Results]
Loading

πŸ“ˆ Model Performance

YOLOv8n Results

Performance Visualization

πŸ” Detection Examples

πŸ› οΈ Setup & Usage

  1. Environment Setup

    git clone <repository-url>
    cd <project-directory>
  2. Data Preprocessing

    cd data_preprocessing
    python preprocess_images.py
  3. Running YOLOv8n

    • Open objectDetectionDL_YOLOv8n/uatd_YOLOv8n.ipynb
    • Follow the notebook instructions for training and inference

πŸ“Š Results Analysis

The project demonstrates superior performance with YOLOv8n:

  • High precision in object detection
  • Real-time inference capabilities
  • Robust performance across different scenarios

πŸ”— Dependencies

  • Python 3.8+
  • PyTorch
  • Ultralytics YOLOv8
  • OpenCV
  • NumPy
  • Pandas

πŸ“ Notes

  • Dataset is preprocessed using the pipeline in data_preprocessing/
  • Annotations follow Pascal VOC XML format
  • YOLOv8n provides the best balance of speed and accuracy

🌟 Future Improvements

  • Model ensemble techniques
  • Real-time video processing
  • API deployment
  • Mobile optimization

Object Detection Web Application

This is a web application that uses YOLOv8 for object detection in images. The application consists of a React frontend and a Node.js backend that interfaces with a Python script for model inference.

Prerequisites

  • Node.js (v14 or higher)
  • Python (v3.8 or higher)
  • Your trained YOLOv8 model (uatd_yolov8_m-pytorch-default-v1.tar.gz)

Setup

  1. Install Node.js dependencies:
npm install
  1. Install Python dependencies:
pip install -r requirements.txt
  1. Place your trained model file (uatd_yolov8_m-pytorch-default-v1.tar.gz) in the root directory of the project.

Running the Application

  1. Start the backend server:
node server.js
  1. In a new terminal, start the React development server:
npm start
  1. Open your browser and navigate to http://localhost:3000

Usage

  1. Click the "Upload Image" button to select an image from your computer
  2. Once an image is selected, you'll see a preview
  3. Click the "Detect Objects" button to run the object detection
  4. The results will be displayed below the image, showing detected objects and their confidence scores

Project Structure

  • src/App.js - React frontend application
  • server.js - Node.js backend server
  • detect.py - Python script for model inference
  • requirements.txt - Python dependencies
  • package.json - Node.js dependencies

Notes

  • The application expects your model file to be in the root directory
  • The backend server runs on port 3001 by default
  • The React development server runs on port 3000
  • Uploaded images are temporarily stored in the uploads directory and automatically deleted after processing
Made with ❀️ Tensors Ahmad, Hema & China

About

A deep learning model for detecting underwater objects in sonar images, leveraging the YOLOv8m architecture for final deployment. This AI-powered model achieved a mean Average Precision ([email protected]) of approximately 83%, outperforming previous benchmarks in underwater object detection.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages