SkillAgentSearch skills...

YoloSlicing

YOLOv11 Segmentation: Unlocking Small Object Detection with Slicing

Install / Use

/learn @jsammarco/YoloSlicing
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

YOLO Slicing - Segmentation Scripts

This repository contains three Python scripts utilizing YOLOv11s-seg for object segmentation in videos. These scripts progressively enhance object detection accuracy through slicing techniques, making them effective for detecting small or partially visible objects.

<img src="https://raw.githubusercontent.com/jsammarco/YoloSlicing/57d5a2bfbf7e0ba5aa967d111868a0d3c575fbdd/banner.gif">

Video Explanation


For a detailed explanation and demonstration of these scripts, watch the YouTube video.

Scripts Overview

1. yoloDetect.py

  • Description: Performs standard YOLO segmentation on an entire video frame. Ideal for detecting objects in scenes with minimal occlusion or overlap.
  • Key Features:
    • Processes the entire frame in one step.
    • Outputs annotated videos with detected objects and confidence scores.
    • Simple and efficient for general use cases.
  • Usage: Best suited for quick segmentation tasks with standard video footage.

2. yoloSliceDetect.py

  • Description: Enhances object detection by dividing the frame into 4 overlapping slices (2 rows × 2 columns). This approach helps in detecting smaller objects.
  • Key Features:
    • Utilizes 10% overlap between slices for seamless object detection.
    • Processes each slice independently to improve accuracy for small objects.
    • Combines results from all slices into a unified annotated video.
  • Usage: Recommended for videos with smaller or partially obscured objects.

3. yoloSuperSliceDetect.py

  • Description: Maximizes detection accuracy by dividing the frame into 12 overlapping slices (4 rows × 3 columns). This method is optimized for complex scenes with very small or occluded objects.
  • Key Features:
    • Uses 10% overlap between slices for superior coverage.
    • Processes a higher number of slices to ensure no small object is missed.
    • Balances detection quality, speed, and quantity effectively.
  • Usage: Ideal for videos with high object density or complex backgrounds.

How to Use

  1. Setup:

    • Install required libraries using:
      pip install ultralytics opencv-python numpy
      
    • Ensure the YOLO model file yolo11s-seg.pt is in the same directory as the scripts.
    • Place the video file (e.g., input3.mp4) in the directory.
  2. Run the Scripts:

    • For single-frame segmentation:
      python yoloDetect.py
      
    • For 4-slice segmentation:
      python yoloSliceDetect.py
      
    • For 12-slice segmentation:
      python yoloSuperSliceDetect.py
      
  3. Output:

    • Annotated video files will be saved as instance-segmentation3.avi.

Learn More

Visit Consulting Joe for more AI-powered solutions and tutorials.


Related Skills

View on GitHub
GitHub Stars8
CategoryDevelopment
Updated4mo ago
Forks1

Languages

Python

Security Score

82/100

Audited on Nov 16, 2025

No findings