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 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
Metadata
Release files for odach 0.1.3-2010300443
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| odach-0.1.3-2010300443.tar.gz | 8.0 kB | Details |
Release files / odach-0.1.3-2010300443.tar.gz
| Download URL | odach-0.1.3-2010300443.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a6a91bb6f8801aee0d3ee0a2d7353444815222057ac804a24e5c736ce54371ae
|
|
BLAKE2b-256 checksum How to use checksums |
1a73525b052e10a4d783728a5bcd97973ee35c43c4b2628880f36c21465d4f3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|