java调用远端预测模型,返回的一堆字符串我该如何进一步处理,如何转成图片
PaddleServingClientExample.java 我模仿了例子中的yolov4方法,预测一张图片, Client client = new Client(); client.setIP("127.0.0.1"); client.setPort("9292"); client.loadClientConfig(model_config_path); String result = client.predict(feed_data, fetch, true, 0); System.out.println(result); 我如何处理这里的result,目前我得到的是这样的数据,我如何转换成图片? outputs { tensor { int64_data: 0 int64_data: 0 int64_data: 0 int64_data: 0 int64_data: 0 ...... shape: 1 shape: 275 shape: 170 name: "depthwise_conv2d_11.tmp_0" alias_name: "argmax_0.tmp_0" } engine_name: "general_infer_0" } profile_time: 1645339861250398 profile_time: 1645339861346107 我看到有python的demo可以实现 img = seq(args.image_path) fetch_map = client.predict( feed={"x": img}, fetch=["argmax_0.tmp_0"])
result = fetch_map["argmax_0.tmp_0"]
color_img = get_pseudo_color_map(result[0])
color_img.save("./result.png")
print("The segmentation image is saved in ./result.png")
如果换成java,如何保存图片,能否把example代码补全
Message that will be displayed on users' first issue
示例为了方便演示,统一将结果转换为字符串形式打印输出。 如果需要自行后处理,可以直接去Java的Client 类中,自行修改输出即可。
PaddleServingClientExample.java 我模仿了例子中的yolov4方法,预测一张图片, Client client = new Client(); client.setIP("127.0.0.1"); client.setPort("9292"); client.loadClientConfig(model_config_path); String result = client.predict(feed_data, fetch, true, 0); System.out.println(result); 我如何处理这里的result,目前我得到的是这样的数据,我如何转换成图片? outputs { tensor { int64_data: 0 int64_data: 0 int64_data: 0 int64_data: 0 int64_data: 0 ...... shape: 1 shape: 275 shape: 170 name: "depthwise_conv2d_11.tmp_0" alias_name: "argmax_0.tmp_0" } engine_name: "general_infer_0" } profile_time: 1645339861250398 profile_time: 1645339861346107 我看到有python的demo可以实现 img = seq(args.image_path) fetch_map = client.predict( feed={"x": img}, fetch=["argmax_0.tmp_0"])
result = fetch_map["argmax_0.tmp_0"] color_img = get_pseudo_color_map(result[0]) color_img.save("./result.png") print("The segmentation image is saved in ./result.png")如果换成java,如何保存图片,能否把example代码补全
Hi, can you share your code? I can not succeed. Thank you very much.
这个问题解决了吗,一堆字符串怎么解析?