Skip to content

count-localizations: Count Annotations by Concept

The count-localizations command analyzes Pascal VOC annotation files and produces a summary of how many bounding boxes exist for each concept (class) in the dataset. This is useful for understanding class distribution and identifying imbalances in your dataset.

Usage

m3-download count-localizations DIRECTORY [OPTIONS]

Parameters

  • DIRECTORY: Directory containing Pascal VOC annotation XML files
  • --csv: (Optional) Output in CSV format instead of human-readable text
  • --total: (Optional) Include a total count of all annotations in the output

Output Formats

Default (Human-Readable) Format

  • Lists each concept (class) found in the annotations
  • Displays the number of bounding boxes for each concept
  • Optionally includes a total count of all bounding boxes

CSV Format

  • Outputs the data in CSV format
  • Columns typically include Concept, Count, and optionally Total

Examples

Count localizations with default output:

m3-download count-localizations /path/to/annotations

Count localizations and output in CSV format:

m3-download count-localizations /path/to/annotations --csv

Count localizations and include total count:

m3-download count-localizations /path/to/annotations --total

Notes

  • Ensure that the specified directory contains valid Pascal VOC XML files.
  • The command will recursively search for XML files in the specified directory.
  • If no XML files are found, the command will not produce any output.
  • The CSV output can be opened in spreadsheet software for further analysis.