facebookresearch / facebookresearch/detectron2

GeneralizedRCNNWithTTA with horizontal and vertical flip

Open
#3,078 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
34.7k
Forks
7.9k
PR merge metrics
No merged PRs in 30d

Description

## 🚀 Feature
I propose to add to GeneralizedRCNNWithTTA not only vertical flip, that I can trigger with cfg.TEST.AUG.FLIP, but even horizontal flip, with another parameter, i.e. cfg.TEST.AUG.HFLIP and cfg.TEST.AUG.VFLIP

## Motivation & Examples

I created by myself a CustomDatasetMapperTTA, that achieve H and V flip:

```
flipH = RandomFlip(prob=1.0, horizontal=True, vertical=False)
aug_candidates.append([resize, flipH]) # resize + flipH

flipV = RandomFlip(prob=1.0, horizontal=False, vertical=True)
aug_candidates.append([resize, flipV]) # resize + flipV

```
but when I run instance segmentation, I get wrong masks, because of the assumption [here in _reduce_pred_masks](https://github.com/facebookresearch/detectron2/blob/f50ec07cf220982e2c4861c5a9a17c4864ab5bfd/detectron2/modeling/test_time_augmentation.py#L298)

Contributor guide

Open the contributing guide

Research direction

Start in detectron2/modeling/test_time_augmentation.py at _reduce_pred_masks and inspect how flip assumptions affect augmented mask predictions. Trace the existing cfg.TEST.AUG.FLIP behavior and the referenced CustomDatasetMapperTTA examples, then define what HFLIP and VFLIP should produce. Done means horizontal and vertical flip options work without incorrect instance masks.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.