# Path: keras_image_captioning/config.py
# def active_config(new_active_config=None):
#     if new_active_config:
#         global _active_config
#         _active_config = new_active_config
#     return _active_config


import numpy as np
from functools import partial
from keras.applications import inception_v3
from keras.preprocessing import sequence as keras_seq
from keras.preprocessing.image import (ImageDataGenerator, img_to_array,
                                       load_img)
from keras.preprocessing.text import Tokenizer, text_to_word_sequence
from .config import active_config




class ImagePreprocessor(object):
    """A Inception v3 image preprocessor. Implements an image augmentation
    as well."""
    IMAGE_SIZE = (299, 299)

    def __init__(self, image_augmentation=None):
        self._image_data_generator = ImageDataGenerator(rotation_range=40,
                                                        width_shift_range=0.2,
                                                        height_shift_range=0.2,
                                                        shear_range=0.2,
                                                        zoom_range=0.2,
                                                        horizontal_flip=True,
                                                        fill_mode='nearest')
        if image_augmentation is None:

# Path: keras_image_captioning/config.py
# def active_config(new_active_config=None):
#     if new_active_config:
#         global _active_config
#         _active_config = new_active_config
#     return _active_config


# Path: keras_image_captioning/preprocessors.py
import numpy as np
from functools import partial
from keras.applications import inception_v3
from keras.preprocessing import sequence as keras_seq
from keras.preprocessing.image import (ImageDataGenerator, img_to_array,
                                       load_img)
from keras.preprocessing.text import Tokenizer, text_to_word_sequence
from .config import active_config





class ImagePreprocessor(object):
    """A Inception v3 image preprocessor. Implements an image augmentation
    as well."""
    IMAGE_SIZE = (299, 299)

    def __init__(self, image_augmentation=None):
        self._image_data_generator = ImageDataGenerator(rotation_range=40,
                                                        width_shift_range=0.2,
                                                        height_shift_range=0.2,
                                                        shear_range=0.2,
                                                        zoom_range=0.2,
                                                        horizontal_flip=True,
                                                        fill_mode='nearest')
        if image_augmentation is None:

            self._image_augmentation_switch = active_config().image_augmentation