同步操作将从 zhaomingming/bd_cv3_webserver_demo 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
智能模型的部署方法
主要有两种,一种是在互联网平台上,做成webserver的方式。一种是在生产环境中,模型需要布置在嵌入式的平台上。
本项目演示了互联网公司的一般部署方式:webserver的方式。
注意: 。
这个仓库的目标是:
主要在后端部分,计划用两种技术完成。一种是php+python,一种完全用python
$ sudo apachectl -k stop & sudo apachedtl -k start
#建立数据库zmm
CREATE DATABASE `zmm`;
#在zmm中建立表前,先选中zmm
use zmm;
#建立数据表baiduclass
CREATE TABLE `baiduclass` (
`id` int NOT NULL AUTO_INCREMENT,
`info` text,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=62 DEFAULT CHARSET=utf8
建立好之后,表结构应该如下:
+-------+------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+------+------+-----+---------+----------------+
| id | int | NO | PRI | NULL | auto_increment |
| info | text | YES | | NULL | |
+-------+------+------+-----+---------+----------------+
#建立表baiduclasshomework
CREATE TABLE `baiduclasshomework` (
`id` int NOT NULL AUTO_INCREMENT,
`title` tinytext NOT NULL COMMENT '课程资料文章的标题',
`content` text NOT NULL COMMENT '文章内容',
`author` tinytext NOT NULL COMMENT '作者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
表结构如下:
+-------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+----------+------+-----+---------+----------------+
| id | int | NO | PRI | NULL | auto_increment |
| title | tinytext | NO | | NULL | |
| content | text | NO | | NULL | |
| author | tinytext | NO | | NULL | |
| update_time | datetime | YES | | NULL | |
| create_time | datetime | YES | | NULL | |
+-------------+----------+------+-----+---------+----------------+
#建立表baiduclassoutziliao
CREATE TABLE `baiduclassoutziliao` (
`id` int NOT NULL AUTO_INCREMENT,
`title` tinytext NOT NULL COMMENT '课程资料文章的标题',
`content` text NOT NULL COMMENT '文章内容',
`author` tinytext NOT NULL COMMENT '作者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
表结构如下:
+-------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+----------+------+-----+---------+----------------+
| id | int | NO | PRI | NULL | auto_increment |
| title | tinytext | NO | | NULL | |
| content | text | NO | | NULL | |
| author | tinytext | NO | | NULL | |
| update_time | datetime | YES | | NULL | |
| create_time | datetime | YES | | NULL | |
+-------------+----------+------+-----+---------+----------------+
#建立表baiduclassziliao
CREATE TABLE `baiduclassziliao` (
`id` int NOT NULL AUTO_INCREMENT,
`title` tinytext NOT NULL COMMENT '课程资料文章的标题',
`content` text NOT NULL COMMENT '文章内容',
`author` tinytext NOT NULL COMMENT '作者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
表结构如下:
+-------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+----------+------+-----+---------+----------------+
| id | int | NO | PRI | NULL | auto_increment |
| title | tinytext | NO | | NULL | |
| content | text | NO | | NULL | |
| author | tinytext | NO | | NULL | |
| update_time | datetime | YES | | NULL | |
| create_time | datetime | YES | | NULL | |
+-------------+----------+------+-----+---------+----------------+
#建立表huaweiclass
CREATE TABLE `huaweiclass` (
`id` int NOT NULL AUTO_INCREMENT,
`info` text,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8
表结构如下:
+-------+------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+------+------+-----+---------+----------------+
| id | int | NO | PRI | NULL | auto_increment |
| info | text | YES | | NULL | |
+-------+------+------+-----+---------+----------------+
python EAST-tensorflow_zmm_modify/demo_use.py https://https://img2018.cnblogs.com/blog/1291224/201810/1291224-20181022204302682-772722177.png
# 这里infer.py是我重新写的前向计算过程,会有更加清晰的计算流。
python im2latex/infer.py https://img.mianfeiwendang.com/pic/1f296848e34b74eec54b5d9f/5-810-jpg_6-1080-0-0-1080.jpg
配置east模型时,可以先在命令行把模型前向计算做好:
$ python EAST-tensorflow_zmm_modify/demo_use.py [image_url]
# east前向处理过程。
百度cv3网络API接口设计:
1 接口访问方式:http://localhost/demo_cv_api.php?access_token=houchangligong
2 返回的结果:
下面的数据是检测一张图片的返回结果,img_url是图片路径,net_cost是网络前向计算的耗时,nms_cost是nms部分的耗时。result中包含了100个quad,其中每个quad包含一个confidence和一个quadrangle,一个quadrangel包含4个顶点p1,p2,p3,p4.
json格式:
{
"info": "xxx",
"model_type":"east/im2latx",
"output":
{
"net_cost":1,
"nms_cost":24.6,
"img_url":"https://https://img2018.cnblogs.com/blog/1291224/201810/1291224-20181022204302682-772722177.png",
"result":
{
"quad0":
{
"quadrangle":
{
"p2": "263,266",
"p3": "264,274",
"p1": "225,269",
"p4": "226,277"
},
"confidence": "0.46699054196234535"
},
"quad1":
{
"quadrangle":
{
"p2": "263,266",
"p3": "264,274",
"p1": "225,269",
"p4": "226,277"
},
"confidence": "0.46699054196234535"
},
...
"quad100":
{
"quadrangle":
{
"p2": "263,266",
"p3": "264,274",
"p1": "225,269",
"p4": "226,277"
},
"confidence": "0.46699054196234535"
},
}
}
}
:
成功状态
{
"msg":"OK",
"code":200,
“其他成功时得代码"
}
识别不出来
{
"msg":"UNRECOGNIZED",
"code":200,
"img_url": "xxx",
"data":null
}
其他错误
{
"msg":"SERVER_ERROR",
"code":500,
"img_url": "xxx",
"data":null
}
无效url
{
"msg":"INVALID_URL",
"code":200,
"img_url": "xxx",
"data":null
}
crul的方式:
cd python_tool
chmod +x ./curl.sh
#./curl.sh [access_token 访问许可,例如’访问许可‘的为字符串:houchangligong],则可用下式访问:
./curl.sh houchangligong east
# 利用后厂理工的east模型
./curl.sh houchangligong im2latex
# 利用后厂理工的im2latex模型
python的方式:
cd python_tool
# 用python的post 调用east模型的 web api
python post_example.py
# 用python的post 调用im2latex模型的web api
python post_example_im2latex.py
返回的json过于复杂时,可把json复制到这个页面进行查看:https://www.sojson.com
截止20200401,这里基本完成了一个php+python版本。这个版本还需要完成得细节如下:
截止20200403:
截止20200407:
截止20200408:
截止20200409:
如果你的项目遵循 Standard-Readme 而且项目位于 Github上,非常希望你能把这个徽章加入你的项目。 它可以更多的人访问到这个项目,而且采纳 Stand-README。 加入徽章并非强制的。
为了加入徽章到 Markdown 文本里面,可以使用以下代码:
[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
@赵明明.
非常欢迎你的加入! 提一个Issue 或者提交一个 Pull R equest.
感谢以下参与项目的人:
HCT © 赵明明
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。