def init(config): model = raimodel.Model.load(config['modelpath']) host = config['server'].split(':')[0] port = config['server'].split(':')[1] init.con = rai.Client(host=host, port=port) init.con.modelset('model', rai.Backend.torch, rai.Device.cpu, model) image, init.img_class = get_one_image(transpose=(2, 0, 1)) init.image = rai.BlobTensor.from_numpy(image)
def init(config): channel = grpc.insecure_channel('localhost:8500') init.stub = prediction_service_pb2_grpc.PredictionServiceStub(channel) init.request = predict_pb2.PredictRequest() init.request.model_spec.name = 'resnet' init.request.model_spec.signature_name = 'serving_default' image, init.img_class = get_one_image() init.image = tf.contrib.util.make_tensor_proto(image)
def init(config): img, init.img_class = get_one_image(transpose=(2, 0, 1)) imgdata = ImageData() # protobuf assumes the shape of the image is (1, 3, height, width) # where 1 is the batchsize and 3 is number of channels imgdata.image = img.tobytes() imgdata.height = img.shape[2] imgdata.width = img.shape[3] imgdata.dtype = img.dtype.name init.image = imgdata channel = grpc.insecure_channel('localhost:50051') init.stub = PredictorStub(channel)
def init(config): with tf.gfile.GFile(config['modelpath'], "rb") as f: restored_graph_def = tf.GraphDef() restored_graph_def.ParseFromString(f.read()) with tf.Graph().as_default() as graph: tf.import_graph_def( restored_graph_def, input_map=None, return_elements=None, name="") init.graph = graph init.image, init.img_class = get_one_image() init.images_tensor = graph.get_tensor_by_name('images:0') init.logits_tensor = graph.get_tensor_by_name('output:0')
def init(config): host = config['server'].split(':')[0] port = config['server'].split(':')[1] init.con = rai.Client(host=host, port=port) graph = raimodel.Model.load(config['modelpath']) inputs = ['images'] outputs = ['output'] init.con.modelset('graph', rai.Backend.tf, rai.Device.cpu, graph, input=inputs, output=outputs) image, init.img_class = get_one_image() init.image = rai.BlobTensor.from_numpy(image)
def init(): init.img_list, init.img_class = get_one_image(transpose=(2, 0, 1)) init.img_list = init.img_list.tolist()
def init(): init.img_list, init.img_class = get_one_image() init.img_list = init.img_list.tolist()
def init(config): init.model = torch.jit.load(config['modelpath']) image, init.img_class = get_one_image(transpose=(2, 0, 1)) init.image = torch.from_numpy(image)