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-2206210229.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

odach-0.1.5.post2206210229-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: odach-0.1.5-2206210229.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for odach-0.1.5-2206210229.tar.gz
Algorithm Hash digest
SHA256 2aa2560926bf10b873d2a56790840550a8e8eb087ececadd8bcc81fca3ebc0ad
MD5 819f5ec6c777fbdc76c4106307a30d72
BLAKE2b-256 89ef8dca698528eb50266b98daa04381183f4bc024eaa90b6b5878a0a5d0bda5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for odach-0.1.5.post2206210229-py3-none-any.whl
Algorithm Hash digest
SHA256 07043249df42b33fbb6fcf2acab10961ed1e38b6c9f524113a3863db8b1daf8a
MD5 5a2600943891073b6f989ae575288b91
BLAKE2b-256 1b607b6c423424a80b4e29ce3825c95cd1c688f21ea88a55ee61e89e8f8f94a2

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