This commit is contained in:
HuangHai
2026-01-15 10:14:44 +08:00
parent ccac3e889c
commit 23dfa433b0
6 changed files with 96 additions and 58 deletions

View File

@@ -23,7 +23,7 @@ class ReadImageKit:
async def find_price_entrance_ocr(self, image_path):
"""
使用 OCR 在详情页寻找价格入口 (全部时段 >)
使用 OCR 在详情页寻找价格入口 (全部时段 > 或 全天价格统一 >)
不再使用 VLM 和 掩码 CV
"""
container_norm = detect_price_info_container_cv(image_path)
@@ -45,12 +45,12 @@ class ReadImageKit:
return {
"found": True,
"reason": "OCR 精准定位到‘全部时段’文字",
"reason": "OCR 精准定位到价格入口关键字",
"point": [center_x, center_y]
}
# 记录警告日志
logger.warning(f"⚠️ [OCR识别失败] 在图片中未发现‘全部时段’关键字: {image_path}")
logger.warning(f"⚠️ [OCR识别失败] 在图片中未发现价格入口关键字 (全部时段/全天价格统一): {image_path}")
return {"found": False}
async def find_close_button_vlm(self, image_path):
@@ -278,11 +278,12 @@ class ReadImageKit:
要求:
1. 忽略页面上半部分(如顶部导航栏、搜索框、广告 Banner、筛选标签等)。
2. 仅识别下半部分一条条“充电站卡片”,每张卡片通常包含:场站名称、评分、最近充电时间、距离、价格、快/慢空闲数量等。
2. 仅识别下半部分一条条“充电站卡片”,每张卡片通常包含:场站名称、评分、最近充电时间、距离(如 '5.3km' 或 '90m')、价格、快/慢空闲数量等。
3. 不要把同一张卡片拆成多块;每条场站只对应一个矩形框。
对于每张卡片,请输出:
- name: 场站名称
- distance: 距离信息字符串(例如 '5.3km' 或 '90m')
- address: 场站地址(如果无法确定可置为 null)
- point: 卡片中心点击坐标 [x, y],使用归一化坐标 [0-1000](0 表示最左/最上,1000 表示最右/最下)
- bbox: 卡片外接矩形边界 [x1, y1, x2, y2],同样使用归一化坐标 [0-1000]
@@ -291,6 +292,7 @@ class ReadImageKit:
[
{
"name": "某某充电站",
"distance": "1.2km",
"address": "某某路 100 号",
"point": [500, 750],
"bbox": [50, 600, 950, 820]
@@ -370,6 +372,7 @@ class ReadImageKit:
final_stations.append({
"name": res.get("name"),
"distance": res.get("distance"),
"address": res.get("address"),
"point": actual_p,
"bbox": actual_bbox