def get_layer_outputs(layer_name, input_path): return jsonify( save_layer_outputs( load_img(join(abspath(input_folder), input_path), single_input_shape, grayscale=input_channels == 1), model, layer_name, temp_folder, input_path))
def get_layer_outputs(layer_name, input_path): is_grayscale = (input_channels == 1) input_img = load_img(join(abspath(input_folder), input_path), single_input_shape, grayscale=is_grayscale) output_generator = get_outputs_generator(model, layer_name) with get_evaluation_context(): layer_outputs = output_generator(input_img)[0] output_files = [] if keras.backend.backend() == 'theano': #correct for channel location difference betwen TF and Theano layer_outputs = np.rollaxis(layer_outputs, 0, 3) for z in range(0, layer_outputs.shape[2]): img = layer_outputs[:, :, z] deprocessed = deprocess_image(img) filename = get_output_name(temp_folder, layer_name, input_path, z) output_files.append(relpath(filename, abspath(temp_folder))) imsave(filename, deprocessed) return jsonify(output_files)
def get_layer_outputs(layer_name, input_path): return jsonify( save_layer_outputs( load_img( join(abspath(input_folder), input_path), single_input_shape, grayscale=(input_channels == 1), mean=mean, std=std), model, layer_name, temp_folder, input_path))
def get_prediction(input_path): with get_evaluation_context(): return safe_jsonify( decode_predictions( model.predict( load_img(join(abspath(input_folder), input_path), single_input_shape, grayscale=(input_channels == 1))), classes, top))
def get_prediction(input_path): is_grayscale = (input_channels == 1) input_img = load_img(input_path, single_input_shape, grayscale=is_grayscale) with get_evaluation_context(): return jsonify( json.loads( get_json(decode_predictions(model.predict(input_img)))))
def get_layer_outputs(layer_name, input_path): print(single_input_shape) return jsonify( save_layer_outputs( load_img(join(abspath(input_folder), input_path.replace("%23", "#")), single_input_shape, grayscale=(input_channels == 1), mean=mean, std=std), model, layer_name, temp_folder, input_path))
def get_layer_outputs(layer_name, input_path): return jsonify( save_layer_outputs( custom_load_img(abspath(input_folder), input_path) if custom_load_img else load_img( join(abspath(input_folder), input_path), single_input_shape, grayscale=(input_channels == 1), mean=mean, std=std), model, layer_name, temp_folder, input_path))
def get_prediction(input_path): is_grayscale = (input_channels == 1) input_img = load_img(join(abspath(input_folder), input_path), single_input_shape, grayscale=is_grayscale) with get_evaluation_context(): return jsonify( json.loads( get_json( decode_predictions(model.predict(input_img), classes, top))))
def get_prediction(input_path): with get_evaluation_context(): return safe_jsonify( decode_predictions( model.predict( load_img( join(abspath(input_folder), input_path), single_input_shape, grayscale=(input_channels == 1), mean=mean, std=std)), classes, top))