当前位置: 首页 > news >正文

展示网站动画怎么做的seo教育培训机构

展示网站动画怎么做的,seo教育培训机构,学校网站建设报价表,html网页的代码大全章节一#xff1a;Windows 下的 PIP 安装 官网安装教程地址 按照里面的教程去安装 如果使用cuda版本的还要安装tensorrt#xff0c;不然后面运行demo程序的程序会报如下错。 下载TensorRT 8版本#xff0c;tensorrt下载地址 章节二#xff1a;编译源码 进入官网源码地址 下… 章节一Windows 下的 PIP 安装 官网安装教程地址 按照里面的教程去安装 如果使用cuda版本的还要安装tensorrt不然后面运行demo程序的程序会报如下错。 下载TensorRT 8版本tensorrt下载地址 章节二编译源码 进入官网源码地址 下载release2.7 下载三个模型 下载推理预测库 官网下载地址根据自己的情况下载CPU或对应的自己CUDA版本的GPU 用CMAK打开如下文件 添加路径OpenCV路径和预测库路径。 然后Configers再Generate如果有报错不用管他最后在你的构建目录生成了项目然后开始编译。 但是编译会报错 在utility.cpp中无法打开包括文件dirent.h:No such file or directory dirent.h是个unix系统下常见的接口但windows平台的MSVC编译器并没有提供这个接口对于跨平台的项目开发就会带来一些麻烦如果在MSVC下编译时可能因为windows平台缺少这个接口就要为windows平台另外写一些代码。 不过大佬已经做了一个windows版本的dirent.h放在了github上面链接如下 https://github.com/tronkko/dirent 下载完后加入这个文件夹 然后重新编译但是会报错找不到_stat做如下修改就可以了。 //修改前struct stat s;_stat(dir_name, s); //修改后struct _stat64 s;_stat64(dir_name, s); 最后就可以生成成功生成成功要将这几个dll复制到程序目录。 onnxruntime和paddle2onnx在这里 将这个文件复制到程序目录 源码里面这个文件的路径也要改一下 然后输入命令运行程序下面的路径根据自己情况去修改 ./ppocr.exe --det_model_dirF:/Vision/PaddleOCR/2_7/model/ch_PP-OCRv4_det_infer --cls_model_dirF:/Vision/PaddleOCR/2_7/model/ch_ppocr_mobile_v2.0_cls_infer --rec_model_dirF:/Vision/PaddleOCR/2_7/model/ch_PP-OCRv4_rec_infer --image_dirF:/Vision/PaddleOCR/2_7/PaddleOCR-release-2.7/deploy/cpp_infer/build/Release/aa.png 运行结果如下 章节三在Qt上编译运行 pro文件构建 QT core gui widgetsgreaterThan(QT_MAJOR_VERSION, 4): QT widgetsCONFIG c17DEFINES QT_DEPRECATED_WARNINGS################################################################## #指定生成的文件存放位置 ################################################################## MOC_DIR $$PWD/temp/moc RCC_DIR $$PWD/temp/rcc UI_DIR $$PWD/temp/ui OBJECTS_DIR $$PWD/temp/obj DESTDIR $$PWD/temp/binCONFIG(debug, debug|release) {QMAKE_CXXFLAGS_DEBUG /MTd }CONFIG(release, debug|release) {QMAKE_CXXFLAGS_RELEASE /MT }PaddleOCR_ROOT F:/Vision/PaddleOCR/2_7/OCR_Demo/OCR_Demo/ocr SOURCES \ # $$PaddleOCR_ROOT/src/args.cpp \$$PaddleOCR_ROOT/src/clipper.cpp \$$PaddleOCR_ROOT/src/ocr_cls.cpp \$$PaddleOCR_ROOT/src/ocr_det.cpp \$$PaddleOCR_ROOT/src/ocr_rec.cpp \ # $$PaddleOCR_ROOT/src/paddleocr.cpp \ # $$PaddleOCR_ROOT/src/paddlestructure.cpp \$$PaddleOCR_ROOT/src/postprocess_op.cpp \$$PaddleOCR_ROOT/src/preprocess_op.cpp \$$PaddleOCR_ROOT/src/structure_layout.cpp \$$PaddleOCR_ROOT/src/structure_table.cpp \$$PaddleOCR_ROOT/src/utility.cpp \ScreenWidget/screen.cpp \ScreenWidget/screenwidget.cpp \main.cpp \mainwindow.cpp \my_config.cpp \my_paddleocr.cppHEADERS \$$PaddleOCR_ROOT/include/ocr_cls.h \$$PaddleOCR_ROOT/include/ocr_det.h \$$PaddleOCR_ROOT/include/ocr_rec.h \ # $$PaddleOCR_ROOT/include/paddleocr.h \ # $$PaddleOCR_ROOT/include/paddlestructure.h \$$PaddleOCR_ROOT/include/postprocess_op.h \$$PaddleOCR_ROOT/include/preprocess_op.h \$$PaddleOCR_ROOT/include/structure_layout.h \$$PaddleOCR_ROOT/include/structure_table.h \$$PaddleOCR_ROOT/include/utility.h \ # $$PaddleOCR_ROOT/include/args.h \$$PaddleOCR_ROOT/include/clipper.h \$$PaddleOCR_ROOT/include/dirent.h \ScreenWidget/screen.h \ScreenWidget/screenwidget.h \mainwindow.h \my_config.h \my_paddleocr.hFORMS \mainwindow.uiINCLUDEPATH $$PaddleOCR_ROOT INCLUDEPATH $$PaddleOCR_ROOT/include INCLUDEPATH $$PWD\ScreenWidgetInference_ROOT F:/Vision/PaddleOCR/2_7/prelib/cuda11_0 INCLUDEPATH $$Inference_ROOT/paddle/include INCLUDEPATH $$Inference_ROOT/third_party/install/protobuf/include INCLUDEPATH $$Inference_ROOT/third_party/install/glog/include #INCLUDEPATH $$Inference_ROOT/third_party/install/gflags/include INCLUDEPATH $$Inference_ROOT/third_party/install/xxhash/include INCLUDEPATH $$Inference_ROOT/third_party/install/mklml/include INCLUDEPATH $$Inference_ROOT/third_party/install/mkldnn/includeLIBS -L$$Inference_ROOT/paddle/lib -lpaddle_inference LIBS -L$$Inference_ROOT/third_party/install/mklml/lib -lmklml LIBS -L$$Inference_ROOT/third_party/install/mklml/lib -llibiomp5md LIBS -L$$Inference_ROOT/third_party/install/mkldnn/lib -lmkldnn LIBS -L$$Inference_ROOT/third_party/install/glog/lib -lglog #LIBS -L$$Inference_ROOT/third_party/install/gflags/lib -lgflags_static LIBS -L$$Inference_ROOT/third_party/install/protobuf/lib -llibprotobuf LIBS -L$$Inference_ROOT/third_party/install/xxhash/lib -lxxhashOpenCV_ROOT E:/2021_software/OpenCv/OpenCv3_4_15/install/opencv/build INCLUDEPATH $$OpenCV_ROOT/include INCLUDEPATH $$OpenCV_ROOT/include/opencv INCLUDEPATH $$OpenCV_ROOT/include/opencv2 LIBS -L$$OpenCV_ROOT/x64/vc15/lib -lopencv_world3415 自定义一个config类 #pragma once#include iomanip #include iostream #include map #include ostream #include string #include vector#include include/utility.husing namespace PaddleOCR;class MY_OCRConfig { public:explicit MY_OCRConfig(const std::string config_file);// common argsbool use_gpu false;bool use_tensorrt false;int gpu_id 0;int gpu_mem 4000;int cpu_threads 10;bool enable_mkldnn false;std::string precision fp32;bool benchmark false;std::string output ./output/;std::string image_dir ;std::string type ocr;// detection relatedstd::string det_model_dir ;std::string limit_type max;int limit_side_len 960;double det_db_thresh 0.3;double det_db_box_thresh 0.6;double det_db_unclip_ratio 1.5;bool use_dilation false;std::string det_db_score_mode slow;bool visualize true;// classification relatedbool use_angle_cls false;std::string cls_model_dir ;double cls_thresh 0.9;int cls_batch_num 1;// recognition relatedstd::string rec_model_dir ;int rec_batch_num 6;std::string rec_char_dict_path ./ppocr_keys_v1.txt;int rec_img_h 48;int rec_img_w 320;// layout model relatedstd::string layout_model_dir ;std::string layout_dict_path ../../ppocr/utils/dict/layout_dict/layout_publaynet_dict.txt;double layout_score_threshold 0.5;double layout_nms_threshold 0.5;// structure model relatedstd::string table_model_dir ;int table_max_len 488;int table_batch_num 1;bool merge_no_span_structure true;std::string table_char_dict_path ../../ppocr/utils/dict/table_structure_dict_ch.txt;// ocr forward relatedbool det true;bool rec true;bool cls false;bool table false;bool layout false;private:// Load configurationstd::mapstd::string, std::string LoadConfig(const std::string config_file);std::vectorstd::string split(const std::string str,const std::string delim);std::mapstd::string, std::string config_map_; };#include my_config.h #include qdebug.hstd::vectorstd::string MY_OCRConfig::split(const std::string str,const std::string delim) {std::vectorstd::string res;if ( str)return res;int strlen str.length() 1;char *strs new char[strlen];std::strcpy(strs, str.c_str());int delimlen delim.length() 1;char *d new char[delimlen];std::strcpy(d, delim.c_str());char *p std::strtok(strs, d);while (p) {std::string s p;res.push_back(s);p std::strtok(NULL, d);}delete[] strs;delete[] d;return res; }std::mapstd::string, std::string MY_OCRConfig::LoadConfig(const std::string config_path) {auto config Utility::ReadDict(config_path);std::mapstd::string, std::string dict;for (int i 0; i config.size(); i) {// pass for empty line or commentif (config[i].size() 1 || config[i][0] #) {continue;}//std::vectorstd::string res split(config[i], );if (res.size() 2) {dict[res[0]] ;}else{dict[res[0]] res[1];}}return dict; }MY_OCRConfig::MY_OCRConfig(const std::string config_file) {config_map_ LoadConfig(config_file);// common argsthis-use_gpu (config_map_[use_gpu] true);this-use_tensorrt (config_map_[use_tensorrt] true);this-gpu_id stoi(config_map_[gpu_id]);this-gpu_mem stoi(config_map_[gpu_mem]);this-cpu_threads stoi(config_map_[cpu_threads]);this-enable_mkldnn (config_map_[enable_mkldnn] true);this-precision config_map_[precision];this-benchmark (config_map_[benchmark] true);this-output config_map_[output];this-image_dir config_map_[image_dir];this-type config_map_[type];// detection relatedthis-det_model_dir config_map_[det_model_dir];this-limit_type config_map_[limit_type];this-limit_side_len stoi(config_map_[limit_side_len]);this-det_db_thresh stod(config_map_[det_db_thresh]);this-det_db_box_thresh stod(config_map_[det_db_box_thresh]);this-det_db_unclip_ratio stod(config_map_[det_db_unclip_ratio]);this-use_dilation (config_map_[use_dilation] true);this-det_db_score_mode config_map_[det_db_score_mode];this-visualize (config_map_[visualize] true);// classification relatedthis-use_angle_cls (config_map_[use_angle_cls] true);this-cls_model_dir config_map_[cls_model_dir];this-cls_thresh stod(config_map_[cls_thresh]);this-cls_batch_num stoi(config_map_[cls_batch_num]);// recognition relatedthis-rec_model_dir config_map_[rec_model_dir];this-rec_batch_num stoi(config_map_[rec_batch_num]);this-rec_char_dict_path config_map_[rec_char_dict_path];this-rec_img_h stoi(config_map_[rec_img_h]);this-rec_img_w stoi(config_map_[rec_img_w]);// layout model relatedthis-layout_model_dir config_map_[layout_model_dir];this-layout_dict_path config_map_[layout_dict_path];this-layout_score_threshold stod(config_map_[layout_score_threshold]);this-layout_nms_threshold stod(config_map_[layout_nms_threshold]);// structure model relatedthis-table_model_dir config_map_[table_model_dir];this-table_max_len stoi(config_map_[table_max_len]);this-table_batch_num stoi(config_map_[table_batch_num]);this-merge_no_span_structure (config_map_[merge_no_span_structure] true);this-table_char_dict_path config_map_[table_char_dict_path];// ocr forward relatedthis-det (config_map_[det] true);this-rec (config_map_[rec] true);this-cls (config_map_[cls] true);this-table (config_map_[table] true);this-layout (config_map_[layout] true);qDebug()this-detconfig_map_[det].c_str()QString(config_map_[det].c_str())this-recthis-clsthis-rec_model_dir.c_str(); } 自定义一个ocr类 #pragma once#include include/ocr_cls.h #include include/ocr_det.h #include include/ocr_rec.h#include my_config.husing namespace PaddleOCR; class MY_PPOCR { public:explicit MY_PPOCR();~MY_PPOCR();std::vectorstd::vectorOCRPredictResult ocr(std::vectorcv::Mat img_list,bool det true,bool rec true,bool cls true);std::vectorOCRPredictResult ocr(cv::Mat img, bool det true,bool rec true, bool cls true);void reset_timer();void benchmark_log(int img_num);MY_OCRConfig *p_config; protected:std::vectordouble time_info_det {0, 0, 0};std::vectordouble time_info_rec {0, 0, 0};std::vectordouble time_info_cls {0, 0, 0};void det(cv::Mat img, std::vectorOCRPredictResult ocr_results);void rec(std::vectorcv::Mat img_list,std::vectorOCRPredictResult ocr_results);void cls(std::vectorcv::Mat img_list,std::vectorOCRPredictResult ocr_results);private:std::unique_ptrDBDetector detector_;std::unique_ptrClassifier classifier_;std::unique_ptrCRNNRecognizer recognizer_; };#include my_paddleocr.h #include qdebug.h //#include auto_log/autolog.hMY_PPOCR::MY_PPOCR() {qDebug()aaa1;p_config new MY_OCRConfig(./ocrconfig.txt);qDebug()aaa2;//if (p_config-det) {this-detector_.reset(new DBDetector(p_config-det_model_dir, p_config-use_gpu, p_config-gpu_id, p_config-gpu_mem,p_config-cpu_threads, p_config-enable_mkldnn, p_config-limit_type,p_config-limit_side_len, p_config-det_db_thresh, p_config-det_db_box_thresh,p_config-det_db_unclip_ratio, p_config-det_db_score_mode, p_config-use_dilation,p_config-use_tensorrt, p_config-precision));}qDebug()aaa3;//if (p_config-cls p_config-use_angle_cls) {this-classifier_.reset(new Classifier(p_config-cls_model_dir, p_config-use_gpu, p_config-gpu_id, p_config-gpu_mem,p_config-cpu_threads, p_config-enable_mkldnn, p_config-cls_thresh,p_config-use_tensorrt, p_config-precision, p_config-cls_batch_num));}qDebug()aaa4;//if (p_config-rec) {this-recognizer_.reset(new CRNNRecognizer(p_config-rec_model_dir, p_config-use_gpu, p_config-gpu_id, p_config-gpu_mem,p_config-cpu_threads, p_config-enable_mkldnn, p_config-rec_char_dict_path,p_config-use_tensorrt, p_config-precision, p_config-rec_batch_num,p_config-rec_img_h, p_config-rec_img_w));}qDebug()aaa5; }MY_PPOCR::~MY_PPOCR() {delete p_config; }std::vectorstd::vectorOCRPredictResult MY_PPOCR::ocr(std::vectorcv::Mat img_list, bool det, bool rec, bool cls) {std::vectorstd::vectorOCRPredictResult ocr_results;if (!det) {std::vectorOCRPredictResult ocr_result;ocr_result.resize(img_list.size());if (cls this-classifier_) {this-cls(img_list, ocr_result);for (int i 0; i img_list.size(); i) {if (ocr_result[i].cls_label % 2 1 ocr_result[i].cls_score this-classifier_-cls_thresh) {cv::rotate(img_list[i], img_list[i], 1);}}}if (rec) {this-rec(img_list, ocr_result);}for (int i 0; i ocr_result.size(); i) {std::vectorOCRPredictResult ocr_result_tmp;ocr_result_tmp.push_back(ocr_result[i]);ocr_results.push_back(ocr_result_tmp);}} else {for (int i 0; i img_list.size(); i) {std::vectorOCRPredictResult ocr_result this-ocr(img_list[i], true, rec, cls);ocr_results.push_back(ocr_result);}}return ocr_results; }std::vectorOCRPredictResult MY_PPOCR::ocr(cv::Mat img, bool det, bool rec, bool cls) {std::vectorOCRPredictResult ocr_result;// detthis-det(img, ocr_result);// crop imagestd::vectorcv::Mat img_list;for (int j 0; j ocr_result.size(); j) {cv::Mat crop_img;crop_img Utility::GetRotateCropImage(img, ocr_result[j].box);img_list.push_back(crop_img);}// clsif (cls this-classifier_) {this-cls(img_list, ocr_result);for (int i 0; i img_list.size(); i) {if (ocr_result[i].cls_label % 2 1 ocr_result[i].cls_score this-classifier_-cls_thresh) {cv::rotate(img_list[i], img_list[i], 1);}}}// recif (rec) {this-rec(img_list, ocr_result);}return ocr_result; }void MY_PPOCR::det(cv::Mat img, std::vectorOCRPredictResult ocr_results) {std::vectorstd::vectorstd::vectorint boxes;std::vectordouble det_times;this-detector_-Run(img, boxes, det_times);for (int i 0; i boxes.size(); i) {OCRPredictResult res;res.box boxes[i];ocr_results.push_back(res);}// sort boex from top to bottom, from left to rightUtility::sorted_boxes(ocr_results);this-time_info_det[0] det_times[0];this-time_info_det[1] det_times[1];this-time_info_det[2] det_times[2]; }void MY_PPOCR::rec(std::vectorcv::Mat img_list, std::vectorOCRPredictResult ocr_results) {std::vectorstd::string rec_texts(img_list.size(), );std::vectorfloat rec_text_scores(img_list.size(), 0);std::vectordouble rec_times;this-recognizer_-Run(img_list, rec_texts, rec_text_scores, rec_times);// output rec resultsfor (int i 0; i rec_texts.size(); i) {ocr_results[i].text rec_texts[i];ocr_results[i].score rec_text_scores[i];}this-time_info_rec[0] rec_times[0];this-time_info_rec[1] rec_times[1];this-time_info_rec[2] rec_times[2]; }void MY_PPOCR::cls(std::vectorcv::Mat img_list, std::vectorOCRPredictResult ocr_results) {std::vectorint cls_labels(img_list.size(), 0);std::vectorfloat cls_scores(img_list.size(), 0);std::vectordouble cls_times;this-classifier_-Run(img_list, cls_labels, cls_scores, cls_times);// output cls resultsfor (int i 0; i cls_labels.size(); i) {ocr_results[i].cls_label cls_labels[i];ocr_results[i].cls_score cls_scores[i];}this-time_info_cls[0] cls_times[0];this-time_info_cls[1] cls_times[1];this-time_info_cls[2] cls_times[2]; }void MY_PPOCR::reset_timer() {this-time_info_det {0, 0, 0};this-time_info_rec {0, 0, 0};this-time_info_cls {0, 0, 0}; }核心调用代码 //std::vectorcv::Mat img_list;cv::Mat srcimg cv::imread(qstr2str(fileName).data(), cv::IMREAD_COLOR);img_list.push_back(srcimg);p_ocr-reset_timer();//QElapsedTimer RunTimer;RunTimer.start();std::vectorstd::vectorOCRPredictResult ocr_results p_ocr-ocr(img_list, p_ocr-p_config-det, p_ocr-p_config-rec, p_ocr-p_config-cls);ui-textBrowser-append(QString(检测时间:%1ms ---------------------).arg(RunTimer.elapsed()));//for (int i 0; i img_list.size(); i) {std::vectorOCRPredictResult ocr_result ocr_results[i];for (int i 0; i ocr_result.size(); i) {QString oustr;oustr QString::number(i) ;// det // std::vectorstd::vectorint boxes ocr_result[i].box; // if (boxes.size() 0) { // oustr det boxes: [; // for (int n 0; n boxes.size(); n) { // oustr [ QString::number(boxes[n][0]) , QString::number(boxes[n][1]) ]; // if (n ! boxes.size() - 1) { // oustr ,; // } // } // oustr ]; // }// recif (ocr_result[i].score ! -1.0) {oustr score: QString::number(ocr_result[i].score,f,2) text: QString::fromUtf8(ocr_result[i].text.c_str()) ;}// clsif (ocr_result[i].cls_label ! -1) {oustr cls label: QString::number(ocr_result[i].cls_label) cls score: ocr_result[i].cls_score;}// // oustr \r\n;ui-textBrowser-append(oustr);}//for (int n 0; n ocr_result.size(); n) {cv::Point rook_points[4];//for (int m 0; m ocr_result[n].box.size(); m) {rook_points[m] cv::Point(int(ocr_result[n].box[m][0]), int(ocr_result[n].box[m][1]));}//const cv::Point *ppt[1] {rook_points};int npt[] {4};cv::polylines(img_list[i], ppt, npt, 1, 1, CV_RGB(255, 0, 0), 2, 8, 0);}//QImage outimage;cvMat2QImage(img_list[i], outimage);ui-label_image-setPixmap(QPixmap::fromImage(outimage.scaled(ui-label_image-width(),ui-label_image-height(),Qt::KeepAspectRatio)));} 程序目录包含这个几个文件如果你没有在源码路径和预测库路径去搜索 ocrconfig.txt是自定义的配置 # common args use_gpu false use_tensorrt false gpu_id 0 gpu_mem 4000 cpu_threads 10 enable_mkldnn false precision fp32 benchmark false output ./output/ image_dir type ocr# detection related det_model_dir F:\Vision\PaddleOCR\2_7\model\ch_PP-OCRv4_det_infer limit_type max limit_side_len 960 det_db_thresh 0.3 det_db_box_thresh 0.6 det_db_unclip_ratio 1.5 use_dilation false det_db_score_mode slow visualize true# classification related use_angle_cls false cls_model_dir F:\Vision\PaddleOCR\2_7\model\ch_ppocr_mobile_v2.0_cls_infer cls_thresh 0.9 cls_batch_num 1# recognition related rec_model_dir F:\Vision\PaddleOCR\2_7\model\ch_PP-OCRv4_rec_infer rec_batch_num 6 rec_char_dict_path ./ppocr_keys_v1.txt rec_img_h 48 rec_img_w 320# layout model related layout_model_dir layout_dict_path ./layout_publaynet_dict.txt layout_score_threshold 0.5 layout_nms_threshold 0.5# structure model related table_model_dir table_max_len 488 table_batch_num 1 merge_no_span_structure true table_char_dict_path ./table_structure_dict_ch.txt# ocr forward related det true rec true cls false table false layout false 最后运行结果 有需要源码测试的 这是源码地址
http://www.hkea.cn/news/14295994/

相关文章:

  • 常见的网站空间重庆网站seo按天计费
  • 如何设置个人网站visual studio做网站
  • 广西柳州网站制作公司网站推广的网站
  • 临沂企业建站系统外贸英语 网站
  • 中山市城乡建设局网站个体工商户经营范围网站开发
  • 韩国网站建设设置wordpress上传文件大小
  • 装潢公司网站设计与制作嘉峪关市建设局公示公告网站
  • 网站建设是指什么东莞玩具加工东莞网站建设
  • xp花生壳做网站网站没备案怎么做淘宝客
  • 昆明做网站建设的公司哪家好画画外包网站
  • 查看网站是由什么开源做的无锡定制网站制作公司
  • 正规品牌网站设计一般网站维护需要做什么
  • 淘宝客网站怎么做产品设计五个流程
  • 装饰网站建设的方案app推广联盟平台
  • 做网站主流用什么语言贵阳网站建设平台
  • 陕西网站建设哪家专业百度上能收到的企业名称网站怎么做
  • 官方网站建设银行年利息是多少cps推广是什么意思
  • 网站使用什么数据库公司网站建设会计处理
  • 企业网站子页面模板威海人社app下载官网2022
  • 从域名角度看网站建设注意事项企业画册的设计效果
  • 企业营销型网站推广方法宁波网站建设服务提供商
  • 做标书需要用到哪些网站查资料价格合理的网站建设
  • 有没有做衣服的网站如何设计网站以网络为中心的企业文化
  • 微信小程序一键生成链接官网seo关键词排名系统
  • 网站做中英版网页期末大作业
  • 郑州百度网站优化便宜的网站建设
  • 商品网站wordpress百度收录插件
  • 重庆新闻联播回放今天seo成功案例分析
  • 门户网站兴化建设局 金建设网站需要从哪方面考虑
  • 我是做网站怎么赚钱吗软件代理网