import requests from flask import request, Response import dataiku dataiku.use_plugin_libs("deeplearning-image") from tensorboard_handle import TensorboardThread import time import os ################################################################################################################### ## VARIABLES THAT NEED TO BE SET ################################################################################################################### # To work, your web-app requires to run on a code-env with the following libraries installed: # tensorflow==1.4.0 # flask==0.12.2 # The 'model_folder' must be the name of the managed folder where tensorboard logs are found. # They are generated through the Retrain recipe, when checking the 'tensorboard' option model_folder = "retrained_model" ################################################################################################################### ## DEFINING AND LAUNCHING TENSORBOARD ################################################################################################################### tt = TensorboardThread(model_folder) port = tt.get_port() tt.start() ################################################################################################################### ## ROUTING
import dataiku from dataiku.customrecipe import * import pandas as pd import numpy as np from keras_retinanet.models.retinanet import * from keras_retinanet.utils.image import read_image_bgr, preprocess_image, resize_image from keras_retinanet import backend from keras_retinanet.layers import FilterDetections from lal import utils from cardinal import uncertainty try: dataiku.use_plugin_libs('object-detection-cpu') except: try: dataiku.use_plugin_libs('object-detection-gpu') except: raise ImportError(utils.prettify_error( 'ML assisted labeling object detection relies on the DSS object detection ' 'plugin. The plugin could not be found on this instance. Please insteall it ' 'to use this recipe. More information: https://www.dataiku.com/product/plugins/object-detection/' )) from retinanet_model import get_model from gpu_utils import load_gpu_options