Comments (2)
麻烦提供一个最小可复现的demo
from paddleocr.
麻烦提供一个最小可复现的demo
什么样的demo 不用代码吗
我是只修改了 args.cpp里打开GPU 和TensorRT ,打开det和rec
然后调用一次ocrInit,然后反复调用ocr_once 实现的 能这样用吗
PPOCR *ocrRun;
//OCR初始化
void ocrInit(int argc, char **argv)
{
google::ParseCommandLineFlags(&argc, &argv, true);
check_params(); //检测ocr配置
ocrRun = new PPOCR();
}
//OCR一次
int ocr_once (cv::Mat ocrimg , Ui::MainWindow *ui)
{
if (ocrimg.empty()) {
std::cerr << "[ERROR] image inexistence! "
<< std::endl;
return 0;
// exit(1);
}
if (!Utility::PathExists(FLAGS_output)) {
Utility::CreateDir(FLAGS_output);
}
if (FLAGS_type == "ocr") {
std::vector<OCRPredictResult> ocr_results =
ocrRun->ocr(ocrimg, FLAGS_det, FLAGS_rec, FLAGS_cls); //*OCR
Utility::print_result(ocr_results); //printf
//print_result_recUi(ocr_results ,ui);
if (FLAGS_visualize && FLAGS_det) {
cv::Mat srcimg = ocrimg;
QDateTime current_date_time =QDateTime::currentDateTime();
std::string current_date_name = (QString("%1-%2-%3-%4-%5-%6").arg(current_date_time.date().year()).arg(current_date_time.date().month())
.arg(current_date_time.date().day()).arg(current_date_time.time().hour())
.arg(current_date_time.time().minute()).arg(current_date_time.time().msec())).toStdString();
Utility::VisualizeBboxes(srcimg, ocr_results, //画框 并 保存
FLAGS_output + "/" + current_date_name + ".jpg");
return 1;
}
}
return 0;
}
初始化后输出内容是这样的
In PP-OCRv3, rec_image_shape parameter defaults to '3, 48, 320',if you are using recognition model with PP-OCRv2 or an older version, please set --rec_image_shape='3,32,320
WARNING: Logging before InitGoogleLogging() is written to STDERR
I0606 13:33:05.597819 10352 analysis_config.cc:1539] In CollectShapeInfo mode, we will disable optimizations and collect the shape information of all intermediate tensors in the compute graph and calculate the min_shape, max_shape and opt_shape.
I0606 13:33:06.436725 10352 analysis_predictor.cc:1532] TensorRT subgraph engine is enabled
I0606 13:33:06.436725 10352 analysis_predictor.cc:1740] Ir optimization is turned off, no ir pass will be executed.
e[1me[35m--- Running analysis [ir_graph_build_pass]e[0m
I0606 13:33:06.440716 10352 executor.cc:187] Old Executor is Running.
e[1me[35m--- Running analysis [ir_analysis_pass]e[0m
e[1me[35m--- Running analysis [save_optimized_model_pass]e[0m
e[1me[35m--- Running analysis [ir_params_sync_among_devices_pass]e[0m
I0606 13:33:06.454707 10352 ir_params_sync_among_devices_pass.cc:53] Sync params from CPU to GPU
e[1me[35m--- Running analysis [adjust_cudnn_workspace_size_pass]e[0m
e[1me[35m--- Running analysis [inference_op_replace_pass]e[0m
e[1me[35m--- Running analysis [memory_optimize_pass]e[0m
I0606 13:33:06.468638 10352 memory_optimize_pass.cc:118] The persistable params in main graph are : 4.47025MB
I0606 13:33:06.474623 10352 memory_optimize_pass.cc:246] Cluster name : tmp_85 size: 1536
I0606 13:33:06.474623 10352 memory_optimize_pass.cc:246] Cluster name : tmp_21 size: 192
I0606 13:33:06.474623 10352 memory_optimize_pass.cc:246] Cluster name : tmp_94 size: 1536
I0606 13:33:06.474623 10352 memory_optimize_pass.cc:246] Cluster name : tmp_118 size: 96
I0606 13:33:06.474623 10352 memory_optimize_pass.cc:246] Cluster name : relu_1.tmp_0 size: 384
I0606 13:33:06.474623 10352 memory_optimize_pass.cc:246] Cluster name : hardswish_79.tmp_0 size: 1536
I0606 13:33:06.474623 10352 memory_optimize_pass.cc:246] Cluster name : tmp_35 size: 384
I0606 13:33:06.474623 10352 memory_optimize_pass.cc:246] Cluster name : tmp_73 size: 768
I0606 13:33:06.474623 10352 memory_optimize_pass.cc:246] Cluster name : x size: 12
e[1me[35m--- Running analysis [ir_graph_to_program_pass]e[0m
I0606 13:33:06.519503 10352 analysis_predictor.cc:1838] ======= optimize end =======
I0606 13:33:06.520501 10352 naive_executor.cc:200] --- skip [feed], feed -> x
I0606 13:33:06.522496 10352 naive_executor.cc:200] --- skip [sigmoid_0.tmp_0], fetch -> fetch
In PP-OCRv3, default rec_img_h is 48,if you use other model, you should set the param rec_img_h=32
I0606 13:33:06.523494 10352 analysis_config.cc:1539] In CollectShapeInfo mode, we will disable optimizations and collect the shape information of all intermediate tensors in the compute graph and calculate the min_shape, max_shape and opt_shape.
I0606 13:33:06.530472 10352 analysis_predictor.cc:1740] Ir optimization is turned off, no ir pass will be executed.
e[1me[35m--- Running analysis [ir_graph_build_pass]e[0m
e[1me[35m--- Running analysis [ir_analysis_pass]e[0m
e[1me[35m--- Running analysis [save_optimized_model_pass]e[0m
e[1me[35m--- Running analysis [ir_params_sync_among_devices_pass]e[0m
I0606 13:33:06.554409 10352 ir_params_sync_among_devices_pass.cc:53] Sync params from CPU to GPU
e[1me[35m--- Running analysis [adjust_cudnn_workspace_size_pass]e[0m
e[1me[35m--- Running analysis [inference_op_replace_pass]e[0m
e[1me[35m--- Running analysis [memory_optimize_pass]e[0m
I0606 13:33:06.578346 10352 memory_optimize_pass.cc:118] The persistable params in main graph are : 10.2689MB
I0606 13:33:06.584360 10352 memory_optimize_pass.cc:246] Cluster name : linear_170.tmp_1 size: 26500
I0606 13:33:06.584360 10352 memory_optimize_pass.cc:246] Cluster name : shape_5.tmp_0_slice_1 size: 4
I0606 13:33:06.584360 10352 memory_optimize_pass.cc:246] Cluster name : conv2d_198.tmp_1 size: 11520
I0606 13:33:06.584360 10352 memory_optimize_pass.cc:246] Cluster name : linear_170.tmp_0 size: 26500
I0606 13:33:06.584360 10352 memory_optimize_pass.cc:246] Cluster name : pool2d_3.tmp_0_clone_0 size: 1920
I0606 13:33:06.584360 10352 memory_optimize_pass.cc:246] Cluster name : batch_norm_5.tmp_0 size: 1920
I0606 13:33:06.584360 10352 memory_optimize_pass.cc:246] Cluster name : x size: 576
I0606 13:33:06.584360 10352 memory_optimize_pass.cc:246] Cluster name : transpose_44.tmp_0_slice_2 size: 480
I0606 13:33:06.584360 10352 memory_optimize_pass.cc:246] Cluster name : fill_constant_17.tmp_0 size: 4
I0606 13:33:06.584360 10352 memory_optimize_pass.cc:246] Cluster name : fill_constant_19.tmp_0 size: 4
I0606 13:33:06.584360 10352 memory_optimize_pass.cc:246] Cluster name : shape_3.tmp_0_slice_1 size: 4
I0606 13:33:06.584360 10352 memory_optimize_pass.cc:246] Cluster name : reshape2_27.tmp_1 size: 0
e[1me[35m--- Running analysis [ir_graph_to_program_pass]e[0m
I0606 13:33:06.629241 10352 analysis_predictor.cc:1838] ======= optimize end =======
I0606 13:33:06.629241 10352 naive_executor.cc:200] --- skip [feed], feed -> x
I0606 13:33:06.631232 10352 naive_executor.cc:200] --- skip [softmax_11.tmp_0], fetch -> fetch
from paddleocr.
Related Issues (20)
- 新的表格识别算法-SLANet-LCNetV2,推理模型结果没法复现 HOT 7
- ModuleNotFoundError: No module named 'tools.infer' while Detectron2 are installed HOT 6
- DB_MV3 loss wont decrease beyond a certain point
- ValueError: (InvalidArgument) input and filter data type should be consistent, but received input data type is float and filter type is int8_t [Hint: Expected input_data_type == filter_data_type, but received input_data_type:5 != filter_data_type:21.] (at ../paddle/fluid/operators/generator/get_expected_kernel_func.cc:423) [operator < conv2d > error] HOT 1
- 在识别大量图片过程种,某一区间的识别率会骤降,这是bug吗? HOT 8
- pp-ocrv4 det模型调优 召回率不高
- 训练中文识别CPPD方法时,在CPPDLabelEncode中encodech()方法内报错 HOT 1
- A global iterator flag was passed as a per-operand flag to the iterator constructor HOT 4
- KeyError: 'cells'
- 最新发布表格识别模型报错 HOT 5
- pyinstaller 打包好的软件,导出模型时报的错
- 用quick start推理实现检测和识别 InvalidArgumentError: Broadcast dimension mismatch HOT 2
- 本地推理时比飞桨官网通用OCR体验的识别效果差了很多 HOT 2
- infer_vqa_token_ser_re.py 输出的内容是空,没有在图片显示键值的结果,infer_results.txt里面ser_result数组结果也是空
- 使用GPU推理乱码 HOT 1
- 存在内存泄露 HOT 4
- paddle_serving部署教程中,模型转换代码实效。 HOT 2
- Paddleocr models keep downloading every time container starts HOT 2
- File "tools/infer_kie_token_ser_re.py", line 223, in <module> result_key[ocr_info_head['text']] = ocr_info_tail['text'] KeyError: 'text' HOT 2
- PPStructure missing text that PaddleOCR do not miss HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from paddleocr.