This commit is contained in:
HuangHai
2026-01-16 20:58:45 +08:00
parent 07741bcf4b
commit 3f3eb5ee05
4 changed files with 12 additions and 12 deletions

View File

@@ -83,9 +83,9 @@ async def get_station_list(d, service, max_stations_count=MAX_STATIONS_COUNT):
total_new_processed_count = 0
scroll_count = 0
while total_encountered_count < max_stations_count:
while total_new_processed_count < max_stations_count:
scroll_count += 1
logger.info(f"正在处理第 {scroll_count} 次滚动 (已遇到: {total_encountered_count}/{max_stations_count}, 新采集: {total_new_processed_count})...")
logger.info(f"正在处理第 {scroll_count} 次滚动 (已遇到: {total_encountered_count}, 新采集: {total_new_processed_count}/{max_stations_count})...")
# 1. 拍摄截图
image_uuid = str(uuid.uuid4())
@@ -121,7 +121,7 @@ async def get_station_list(d, service, max_stations_count=MAX_STATIONS_COUNT):
logger.info("正在调用 VL 模型识别场站信息 (整页识别)...")
# 优先使用带绿框的图片进行识别
img_to_process = vl_img_path if os.path.exists(vl_img_path) else screenshot_path
stations = await service.process_station_list_vl(img_to_process, json_metadata, device_info=device_info, max_count=max_stations_count - total_encountered_count)
stations = await service.process_station_list_vl(img_to_process, json_metadata, device_info=device_info, max_count=max_stations_count - total_new_processed_count)
logger.info(f"本页识别到 {len(stations)} 个有效场站")
ad_top_y_norm = 1.0 - BOTTOM_SAFE_EXCLUDE_RATIO
@@ -130,8 +130,8 @@ async def get_station_list(d, service, max_stations_count=MAX_STATIONS_COUNT):
new_stations_processed_in_page = 0
if json_metadata.get("cards") and stations:
for card_idx, card in enumerate(json_metadata["cards"]):
# 检查是否已达到最大采集数量
if total_encountered_count >= max_stations_count:
# 检查是否已达到最大采集数量(按新采集的场站数量限制)
if total_new_processed_count >= max_stations_count:
break
# 检查索引是否越界 (VL 模型可能返回的数组长度不一致)
@@ -158,7 +158,7 @@ async def get_station_list(d, service, max_stations_count=MAX_STATIONS_COUNT):
# 正常处理新场站
click_x, click_y = card["click_point"]
current_idx = total_encountered_count
current_idx = total_new_processed_count + 1
remaining = max_stations_count - current_idx
logger.info(f"--- [进度: {current_idx}/{max_stations_count}, 剩余: {remaining}] 发现新场站 '{station_name}',开始处理... ---")
new_stations_processed_in_page += 1

View File

@@ -157,9 +157,9 @@ async def get_station_list(d, service, uploader, max_stations_count=MAX_STATIONS
total_new_processed_count = 0
scroll_count = 0
while total_encountered_count < max_stations_count:
while total_new_processed_count < max_stations_count:
scroll_count += 1
logger.info(f"正在处理第 {scroll_count} 次滚动 (已遇到: {total_encountered_count}/{max_stations_count}, 新采集: {total_new_processed_count})...")
logger.info(f"正在处理第 {scroll_count} 次滚动 (已遇到: {total_encountered_count}, 新采集: {total_new_processed_count}/{max_stations_count})...")
# 1. 拍摄截图
image_uuid = str(uuid.uuid4())
@@ -204,7 +204,7 @@ async def get_station_list(d, service, uploader, max_stations_count=MAX_STATIONS
# 4. 【优化】直接使用本地路径调用 VL 模型识别,避免等待上传
logger.info("正在调用 VL 模型识别场站信息...")
stations = await service.process_station_list_vl(vl_img_path, json_metadata, device_info=device_info, max_count=max_stations_count - total_encountered_count)
stations = await service.process_station_list_vl(vl_img_path, json_metadata, device_info=device_info, max_count=max_stations_count - total_new_processed_count)
logger.info(f"本页识别到 {len(stations)} 个场站")
# 5. 匹配几何卡片与 VL 识别结果 (XinDianTu 的 parse_vl_image 已经按顺序返回了)
@@ -212,8 +212,8 @@ async def get_station_list(d, service, uploader, max_stations_count=MAX_STATIONS
new_stations_processed_in_page = 0
if json_metadata.get("cards") and stations:
for idx, card in enumerate(json_metadata["cards"]):
# 检查是否已达到最大采集数量
if total_encountered_count >= max_stations_count:
# 检查是否已达到最大采集数量(按新采集的场站数量限制)
if total_new_processed_count >= max_stations_count:
break
# 检查索引是否越界 (VL 模型可能返回的数组长度不一致)
@@ -240,7 +240,7 @@ async def get_station_list(d, service, uploader, max_stations_count=MAX_STATIONS
continue
# 正常处理新场站
current_idx = total_encountered_count
current_idx = total_new_processed_count + 1
remaining = max_stations_count - current_idx
logger.info(f"--- [进度: {current_idx}/{max_stations_count}, 剩余: {remaining}] 发现新场站 '{station_name}',开始处理... ---")
new_stations_processed_in_page += 1