Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangsen
paddle_dbnet
Commits
dc4f1c21
Commit
dc4f1c21
authored
Feb 27, 2022
by
WenmuZhou
Browse files
add ocr cpp pferx to logi
parent
aedddd81
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
deploy/android_demo/app/src/main/cpp/ppredictor.cpp
deploy/android_demo/app/src/main/cpp/ppredictor.cpp
+6
-6
No files found.
deploy/android_demo/app/src/main/cpp/ppredictor.cpp
View file @
dc4f1c21
...
...
@@ -42,17 +42,17 @@ template <typename ConfigT> int PPredictor::_init(ConfigT &config) {
// CL_PRECISION_FP32: 1, force fp32
// CL_PRECISION_FP16: 2, force fp16
config
.
set_opencl_precision
(
paddle
::
lite_api
::
CL_PRECISION_FP32
);
LOGI
(
"device: running on gpu."
);
LOGI
(
"
ocr cpp
device: running on gpu."
);
}
}
else
{
LOGI
(
"device: running on cpu."
);
LOGI
(
"
ocr cpp
device: running on cpu."
);
// you can give backup cpu nb model instead
// config.set_model_from_file(cpu_nb_model_dir);
}
config
.
set_threads
(
_thread_num
);
config
.
set_power_mode
(
_mode
);
_predictor
=
paddle
::
lite_api
::
CreatePaddlePredictor
(
config
);
LOGI
(
"paddle instance created"
);
LOGI
(
"
ocr cpp
paddle instance created"
);
return
RETURN_OK
;
}
...
...
@@ -73,18 +73,18 @@ std::vector<PredictorInput> PPredictor::get_inputs(int num) {
PredictorInput
PPredictor
::
get_first_input
()
{
return
get_input
(
0
);
}
std
::
vector
<
PredictorOutput
>
PPredictor
::
infer
()
{
LOGI
(
"infer Run start %d"
,
_net_flag
);
LOGI
(
"
ocr cpp
infer Run start %d"
,
_net_flag
);
std
::
vector
<
PredictorOutput
>
results
;
if
(
!
_is_input_get
)
{
return
results
;
}
_predictor
->
Run
();
LOGI
(
"infer Run end"
);
LOGI
(
"
ocr cpp
infer Run end"
);
for
(
int
i
=
0
;
i
<
_predictor
->
GetOutputNames
().
size
();
i
++
)
{
std
::
unique_ptr
<
const
paddle
::
lite_api
::
Tensor
>
output_tensor
=
_predictor
->
GetOutput
(
i
);
LOGI
(
"output tensor[%d] size %ld"
,
i
,
product
(
output_tensor
->
shape
()));
LOGI
(
"
ocr cpp
output tensor[%d] size %ld"
,
i
,
product
(
output_tensor
->
shape
()));
PredictorOutput
result
{
std
::
move
(
output_tensor
),
i
,
_net_flag
};
results
.
emplace_back
(
std
::
move
(
result
));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment