Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3e54662d7f | |||
| 7ca1008461 | |||
| a52899ca02 | |||
| 0f0e666e67 | |||
| bf1000a848 | |||
| 2656976efa | |||
| cae997fcf7 | |||
| e018250344 | |||
| c0f5ca2eb4 | |||
| ffed64b0b9 |
@@ -15,6 +15,7 @@ ENV PYTHONUNBUFFERED=1 \
|
|||||||
COPY requirements.txt /app/requirements.txt
|
COPY requirements.txt /app/requirements.txt
|
||||||
COPY packages /app/packages
|
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 \
|
||||||
|
&& python3 -m pip install --upgrade pip \
|
||||||
&& pip install --no-cache-dir -r requirements.txt \
|
&& pip install --no-cache-dir -r requirements.txt \
|
||||||
&& pip uninstall -y onnxruntime onnxruntime-gpu \
|
&& 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/
|
&& pip install onnxruntime-gpu==1.18.0 --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/
|
||||||
|
|||||||
@@ -129,4 +129,5 @@ bash update.sh
|
|||||||
22. 版本号:1.15.0
|
22. 版本号:1.15.0
|
||||||
1. 新增图片清晰度测试
|
1. 新增图片清晰度测试
|
||||||
23. 版本号:1.16.0
|
23. 版本号:1.16.0
|
||||||
1. 更新paddle框架至3.0
|
1. 优化结算单号规则
|
||||||
|
2. 新增判断截图方法
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
x-env:
|
x-env:
|
||||||
&template
|
&template
|
||||||
image: fcb_photo_review:1.15.4
|
image: fcb_photo_review:1.16.0
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
x-review:
|
x-review:
|
||||||
|
|||||||
@@ -262,18 +262,18 @@ def information_extraction(ie, phrecs, identity):
|
|||||||
session.add_all(zx_ie_results)
|
session.add_all(zx_ie_results)
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|
||||||
# 添加清晰度测试
|
# # 添加清晰度测试
|
||||||
if better_image is None:
|
# if better_image is None:
|
||||||
# 替换后图片默认清晰
|
# # 替换后图片默认清晰
|
||||||
clarity_result = image_util.parse_clarity(image)
|
# clarity_result = image_util.parse_clarity(image)
|
||||||
unsharp_flag = 0 if (clarity_result[0] == 0 and clarity_result[1] >= 0.8) else 1
|
# unsharp_flag = 0 if (clarity_result[0] == 0 and clarity_result[1] >= 0.8) else 1
|
||||||
update_clarity = (update(ZxPhrec).where(ZxPhrec.pk_phrec == phrec.pk_phrec).values(
|
# update_clarity = (update(ZxPhrec).where(ZxPhrec.pk_phrec == phrec.pk_phrec).values(
|
||||||
cfjaddress2=json.dumps(clarity_result),
|
# cfjaddress2=json.dumps(clarity_result),
|
||||||
unsharp_flag=unsharp_flag,
|
# unsharp_flag=unsharp_flag,
|
||||||
))
|
# ))
|
||||||
session.execute(update_clarity)
|
# session.execute(update_clarity)
|
||||||
session.commit()
|
# session.commit()
|
||||||
session.close()
|
# session.close()
|
||||||
|
|
||||||
result['ocr_text'] = ocr_text
|
result['ocr_text'] = ocr_text
|
||||||
return result
|
return result
|
||||||
@@ -320,7 +320,7 @@ def save_or_update_ie(table, pk_phhd, data):
|
|||||||
if db_data:
|
if db_data:
|
||||||
# 更新
|
# 更新
|
||||||
db_data.update_time = now
|
db_data.update_time = now
|
||||||
db_data.creator = HOSTNAME
|
db_data.updater = HOSTNAME
|
||||||
for k, v in data.items():
|
for k, v in data.items():
|
||||||
setattr(db_data, k, v)
|
setattr(db_data, k, v)
|
||||||
else:
|
else:
|
||||||
@@ -421,6 +421,10 @@ def settlement_task(pk_phhd, settlement_list, identity):
|
|||||||
get_best_value_in_keys(settlement_list_ie_result, MEDICAL_EXPENSES))
|
get_best_value_in_keys(settlement_list_ie_result, MEDICAL_EXPENSES))
|
||||||
settlement_data["medical_expenses_str"] = handle_original_data(parse_money_result[0])
|
settlement_data["medical_expenses_str"] = handle_original_data(parse_money_result[0])
|
||||||
settlement_data["medical_expenses"] = parse_money_result[1]
|
settlement_data["medical_expenses"] = parse_money_result[1]
|
||||||
|
|
||||||
|
if not settlement_data["settlement_id"]:
|
||||||
|
# 如果没有结算单号就填住院号
|
||||||
|
settlement_data["settlement_id"] = settlement_data["admission_id"]
|
||||||
save_or_update_ie(ZxIeSettlement, pk_phhd, settlement_data)
|
save_or_update_ie(ZxIeSettlement, pk_phhd, settlement_data)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -268,3 +268,61 @@ def parse_clarity(image):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error("获取图片清晰度失败", exc_info=e)
|
logging.error("获取图片清晰度失败", exc_info=e)
|
||||||
return clarity_result
|
return clarity_result
|
||||||
|
|
||||||
|
|
||||||
|
def is_photo_by_exif(exif_tags):
|
||||||
|
"""分析EXIF数据判断是否为照片"""
|
||||||
|
# 照片通常包含的EXIF标签
|
||||||
|
photo_tags = [
|
||||||
|
'FNumber', # 光圈
|
||||||
|
'ExposureTime', # 曝光时间
|
||||||
|
'ISOSpeedRatings', # ISO
|
||||||
|
'FocalLength', # 焦距
|
||||||
|
'LensModel', # 镜头型号
|
||||||
|
'GPSLatitude' # GPS位置信息
|
||||||
|
]
|
||||||
|
|
||||||
|
# 统计照片相关的EXIF标签数量
|
||||||
|
photo_tag_count = 0
|
||||||
|
if exif_tags:
|
||||||
|
for tag in photo_tags:
|
||||||
|
if tag in exif_tags:
|
||||||
|
photo_tag_count += 1
|
||||||
|
# 如果有2个以上照片相关的EXIF标签,倾向于是照片
|
||||||
|
if photo_tag_count >= 2:
|
||||||
|
return True
|
||||||
|
# 不确定是照片返回False
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def is_screenshot_by_image_features(image):
|
||||||
|
"""分析图像特征判断是否为截图"""
|
||||||
|
# 定义边缘像素标准差阈值,小于此阈值则认为图片是截图
|
||||||
|
edge_std_threshold = 20.0
|
||||||
|
try:
|
||||||
|
# 检查边缘像素的一致性(截图边缘通常更整齐)
|
||||||
|
edge_pixels = []
|
||||||
|
# 取图像边缘10像素
|
||||||
|
edge_pixels.extend(image[:10, :].flatten()) # 顶部边缘
|
||||||
|
edge_pixels.extend(image[-10:, :].flatten()) # 底部边缘
|
||||||
|
edge_pixels.extend(image[:, :10].flatten()) # 左侧边缘
|
||||||
|
edge_pixels.extend(image[:, -10:].flatten()) # 右侧边缘
|
||||||
|
|
||||||
|
# 计算边缘像素的标准差(值越小说明越一致)
|
||||||
|
edge_std = numpy.std(edge_pixels)
|
||||||
|
logging.info(f"边缘像素标准差: {edge_std}")
|
||||||
|
return edge_std < edge_std_threshold
|
||||||
|
except Exception as e:
|
||||||
|
logging.error("图像特征分析失败", exc_info=e)
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def is_screenshot(image, exif_tags):
|
||||||
|
"""综合判断是否是截图"""
|
||||||
|
# 先检查EXIF数据
|
||||||
|
result_of_exif = is_photo_by_exif(exif_tags)
|
||||||
|
# 如果有明显的照片EXIF信息,直接判断为照片
|
||||||
|
if result_of_exif:
|
||||||
|
return False
|
||||||
|
# 分析图像特征
|
||||||
|
return is_screenshot_by_image_features(image)
|
||||||
|
|||||||
Reference in New Issue
Block a user