Skip to main content

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

Project description

ODAch-Object-Detection-ttA in Pytorch

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

Used in Kaggle object detection competitions!

Install

pip install odach

Usage

See Example.ipynb.

The setup is very simple, similar to ttach.

import odach as oda
# Declare single scale TTA variations
mono = [oda.VerticalFlip(),oda.HorizontalFlip(), oda.Rotate90(), oda.Multiply(0.9), oda.Multiply(1.1)]
# Declare multiscale-TTA with 0.8~1.2x image sizes.
multi = [oda.MultiScale(i) for i in [0.8, 0.9, 1.1, 1.2]] + [oda.MultiScaleFlip(i) for i in [0.8, 0.9, 1.1, 1.2]]

# load image
impath = "imgs/cars3.jpg"
img = loadimg(impath)
# wrap model and tta
tta_model = oda.TTAWrapper(model, mono, multi)
# Execute TTA!
boxes, scores, labels = tta_model.inference(img)
  • 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.1-2010290537.tar.gz (7.6 kB view details)

Uploaded Source

File details

Details for the file odach-0.1.1-2010290537.tar.gz.

File metadata

  • Download URL: odach-0.1.1-2010290537.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.7.7

File hashes

Hashes for odach-0.1.1-2010290537.tar.gz
Algorithm Hash digest
SHA256 47642cc818fb449bd80a7aa6a09a03a1a4b3118ffddb99687d3bc83f2f1f4225
MD5 c2ba726609352da2f8298def5f7cbf6c
BLAKE2b-256 44f5f23b06f42486fc25c5fa4110f84d1497136a5e3e9365505ec264c408dc8a

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