コード例 #1
0
def make_detmot_transforms(image_set, args=None):
    normalize = T.MotCompose([
        T.MotToTensor(),
        T.MotNormalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
    ])

    scales = [480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800]

    if image_set == 'train':
        color_transforms = []
        scale_transforms = [
            T.MotRandomHorizontalFlip(),
            T.MotRandomResize(scales, max_size=1333),
            normalize,
        ]

        return T.MotCompose(color_transforms + scale_transforms)

    if image_set == 'val':
        return T.MotCompose([
            T.MotRandomResize([800], max_size=1333),
            normalize,
        ])

    raise ValueError(f'unknown {image_set}')
コード例 #2
0
def make_transforms_for_crowdhuman(image_set, args=None):

    normalize = T.MotCompose([
        T.MotToTensor(),
        T.MotNormalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
    ])
    scales = [608, 640, 672, 704, 736, 768, 800, 832, 864, 896, 928, 960, 992]

    if image_set == 'train':
        return T.MotCompose([
            T.MotRandomHorizontalFlip(),
            T.FixedMotRandomShift(bs=1),
            T.MotRandomSelect(
                T.MotRandomResize(scales, max_size=1536),
                T.MotCompose([
                    T.MotRandomResize([400, 500, 600]),
                    T.FixedMotRandomCrop(384, 600),
                    T.MotRandomResize(scales, max_size=1536),
                ])
            ),
            normalize,

        ])

    if image_set == 'val':
        return T.MotCompose([
            T.MotRandomResize([800], max_size=1333),
            normalize,
        ])

    raise ValueError(f'unknown {image_set}')
コード例 #3
0
def make_detmot_transforms(image_set, args=None):
    normalize = T.MotCompose([
        T.MotToTensor(),
        T.MotNormalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
    ])

    scales = [608, 640, 672, 704, 736, 768, 800, 832, 864, 896, 928, 960, 992]

    if image_set == 'train':
        color_transforms = []
        if args.cj:
            print('Training with RandomColorJitter.')
            color_transforms.append(
                T.MoTColorJitter(brightness=0.5,
                                 contrast=0.5,
                                 saturation=0.5,
                                 hue=0))
        if not args.crop:
            scale_transforms = [
                T.MotRandomHorizontalFlip(),
                T.FixedMotRandomShift(bs=1),
                T.MotRandomResize(scales, max_size=1536),
                normalize,
            ]
        else:
            print('Training with RandomCrop.')
            scale_transforms = [
                T.MotRandomHorizontalFlip(),
                T.FixedMotRandomShift(bs=1),
                T.MotRandomSelect(
                    T.MotRandomResize(scales, max_size=1536),
                    T.MotCompose([
                        T.MotRandomResize([400, 500, 600]),
                        T.FixedMotRandomCrop(384, 600),
                        T.MotRandomResize(scales, max_size=1536),
                    ])),
                normalize,
            ]

        return T.MotCompose(color_transforms + scale_transforms)

    if image_set == 'val':
        return T.MotCompose([
            T.MotRandomResize([800], max_size=1536),
            normalize,
        ])

    raise ValueError(f'unknown {image_set}')