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 effdet
oda_effdet = oda.wrap_effdet(effdet)
# Declare TTA variations
tta = [oda.HorizontalFlip(), oda.VerticalFlip(), oda.Rotate90()]
# Declare scales to tta
scale = [1]
# wrap model and tta
tta_model = oda.TTAWrapper(oda_effdet, tta, scale)

Example

Global Wheat Detection

Example notebook

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.5-2011180124.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

odach-0.1.5.post2011180124-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file odach-0.1.5-2011180124.tar.gz.

File metadata

  • Download URL: odach-0.1.5-2011180124.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.9.0

File hashes

Hashes for odach-0.1.5-2011180124.tar.gz
Algorithm Hash digest
SHA256 0d6c59cc25419655ae225e4a90f2bd3d6abf167756def597c197dfcc19dded5d
MD5 9d2872c3dc4170e6d86c05e16e84e6ae
BLAKE2b-256 472db50108282f9be2000359a28548d853e15bf87a7d4230cd6f964245a21425

See more details on using hashes here.

File details

Details for the file odach-0.1.5.post2011180124-py3-none-any.whl.

File metadata

  • Download URL: odach-0.1.5.post2011180124-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.9.0

File hashes

Hashes for odach-0.1.5.post2011180124-py3-none-any.whl
Algorithm Hash digest
SHA256 7589a17eea1dc8c20995ed85f54350accbce25ac07775e37ade2d0e6c52b4dd3
MD5 870cc605675bcbca732154fbcd10583c
BLAKE2b-256 ad5c2a7c44cf6c4ac4e933596ca44c068b509d67bf0abb610b779e864edf1880

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