Ejemplo n.º 1
0
    help='When this flag is provided, flip augmentation is performed.')

parser.add_argument(
    '--crop_augment',
    choices=['center', 'avgpool', 'five'],
    default=None,
    help='When this flag is provided, crop augmentation is performed.'
    '`avgpool` means the full image at the precrop size is used and '
    'the augmentation is performed by the average pooling. `center` means'
    'only the center crop is used and `five` means the four corner and '
    'center crops are used. When not provided, by default the image is '
    'resized to network input size.')

parser.add_argument(
    '--aggregator',
    choices=AGGREGATORS.keys(),
    default=None,
    help='The type of aggregation used to combine the different embeddings '
    'after augmentation.')

parser.add_argument('--quiet',
                    action='store_true',
                    default=False,
                    help='Don\'t be so verbose.')

config = tf.ConfigProto()
config.gpu_options.allow_growth = True


def flip_augment(image, fid, pid):
    """ Returns both the original and the horizontal flip of an image. """
parser.add_argument(
    '--flip_augment', action='store_true', default=False,
    help='When this flag is provided, flip augmentation is performed.')

parser.add_argument(
    '--crop_augment', choices=['center', 'avgpool', 'five'], default=None,
    help='When this flag is provided, crop augmentation is performed.'
         '`avgpool` means the full image at the precrop size is used and '
         'the augmentation is performed by the average pooling. `center` means'
         'only the center crop is used and `five` means the four corner and '
         'center crops are used. When not provided, by default the image is '
         'resized to network input size.')

parser.add_argument(
    '--aggregator', choices=AGGREGATORS.keys(), default=None,
    help='The type of aggregation used to combine the different embeddings '
         'after augmentation.')

parser.add_argument(
    '--quiet', action='store_true', default=False,
    help='Don\'t be so verbose.')

config = tf.ConfigProto()
config.gpu_options.allow_growth = True


def flip_augment(image, fid, pid):
    """ Returns both the original and the horizontal flip of an image. """
    images = tf.stack([image, tf.reverse(image, [1])])
    return images, [fid]*2, [pid]*2