Beispiel #1
0
def make_mot_transforms(image_set, args):

    normalize = T.Compose([
        T.ToTensor(),
        T.Normalize([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' and not args.eval:
        return T.Compose([
            T.RandomHorizontalFlip(),
            T.RandomSelect(
                T.RandomResize(scales, max_size=1333),
                T.Compose([
                    T.RandomResize([800, 1000, 1200]),
#                     T.RandomSizeCrop(384, 600),
                    T.RandomSizeCrop_MOT(800, 1200),
                    T.RandomResize(scales, max_size=1333),
                ])
            ),
            normalize,
        ])
    
    if image_set == 'trainall' and not args.eval:
        return T.Compose([
            T.RandomHorizontalFlip(),
            T.RandomSelect(
                T.RandomResize(scales, max_size=1333),
                T.Compose([
                    T.RandomResize([800, 1000, 1200]),
#                     T.RandomSizeCrop(384, 600),
                    T.RandomSizeCrop_MOT(800, 1200),
                    T.RandomResize(scales, max_size=1333),
                ])
            ),
            normalize,
        ])
    if image_set == 'val' or args.eval:
        return T.Compose([
            T.RandomResize([800], max_size=1333),
            normalize,
        ])
    if image_set == 'test' or args.eval:
        return T.Compose([
            T.RandomResize([800], max_size=1333),
            normalize,
        ])
    raise ValueError(f'unknown {image_set}')
Beispiel #2
0
def make_mot_transforms(image_set):

    normalize = T.Compose([
        T.ToTensor(),
        T.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
    ])

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

    if image_set == 'train':
        return T.Compose([
            T.RandomHorizontalFlip(),
            T.RandomSelect(
                T.RandomResize(scales, max_size=960),
                T.Compose([
                    T.RandomResize([400, 500, 600]),
                    #                     T.RandomSizeCrop(384, 600),
                    T.RandomSizeCrop_MOT(384, 600),
                    T.RandomResize(scales, max_size=960),
                ])),
            normalize,
        ])

    if image_set == 'val':
        return T.Compose([
            T.RandomResize([540], max_size=960),
            normalize,
        ])
    if image_set == 'test':
        return T.Compose([
            T.RandomResize([540], max_size=960),
            normalize,
        ])
    raise ValueError(f'unknown {image_set}')