Skip to main content

A tool for collecting object detection datasets with OpenCV

Project description

Detection Data Collection

PyPI version License: MIT

A Python tool for collecting object detection datasets with bounding boxes using OpenCV. It allows you to draw bounding boxes on live camera/video feed and automatically saves annotated images + YOLO-format labels.


🚀 Installation

pip install detection-datacollection

Or install directly from GitHub:

pip install git+https://github.com/ShashwatDev-26/imageDataCollection.git

📦 Dependencies

This package requires:

  • numpy==2.2.6
  • opencv-python==4.12.0.88
  • PyYAML==6.0.2

They are automatically installed with pip.


🔧 Usage

1. Import and initialize

from detectionDataCollection import detectionDataCollection
# Create a collector instance
collector = detectionDataCollection()
# Use a video file or camera index (0 for default webcam)
collector.set_sourceID(0)  # or "video.mp4"
# Number of samples to capture per class
collector.set_nSamples(10)
# Initialize camera
collector.camera_init_()
# Start annotation mode
collector.annotation()

2. Controls

  • CTRL + Left Click → Start drawing bounding box
  • Right Click → Add object/class
  • CTRL + Right Click → Start capturing samples
  • ESC → Stop and save dataset

📂 Output Structure

When you stop annotation (ESC), the dataset is stored like:

detectionDataset/
├── train/
│   ├── images/
│   │   ├── frame_000_000.jpg
│   │   └── ...
│   ├── labels/
│   │   ├── frame_000_000.txt
│   │   └── ...
├── data.yaml

The labels follow YOLO format:

class_id x_center y_center width height

🎥

🌍 Links


📜 License

This project is licensed under the MIT License.

To be continued ....


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

detection_datacollection-0.1.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

detection_datacollection-0.1.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file detection_datacollection-0.1.0.tar.gz.

File metadata

File hashes

Hashes for detection_datacollection-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0289c0ae95e97dfff9c8bf0b7ea7d31145f43c907fa22bd84111d397e4110839
MD5 c9e86ebe5d8c78a41d85ae0757640dff
BLAKE2b-256 117f94c959e36de78869b9006b96f0e19c0f9729cb3f4a9fa7a3facfdd7bbd40

See more details on using hashes here.

File details

Details for the file detection_datacollection-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for detection_datacollection-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ce58ef70654946aceb7ec4b08346c2fd5691c1e721a0ce464ed2b857852a6835
MD5 516940efc704f3eaf4d87ff3576c035e
BLAKE2b-256 33e2fc764004142272faf29e9e3680b012a047460f1d0a0e95dfe2fb0f40dbf2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page