Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Object Detection Utils

  • Utility scripts used in object detection model training and testing
  • Utility functions and classes are easy to import in your projects

Requirements

Before using any of the tools, install requirements:

pip install -r requirements.txt

List of Tools

Visualizer

Visualize standardized object detection datasets

Features

  • Support COCO and YOLO style dataset
  • Live search for files

COCO Style dataset

python visualizer.py -m coco -d train/images -l train.json 

YOLO Style dataset

python visualizer.py -m yolo -d train/images -l train/labels 
Choose image Visualize
visualizer_1 visualizer_2

YOLO to COCO Converter

A simple script to convert YOLO annotations to COCO format.

Usage

python yolo_to_coco.py <yolo_annotations> <image_dir> <output_file>
  • <yolo_annotations>: Directory with YOLO .txt files.
  • <image_dir>: Directory with corresponding images.
  • <output_file>: Output COCO JSON file.

COCO to YOLO Converter

A simple script to convert YOLO annotations to COCO format.

Usage

python coco_to_yolo.py -c <coco_annotation_json> -i <image_dir> -o <output_labels_path>
  • <coco_annotation_json>: Path to COCO annotations JSON file.
  • <image_dir>: Directory with corresponding images.
  • <output_labels_path>: Path to output yolo labels directory path.

Histogram

Draw histogram of colored or grey images

  • Support medical DICOM image format
  • Support PNG / JPEG
  • Auto-detect colored / grey images
  • Hover on chart to get exact pixel intensity values

Usage

python histogram.py <image_path>

COCO Metrics

Calculate metrics using an output JSON containing your model predictions in COCO format. The metrics calculated include mAP (Mean Average Precison).
Your output JSON has annotations in this format:

"annotations": [
  {
    "id": 0,
    "image_id": 0,
    "category_id": 0,
    "bbox": [...],   // bounding box coordinates according to COCO format
    "score": 0.9994403719902039
  },
  ...
]

Usage

python coco_metrics.py predictions.json  # Your predictions JSON

COCO split train / validation / test set

You may happen to forget to split your database into train / validation /test set, in that case you may use this script to split a single labels.json into train.json, val.json, and test.json. (no need to split images folder, JSON would suffice)

python coco_split_train_val_test.py labels.json  # Your labels JSON

COCO Multi to Single Class

Sometimes you need to convert your multi-class object detection COCO JSON into a single-class COCO JSON. All categories of objects squashed into one.

Usage

python coco_multi_to_single_class.py labels.json  # Your COCO-style JSON

About

Utility scripts used in object detection model training and testing

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages