Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kentaroy47/oda-object-detection-tta
ODA is a test-time-augmentation(TTA) tool for 2D object detectors. For use in Kaggle competitions.
https://github.com/kentaroy47/oda-object-detection-tta
augmentation detection-tta nms pytorch tta
Last synced: 1 day ago
JSON representation
ODA is a test-time-augmentation(TTA) tool for 2D object detectors. For use in Kaggle competitions.
- Host: GitHub
- URL: https://github.com/kentaroy47/oda-object-detection-tta
- Owner: kentaroy47
- License: mit
- Created: 2020-10-21T02:23:55.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-21T02:28:48.000Z (over 2 years ago)
- Last Synced: 2025-01-16T09:14:50.820Z (5 days ago)
- Topics: augmentation, detection-tta, nms, pytorch, tta
- Language: Jupyter Notebook
- Homepage:
- Size: 23.3 MB
- Stars: 38
- Watchers: 3
- Forks: 4
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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! ;)
![](imgs/res.png)
# Install
`pip install odach`# Usage
See `Example.ipynb`.The setup is very simple, similar to [ttach](https://github.com/qubvel/ttach).
## Singlescale TTA
```python
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
```python
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, ..]]* Example for EfficientDets
https://www.kaggle.com/kyoshioka47/example-of-2d-single-scale-tta-with-odach/```python
# 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](https://www.kaggle.com/kyoshioka47/example-of-odach)# Thanks
nms, wbf are from https://kaggle.com/zfturbotta 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