Compare commits
61 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 97903b2722 | |||
| 670172e79e | |||
| d266c2828c | |||
| bc4c95c18c | |||
| af08078380 | |||
| 8984948107 | |||
| 843511b6f3 | |||
| a5d7da6536 | |||
| 99d555aba9 | |||
| 7ca5b9d908 | |||
| 5e5e35fd9f | |||
| d080b66ebf | |||
| 1e8ef432df | |||
| a6515e971b | |||
| e3fd3f618f | |||
| b6ae36a8ec | |||
| a99a615e22 | |||
| 5f645b5b4b | |||
| 1625f0294f | |||
| f19f8cbcae | |||
| ba3e23d185 | |||
| 0abf7abb5b | |||
| 47ac6aadbe | |||
| 09ede1af25 | |||
| e40d963bf5 | |||
| 34344edd29 | |||
| b387db1e08 | |||
| 88ca27928f | |||
| 109a5e9444 | |||
| ab5f78cc7b | |||
| 04358ee646 | |||
| a67c53f470 | |||
| cd604bc1eb | |||
| 0de9fc14b5 | |||
| 5287df4959 | |||
| 3e9c0c99b9 | |||
| a740f16e6b | |||
| b9606771cf | |||
| 110bc57abc | |||
| f965bc4289 | |||
| 8b6bf03d76 | |||
| 73536aea89 | |||
| 12f6554d8c | |||
| be94bc7f09 | |||
| 8307fcd549 | |||
| ab2dbf7c15 | |||
| dac7a1b5ce | |||
| 935fa26067 | |||
| 16ab4c78d5 | |||
| ed77b8ed82 | |||
| f4ec3b1eb4 | |||
| a93f68413c | |||
| 0a947274dc | |||
| f7540c4574 | |||
| 5e6a471954 | |||
| 96b8a06e6c | |||
| be27f753ba | |||
| 8ea5420520 | |||
| 9749577c5a | |||
| e0f6b82dad | |||
| 8223759fdf |
@@ -238,11 +238,8 @@ cython_debug/
|
|||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
#.idea/
|
#.idea/
|
||||||
|
|
||||||
# 通过卷绑定挂载到容器中
|
# 模型通过卷绑定挂载到容器中
|
||||||
/log
|
/model
|
||||||
/services/paddle_services/log
|
|
||||||
/services/paddle_services/model
|
|
||||||
/tmp_img
|
|
||||||
# docker
|
# docker
|
||||||
Dockerfile
|
Dockerfile
|
||||||
docker-compose*.yml
|
docker-compose*.yml
|
||||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -142,11 +142,7 @@ cython_debug/
|
|||||||
.idea
|
.idea
|
||||||
|
|
||||||
### Model
|
### Model
|
||||||
services/paddle_services/model
|
model
|
||||||
|
|
||||||
### Log Backups
|
### Log Backups
|
||||||
*.log.*-*-*
|
*.log.*-*-*
|
||||||
|
|
||||||
### Tmp Files
|
|
||||||
/tmp_img
|
|
||||||
/test_img
|
|
||||||
12
Dockerfile
12
Dockerfile
@@ -1,5 +1,5 @@
|
|||||||
# 使用官方的python镜像作为基础
|
# 使用官方的paddle镜像作为基础
|
||||||
FROM python:3.10.15-bookworm
|
FROM registry.baidubce.com/paddlepaddle/paddle:2.6.1-gpu-cuda12.0-cudnn8.9-trt8.6
|
||||||
|
|
||||||
# 设置工作目录
|
# 设置工作目录
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@@ -13,10 +13,12 @@ ENV PYTHONUNBUFFERED=1 \
|
|||||||
|
|
||||||
# 安装依赖
|
# 安装依赖
|
||||||
COPY requirements.txt /app/requirements.txt
|
COPY requirements.txt /app/requirements.txt
|
||||||
|
COPY packages /app/packages
|
||||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo '$TZ' > /etc/timezone \
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo '$TZ' > /etc/timezone \
|
||||||
&& sed -i 's|deb.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources \
|
&& python3 -m pip install --upgrade pip \
|
||||||
&& apt-get update && apt-get install libgl1 -y \
|
&& pip install --no-cache-dir -r requirements.txt \
|
||||||
&& pip install --no-cache-dir -r requirements.txt
|
&& pip uninstall -y onnxruntime onnxruntime-gpu \
|
||||||
|
&& pip install onnxruntime-gpu==1.18.0 --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/
|
||||||
|
|
||||||
# 将当前目录内容复制到容器的/app内
|
# 将当前目录内容复制到容器的/app内
|
||||||
COPY . /app
|
COPY . /app
|
||||||
|
|||||||
33
Dockerfile.dev
Normal file
33
Dockerfile.dev
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# 使用官方的paddle镜像作为基础
|
||||||
|
FROM ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.1.2-paddlepaddle3.0.0-gpu-cuda12.6-cudnn9.5-trt10.5
|
||||||
|
|
||||||
|
# 设置工作目录
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# 设置环境变量
|
||||||
|
ENV PYTHONUNBUFFERED=1 \
|
||||||
|
# 设置时区
|
||||||
|
TZ=Asia/Shanghai \
|
||||||
|
# 设置pip镜像地址,加快安装速度
|
||||||
|
PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
|
||||||
|
|
||||||
|
# 安装language-pack-en和openssh-server
|
||||||
|
RUN apt update && \
|
||||||
|
apt install -y language-pack-en && \
|
||||||
|
apt install -y openssh-server
|
||||||
|
|
||||||
|
# 配置SSH服务
|
||||||
|
RUN mkdir /var/run/sshd && \
|
||||||
|
# 设置root密码,可根据需要修改
|
||||||
|
echo 'root:fcb0102' | chpasswd && \
|
||||||
|
# 允许root登录SSH
|
||||||
|
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
|
||||||
|
|
||||||
|
# 将当前目录内容复制到容器的/app内
|
||||||
|
COPY . /app
|
||||||
|
|
||||||
|
# 暴露22端口
|
||||||
|
EXPOSE 22
|
||||||
|
|
||||||
|
# 启动SSH服务
|
||||||
|
CMD ["/usr/sbin/sshd", "-D"]
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
1. 从Git远程仓库克隆项目到本地。
|
1. 从Git远程仓库克隆项目到本地。
|
||||||
|
|
||||||
2. 将深度学习模型复制到./services/paddle_services/model目录下,具体请看[模型更新](#模型更新)部分。
|
2. 将深度学习模型复制到./model目录下,具体请看[模型更新](#模型更新)部分。
|
||||||
|
|
||||||
3. 安装docker和docker-compose。
|
3. 安装docker和docker-compose。
|
||||||
|
|
||||||
@@ -126,5 +126,7 @@ bash update.sh
|
|||||||
2. 新增扭曲矫正功能
|
2. 新增扭曲矫正功能
|
||||||
21. 版本号:1.14.0
|
21. 版本号:1.14.0
|
||||||
1. 新增二维码识别替换高清图片功能
|
1. 新增二维码识别替换高清图片功能
|
||||||
22. 版本号:2.0.0
|
22. 版本号:1.15.0
|
||||||
1. 项目架构调整,模型全部采用接口调用
|
1. 新增图片清晰度测试
|
||||||
|
23. 版本号:1.16.0
|
||||||
|
1. 更新paddle框架至3.0
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
import time
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
time.sleep(3600)
|
|
||||||
@@ -8,13 +8,15 @@ MAX_WAIT_TIME = 3
|
|||||||
# 程序异常短信配置
|
# 程序异常短信配置
|
||||||
ERROR_EMAIL_CONFIG = {
|
ERROR_EMAIL_CONFIG = {
|
||||||
# SMTP服务器地址
|
# SMTP服务器地址
|
||||||
'smtp_server': 'smtp.163.com',
|
"smtp_server": "smtp.163.com",
|
||||||
# 连接SMTP的端口
|
# 连接SMTP的端口
|
||||||
'port': 994,
|
"port": 994,
|
||||||
# 发件人邮箱地址,请确保开启了SMTP邮件服务!
|
# 发件人邮箱地址,请确保开启了SMTP邮件服务!
|
||||||
'sender': 'EchoLiu618@163.com',
|
"sender": "EchoLiu618@163.com",
|
||||||
# 授权码--用于登录第三方邮件客户端的专用密码,不是邮箱密码
|
# 授权码--用于登录第三方邮件客户端的专用密码,不是邮箱密码
|
||||||
'authorization_code': 'OKPQLIIVLVGRZYVH',
|
"authorization_code": "OKPQLIIVLVGRZYVH",
|
||||||
# 收件人邮箱地址
|
# 收件人邮箱地址
|
||||||
'receivers': ['1515783401@qq.com'],
|
"receivers": ["1515783401@qq.com"],
|
||||||
|
# 尝试次数
|
||||||
|
"retry_times": 3,
|
||||||
}
|
}
|
||||||
@@ -5,18 +5,18 @@ from email.mime.text import MIMEText
|
|||||||
|
|
||||||
from tenacity import retry, stop_after_attempt, wait_random
|
from tenacity import retry, stop_after_attempt, wait_random
|
||||||
|
|
||||||
|
from auto_email import ERROR_EMAIL_CONFIG, TRY_TIMES, MIN_WAIT_TIME, MAX_WAIT_TIME
|
||||||
from log import HOSTNAME
|
from log import HOSTNAME
|
||||||
from my_email import ERROR_EMAIL_CONFIG, TRY_TIMES, MIN_WAIT_TIME, MAX_WAIT_TIME
|
|
||||||
|
|
||||||
|
|
||||||
@retry(stop=stop_after_attempt(TRY_TIMES), wait=wait_random(MIN_WAIT_TIME, MAX_WAIT_TIME), reraise=True,
|
@retry(stop=stop_after_attempt(TRY_TIMES), wait=wait_random(MIN_WAIT_TIME, MAX_WAIT_TIME), reraise=True,
|
||||||
after=lambda x: logging.warning('发送邮件失败!'))
|
after=lambda x: logging.warning("发送邮件失败!"))
|
||||||
def send_email(email_config, massage):
|
def send_email(email_config, massage):
|
||||||
smtp_server = email_config['smtp_server']
|
smtp_server = email_config["smtp_server"]
|
||||||
port = email_config['port']
|
port = email_config["port"]
|
||||||
sender = email_config['sender']
|
sender = email_config["sender"]
|
||||||
authorization_code = email_config['authorization_code']
|
authorization_code = email_config["authorization_code"]
|
||||||
receivers = email_config['receivers']
|
receivers = email_config["receivers"]
|
||||||
mail = smtplib.SMTP_SSL(smtp_server, port) # 连接SMTP服务
|
mail = smtplib.SMTP_SSL(smtp_server, port) # 连接SMTP服务
|
||||||
mail.login(sender, authorization_code) # 登录到SMTP服务
|
mail.login(sender, authorization_code) # 登录到SMTP服务
|
||||||
mail.sendmail(sender, receivers, massage.as_string()) # 发送邮件
|
mail.sendmail(sender, receivers, massage.as_string()) # 发送邮件
|
||||||
@@ -34,13 +34,13 @@ def send_error_email(program_name, error_name, error_detail):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# SMTP 服务器配置
|
# SMTP 服务器配置
|
||||||
sender = ERROR_EMAIL_CONFIG['sender']
|
sender = ERROR_EMAIL_CONFIG["sender"]
|
||||||
receivers = ERROR_EMAIL_CONFIG['receivers']
|
receivers = ERROR_EMAIL_CONFIG["receivers"]
|
||||||
|
|
||||||
# 获取程序出错的时间
|
# 获取程序出错的时间
|
||||||
error_time = datetime.datetime.strftime(datetime.datetime.today(), '%Y-%m-%d %H:%M:%S:%f')
|
error_time = datetime.datetime.strftime(datetime.datetime.today(), "%Y-%m-%d %H:%M:%S:%f")
|
||||||
# 邮件内容
|
# 邮件内容
|
||||||
subject = f'【程序异常提醒】{program_name}({HOSTNAME}) {error_time}' # 邮件的标题
|
subject = f"【程序异常提醒】{program_name}({HOSTNAME}) {error_time}" # 邮件的标题
|
||||||
content = f'''<div class="emailcontent" style="width:100%;max-width:720px;text-align:left;margin:0 auto;padding-top:80px;padding-bottom:20px">
|
content = f'''<div class="emailcontent" style="width:100%;max-width:720px;text-align:left;margin:0 auto;padding-top:80px;padding-bottom:20px">
|
||||||
<div class="emailtitle">
|
<div class="emailtitle">
|
||||||
<h1 style="color:#fff;background:#51a0e3;line-height:70px;font-size:24px;font-weight:400;padding-left:40px;margin:0">程序运行异常通知</h1>
|
<h1 style="color:#fff;background:#51a0e3;line-height:70px;font-size:24px;font-weight:400;padding-left:40px;margin:0">程序运行异常通知</h1>
|
||||||
15
auto_generator.py
Normal file
15
auto_generator.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# 自动生成数据库表和sqlalchemy对应的Model
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
from db import DB_URL
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
table = input("请输入表名:")
|
||||||
|
out_file = f"db/{table}.py"
|
||||||
|
command = f"sqlacodegen {DB_URL} --outfile={out_file} --tables={table}"
|
||||||
|
|
||||||
|
try:
|
||||||
|
subprocess.run(command, shell=True, check=True)
|
||||||
|
print(f"{table}.py文件生成成功!请检查并复制到合适的文件中!")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"生成{table}.py文件时发生错误: {e}")
|
||||||
1
check_ie_result/__init__.py
Normal file
1
check_ie_result/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
108
check_ie_result/check_ie_result.py
Normal file
108
check_ie_result/check_ie_result.py
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
import datetime
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
from decimal import Decimal
|
||||||
|
from io import BytesIO
|
||||||
|
from itertools import groupby
|
||||||
|
|
||||||
|
import requests
|
||||||
|
from PIL import ImageDraw, Image, ImageFont
|
||||||
|
|
||||||
|
from db import MysqlSession
|
||||||
|
from db.mysql import ZxIeCost, ZxIeDischarge, ZxIeSettlement, ZxPhhd, ZxIeResult, ZxPhrec
|
||||||
|
from ucloud import ufile
|
||||||
|
from util import image_util
|
||||||
|
|
||||||
|
|
||||||
|
def check_ie_result(pk_phhd, need_to_annotation=True):
|
||||||
|
os.makedirs(f"./check_result/{pk_phhd}", exist_ok=True)
|
||||||
|
json_result = {"pk_phhd": pk_phhd}
|
||||||
|
session = MysqlSession()
|
||||||
|
phhd = session.query(ZxPhhd.cXm).filter(ZxPhhd.pk_phhd == pk_phhd).one()
|
||||||
|
json_result["cXm"] = phhd.cXm
|
||||||
|
settlement = (session.query(ZxIeSettlement.pk_ie_settlement, ZxIeSettlement.name, ZxIeSettlement.admission_date,
|
||||||
|
ZxIeSettlement.discharge_date, ZxIeSettlement.medical_expenses,
|
||||||
|
ZxIeSettlement.personal_cash_payment, ZxIeSettlement.personal_account_payment,
|
||||||
|
ZxIeSettlement.personal_funded_amount, ZxIeSettlement.medical_insurance_type,
|
||||||
|
ZxIeSettlement.admission_id, ZxIeSettlement.settlement_id)
|
||||||
|
.filter(ZxIeSettlement.pk_phhd == pk_phhd).one())
|
||||||
|
settlement_result = settlement._asdict()
|
||||||
|
json_result["settlement"] = settlement_result
|
||||||
|
|
||||||
|
discharge = (session.query(ZxIeDischarge.pk_ie_discharge, ZxIeDischarge.hospital, ZxIeDischarge.pk_yljg,
|
||||||
|
ZxIeDischarge.department, ZxIeDischarge.pk_ylks, ZxIeDischarge.name, ZxIeDischarge.age,
|
||||||
|
ZxIeDischarge.admission_date, ZxIeDischarge.discharge_date, ZxIeDischarge.doctor,
|
||||||
|
ZxIeDischarge.admission_id)
|
||||||
|
.filter(ZxIeDischarge.pk_phhd == pk_phhd).one())
|
||||||
|
discharge_result = discharge._asdict()
|
||||||
|
json_result["discharge"] = discharge_result
|
||||||
|
|
||||||
|
cost = session.query(ZxIeCost.pk_ie_cost, ZxIeCost.name, ZxIeCost.admission_date, ZxIeCost.discharge_date,
|
||||||
|
ZxIeCost.medical_expenses).filter(ZxIeCost.pk_phhd == pk_phhd).one()
|
||||||
|
cost_result = cost._asdict()
|
||||||
|
json_result["cost"] = cost_result
|
||||||
|
|
||||||
|
phrecs = session.query(ZxPhrec.pk_phrec, ZxPhrec.pk_phhd, ZxPhrec.cRectype, ZxPhrec.cfjaddress).filter(
|
||||||
|
ZxPhrec.pk_phhd == pk_phhd).all()
|
||||||
|
for phrec in phrecs:
|
||||||
|
img_name = phrec.cfjaddress
|
||||||
|
img_path = ufile.get_private_url(img_name, "drg2015")
|
||||||
|
if not img_path:
|
||||||
|
img_path = ufile.get_private_url(img_name)
|
||||||
|
|
||||||
|
response = requests.get(img_path)
|
||||||
|
image = Image.open(BytesIO(response.content)).convert("RGB")
|
||||||
|
if need_to_annotation:
|
||||||
|
font_size = image.width * image.height / 200000
|
||||||
|
font = ImageFont.truetype("./font/simfang.ttf", size=font_size)
|
||||||
|
|
||||||
|
ocr = session.query(ZxIeResult.id, ZxIeResult.content, ZxIeResult.rotation_angle, ZxIeResult.x_offset,
|
||||||
|
ZxIeResult.y_offset).filter(ZxIeResult.pk_phrec == phrec.pk_phrec).all()
|
||||||
|
if not ocr:
|
||||||
|
os.makedirs(f"./check_result/{pk_phhd}/0", exist_ok=True)
|
||||||
|
image.save(f"./check_result/{pk_phhd}/0/{img_name}")
|
||||||
|
|
||||||
|
for _, group_results in groupby(ocr, key=lambda x: x.id):
|
||||||
|
draw = ImageDraw.Draw(image)
|
||||||
|
for ocr_item in group_results:
|
||||||
|
result = json.loads(ocr_item.content)
|
||||||
|
rotation_angle = ocr_item.rotation_angle
|
||||||
|
x_offset = ocr_item.x_offset
|
||||||
|
y_offset = ocr_item.y_offset
|
||||||
|
for key in result:
|
||||||
|
for value in result[key]:
|
||||||
|
box = value["bbox"][0]
|
||||||
|
|
||||||
|
if rotation_angle:
|
||||||
|
box = image_util.invert_rotate_rectangle(box, (image.width / 2, image.height / 2),
|
||||||
|
rotation_angle)
|
||||||
|
if x_offset:
|
||||||
|
box[0] += x_offset
|
||||||
|
box[2] += x_offset
|
||||||
|
if y_offset:
|
||||||
|
box[1] += y_offset
|
||||||
|
box[3] += y_offset
|
||||||
|
|
||||||
|
draw.rectangle(box, outline="red", width=2) # 绘制矩形
|
||||||
|
draw.text((box[0], box[1] - font_size), key, fill="blue", font=font) # 在矩形上方绘制文本
|
||||||
|
draw.text((box[0], box[3]), value["text"], fill="blue", font=font) # 在矩形下方绘制文本
|
||||||
|
os.makedirs(f"./check_result/{pk_phhd}/{ocr_item.id}", exist_ok=True)
|
||||||
|
image.save(f"./check_result/{pk_phhd}/{ocr_item.id}/{img_name}")
|
||||||
|
else:
|
||||||
|
os.makedirs(f"./check_result/{pk_phhd}/0", exist_ok=True)
|
||||||
|
image.save(f"./check_result/{pk_phhd}/0/{img_name}")
|
||||||
|
session.close()
|
||||||
|
|
||||||
|
# 自定义JSON处理器
|
||||||
|
def default(obj):
|
||||||
|
if isinstance(obj, Decimal):
|
||||||
|
return float(obj)
|
||||||
|
if isinstance(obj, datetime.date):
|
||||||
|
return obj.strftime("%Y-%m-%d")
|
||||||
|
|
||||||
|
with open(f"./check_result/{pk_phhd}/result.json", "w", encoding="utf-8") as json_file:
|
||||||
|
json.dump(json_result, json_file, indent=4, ensure_ascii=False, default=default)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
check_ie_result(5640504)
|
||||||
@@ -19,5 +19,5 @@ DB_URL = f'mysql+pymysql://{USERNAME}:{PASSWORD}@{HOSTNAME}:{PORT}/{DATABASE}'
|
|||||||
SHOW_SQL = False
|
SHOW_SQL = False
|
||||||
|
|
||||||
Engine = create_engine(DB_URL, echo=SHOW_SQL)
|
Engine = create_engine(DB_URL, echo=SHOW_SQL)
|
||||||
Base = declarative_base(Engine)
|
Base = declarative_base()
|
||||||
MysqlSession = sessionmaker(bind=Engine)
|
MysqlSession = sessionmaker(bind=Engine)
|
||||||
|
|||||||
35
db/mysql.py
35
db/mysql.py
@@ -1,5 +1,5 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from sqlalchemy import Column, DECIMAL, Date, DateTime, Index, String, text, LargeBinary
|
from sqlalchemy import Column, DECIMAL, Date, DateTime, Index, String, text, LargeBinary, Text
|
||||||
from sqlalchemy.dialects.mysql import BIT, CHAR, INTEGER, TINYINT, VARCHAR
|
from sqlalchemy.dialects.mysql import BIT, CHAR, INTEGER, TINYINT, VARCHAR
|
||||||
|
|
||||||
from db import Base
|
from db import Base
|
||||||
@@ -56,7 +56,8 @@ class ZxIeCost(Base):
|
|||||||
|
|
||||||
pk_ie_cost = Column(INTEGER(11), primary_key=True, comment='费用明细信息抽取主键')
|
pk_ie_cost = Column(INTEGER(11), primary_key=True, comment='费用明细信息抽取主键')
|
||||||
pk_phhd = Column(INTEGER(11), nullable=False, unique=True, comment='报销案子主键')
|
pk_phhd = Column(INTEGER(11), nullable=False, unique=True, comment='报销案子主键')
|
||||||
name = Column(String(30), comment='患者姓名')
|
content = Column(Text, comment='详细内容')
|
||||||
|
name = Column(String(20), comment='患者姓名')
|
||||||
admission_date_str = Column(String(255), comment='入院日期字符串')
|
admission_date_str = Column(String(255), comment='入院日期字符串')
|
||||||
admission_date = Column(Date, comment='入院日期')
|
admission_date = Column(Date, comment='入院日期')
|
||||||
discharge_date_str = Column(String(255), comment='出院日期字符串')
|
discharge_date_str = Column(String(255), comment='出院日期字符串')
|
||||||
@@ -96,19 +97,19 @@ class ZxIeDischarge(Base):
|
|||||||
|
|
||||||
pk_ie_discharge = Column(INTEGER(11), primary_key=True, comment='出院记录信息抽取主键')
|
pk_ie_discharge = Column(INTEGER(11), primary_key=True, comment='出院记录信息抽取主键')
|
||||||
pk_phhd = Column(INTEGER(11), nullable=False, unique=True, comment='报销案子主键')
|
pk_phhd = Column(INTEGER(11), nullable=False, unique=True, comment='报销案子主键')
|
||||||
content = Column(String(5000), comment='详细内容')
|
content = Column(Text, comment='详细内容')
|
||||||
hospital = Column(String(255), comment='医院')
|
hospital = Column(String(200), comment='医院')
|
||||||
pk_yljg = Column(INTEGER(11), comment='医院主键')
|
pk_yljg = Column(INTEGER(11), comment='医院主键')
|
||||||
department = Column(String(255), comment='科室')
|
department = Column(String(200), comment='科室')
|
||||||
pk_ylks = Column(INTEGER(11), comment='科室主键')
|
pk_ylks = Column(INTEGER(11), comment='科室主键')
|
||||||
name = Column(String(30), comment='患者姓名')
|
name = Column(String(20), comment='患者姓名')
|
||||||
age = Column(INTEGER(3), comment='年龄')
|
age = Column(INTEGER(3), comment='年龄')
|
||||||
admission_date_str = Column(String(255), comment='入院日期字符串')
|
admission_date_str = Column(String(255), comment='入院日期字符串')
|
||||||
admission_date = Column(Date, comment='入院日期')
|
admission_date = Column(Date, comment='入院日期')
|
||||||
discharge_date_str = Column(String(255), comment='出院日期字符串')
|
discharge_date_str = Column(String(255), comment='出院日期字符串')
|
||||||
discharge_date = Column(Date, comment='出院日期')
|
discharge_date = Column(Date, comment='出院日期')
|
||||||
doctor = Column(String(30), comment='主治医生')
|
doctor = Column(String(20), comment='主治医生')
|
||||||
admission_id = Column(String(50), comment='住院号')
|
admission_id = Column(String(20), comment='住院号')
|
||||||
create_time = Column(DateTime, server_default=text("CURRENT_TIMESTAMP"), comment='创建时间')
|
create_time = Column(DateTime, server_default=text("CURRENT_TIMESTAMP"), comment='创建时间')
|
||||||
creator = Column(String(255), comment='创建人')
|
creator = Column(String(255), comment='创建人')
|
||||||
update_time = Column(DateTime, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
|
update_time = Column(DateTime, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
|
||||||
@@ -122,7 +123,7 @@ class ZxIeResult(Base):
|
|||||||
pk_ocr = Column(INTEGER(11), primary_key=True, comment='图片OCR识别主键')
|
pk_ocr = Column(INTEGER(11), primary_key=True, comment='图片OCR识别主键')
|
||||||
pk_phhd = Column(INTEGER(11), nullable=False, comment='报销单主键')
|
pk_phhd = Column(INTEGER(11), nullable=False, comment='报销单主键')
|
||||||
pk_phrec = Column(INTEGER(11), nullable=False, comment='图片主键')
|
pk_phrec = Column(INTEGER(11), nullable=False, comment='图片主键')
|
||||||
id = Column(CHAR(32), nullable=False, comment='识别批次')
|
id = Column(INTEGER(11), nullable=False, comment='识别批次')
|
||||||
cfjaddress = Column(String(200), nullable=False, comment='云存储文件名')
|
cfjaddress = Column(String(200), nullable=False, comment='云存储文件名')
|
||||||
content = Column(String(5000), comment='OCR识别内容')
|
content = Column(String(5000), comment='OCR识别内容')
|
||||||
rotation_angle = Column(INTEGER(11), comment='旋转角度')
|
rotation_angle = Column(INTEGER(11), comment='旋转角度')
|
||||||
@@ -140,7 +141,7 @@ class ZxIeSettlement(Base):
|
|||||||
|
|
||||||
pk_ie_settlement = Column(INTEGER(11), primary_key=True, comment='结算清单信息抽取主键')
|
pk_ie_settlement = Column(INTEGER(11), primary_key=True, comment='结算清单信息抽取主键')
|
||||||
pk_phhd = Column(INTEGER(11), nullable=False, unique=True, comment='报销案子主键')
|
pk_phhd = Column(INTEGER(11), nullable=False, unique=True, comment='报销案子主键')
|
||||||
name = Column(String(30), comment='患者姓名')
|
name = Column(String(20), comment='患者姓名')
|
||||||
admission_date_str = Column(String(255), comment='入院日期字符串')
|
admission_date_str = Column(String(255), comment='入院日期字符串')
|
||||||
admission_date = Column(Date, comment='入院日期')
|
admission_date = Column(Date, comment='入院日期')
|
||||||
discharge_date_str = Column(String(255), comment='出院日期字符串')
|
discharge_date_str = Column(String(255), comment='出院日期字符串')
|
||||||
@@ -154,9 +155,9 @@ class ZxIeSettlement(Base):
|
|||||||
personal_funded_amount_str = Column(String(255), comment='自费金额字符串')
|
personal_funded_amount_str = Column(String(255), comment='自费金额字符串')
|
||||||
personal_funded_amount = Column(DECIMAL(18, 2), comment='自费金额')
|
personal_funded_amount = Column(DECIMAL(18, 2), comment='自费金额')
|
||||||
medical_insurance_type_str = Column(String(255), comment='医保类型字符串')
|
medical_insurance_type_str = Column(String(255), comment='医保类型字符串')
|
||||||
medical_insurance_type = Column(String(40), comment='医保类型')
|
medical_insurance_type = Column(String(10), comment='医保类型')
|
||||||
admission_id = Column(String(50), comment='住院号')
|
admission_id = Column(String(20), comment='住院号')
|
||||||
settlement_id = Column(String(50), comment='医保结算单号码')
|
settlement_id = Column(String(30), comment='医保结算单号码')
|
||||||
create_time = Column(DateTime, server_default=text("CURRENT_TIMESTAMP"), comment='创建时间')
|
create_time = Column(DateTime, server_default=text("CURRENT_TIMESTAMP"), comment='创建时间')
|
||||||
creator = Column(String(255), comment='创建人')
|
creator = Column(String(255), comment='创建人')
|
||||||
update_time = Column(DateTime, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
|
update_time = Column(DateTime, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
|
||||||
@@ -414,19 +415,17 @@ class ZxIeReview(Base):
|
|||||||
pk_ie_review = Column(INTEGER(11), primary_key=True, comment='自动审核主键')
|
pk_ie_review = Column(INTEGER(11), primary_key=True, comment='自动审核主键')
|
||||||
pk_phhd = Column(INTEGER(11), nullable=False, comment='报销案子主键')
|
pk_phhd = Column(INTEGER(11), nullable=False, comment='报销案子主键')
|
||||||
success = Column(BIT(1))
|
success = Column(BIT(1))
|
||||||
integrity = Column(BIT(1))
|
|
||||||
has_settlement = Column(BIT(1))
|
has_settlement = Column(BIT(1))
|
||||||
has_discharge = Column(BIT(1))
|
has_discharge = Column(BIT(1))
|
||||||
has_cost = Column(BIT(1))
|
has_cost = Column(BIT(1))
|
||||||
full_page = Column(BIT(1))
|
full_page = Column(BIT(1))
|
||||||
page_description = Column(String(255), comment='具体缺页描述')
|
page_description = Column(String(255), comment='具体缺页描述')
|
||||||
consistency = Column(BIT(1), comment='三项资料一致性。0:不一致;1:一致')
|
|
||||||
name_match = Column(CHAR(1), server_default=text("'0'"),
|
name_match = Column(CHAR(1), server_default=text("'0'"),
|
||||||
comment='三项资料姓名是否一致。0:都不一致;1:一致;2:结算单不一致;3:出院记录不一致;4:费用清单不一致;5:与报销申请对象不一致')
|
comment='三项资料姓名是否一致。0:不一致;1:一致;2:结算单不一致;3:出院记录不一致;4:费用清单不一致;5:与报销申请对象不一致')
|
||||||
admission_date_match = Column(CHAR(1), server_default=text("'0'"),
|
admission_date_match = Column(CHAR(1), server_default=text("'0'"),
|
||||||
comment='三项资料入院日期是否一致。0:都不一致;1:一致;2:结算单不一致;3:出院记录不一致;4:费用清单不一致')
|
comment='三项资料入院日期是否一致。0:不一致;1:一致;2:结算单不一致;3:出院记录不一致;4:费用清单不一致')
|
||||||
discharge_date_match = Column(CHAR(1), server_default=text("'0'"),
|
discharge_date_match = Column(CHAR(1), server_default=text("'0'"),
|
||||||
comment='三项资料出院日期是否一致。0:都不一致;1:一致;2:结算单不一致;3:出院记录不一致;4:费用清单不一致')
|
comment='三项资料出院日期是否一致。0:不一致;1:一致;2:结算单不一致;3:出院记录不一致;4:费用清单不一致')
|
||||||
create_time = Column(DateTime, server_default=text("CURRENT_TIMESTAMP"), comment='创建时间')
|
create_time = Column(DateTime, server_default=text("CURRENT_TIMESTAMP"), comment='创建时间')
|
||||||
creator = Column(String(255), comment='创建人')
|
creator = Column(String(255), comment='创建人')
|
||||||
update_time = Column(DateTime, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
|
update_time = Column(DateTime, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
|
||||||
|
|||||||
74
delete_deprecated_data.py
Normal file
74
delete_deprecated_data.py
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
# 删除本地数据库中的过期数据
|
||||||
|
import logging.config
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
|
from db import MysqlSession
|
||||||
|
from db.mysql import ZxPhhd, ZxIeCost, ZxIeDischarge, ZxIeResult, ZxIeSettlement, ZxPhrec
|
||||||
|
from log import LOGGING_CONFIG
|
||||||
|
|
||||||
|
# 过期时间(不建议小于1个月)
|
||||||
|
EXPIRATION_DAYS = 183
|
||||||
|
# 批量删除数量(最好在1000~10000之间)
|
||||||
|
BATCH_SIZE = 5000
|
||||||
|
# 数据库会话对象
|
||||||
|
session = None
|
||||||
|
|
||||||
|
|
||||||
|
def batch_delete_by_pk_phhd(model, pk_phhds):
|
||||||
|
"""
|
||||||
|
批量删除指定模型中主键在指定列表中的数据
|
||||||
|
|
||||||
|
参数:
|
||||||
|
model:SQLAlchemy模型类(对应数据库表)
|
||||||
|
pk_phhds:待删除的主键值列表
|
||||||
|
|
||||||
|
返回:
|
||||||
|
删除的记录数量
|
||||||
|
"""
|
||||||
|
delete_count = (
|
||||||
|
session.query(model)
|
||||||
|
.filter(model.pk_phhd.in_(pk_phhds))
|
||||||
|
.delete(synchronize_session=False)
|
||||||
|
)
|
||||||
|
session.commit()
|
||||||
|
logging.getLogger("sql").info(f"{model.__tablename__}成功删除{delete_count}条数据")
|
||||||
|
return delete_count
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
logging.config.dictConfig(LOGGING_CONFIG)
|
||||||
|
deadline = datetime.now() - timedelta(days=EXPIRATION_DAYS)
|
||||||
|
double_deadline = deadline - timedelta(days=EXPIRATION_DAYS)
|
||||||
|
session = MysqlSession()
|
||||||
|
try:
|
||||||
|
while 1:
|
||||||
|
# 已经走完所有流程的案子,超过过期时间后删除
|
||||||
|
phhds = (session.query(ZxPhhd.pk_phhd)
|
||||||
|
.filter(ZxPhhd.paint_flag == "9")
|
||||||
|
.filter(ZxPhhd.billdate < deadline)
|
||||||
|
.limit(BATCH_SIZE)
|
||||||
|
.all())
|
||||||
|
if not phhds or len(phhds) <= 0:
|
||||||
|
# 没有通过审核,可能会重拍补拍上传的案子,超过两倍过期时间后删除
|
||||||
|
phhds = (session.query(ZxPhhd.pk_phhd)
|
||||||
|
.filter(ZxPhhd.exsuccess_flag == "9")
|
||||||
|
.filter(ZxPhhd.paint_flag == "0")
|
||||||
|
.filter(ZxPhhd.billdate < double_deadline)
|
||||||
|
.limit(BATCH_SIZE)
|
||||||
|
.all())
|
||||||
|
if not phhds or len(phhds) <= 0:
|
||||||
|
# 没有符合条件的数据,退出循环
|
||||||
|
break
|
||||||
|
pk_phhd_values = [phhd.pk_phhd for phhd in phhds]
|
||||||
|
logging.getLogger("sql").info(f"过期的pk_phhd有{','.join(map(str, pk_phhd_values))}")
|
||||||
|
batch_delete_by_pk_phhd(ZxPhrec, pk_phhd_values)
|
||||||
|
batch_delete_by_pk_phhd(ZxIeResult, pk_phhd_values)
|
||||||
|
batch_delete_by_pk_phhd(ZxIeSettlement, pk_phhd_values)
|
||||||
|
batch_delete_by_pk_phhd(ZxIeDischarge, pk_phhd_values)
|
||||||
|
batch_delete_by_pk_phhd(ZxIeCost, pk_phhd_values)
|
||||||
|
batch_delete_by_pk_phhd(ZxPhhd, pk_phhd_values)
|
||||||
|
except Exception as e:
|
||||||
|
session.rollback()
|
||||||
|
logging.getLogger('error').error('过期数据删除失败!', exc_info=e)
|
||||||
|
finally:
|
||||||
|
session.close()
|
||||||
32
det_api.py
Normal file
32
det_api.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import base64
|
||||||
|
|
||||||
|
import cv2
|
||||||
|
import numpy as np
|
||||||
|
from flask import Flask, request, jsonify
|
||||||
|
|
||||||
|
from paddle_detection import detector
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/det/detect_books", methods=['POST'])
|
||||||
|
def detect_books():
|
||||||
|
try:
|
||||||
|
file = request.files['image']
|
||||||
|
image_data = file.read()
|
||||||
|
nparr = np.frombuffer(image_data, np.uint8)
|
||||||
|
image = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
|
||||||
|
result = detector.get_book_areas(image)
|
||||||
|
encoded_images = []
|
||||||
|
for i in result:
|
||||||
|
_, encoded_image = cv2.imencode('.jpg', i)
|
||||||
|
byte_stream = encoded_image.tobytes()
|
||||||
|
img_str = base64.b64encode(byte_stream).decode('utf-8')
|
||||||
|
encoded_images.append(img_str)
|
||||||
|
return jsonify(encoded_images), 200
|
||||||
|
except Exception as e:
|
||||||
|
return jsonify({'error': str(e)}), 500
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app.run("0.0.0.0")
|
||||||
26
docker-compose.dev.yml
Normal file
26
docker-compose.dev.yml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
services:
|
||||||
|
fcb_ai_dev:
|
||||||
|
image: fcb_ai_dev:0.0.10
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile.dev
|
||||||
|
# 容器名称,可自定义
|
||||||
|
container_name: fcb_ai_dev
|
||||||
|
hostname: fcb_ai_dev
|
||||||
|
# 始终重启容器
|
||||||
|
restart: always
|
||||||
|
# 端口映射,根据需要修改主机端口
|
||||||
|
ports:
|
||||||
|
- "8022:22"
|
||||||
|
# 数据卷映射,根据实际路径修改
|
||||||
|
volumes:
|
||||||
|
- ./log:/app/log
|
||||||
|
- ./model:/app/model
|
||||||
|
# 启用GPU支持
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
reservations:
|
||||||
|
devices:
|
||||||
|
- device_ids: [ '0', '1' ]
|
||||||
|
capabilities: [ 'gpu' ]
|
||||||
|
driver: 'nvidia'
|
||||||
@@ -1,150 +1,46 @@
|
|||||||
x-base:
|
x-env:
|
||||||
&base_template
|
&template
|
||||||
|
image: fcb_photo_review:1.15.7
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
x-project:
|
x-review:
|
||||||
&project_template
|
&review_template
|
||||||
<<: *base_template
|
<<: *template
|
||||||
image: fcb_photo_review:2.0.0
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./log:/app/log
|
- ./log:/app/log
|
||||||
- ./tmp_img:/app/tmp_img
|
- ./model:/app/model
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
reservations:
|
||||||
|
devices:
|
||||||
|
- device_ids: [ '0', '1' ]
|
||||||
|
capabilities: [ 'gpu' ]
|
||||||
|
driver: 'nvidia'
|
||||||
|
|
||||||
x-paddle:
|
x-mask:
|
||||||
&paddle_template
|
&mask_template
|
||||||
<<: *base_template
|
<<: *template
|
||||||
image: fcb_paddle:0.0.1
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./services/paddle_services/log:/app/log
|
- ./log:/app/log
|
||||||
- ./services/paddle_services/model:/app/model
|
deploy:
|
||||||
- ./tmp_img:/app/tmp_img
|
resources:
|
||||||
|
reservations:
|
||||||
|
devices:
|
||||||
|
- device_ids: [ '1' ]
|
||||||
|
capabilities: [ 'gpu' ]
|
||||||
|
driver: 'nvidia'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
ocr:
|
|
||||||
<<: *paddle_template
|
|
||||||
build:
|
|
||||||
context: ./services/paddle_services
|
|
||||||
container_name: ocr
|
|
||||||
hostname: ocr
|
|
||||||
command: [ '-w', '4', 'ocr:app', '--bind', '0.0.0.0:5001' ]
|
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
reservations:
|
|
||||||
devices:
|
|
||||||
- device_ids: [ '0' ]
|
|
||||||
capabilities: [ 'gpu' ]
|
|
||||||
driver: 'nvidia'
|
|
||||||
|
|
||||||
ie_settlement:
|
|
||||||
<<: *paddle_template
|
|
||||||
container_name: ie_settlement
|
|
||||||
hostname: ie_settlement
|
|
||||||
command: [ '-w', '5', 'ie_settlement:app', '--bind', '0.0.0.0:5002' ]
|
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
reservations:
|
|
||||||
devices:
|
|
||||||
- device_ids: [ '0' ]
|
|
||||||
capabilities: [ 'gpu' ]
|
|
||||||
driver: 'nvidia'
|
|
||||||
|
|
||||||
ie_discharge:
|
|
||||||
<<: *paddle_template
|
|
||||||
container_name: ie_discharge
|
|
||||||
hostname: ie_discharge
|
|
||||||
command: [ '-w', '5', 'ie_discharge:app', '--bind', '0.0.0.0:5003' ]
|
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
reservations:
|
|
||||||
devices:
|
|
||||||
- device_ids: [ '1' ]
|
|
||||||
capabilities: [ 'gpu' ]
|
|
||||||
driver: 'nvidia'
|
|
||||||
|
|
||||||
ie_cost:
|
|
||||||
<<: *paddle_template
|
|
||||||
container_name: ie_cost
|
|
||||||
hostname: ie_cost
|
|
||||||
command: [ '-w', '5', 'ie_cost:app', '--bind', '0.0.0.0:5004' ]
|
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
reservations:
|
|
||||||
devices:
|
|
||||||
- device_ids: [ '1' ]
|
|
||||||
capabilities: [ 'gpu' ]
|
|
||||||
driver: 'nvidia'
|
|
||||||
|
|
||||||
clas_orientation:
|
|
||||||
<<: *paddle_template
|
|
||||||
container_name: clas_orientation
|
|
||||||
hostname: clas_orientation
|
|
||||||
command: [ '-w', '3', 'clas_orientation:app', '--bind', '0.0.0.0:5005' ]
|
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
reservations:
|
|
||||||
devices:
|
|
||||||
- device_ids: [ '0' ]
|
|
||||||
capabilities: [ 'gpu' ]
|
|
||||||
driver: 'nvidia'
|
|
||||||
|
|
||||||
det_book:
|
|
||||||
<<: *paddle_template
|
|
||||||
container_name: det_book
|
|
||||||
hostname: det_book
|
|
||||||
command: [ '-w', '4', 'det_book:app', '--bind', '0.0.0.0:5006' ]
|
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
reservations:
|
|
||||||
devices:
|
|
||||||
- device_ids: [ '1' ]
|
|
||||||
capabilities: [ 'gpu' ]
|
|
||||||
driver: 'nvidia'
|
|
||||||
|
|
||||||
dewarp:
|
|
||||||
<<: *paddle_template
|
|
||||||
container_name: dewarp
|
|
||||||
hostname: dewarp
|
|
||||||
command: [ '-w', '4', 'dewarp:app', '--bind', '0.0.0.0:5007' ]
|
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
reservations:
|
|
||||||
devices:
|
|
||||||
- device_ids: [ '0' ]
|
|
||||||
capabilities: [ 'gpu' ]
|
|
||||||
driver: 'nvidia'
|
|
||||||
|
|
||||||
# clas_text:
|
|
||||||
# <<: *paddle_template
|
|
||||||
# container_name: clas_text
|
|
||||||
# hostname: clas_text
|
|
||||||
# command: [ '-w', '3', 'clas_text:app', '--bind', '0.0.0.0:5008' ]
|
|
||||||
# deploy:
|
|
||||||
# resources:
|
|
||||||
# reservations:
|
|
||||||
# devices:
|
|
||||||
# - device_ids: [ '1' ]
|
|
||||||
# capabilities: [ 'gpu' ]
|
|
||||||
# driver: 'nvidia'
|
|
||||||
|
|
||||||
photo_review_1:
|
photo_review_1:
|
||||||
<<: *project_template
|
<<: *review_template
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
container_name: photo_review_1
|
container_name: photo_review_1
|
||||||
hostname: photo_review_1
|
hostname: photo_review_1
|
||||||
depends_on:
|
|
||||||
- ocr
|
|
||||||
- ie_settlement
|
|
||||||
- ie_discharge
|
|
||||||
- ie_cost
|
|
||||||
- clas_orientation
|
|
||||||
- det_book
|
|
||||||
- dewarp
|
|
||||||
# - clas_text
|
|
||||||
command: [ 'photo_review.py', '--clean', 'True' ]
|
command: [ 'photo_review.py', '--clean', 'True' ]
|
||||||
|
|
||||||
photo_review_2:
|
photo_review_2:
|
||||||
<<: *project_template
|
<<: *review_template
|
||||||
container_name: photo_review_2
|
container_name: photo_review_2
|
||||||
hostname: photo_review_2
|
hostname: photo_review_2
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -152,41 +48,57 @@ services:
|
|||||||
command: [ 'photo_review.py' ]
|
command: [ 'photo_review.py' ]
|
||||||
|
|
||||||
photo_review_3:
|
photo_review_3:
|
||||||
<<: *project_template
|
<<: *review_template
|
||||||
container_name: photo_review_3
|
container_name: photo_review_3
|
||||||
hostname: photo_review_3
|
hostname: photo_review_3
|
||||||
depends_on:
|
depends_on:
|
||||||
- photo_review_1
|
- photo_review_2
|
||||||
command: [ 'photo_review.py' ]
|
command: [ 'photo_review.py' ]
|
||||||
|
|
||||||
photo_review_4:
|
photo_review_4:
|
||||||
<<: *project_template
|
<<: *review_template
|
||||||
container_name: photo_review_4
|
container_name: photo_review_4
|
||||||
hostname: photo_review_4
|
hostname: photo_review_4
|
||||||
depends_on:
|
depends_on:
|
||||||
- photo_review_1
|
- photo_review_3
|
||||||
command: [ 'photo_review.py' ]
|
command: [ 'photo_review.py' ]
|
||||||
|
|
||||||
photo_review_5:
|
photo_review_5:
|
||||||
<<: *project_template
|
<<: *review_template
|
||||||
container_name: photo_review_5
|
container_name: photo_review_5
|
||||||
hostname: photo_review_5
|
hostname: photo_review_5
|
||||||
depends_on:
|
depends_on:
|
||||||
- photo_review_1
|
- photo_review_4
|
||||||
command: [ 'photo_review.py' ]
|
command: [ 'photo_review.py' ]
|
||||||
|
|
||||||
photo_mask_1:
|
photo_mask_1:
|
||||||
<<: *project_template
|
<<: *mask_template
|
||||||
container_name: photo_mask_1
|
container_name: photo_mask_1
|
||||||
hostname: photo_mask_1
|
hostname: photo_mask_1
|
||||||
depends_on:
|
depends_on:
|
||||||
- photo_review_1
|
- photo_review_5
|
||||||
command: [ 'photo_mask.py', '--clean', 'True' ]
|
command: [ 'photo_mask.py', '--clean', 'True' ]
|
||||||
|
|
||||||
photo_mask_2:
|
photo_mask_2:
|
||||||
<<: *project_template
|
<<: *mask_template
|
||||||
container_name: photo_mask_2
|
container_name: photo_mask_2
|
||||||
hostname: photo_mask_2
|
hostname: photo_mask_2
|
||||||
depends_on:
|
depends_on:
|
||||||
- photo_mask_1
|
- photo_mask_1
|
||||||
command: [ 'photo_mask.py' ]
|
command: [ 'photo_mask.py' ]
|
||||||
|
#
|
||||||
|
# photo_review_6:
|
||||||
|
# <<: *review_template
|
||||||
|
# container_name: photo_review_6
|
||||||
|
# hostname: photo_review_6
|
||||||
|
# depends_on:
|
||||||
|
# - photo_mask_2
|
||||||
|
# command: [ 'photo_review.py' ]
|
||||||
|
#
|
||||||
|
# photo_review_7:
|
||||||
|
# <<: *review_template
|
||||||
|
# container_name: photo_review_7
|
||||||
|
# hostname: photo_review_7
|
||||||
|
# depends_on:
|
||||||
|
# - photo_review_6
|
||||||
|
# command: [ 'photo_review.py' ]
|
||||||
BIN
document/Linux下搭建和部署Paddle相关项目.docx
Normal file
BIN
document/Linux下搭建和部署Paddle相关项目.docx
Normal file
Binary file not shown.
BIN
document/OCR工作效率统计.xlsx
Normal file
BIN
document/OCR工作效率统计.xlsx
Normal file
Binary file not shown.
153
document/PaddleOCR命令.md
Normal file
153
document/PaddleOCR命令.md
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
# PaddleOCR
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
## 数据集
|
||||||
|
|
||||||
|
该部分内容均在PPOCRLabel目录下进行
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 进入PPOCRLabel目录
|
||||||
|
cd .\PPOCRLabel\
|
||||||
|
```
|
||||||
|
|
||||||
|
### 打标
|
||||||
|
|
||||||
|
可以对PPOCRLabel.py直接使用PyCharm中的Run,但是默认是英文的
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 以中文运行打标应用
|
||||||
|
python PPOCRLabel.py --lang ch
|
||||||
|
# 含有关键词提取的打标
|
||||||
|
python PPOCRLabel.py --lang ch --kie True
|
||||||
|
```
|
||||||
|
|
||||||
|
### 划分数据集
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python gen_ocr_train_val_test.py --trainValTestRatio 6:2:2 --datasetRootPath ../train_data/drivingData
|
||||||
|
```
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
## 检测模型
|
||||||
|
|
||||||
|
先回到项目根目录
|
||||||
|
|
||||||
|
### 训练
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python tools/train.py -c configs/det/ch_PP-OCRv4/ch_PP-OCRv4_det_student.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
### 测试
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python tools/infer_det.py -c configs/det/ch_PP-OCRv4/ch_PP-OCRv4_det_student.yml -o Global.pretrained_model=output/det_v4_bankcard/best_accuracy.pdparams Global.infer_img=train_data/drivingData/1.jpg
|
||||||
|
```
|
||||||
|
|
||||||
|
### 恢复训练
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python tools/train.py -c configs/det/ch_PP-OCRv4/ch_PP-OCRv4_det_student.yml -o Global.checkpoints=./output/det_v4_bankcard/latest
|
||||||
|
```
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
## 识别模型
|
||||||
|
|
||||||
|
### 训练
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python tools/train.py -c configs/rec/PP-OCRv4/ch_PP-OCRv4_rec_ampO2_ultra.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
### 测试
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python tools/infer_rec.py -c configs/rec/PP-OCRv4/ch_PP-OCRv4_rec_ampO2_ultra.yml -o Global.pretrained_model=output/rec_v4_bankcard/best_accuracy.pdparams Global.infer_img=train_data/drivingData/crop_img/1_crop_0.jpg
|
||||||
|
```
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
## 推理模型
|
||||||
|
|
||||||
|
### 检测模型转换
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python tools/export_model.py -c configs/det/ch_PP-OCRv4/ch_PP-OCRv4_det_student.yml -o Global.pretrained_model=output/det_v4_bankcard/best_accuracy.pdparams
|
||||||
|
```
|
||||||
|
|
||||||
|
### 识别模型转换
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python tools/export_model.py -c configs/rec/PP-OCRv4/ch_PP-OCRv4_rec_ampO2_ultra.yml -o Global.pretrained_model=output/rec_v4_bankcard/best_accuracy.pdparams
|
||||||
|
```
|
||||||
|
|
||||||
|
### 检测识别测试
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python tools/infer/predict_system.py --det_model_dir=inference_model/det_v4_bankcard --rec_model_dir=inference_model/rec_v4_bankcard --rec_char_dict_path=ppocr/utils/num_dict.txt --image_dir=train_data/drivingData/1.jpg
|
||||||
|
```
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
## 移动端模型
|
||||||
|
|
||||||
|
### 检测模型转换
|
||||||
|
|
||||||
|
```bash
|
||||||
|
paddle_lite_opt --model_file=inference_model/det_v4_bankcard/inference.pdmodel --param_file=inference_model/det_v4_bankcard/inference.pdiparams --optimize_out=inference_model/det_v4_nb_bankcard --valid_targets=arm --optimize_out_type=naive_buffer
|
||||||
|
```
|
||||||
|
|
||||||
|
### 识别模型转换
|
||||||
|
|
||||||
|
```bash
|
||||||
|
paddle_lite_opt --model_file=inference_model/rec_v4_bankcard/inference.pdmodel --param_file=inference_model/rec_v4_bankcard/inference.pdiparams --optimize_out=inference_model/rec_v4_nb_bankcard --valid_targets=arm --optimize_out_type=naive_buffer
|
||||||
|
```
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
# PaddleNLP
|
||||||
|
|
||||||
|
## 数据集
|
||||||
|
|
||||||
|
使用Label Studio进行数据标注,安装过程省略
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 打开Anaconda Prompt
|
||||||
|
# 激活安装Label Studio的环境
|
||||||
|
conda activate label-studio
|
||||||
|
# 启动Label Studio
|
||||||
|
label-studio start
|
||||||
|
```
|
||||||
|
|
||||||
|
[打标流程](https://github.com/PaddlePaddle/PaddleNLP/blob/develop/applications/information_extraction/label_studio_doc.md)
|
||||||
|
|
||||||
|
### 数据转换
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 进入PaddleNLP\applications\information_extraction后执行
|
||||||
|
python label_studio.py --label_studio_file ./document/data/label_studio.json --save_dir ./document/data --splits 0.8 0.1 0.1 --task_type ext
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
## 训练模型
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 进入PaddleNLP\applications\information_extraction\document后执行(双卡训练)
|
||||||
|
python -u -m paddle.distributed.launch --gpus "0,1" finetune.py --device gpu --logging_steps 5 --save_steps 25 --eval_steps 25 --seed 42 --model_name_or_path uie-x-base --output_dir ./checkpoint/model_best --train_path data/train.txt --dev_path data/dev.txt --max_seq_len 512 --per_device_train_batch_size 8 --per_device_eval_batch_size 8 --num_train_epochs 10 --learning_rate 1e-5 --do_train --do_eval --do_export --export_model_dir ./checkpoint/model_best --overwrite_output_dir --disable_tqdm False --metric_for_best_model eval_f1 --load_best_model_at_end True --save_total_limit 1
|
||||||
|
```
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
参考:
|
||||||
|
|
||||||
|
[PaddleOCR训练属于自己的模型详细教程](https://blog.csdn.net/qq_52852432/article/details/131817619?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_baidulandingword~default-0-131817619-blog-124628731.235^v40^pc_relevant_3m_sort_dl_base1&spm=1001.2101.3001.4242.1&utm_relevant_index=3)
|
||||||
|
[端侧部署](https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.7/deploy/lite/readme_ch.md)
|
||||||
|
[PaddleNLP关键信息抽取](https://blog.csdn.net/z5z5z5z56/article/details/130346646)
|
||||||
329
document/paddle镜像自带依赖.md
Normal file
329
document/paddle镜像自带依赖.md
Normal file
@@ -0,0 +1,329 @@
|
|||||||
|
anyio 4.0.0
|
||||||
|
astor 0.8.1
|
||||||
|
certifi 2019.11.28
|
||||||
|
chardet 3.0.4
|
||||||
|
dbus-python 1.2.16
|
||||||
|
decorator 5.1.1
|
||||||
|
distro-info 0.23+ubuntu1.1
|
||||||
|
exceptiongroup 1.1.3
|
||||||
|
h11 0.14.0
|
||||||
|
httpcore 1.0.2
|
||||||
|
httpx 0.25.1
|
||||||
|
idna 2.8
|
||||||
|
numpy 1.26.2
|
||||||
|
opt-einsum 3.3.0
|
||||||
|
paddlepaddle-gpu 2.6.1.post120
|
||||||
|
Pillow 10.1.0
|
||||||
|
pip 24.0
|
||||||
|
protobuf 4.25.0
|
||||||
|
PyGObject 3.36.0
|
||||||
|
python-apt 2.0.1+ubuntu0.20.4.1
|
||||||
|
requests 2.22.0
|
||||||
|
requests-unixsocket 0.2.0
|
||||||
|
setuptools 68.2.2
|
||||||
|
six 1.14.0
|
||||||
|
sniffio 1.3.0
|
||||||
|
unattended-upgrades 0.1
|
||||||
|
urllib3 1.25.8
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.1.0-gpu-cuda12.9-cudnn9.9:
|
||||||
|
|
||||||
|
python:3.10.12
|
||||||
|
|
||||||
|
Package Version
|
||||||
|
------------------------ ----------
|
||||||
|
anyio 4.9.0
|
||||||
|
certifi 2025.6.15
|
||||||
|
decorator 5.2.1
|
||||||
|
exceptiongroup 1.3.0
|
||||||
|
h11 0.16.0
|
||||||
|
httpcore 1.0.9
|
||||||
|
httpx 0.28.1
|
||||||
|
idna 3.10
|
||||||
|
networkx 3.4.2
|
||||||
|
numpy 2.2.6
|
||||||
|
nvidia-cublas-cu12 12.9.0.13
|
||||||
|
nvidia-cuda-cccl-cu12 12.9.27
|
||||||
|
nvidia-cuda-cupti-cu12 12.9.19
|
||||||
|
nvidia-cuda-nvrtc-cu12 12.9.41
|
||||||
|
nvidia-cuda-runtime-cu12 12.9.37
|
||||||
|
nvidia-cudnn-cu12 9.9.0.52
|
||||||
|
nvidia-cufft-cu12 11.4.0.6
|
||||||
|
nvidia-cufile-cu12 1.14.0.30
|
||||||
|
nvidia-curand-cu12 10.3.10.19
|
||||||
|
nvidia-cusolver-cu12 11.7.4.40
|
||||||
|
nvidia-cusparse-cu12 12.5.9.5
|
||||||
|
nvidia-cusparselt-cu12 0.7.1
|
||||||
|
nvidia-nccl-cu12 2.26.5
|
||||||
|
nvidia-nvjitlink-cu12 12.9.41
|
||||||
|
nvidia-nvtx-cu12 12.9.19
|
||||||
|
opt-einsum 3.3.0
|
||||||
|
paddlepaddle-gpu 3.1.0
|
||||||
|
pillow 11.2.1
|
||||||
|
pip 25.1.1
|
||||||
|
protobuf 6.31.1
|
||||||
|
setuptools 59.6.0
|
||||||
|
sniffio 1.3.1
|
||||||
|
typing_extensions 4.14.0
|
||||||
|
wheel 0.37.1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.1.2-paddlepaddle3.0.0-gpu-cuda12.6-cudnn9.5-trt10.5
|
||||||
|
|
||||||
|
python:3.10.18
|
||||||
|
|
||||||
|
Package Version Editable project location
|
||||||
|
------------------------- -------------------- -------------------------
|
||||||
|
aiohappyeyeballs 2.6.1
|
||||||
|
aiohttp 3.12.13
|
||||||
|
aiosignal 1.4.0
|
||||||
|
aistudio_sdk 0.3.5
|
||||||
|
albucore 0.0.13+pdx
|
||||||
|
albumentations 1.4.10+pdx
|
||||||
|
alembic 1.16.2
|
||||||
|
annotated-types 0.7.0
|
||||||
|
anyio 4.9.0
|
||||||
|
astor 0.8.1
|
||||||
|
asttokens 3.0.0
|
||||||
|
async-timeout 4.0.3
|
||||||
|
attrdict3 2.0.2
|
||||||
|
attrs 25.3.0
|
||||||
|
babel 2.17.0
|
||||||
|
bce-python-sdk 0.9.35
|
||||||
|
beautifulsoup4 4.13.4
|
||||||
|
blinker 1.9.0
|
||||||
|
cachetools 6.1.0
|
||||||
|
certifi 2019.11.28
|
||||||
|
cffi 1.17.1
|
||||||
|
chardet 3.0.4
|
||||||
|
charset-normalizer 3.4.2
|
||||||
|
chinese-calendar 1.8.0
|
||||||
|
click 8.2.1
|
||||||
|
cloudpickle 3.1.1
|
||||||
|
colorama 0.4.6
|
||||||
|
colorlog 6.9.0
|
||||||
|
ConfigSpace 1.2.1
|
||||||
|
contourpy 1.3.2
|
||||||
|
cssselect 1.3.0
|
||||||
|
cssutils 2.11.1
|
||||||
|
cycler 0.12.1
|
||||||
|
Cython 3.1.2
|
||||||
|
dataclasses-json 0.6.7
|
||||||
|
datasets 3.6.0
|
||||||
|
dbus-python 1.2.16
|
||||||
|
decorator 5.2.1
|
||||||
|
decord 0.6.0
|
||||||
|
descartes 1.1.0
|
||||||
|
dill 0.3.4
|
||||||
|
distro 1.9.0
|
||||||
|
distro-info 0.23+ubuntu1.1
|
||||||
|
easydict 1.13
|
||||||
|
einops 0.8.1
|
||||||
|
et_xmlfile 2.0.0
|
||||||
|
exceptiongroup 1.2.2
|
||||||
|
executing 2.2.0
|
||||||
|
faiss-cpu 1.8.0.post1
|
||||||
|
fastapi 0.116.0
|
||||||
|
filelock 3.18.0
|
||||||
|
fire 0.7.0
|
||||||
|
FLAML 2.3.5
|
||||||
|
Flask 3.1.1
|
||||||
|
flask-babel 4.0.0
|
||||||
|
fonttools 4.58.5
|
||||||
|
frozenlist 1.7.0
|
||||||
|
fsspec 2025.3.0
|
||||||
|
ftfy 6.3.1
|
||||||
|
future 1.0.0
|
||||||
|
gast 0.3.3
|
||||||
|
GPUtil 1.4.0
|
||||||
|
greenlet 3.2.3
|
||||||
|
h11 0.14.0
|
||||||
|
h5py 3.14.0
|
||||||
|
hf-xet 1.1.5
|
||||||
|
hpbandster 0.7.4
|
||||||
|
httpcore 1.0.7
|
||||||
|
httpx 0.28.1
|
||||||
|
httpx-sse 0.4.1
|
||||||
|
huggingface-hub 0.33.2
|
||||||
|
idna 2.8
|
||||||
|
imageio 2.37.0
|
||||||
|
imagesize 1.4.1
|
||||||
|
imgaug 0.4.0+pdx
|
||||||
|
ipython 8.37.0
|
||||||
|
itsdangerous 2.2.0
|
||||||
|
jedi 0.19.2
|
||||||
|
jieba 0.42.1
|
||||||
|
Jinja2 3.1.6
|
||||||
|
jiter 0.10.0
|
||||||
|
joblib 1.5.1
|
||||||
|
jsonpatch 1.33
|
||||||
|
jsonpointer 3.0.0
|
||||||
|
jsonschema 4.24.0
|
||||||
|
jsonschema-specifications 2025.4.1
|
||||||
|
kiwisolver 1.4.8
|
||||||
|
langchain 0.3.26
|
||||||
|
langchain-community 0.3.27
|
||||||
|
langchain-core 0.3.68
|
||||||
|
langchain-openai 0.3.27
|
||||||
|
langchain-text-splitters 0.3.8
|
||||||
|
langsmith 0.4.4
|
||||||
|
lapx 0.5.11.post1
|
||||||
|
lazy_loader 0.4
|
||||||
|
llvmlite 0.44.0
|
||||||
|
lmdb 1.6.2
|
||||||
|
lxml 6.0.0
|
||||||
|
Mako 1.3.10
|
||||||
|
markdown-it-py 3.0.0
|
||||||
|
MarkupSafe 3.0.2
|
||||||
|
marshmallow 3.26.1
|
||||||
|
matplotlib 3.5.3
|
||||||
|
matplotlib-inline 0.1.7
|
||||||
|
mdurl 0.1.2
|
||||||
|
more-itertools 10.7.0
|
||||||
|
motmetrics 1.4.0
|
||||||
|
msgpack 1.1.1
|
||||||
|
multidict 6.6.3
|
||||||
|
multiprocess 0.70.12.2
|
||||||
|
mypy_extensions 1.1.0
|
||||||
|
netifaces 0.11.0
|
||||||
|
networkx 3.4.2
|
||||||
|
numba 0.61.2
|
||||||
|
numpy 1.24.4
|
||||||
|
nuscenes-devkit 1.1.11+pdx
|
||||||
|
onnx 1.17.0
|
||||||
|
onnxoptimizer 0.3.13
|
||||||
|
openai 1.93.1
|
||||||
|
opencv-contrib-python 4.10.0.84
|
||||||
|
openpyxl 3.1.5
|
||||||
|
opt-einsum 3.3.0
|
||||||
|
optuna 4.4.0
|
||||||
|
orjson 3.10.18
|
||||||
|
packaging 24.2
|
||||||
|
paddle2onnx 2.0.2rc3
|
||||||
|
paddle3d 0.0.0
|
||||||
|
paddleclas 2.6.0
|
||||||
|
paddledet 0.0.0
|
||||||
|
paddlefsl 1.1.0
|
||||||
|
paddlenlp 2.8.0.post0
|
||||||
|
paddlepaddle-gpu 3.0.0
|
||||||
|
paddleseg 0.0.0.dev0
|
||||||
|
paddlets 1.1.0
|
||||||
|
paddlex 3.1.2 /root/PaddleX
|
||||||
|
pandas 1.3.5
|
||||||
|
parso 0.8.4
|
||||||
|
patsy 1.0.1
|
||||||
|
pexpect 4.9.0
|
||||||
|
pillow 11.1.0
|
||||||
|
pip 25.1.1
|
||||||
|
polygraphy 0.49.24
|
||||||
|
ppvideo 2.3.0
|
||||||
|
premailer 3.10.0
|
||||||
|
prettytable 3.16.0
|
||||||
|
prompt_toolkit 3.0.51
|
||||||
|
propcache 0.3.2
|
||||||
|
protobuf 6.30.1
|
||||||
|
psutil 7.0.0
|
||||||
|
ptyprocess 0.7.0
|
||||||
|
pure_eval 0.2.3
|
||||||
|
py-cpuinfo 9.0.0
|
||||||
|
pyarrow 20.0.0
|
||||||
|
pybind11 2.13.6
|
||||||
|
pybind11-stubgen 2.5.1
|
||||||
|
pyclipper 1.3.0.post6
|
||||||
|
pycocotools 2.0.8
|
||||||
|
pycparser 2.22
|
||||||
|
pycryptodome 3.23.0
|
||||||
|
pydantic 2.11.7
|
||||||
|
pydantic_core 2.33.2
|
||||||
|
pydantic-settings 2.10.1
|
||||||
|
Pygments 2.19.2
|
||||||
|
PyGObject 3.36.0
|
||||||
|
PyMatting 1.1.14
|
||||||
|
pyod 2.0.5
|
||||||
|
pypandoc 1.15
|
||||||
|
pyparsing 3.2.3
|
||||||
|
pypdfium2 4.30.1
|
||||||
|
pyquaternion 0.9.9
|
||||||
|
Pyro4 4.82
|
||||||
|
python-apt 2.0.1+ubuntu0.20.4.1
|
||||||
|
python-dateutil 2.9.0.post0
|
||||||
|
python-docx 1.2.0
|
||||||
|
python-dotenv 1.1.1
|
||||||
|
pytz 2025.2
|
||||||
|
PyWavelets 1.3.0
|
||||||
|
PyYAML 6.0.2
|
||||||
|
RapidFuzz 3.13.0
|
||||||
|
rarfile 4.2
|
||||||
|
ray 2.47.1
|
||||||
|
referencing 0.36.2
|
||||||
|
regex 2024.11.6
|
||||||
|
requests 2.32.4
|
||||||
|
requests-toolbelt 1.0.0
|
||||||
|
requests-unixsocket 0.2.0
|
||||||
|
rich 14.0.0
|
||||||
|
rpds-py 0.26.0
|
||||||
|
ruamel.yaml 0.18.14
|
||||||
|
ruamel.yaml.clib 0.2.12
|
||||||
|
safetensors 0.5.3
|
||||||
|
scikit-image 0.25.2
|
||||||
|
scikit-learn 1.3.2
|
||||||
|
scipy 1.15.3
|
||||||
|
seaborn 0.13.2
|
||||||
|
sentencepiece 0.2.0
|
||||||
|
seqeval 1.2.2
|
||||||
|
serpent 1.41
|
||||||
|
setuptools 68.2.2
|
||||||
|
shap 0.48.0
|
||||||
|
Shapely 1.8.5.post1
|
||||||
|
shellingham 1.5.4
|
||||||
|
six 1.14.0
|
||||||
|
sklearn 0.0
|
||||||
|
slicer 0.0.8
|
||||||
|
sniffio 1.3.1
|
||||||
|
soundfile 0.13.1
|
||||||
|
soupsieve 2.7
|
||||||
|
SQLAlchemy 2.0.41
|
||||||
|
stack-data 0.6.3
|
||||||
|
starlette 0.46.2
|
||||||
|
statsmodels 0.14.1
|
||||||
|
tenacity 9.1.2
|
||||||
|
tensorboardX 2.6.4
|
||||||
|
tensorrt 10.5.0
|
||||||
|
termcolor 3.1.0
|
||||||
|
terminaltables 3.1.10
|
||||||
|
threadpoolctl 3.6.0
|
||||||
|
tifffile 2025.5.10
|
||||||
|
tiktoken 0.9.0
|
||||||
|
tokenizers 0.19.1
|
||||||
|
tomli 2.2.1
|
||||||
|
tool_helpers 0.1.2
|
||||||
|
tqdm 4.67.1
|
||||||
|
traitlets 5.14.3
|
||||||
|
typeguard 4.4.4
|
||||||
|
typer 0.16.0
|
||||||
|
typing_extensions 4.14.1
|
||||||
|
typing-inspect 0.9.0
|
||||||
|
typing-inspection 0.4.1
|
||||||
|
tzdata 2025.2
|
||||||
|
ujson 5.10.0
|
||||||
|
unattended-upgrades 0.1
|
||||||
|
urllib3 1.25.8
|
||||||
|
uvicorn 0.35.0
|
||||||
|
visualdl 2.5.3
|
||||||
|
Wand 0.6.13
|
||||||
|
wcwidth 0.2.13
|
||||||
|
Werkzeug 3.1.3
|
||||||
|
xmltodict 0.14.2
|
||||||
|
xxhash 3.5.0
|
||||||
|
yacs 0.1.8
|
||||||
|
yarl 1.20.1
|
||||||
|
zstandard 0.23.0
|
||||||
BIN
document/关于使用PaddleOCR训练模型的进展情况说明.docx
Normal file
BIN
document/关于使用PaddleOCR训练模型的进展情况说明.docx
Normal file
Binary file not shown.
BIN
document/医保类型识别结果.xlsx
Normal file
BIN
document/医保类型识别结果.xlsx
Normal file
Binary file not shown.
@@ -1,15 +1,14 @@
|
|||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
# 项目根目录
|
|
||||||
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
||||||
# 获取主机名,方便区分容器
|
# 获取主机名,方便区分容器
|
||||||
HOSTNAME = socket.gethostname()
|
HOSTNAME = socket.gethostname()
|
||||||
# 检测日志文件的路径是否存在,不存在则创建
|
# 检测日志文件的路径是否存在,不存在则创建
|
||||||
LOG_PATHS = [
|
LOG_PATHS = [
|
||||||
os.path.join(PROJECT_ROOT, 'log', HOSTNAME, 'ucloud'),
|
f"log/{HOSTNAME}/ucloud",
|
||||||
os.path.join(PROJECT_ROOT, 'log', HOSTNAME, 'error'),
|
f"log/{HOSTNAME}/error",
|
||||||
os.path.join(PROJECT_ROOT, 'log', HOSTNAME, 'qr'),
|
f"log/{HOSTNAME}/qr",
|
||||||
|
f"log/{HOSTNAME}/sql",
|
||||||
]
|
]
|
||||||
for path in LOG_PATHS:
|
for path in LOG_PATHS:
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
@@ -76,6 +75,16 @@ LOGGING_CONFIG = {
|
|||||||
'backupCount': 14,
|
'backupCount': 14,
|
||||||
'encoding': 'utf-8',
|
'encoding': 'utf-8',
|
||||||
},
|
},
|
||||||
|
'sql': {
|
||||||
|
'class': 'logging.handlers.TimedRotatingFileHandler',
|
||||||
|
'level': 'INFO',
|
||||||
|
'formatter': 'standard',
|
||||||
|
'filename': f'log/{HOSTNAME}/sql/fcb_photo_review_sql.log',
|
||||||
|
'when': 'midnight',
|
||||||
|
'interval': 1,
|
||||||
|
'backupCount': 14,
|
||||||
|
'encoding': 'utf-8',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
# loggers定义了日志记录器
|
# loggers定义了日志记录器
|
||||||
@@ -100,5 +109,10 @@ LOGGING_CONFIG = {
|
|||||||
'level': 'DEBUG',
|
'level': 'DEBUG',
|
||||||
'propagate': False,
|
'propagate': False,
|
||||||
},
|
},
|
||||||
|
'sql': {
|
||||||
|
'handlers': ['console', 'sql'],
|
||||||
|
'level': 'DEBUG',
|
||||||
|
'propagate': False,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
1
paddle_detection/README.md
Symbolic link
1
paddle_detection/README.md
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
README_cn.md
|
||||||
4
paddle_detection/__init__.py
Normal file
4
paddle_detection/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
from onnxruntime import InferenceSession
|
||||||
|
|
||||||
|
PADDLE_DET = InferenceSession("model/object_det_model/ppyoloe_plus_crn_l_80e_coco_w_nms.onnx",
|
||||||
|
providers=["CPUExecutionProvider"], provider_options=[{"device_id": 0}])
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user