Skip to main content

VerifyDataAnnotations

Overview

Verifyannotations is a Python package specifically designed to validate and annotate image data with bounding boxes using annotations provided in both YOLO and PASCAL VOC format text files. It serves as a tool for verifying the correctness of annotations and ensuring the integrity of datasets intended for use in computer vision tasks, especially those utilizing object detection frameworks.

Features

  • Validates the structure of image and label directories.
  • Checks if label files contain valid annotations in YOLO or PASCAL VOC format.
  • Ensures that image files have the correct format.
  • Annotates images with bounding boxes based on YOLO or PASCAL VOC label annotations.
  • Saves annotated images to an output directory.

Installation

You can install VerifyDataAnnotations via pip:

pip install verifyannotations

Verifying Data Annotations in YOLO Format

Input Parameters

  • label_folder: Path to the directory containing label files with annotations in YOLO format.
  • raw_image_folder: Path to the directory containing the raw image files.
  • output_image_folder: Path to the directory where annotated images will be saved.
  • image_name_list_path: Path to the text file listing the names of all images in the dataset.
  • class_path: Path to the text file containing the list of classes or labels used in the dataset.

Example

Suppose you have the following directory structure:

dataset/
│
├── labels/
│   ├── image1.txt
│   ├── image2.txt
│   └── ...
│
├── images/
│   ├── image1.bmp
│   ├── image2.bmp
│   └── ...
│
├── saved_annotations/
│
├── name_list.txt
└── classes.txt

The labels directory contains text files with annotation data in YOLO format. The images directory contains corresponding image files. saved_annotations will store the annotated images.

Using VerifyDataAnnotations:

from verifyannotations import VerifyDataAnnotations

label_folder = "dataset/labels"
raw_image_folder = "dataset/images"
output_image_folder = "dataset/saved_annotations"
image_name_list_path = "dataset/name_list.txt"
class_path = "dataset/classes.txt"

verifier = VerifyDataAnnotations(
    label_folder,
    raw_image_folder,
    output_image_folder,
    image_name_list_path,
    class_path,
)

verifier.verify_annotations()

This will validate the annotations, annotate the images with bounding boxes, and save the annotated images to the saved_annotations directory.

Verifying Data Annotations in PASCAL VOC format

CASE 1

Suppose you have a dataset folder with the following structure:

dataset/
│
├── image1.jpg
├── image1.xml
├── image2.png
├── image2.xml
└── ...

The dataset directory contains both the images and their corresponding annotations in PASCAL VOC format.

Input Parameters

  • dataset_folder: Path to the directory containing both the images and their corresponding annotations in PASCAL VOC format.
  • output_image_folder: Path to the directory where annotated images will be saved.

Using VerifyDataAnnotationsPascalVOC:

from verifyannotations import VerifyDataAnnotationsPascalVOC

dataset_folder = "dataset"
output_image_folder = "dataset/saved_annotations"

verifier = VerifyDataAnnotationsPascalVOC(
    dataset_folder,
    output_image_folder,
)

verifier.verify_annotations()

This will validate the annotations, annotate the images with bounding boxes, and save the annotated images to the saved_annotations directory with the same extension as the original images.

CASE 2

In case your PASCAL VOC dataset has the structure shown below,

├── annotations/
│   ├── image1.xml
│   ├── image2.xml
│   └── ...
│
├── images/
│   ├── image1.jpg
│   ├── image2.jpg
│   └── ...

You have separate directories for images images and annotations, then you can verify the PASCAL VOC annotations like this:

Input Parameters

  • image_folder: Path to the directory containing the images.
  • annotation_folder Path to the directory containing annotations in PASCAL VOC format.
  • output_image_folder: Path to the directory where annotated images will be saved.

Using VerifyDataAnnotationsPascalVOC:

from verifyannotations import VerifyDataAnnotationsPascalVOCSeparatedFolders

image_folder = "imagefolder"

annotation_folder = "annotationfolder"


output_folder = "dataset/saved_annotations"


verifier = VerifyDataAnnotationsPascalVOCSeparatedFolders(image_folder, annotation_folder, output_folder)
verifier.verify_annotations()

Metadata

Release files for verifyannotations 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for verifyannotations 1.0
File Size Uploaded
verifyannotations-1.0.tar.gz 7.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for verifyannotations 1.0
File Interpreter ABI Platform
verifyannotations-1.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.7 kB

Release files / verifyannotations-1.0.tar.gz

Download URL verifyannotations-1.0.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
883c36f801d3b0c2855607ab623869de18751312d3fa88084f221eee9149107b
BLAKE2b-256 checksum
How to use checksums
53369e6a66c13e16a897aa158b5d20a6df774a481140900139700c59289fe947
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.12

Release files / verifyannotations-1.0-py3-none-any.whl

Download URL verifyannotations-1.0-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ffc4ae0cbf2e9fd8f5418e48933fa73162ebdead2b1445354b1e96fbd288a8c
BLAKE2b-256 checksum
How to use checksums
eda3e80729ed8e3bcdddeebb101b07b701725a351f435a90e3e1026a454d5763
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

1.0 This release

2 release files

0.1.1

2 release files

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page