facebookresearch / facebookresearch/detectron2

Bug in HFLip of DensePose annotations

Open
#278 1 comment 0 reactions 0 assignees View on GitHub
densepose
Dominant language
Python
Stars
34.7k
Forks
7.9k
PR merge metrics
No merged PRs in 30d

Description

Hi guys,

In `DensePoseTransformData._transform_pts` method the `x` values of the DensePose annotations can become 256, but the assumption is that the values of `x` and `y` coordinate must lie in `[0, 255]` range (see [densepose/structures.py#L43](https://github.com/facebookresearch/detectron2/blob/master/projects/DensePose/densepose/structures.py#L43))

```
def _transform_pts(self, transforms, dp_transform_data):
import detectron2.data.transforms as T

# NOTE: This assumes that HorizFlipTransform is the only one that does flip
do_hflip = sum(isinstance(t, T.HFlipTransform) for t in transforms.transforms) % 2 == 1
if do_hflip:
self.x = self.segm.size(1) - self.x # <-- Here we can get a value of 256
self._flip_iuv_semantics(dp_transform_data)
```
(excerpt from [densepose/structures.py#L152](https://github.com/facebookresearch/detectron2/blob/master/projects/DensePose/densepose/structures.py#L152))

The fix is to substract 1 from `self.segm.size(1)`: in L152
```
self.x = self.segm.size(1) - 1 - self.x
```

## Expected behavior

`x` and `y` coordinate of DensePose annotations must lie in `[0, 255]` range.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.