def init(): util.lock()#detect previous precess has completed or not util.set_img_format()#set image format: channels first or channels last util.override_keras_directory_iterator_next() util.set_classes_from_train_dir()#data_dir: data/sorted/train/ util.set_samples_info() if util.get_keras_backend_name() != 'theano': util.tf_allow_growth() if not os.path.exists(config.trained_dir): os.mkdir(config.trained_dir)
def init(): util.lock() util.set_img_format() util.override_keras_directory_iterator_next() util.set_classes_from_train_dir() util.set_samples_info() if util.get_keras_backend_name() != 'theano': util.tf_allow_growth() if not os.path.exists(config.trained_dir): os.mkdir(config.trained_dir)
def init(): util.lock() util.set_img_format() util.override_keras_directory_iterator_next() util.set_classes_from_train_dir() util.set_samples_info() if util.get_keras_backend_name() != 'theano': util.tf_allow_growth() if not os.path.exists(config.trained_dir): os.mkdir(config.trained_dir)
def init(): util.lock() util.set_img_format() # Pay extremely attention to the RGB->BGR, the next method is override. util.override_keras_directory_iterator_next() util.set_classes_from_train_dir() util.set_samples_info() if util.get_keras_backend_name() != 'theano': util.tf_allow_growth() if not os.path.exists(config.trained_dir): os.mkdir(config.trained_dir)
required=True, help='Base model architecture', choices=[ config.MODEL_RESNET50, config.MODEL_RESNET152, config.MODEL_INCEPTION_V3, config.MODEL_VGG16 ]) args = parser.parse_args() config.model = args.model model_module = util.get_model_class_instance() model = model_module.load() print('Model loaded') print('Warming up the model') start = time.clock() if util.get_keras_backend_name() != 'tensorflow': input_shape = ( 1, 3, ) + model_module.img_size else: input_shape = (1, ) + model_module.img_size + (3, ) dummpy_img = np.ones(input_shape) dummpy_img = preprocess_input(dummpy_img) model.predict(dummpy_img) end = time.clock() print('Warming up took {} s'.format(end - start)) print('Trying to load a Novelty Detector') try: af = util.get_activation_function(model,
def get_input_tensor(self): if util.get_keras_backend_name() == 'theano': return Input(shape=(3, ) + self.img_size) else: return Input(shape=self.img_size + (3, ))
def get_input_tensor(self): if util.get_keras_backend_name() == 'theano': return Input(shape=(3,) + self.img_size) else: return Input(shape=self.img_size + (3,))