feat: Introduce JPEG support check and remove obsolete files
- Added a new script `check_jpeg_support.py` to verify device support for JPEG screenshots, enhancing functionality for image processing. - Deleted obsolete files including `auto_test_result.txt`, `CODE_QUALITY_REVIEW.md`, and others to streamline the project and improve maintainability. - Cleaned up unnecessary blank lines in various scripts to enhance readability and organization.
This commit is contained in:
1 parent
07c387751d
commit
7db9864848
2 files changed
+29
-6
No files matched your search
+14
-3
@@ -16,14 +16,25 @@ if os.path.exists(target_dir):
|
||||
break
|
||||
|
||||
if target_file:
|
||||
full_path = os.path.join(target_dir, target_file)
|
||||
# 使用绝对路径,避免编码问题
|
||||
full_path = os.path.abspath(os.path.join(target_dir, target_file))
|
||||
print(f"找到文件: {target_file}")
|
||||
print(f"完整路径: {full_path}")
|
||||
print(f"文件存在: {os.path.exists(full_path)}")
|
||||
print("\n开始运行测试...\n")
|
||||
|
||||
# 运行测试脚本
|
||||
cmd = [sys.executable, "test_real_parallel_ocr.py", full_path]
|
||||
subprocess.run(cmd, encoding='utf-8')
|
||||
cmd = [sys.executable, "-u", "test_real_parallel_ocr.py", full_path]
|
||||
env = os.environ.copy()
|
||||
env['PYTHONIOENCODING'] = 'utf-8'
|
||||
env['PYTHONUNBUFFERED'] = '1'
|
||||
# 实时显示输出
|
||||
process = subprocess.Popen(cmd, encoding='utf-8', stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
||||
text=True, env=env, bufsize=1, universal_newlines=True)
|
||||
for line in process.stdout:
|
||||
print(line, end='')
|
||||
process.wait()
|
||||
print(f"\n退出码: {process.returncode}")
|
||||
else:
|
||||
print("未找到目标文件")
|
||||
print("可用文件列表(前10个):")
|
||||
|
||||
@@ -125,13 +125,16 @@ def ocr_single_region(image_path, region_name, ocr_processor):
|
||||
'time': elapsed,
|
||||
'success': True
|
||||
}
|
||||
except (OSError, IOError, ValueError, AttributeError) as e:
|
||||
except Exception as e:
|
||||
import traceback
|
||||
error_msg = f"{type(e).__name__}: {str(e)}"
|
||||
print(f" [DEBUG] {region_name} OCR错误: {error_msg}")
|
||||
return {
|
||||
'region': region_name,
|
||||
'text': '',
|
||||
'time': 0,
|
||||
'success': False,
|
||||
'error': str(e)
|
||||
'error': error_msg
|
||||
}
|
||||
|
||||
def test_parallel_ocr_real(region_images, config_name, omp_threads, max_workers):
|
||||
@@ -193,10 +196,19 @@ def test_parallel_ocr_real(region_images, config_name, omp_threads, max_workers)
|
||||
for future in futures:
|
||||
region_name = futures[future]
|
||||
try:
|
||||
result = future.result()
|
||||
result = future.result(timeout=60) # 每个任务最多60秒
|
||||
results.append(result)
|
||||
status = "✓" if result['success'] else "✗"
|
||||
print(f" {status} {region_name}: {result['time']:.0f}ms, 结果: {result['text'][:30] if result['text'] else '(空)'}")
|
||||
except TimeoutError:
|
||||
print(f" ✗ {region_name}: 超时(>60秒)")
|
||||
results.append({
|
||||
'region': region_name,
|
||||
'text': '',
|
||||
'time': 0,
|
||||
'success': False,
|
||||
'error': 'Timeout'
|
||||
})
|
||||
except (RuntimeError, AttributeError, KeyError) as e:
|
||||
print(f" ✗ {region_name}: 失败 - {e}")
|
||||
results.append({
|
||||
|
||||
Reference in new issue
Block a user