We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
改造了Serving/core/general-server/op/general_detection_op.cpp增加了输出boxes的代码。但是client端获取不到增加的输出。请问应该怎么改prototxt或者client端实现获取多个输出? 增加部分如下:
int box_size_out = box_num*4*2*sizeof(int); void *box_data_out = MempoolWrapper::instance().malloc(box_size_out); if (!box_data_out) { LOG(ERROR) << "Malloc failed, size: " << box_size_out; return -1; } int* databuf_int = reinterpret_cast<int*>(box_data_out); for (int i = 0; i < box_num; ++i) { for (int row = 0; row < 4; row++){ *databuf_int = boxes[i][row][0]; databuf_int++; *databuf_int = boxes[i][row][1]; databuf_int++; } } // memcpy(databuf_data_out, &boxes, databuf_size_out); char *box_char_out = reinterpret_cast<char*>(box_data_out); paddle::PaddleBuf paddleBuf_out_2(box_char_out, box_size_out); paddle::PaddleTensor tensor_out_2; tensor_out_2.name = "boxes"; tensor_out_2.dtype = paddle::PaddleDType::INT32; tensor_out_2.shape = {box_num, 4, 2}; tensor_out_2.data = paddleBuf_out_2; out->push_back(tensor_out_2);
获取serving输出的det_cpp_client.py如下:
import sys import numpy as np import base64 import os import cv2 from paddle_serving_app.reader import Sequential, URL2Image, ResizeByFactor from paddle_serving_app.reader import Div, Normalize, Transpose from paddle_serving_app.reader import OCRReader from paddle_serving_app.reader import DBPostProcess, FilterBoxes, GetRotateCropImage, SortedBoxes client = Client() client.load_client_config(sys.argv[1:]) client.connect(["127.0.0.1:9293"]) fetch_list = client.get_fetch_names() print(fetch_list) test_img_dir = "imgs/" img_file = '1.jpg' def cv2_to_base64(image): return base64.b64encode(image) #data.tostring()).decode('utf8') with open(os.path.join(test_img_dir, img_file), 'rb') as file: image_data = file.read() image = cv2_to_base64(image_data) det_out = client.predict( feed={"x": image}, fetch=["x","boxes"], batch=True) print(det_out)
serving启动代码如下:
python3 -m paddle_serving_server.serve --model ocr_det_model --op GeneralDetectionOp --port 9293
client启动代码如下:
python3 det_cpp_client.py ocr_det_client
The text was updated successfully, but these errors were encountered:
Message that will be displayed on users' first issue
Sorry, something went wrong.
请问您的问题解决了吗?我也有同样的需求
No branches or pull requests
改造了Serving/core/general-server/op/general_detection_op.cpp增加了输出boxes的代码。但是client端获取不到增加的输出。请问应该怎么改prototxt或者client端实现获取多个输出?
增加部分如下:
获取serving输出的det_cpp_client.py如下:
serving启动代码如下:
python3 -m paddle_serving_server.serve --model ocr_det_model --op GeneralDetectionOp --port 9293
client启动代码如下:
python3 det_cpp_client.py ocr_det_client
The text was updated successfully, but these errors were encountered: