Skip to main content

ODAch is a test-time-augmentation tool for pytorch 2d object detectors.

Project description

ODAch, An Object Detection TTA tool for Pytorch

ODA is a test-time-augmentation (TTA) tool for 2d object detectors.

For use in Kaggle object detection competitions.

:star: if it helps you! ;)

Install

pip install odach

Usage

See Example.ipynb.

The setup is very simple, similar to ttach.

Singlescale TTA

import odach as oda
# Declare TTA variations
tta = [oda.HorizontalFlip(), oda.VerticalFlip(), oda.Rotate90(), oda.Multiply(0.9), oda.Multiply(1.1)]

# load image
img = loadimg(impath)
# wrap model and tta
tta_model = oda.TTAWrapper(model, tta)
# Execute TTA!
boxes, scores, labels = tta_model(img)

Multiscale TTA

import odach as oda
# Declare TTA variations
tta = [oda.HorizontalFlip(), oda.VerticalFlip(), oda.Rotate90(), oda.Multiply(0.9), oda.Multiply(1.1)]
# Declare scales to tta
scale = [0.8, 0.9, 1, 1.1, 1.2]

# load image
img = loadimg(impath)
# wrap model and tta
tta_model = oda.TTAWrapper(model, tta, scale)
# Execute TTA!
boxes, scores, labels = tta_model(img)
  • The boxes are also filtered by nms(wbf default).

  • The image size should be square.

model output wrapping

  • Wrap your detection model so that the output is similar to torchvision frcnn format: [["box":[[x,y,x2,y2], [], ..], "labels": [0,1,..], "scores": [1.0, 0.8, ..]]

Thanks

nms, wbf are from https://kaggle.com/zfturbo

tta is based on https://github.com/qubvel/ttach, https://github.com/andrewekhalel/edafa/tree/master/edafa and https://www.kaggle.com/shonenkov/wbf-over-tta-single-model-efficientdet

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

odach-0.1.4-2011020312.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

odach-0.1.4.post2011020312-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file odach-0.1.4-2011020312.tar.gz.

File metadata

  • Download URL: odach-0.1.4-2011020312.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for odach-0.1.4-2011020312.tar.gz
Algorithm Hash digest
SHA256 37f2bbaf134083a5adda7eeb401784b3fd35aed00597a329addce84ec12dc85e
MD5 c00fcb76b1e9dab77332593086d27173
BLAKE2b-256 e6bd3151c5fda060e18bfcedae7dd65cdd4318a6efa692df8edbbc94acbacfd8

See more details on using hashes here.

File details

Details for the file odach-0.1.4.post2011020312-py3-none-any.whl.

File metadata

  • Download URL: odach-0.1.4.post2011020312-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for odach-0.1.4.post2011020312-py3-none-any.whl
Algorithm Hash digest
SHA256 88a046bc0377735a1017d1fa267fd09a1e85be382da9801eee118ef6a4268ab9
MD5 86888fb9a673c9f3c240ee5e0b913497
BLAKE2b-256 bddf0f3713fb2a620db7ca4d53a6bca5aaeb6107added0d55fe45e793e44ab68

See more details on using hashes here.

Supported by

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