(is_train, args)
| 76 | |
| 77 | |
| 78 | def build_transform(is_train, args): |
| 79 | resize_im = args.input_size > 32 |
| 80 | if is_train: |
| 81 | # this should always dispatch to transforms_imagenet_train |
| 82 | transform = create_transform( |
| 83 | input_size=args.input_size, |
| 84 | is_training=True, |
| 85 | color_jitter=args.color_jitter, |
| 86 | auto_augment=args.aa, |
| 87 | interpolation=args.train_interpolation, |
| 88 | re_prob=args.reprob, |
| 89 | re_mode=args.remode, |
| 90 | re_count=args.recount, |
| 91 | ) |
| 92 | if not resize_im: |
| 93 | # replace RandomResizedCropAndInterpolation with |
| 94 | # RandomCrop |
| 95 | transform.transforms[0] = transforms.RandomCrop( |
| 96 | args.input_size, padding=4) |
| 97 | return transform |
| 98 | |
| 99 | t = [] |
| 100 | if resize_im: |
| 101 | size = int(args.input_size / args.eval_crop_ratio) |
| 102 | t.append( |
| 103 | transforms.Resize(size, interpolation=3), # to maintain same ratio w.r.t. 224 images |
| 104 | ) |
| 105 | t.append(transforms.CenterCrop(args.input_size)) |
| 106 | |
| 107 | t.append(transforms.ToTensor()) |
| 108 | t.append(transforms.Normalize(IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD)) |
| 109 | return transforms.Compose(t) |
no outgoing calls
no test coverage detected
searching dependent graphs…