Skip to main content

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.

⭐ 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

Metadata

Release files for odach 0.1.5-2107010420

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

Source distribution (sdist)

Source distribution for odach 0.1.5-2107010420
File Size Uploaded
odach-0.1.5-2107010420.tar.gz 10.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for odach 0.1.5-2107010420
File Interpreter ABI Platform
odach-0.1.5.post2107010420-py3-none-any.whl Python 3 none any Details

Total release size: 21.2 kB

Release files / odach-0.1.5-2107010420.tar.gz

Download URL odach-0.1.5-2107010420.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
cff72db0f5f506106095a18a785bb1a1bead47c5490be506fa0a516efc57ddb0
BLAKE2b-256 checksum
How to use checksums
e56511168b0dfb45a03b2a2c05c67811399eda778e2c90befb63ae462404be22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

Release files / odach-0.1.5.post2107010420-py3-none-any.whl

Download URL odach-0.1.5.post2107010420-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
92a09efa1ab0cf1c925dbc9e4809811fa75fd75311c5ce45705f1e5564cc2e27
BLAKE2b-256 checksum
How to use checksums
c4c647017993786130e6d81541e221d38a3519aa6ec06ec24c01cc1bcfdfb285
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
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