Enhanced logging, diagnostics, and robustness throughout

Added NLog-based logging and diagnostics to Console and WPF apps, with programmatic configuration and support for debugger output. Refactored apps to use dependency injection and Microsoft.Extensions.Hosting. Improved output layer extraction and fallback logic in detection/recognition, including objectness-class probability multiplication. Added crop saving for diagnostics. Introduced new CLI options for diagnostics. MainViewModel and MainWindow now use DI and log errors. NumberRecognitionEngine supports logging, crop saving, and robust fallback. Added Python diagnostic script. Improved error handling and argument parsing.
This commit is contained in:
MaddoScientisto 2026-02-15 18:06:03 +01:00
commit d2206a00cb
14 changed files with 571 additions and 78 deletions

View file

@ -1,21 +1,39 @@
@echo off
SET "SCRIPT_PATH=%~1"
SET VENV_DIR="C:\Users\piero\Desktop\AIFotoONLUS\my_venv"
SET "SCRIPT_PATH=%~f1"
SET "VENV_DIR=.\venv"
IF "%SCRIPT_PATH%"=="" (
echo Usage: %~n0 script.py [args...]
exit /b 1
)
shift
SET "PARAMS=%*"
SET "PARAMS=%PARAMS:*%SCRIPT_PATH%=%"
IF NOT EXIST %VENV_DIR% (
python -m venv %VENV_DIR%
for %%F in ("%SCRIPT_PATH%") do set "SCRIPT_BASENAME=%%~nxF"
setlocal enabledelayedexpansion
set "NEWPARAMS="
for %%A in (%PARAMS%) do (
if /I not "%%~A"=="%SCRIPT_BASENAME%" (
set "NEWPARAMS=!NEWPARAMS! %%~A"
)
)
endlocal & set "PARAMS=%NEWPARAMS%"
for /f "tokens=*" %%A in ("%PARAMS%") do set "PARAMS=%%A"
IF NOT EXIST "%VENV_DIR%" (
py -3.14 -m venv "%VENV_DIR%"
)
call %VENV_DIR%\Scripts\activate.bat
call "%VENV_DIR%\Scripts\activate.bat"
pip install imutils==0.5.4
pip install numpy==1.20.1
pip install opencv-python==4.5.1.48
pip install Pillow==8.1.0
pip install pytesseract==0.3.7
python -m pip install --upgrade pip setuptools wheel
pip install --upgrade imutils numpy opencv-python Pillow pytesseract
echo Running: python "%SCRIPT_PATH%" %PARAMS%
echo SCRIPT_PATH=[%SCRIPT_PATH%]
echo PARAMS=[%PARAMS%]
python "%SCRIPT_PATH%" %PARAMS%
call %VENV_DIR%\Scripts\deactivate.bat
call "%VENV_DIR%\Scripts\deactivate.bat"