File size: 1,130 Bytes
b213d84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Copyright (c) Facebook, Inc. and its affiliates.

from typing import Any

from .base import BaseConverter


class HFlipConverter(BaseConverter):
    """
    Converts various DensePose predictor outputs to DensePose results.
    Each DensePose predictor output type has to register its convertion strategy.
    """

    registry = {}
    dst_type = None

    @classmethod
    # pyre-fixme[14]: `convert` overrides method defined in `BaseConverter`
    #  inconsistently.
    def convert(cls, predictor_outputs: Any, transform_data: Any, *args, **kwargs):
        """
        Performs an horizontal flip on DensePose predictor outputs.
        Does recursive lookup for base classes, so there's no need
        for explicit registration for derived classes.

        Args:
            predictor_outputs: DensePose predictor output to be converted to BitMasks
            transform_data: Anything useful for the flip
        Return:
            An instance of the same type as predictor_outputs
        """
        return super(HFlipConverter, cls).convert(
            predictor_outputs, transform_data, *args, **kwargs
        )