Skip to content
New issue

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_client调用rpc报错(FasterRCNN) #595

Closed
wszph opened this issue May 22, 2020 · 6 comments
Closed

serving_client调用rpc报错(FasterRCNN) #595

wszph opened this issue May 22, 2020 · 6 comments
Assignees

Comments

@wszph
Copy link

wszph commented May 22, 2020

你好,我在测试提供的目标检测模型提供Faster RCNN Model实例 时,可以正常启动serve端,但是client端报错如下:

WARNING: Logging before InitGoogleLogging() is written to STDERR
E0522 08:31:33.885603   161 config_manager.cpp:217] Not found key in configue: cluster
E0522 08:31:33.885659   161 config_manager.cpp:234] Not found key in configue: split_tag_name
E0522 08:31:33.885700   161 config_manager.cpp:235] Not found key in configue: tag_candidates
E0522 08:31:33.885725   161 config_manager.cpp:202] Not found key in configue: connect_timeout_ms
E0522 08:31:33.885735   161 config_manager.cpp:203] Not found key in configue: rpc_timeout_ms
E0522 08:31:33.885742   161 config_manager.cpp:205] Not found key in configue: hedge_request_timeout_ms
E0522 08:31:33.885751   161 config_manager.cpp:207] Not found key in configue: connect_retry_count
E0522 08:31:33.885767   161 config_manager.cpp:209] Not found key in configue: hedge_fetch_retry_count
E0522 08:31:33.885776   161 config_manager.cpp:211] Not found key in configue: max_connection_per_host
E0522 08:31:33.885790   161 config_manager.cpp:212] Not found key in configue: connection_type
E0522 08:31:33.885798   161 config_manager.cpp:219] Not found key in configue: load_balance_strategy
E0522 08:31:33.885807   161 config_manager.cpp:221] Not found key in configue: cluster_filter_strategy
E0522 08:31:33.885814   161 config_manager.cpp:226] Not found key in configue: protocol
E0522 08:31:33.885821   161 config_manager.cpp:227] Not found key in configue: compress_type
E0522 08:31:33.885829   161 config_manager.cpp:228] Not found key in configue: package_size
E0522 08:31:33.885836   161 config_manager.cpp:230] Not found key in configue: max_channel_per_request
E0522 08:31:33.885844   161 config_manager.cpp:234] Not found key in configue: split_tag_name
E0522 08:31:33.885854   161 config_manager.cpp:235] Not found key in configue: tag_candidates
I0522 08:31:33.891280   161 naming_service_thread.cpp:209] brpc::policy::ListNamingService("127.0.0.1:9494"): added 1

测试代码也是采用实例中的test_client.py文件,麻烦看一下什么原因?

@github-actions
Copy link

Message that will be displayed on users' first issue

@barrierye
Copy link
Contributor

这个应该是Client端的正常输出,程序运行的返回值正常吗?

@wszph
Copy link
Author

wszph commented May 25, 2020

@barrierye 现在Faster RCNN Model实例代码可以正常测试。现在有另外一个问题,我的serving_server_conf.prototxt如下:
feed_var {
name: "image"
alias_name: "image"
is_lod_tensor: false
feed_type: 1
shape: 3
shape: 608
shape: 608
}
feed_var {
name: "im_shape"
alias_name: "im_shape"
is_lod_tensor: false
feed_type: 0
shape: 2
}
fetch_var {
name: "save_infer_model/scale_0.tmp_0"
alias_name: "outputs"
is_lod_tensor: true
fetch_type: 1
shape: -1
}
serving_client_conf.prototxt如下:
feed_var {
name: "image"
alias_name: "image"
is_lod_tensor: false
feed_type: 1
shape: 3
shape: 608
shape: 608
}
feed_var {
name: "im_shape"
alias_name: "im_shape"
is_lod_tensor: false
feed_type: 0
shape: 2
}
fetch_var {
name: "save_infer_model/scale_0.tmp_0"
alias_name: "outputs"
is_lod_tensor: true
fetch_type: 1
shape: -1
}

可以成功启动serving,但写client时,“im_shape”该怎么写?

@bjjwwang
Copy link
Collaborator

@barrierye 现在Faster RCNN Model实例代码可以正常测试。现在有另外一个问题,我的serving_server_conf.prototxt如下:
feed_var {
name: "image"
alias_name: "image"
is_lod_tensor: false
feed_type: 1
shape: 3
shape: 608
shape: 608
}
feed_var {
name: "im_shape"
alias_name: "im_shape"
is_lod_tensor: false
feed_type: 0
shape: 2
}
fetch_var {
name: "save_infer_model/scale_0.tmp_0"
alias_name: "outputs"
is_lod_tensor: true
fetch_type: 1
shape: -1
}
serving_client_conf.prototxt如下:
feed_var {
name: "image"
alias_name: "image"
is_lod_tensor: false
feed_type: 1
shape: 3
shape: 608
shape: 608
}
feed_var {
name: "im_shape"
alias_name: "im_shape"
is_lod_tensor: false
feed_type: 0
shape: 2
}
fetch_var {
name: "save_infer_model/scale_0.tmp_0"
alias_name: "outputs"
is_lod_tensor: true
fetch_type: 1
shape: -1
}

可以成功启动serving,但写client时,“im_shape”该怎么写?

我记得imshape没什么影响,预留给图片的长和宽。比如[608, 608]

@wszph
Copy link
Author

wszph commented May 26, 2020

@barrierye 现在Faster RCNN Model实例代码可以正常测试。现在有另外一个问题,我的serving_server_conf.prototxt如下:
feed_var {
name: "image"
alias_name: "image"
is_lod_tensor: false
feed_type: 1
shape: 3
shape: 608
shape: 608
}
feed_var {
name: "im_shape"
alias_name: "im_shape"
is_lod_tensor: false
feed_type: 0
shape: 2
}
fetch_var {
name: "save_infer_model/scale_0.tmp_0"
alias_name: "outputs"
is_lod_tensor: true
fetch_type: 1
shape: -1
}
serving_client_conf.prototxt如下:
feed_var {
name: "image"
alias_name: "image"
is_lod_tensor: false
feed_type: 1
shape: 3
shape: 608
shape: 608
}
feed_var {
name: "im_shape"
alias_name: "im_shape"
is_lod_tensor: false
feed_type: 0
shape: 2
}
fetch_var {
name: "save_infer_model/scale_0.tmp_0"
alias_name: "outputs"
is_lod_tensor: true
fetch_type: 1
shape: -1
}
可以成功启动serving,但写client时,“im_shape”该怎么写?

我记得imshape没什么影响,预留给图片的长和宽。比如[608, 608]

我在client中尝试用[608, 608],
serving端会报错:
InvalidArgumentError: Tensor holds the wrong type, it holds int64_t, but desires to be int.
[Hint: Expected valid == true, but received valid:0 != true:1.] at (/paddle/paddle/fluid/framework/tensor_impl.h:33)
[operator < yolo_box > error]

我是用yolov3微调的模型,完整的测试代码如下:
from paddle_serving_client import Client

from paddle_serving_app.reader import Sequential, File2Image, Resize

from paddle_serving_app.reader import RGB2BGR, Transpose, Div, Normalize

import time
import numpy as np

client = Client()

client.load_client_config("yolov3_seq20_client/serving_client_conf.prototxt")

client.connect(["127.0.0.1:9494"])

seq = Sequential([

File2Image(), RGB2BGR(),Resize((608,608)), 

Div(255), Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225], False),Transpose((2, 0, 1))

])

start = time.time()

image_file = "HouseFive696.jpg"

#np.array(list(img.shape[1:]) + [1.0])
img = seq(image_file)

fetch_map = client.predict(
feed={
"image": img,
"im_shape": np.array([608,608])
},
fetch=["outputs"])

print("fetch_map",type(fetch_map))

end = time.time()

print(end - start)
麻烦看一下,我该怎么修改client,谢谢

@guru4elephant guru4elephant changed the title serving_client调用rpc报错 serving_client调用rpc报错(FasterRCNN) May 27, 2020
@bjjwwang
Copy link
Collaborator

bjjwwang commented Jul 1, 2020

@barrierye 现在Faster RCNN Model实例代码可以正常测试。现在有另外一个问题,我的serving_server_conf.prototxt如下:
feed_var {
name: "image"
alias_name: "image"
is_lod_tensor: false
feed_type: 1
shape: 3
shape: 608
shape: 608
}
feed_var {
name: "im_shape"
alias_name: "im_shape"
is_lod_tensor: false
feed_type: 0
shape: 2
}
fetch_var {
name: "save_infer_model/scale_0.tmp_0"
alias_name: "outputs"
is_lod_tensor: true
fetch_type: 1
shape: -1
}
serving_client_conf.prototxt如下:
feed_var {
name: "image"
alias_name: "image"
is_lod_tensor: false
feed_type: 1
shape: 3
shape: 608
shape: 608
}
feed_var {
name: "im_shape"
alias_name: "im_shape"
is_lod_tensor: false
feed_type: 0
shape: 2
}
fetch_var {
name: "save_infer_model/scale_0.tmp_0"
alias_name: "outputs"
is_lod_tensor: true
fetch_type: 1
shape: -1
}
可以成功启动serving,但写client时,“im_shape”该怎么写?
我记得imshape没什么影响,预留给图片的长和宽。比如[608, 608]

我在client中尝试用[608, 608],
serving端会报错:
InvalidArgumentError: Tensor holds the wrong type, it holds int64_t, but desires to be int.
[Hint: Expected valid == true, but received valid:0 != true:1.] at (/paddle/paddle/fluid/framework/tensor_impl.h:33)
[operator < yolo_box > error]

我是用yolov3微调的模型,完整的测试代码如下:
from paddle_serving_client import Client

from paddle_serving_app.reader import Sequential, File2Image, Resize

from paddle_serving_app.reader import RGB2BGR, Transpose, Div, Normalize

import time
import numpy as np

client = Client()

client.load_client_config("yolov3_seq20_client/serving_client_conf.prototxt")

client.connect(["127.0.0.1:9494"])

seq = Sequential([

File2Image(), RGB2BGR(),Resize((608,608)), 

Div(255), Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225], False),Transpose((2, 0, 1))

])

start = time.time()

image_file = "HouseFive696.jpg"

#np.array(list(img.shape[1:]) + [1.0])
img = seq(image_file)

fetch_map = client.predict(
feed={
"image": img,
"im_shape": np.array([608,608])
},
fetch=["outputs"])

print("fetch_map",type(fetch_map))

end = time.time()

print(end - start)
麻烦看一下,我该怎么修改client,谢谢

可以参考一下 python/examples/faster_rcnn_model/test_client.py

@paddle-bot paddle-bot bot closed this as completed Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants