Пример #1
0
def default_mapper(sample):
    img, label = sample
    img = image.simple_transform(img,
                                 256,
                                 224,
                                 True,
                                 mean=[103.94, 116.78, 123.68])
    return img.flatten().astype('float32'), label
Пример #2
0
def load_data(file):
    img = load_image(file)
    img = simple_transform(img,
                           256,
                           224,
                           is_train=False,
                           mean=[103.94, 116.78, 123.68])
    img = img.astype('float32')
    img = np.expand_dims(img, axis=0)
    return img
Пример #3
0
def default_mapper(is_train, sample):
    '''
    map image bytes data to type needed by model input layer
    '''
    img, label = sample
    img = load_image_bytes(img)
    img = simple_transform(img,
                           256,
                           224,
                           is_train,
                           mean=[103.94, 116.78, 123.68])
    return img.flatten().astype('float32'), label