Claude: Findet .npz Fehler

This commit is contained in:
chk
2026-06-01 20:47:39 +02:00
parent a38886ce03
commit 4b5108aaa8
113 changed files with 50858 additions and 2470 deletions

View File

@@ -1,53 +1,48 @@
@echo off
setlocal EnableDelayedExpansion
REM 3_pipeline_multiview.bat
REM Multi-camera ArUco detection and pose estimation pipeline
REM Parametr e.g.
REM run_pipeline.bat ../data/simulation/Scene4
REM run_pipeline_v8.bat
REM v8 pipeline: adds elbow angle estimation + camera z refinement
REM
REM Steps:
REM 1 ArUco detection (same as v4)
REM 2 Camera pose from board markers (same as v4)
REM 3a First bundle adjustment with board-calibrated cameras
REM 3b Elbow angle estimation (robust to z-error, uses relative marker vectors)
REM 4 Camera z refinement using FK-predicted Ellbow z
REM 5 Second bundle adjustment with z-corrected cameras -> v8/ subfolder
REM 6 Robot state estimation from v8 positions
REM
REM Usage: .\run_pipeline_v8.bat ..\data\simulation\Scene9
REM Wenn kein Argument übergeben wurde
if "%1"=="" (
echo.
echo [INFO] Aufruf fehlt!
echo Beispiel: .\run_pipeline.bat ../data/simulation/Scene4
echo [INFO] Aufruf fehlt!
echo Beispiel: .\run_pipeline_v8.bat ..\data\simulation\Scene9
echo.
exit /b
)
set "IMAGES=%~1"
REM trailing slash entfernen
if "%IMAGES:~-1%"=="\" set "IMAGES=%IMAGES:~0,-1%"
if "%IMAGES:~-1%"=="/" set "IMAGES=%IMAGES:~0,-1%"
set ROBOT_JSON=..\data\robot\robot.json
set BASE_OUT_DIR=C:\Users\kech\SynologyDrive\2026-AppServer-AppRobot\appRobotRendering\data\evaluations
REM ✅ richtigen Namen extrahieren
for %%I in ("%IMAGES%") do set "SCENE_NAME=%%~nxI"
set OUT_DIR=%BASE_OUT_DIR%\%SCENE_NAME%
set OUT_DIR_V8=%OUT_DIR%\v8
REM ── STEP 1: ArUco detection ────────────────────────────────────
echo.
echo [STEP 1] Detect ArUco markers from all cameras in the folder %IMAGES%
echo [STEP 1] Detect ArUco markers from %IMAGES%
for %%F in ("%IMAGES%\*.png" "%IMAGES%\*.PNG" "%IMAGES%\*.jpg" "%IMAGES%\*.jpeg" "%IMAGES%\*.JPG" "%IMAGES%\*.JPEG") do (
REM Dateiname ohne Pfad und ohne .png
for %%F in ("%IMAGES%\*.png" "%IMAGES%\*.PNG" "%IMAGES%\*.jpg" "%IMAGES%\*.jpeg" "%IMAGES%\*.JPG" "%IMAGES%\*.JPEG") do (
set "NAME=%%~nF"
echo Bearbeite: !NAME!
REM Split bei "_" → nehme 2. Teil (die ID)
for /f "tokens=2 delims=_" %%A in ("%%~nF") do (
set "CAMID=%%A"
REM Takes files and detected arucos output to render_c_aruco_detection.json
python3 ../pipeline/1_detect_aruco_observations.py ^
-i "%%F" ^
-npz "%IMAGES%\render_a.npz" ^
@@ -57,44 +52,100 @@ for %%F in ("%IMAGES%\*.png" "%IMAGES%\*.PNG" "%IMAGES%\*.jpg" "%IMAGES%\*.jpeg"
)
)
REM ── STEP 2: Camera pose from board markers ─────────────────────
echo.
echo [STEP 2] Estimate camera poses from detections
echo [STEP 2] Estimate camera poses from board markers
for %%F in ("%OUT_DIR%\*_aruco_detection.json") do (
for %%F in ("%OUT_DIR%\*_aruco_detection.json") do (
echo Bearbeite: %%F
python3 ../pipeline/2_estimate_camera_from_observations.py ^
-i "%%F" ^
-robot %ROBOT_JSON% ^
-outDir %OUT_DIR%
)
echo.
echo [STEP 3] Triangulate marker positions from multi-view observations
REM ── Collect file lists ─────────────────────────────────────────
set DET_ARGS=
set POSE_ARGS=
set POSE_ARGS_V8=
REM Alle detection files sammeln
for %%F in ("%OUT_DIR%\*_aruco_detection.json") do (
set DET_ARGS=!DET_ARGS! -det "%%F"
)
REM Alle pose files sammeln
for %%F in ("%OUT_DIR%\*_camera_pose.json") do (
set POSE_ARGS=!POSE_ARGS! -pose "%%F"
)
python3 "..\pipeline\3_multiview_bundle_adjustment_v4.py" ^
REM ── STEP 3a: First bundle adjustment (board cameras) ──────────
echo.
echo [STEP 3a] Initial bundle adjustment with board-calibrated cameras
python3 "..\pipeline\3_multiview_bundle_adjustment_v5_board_anchor_patch.py" ^
-robot "%ROBOT_JSON%" ^
-lambdaWeight 100.0 ^
!DET_ARGS! ^
!POSE_ARGS!
REM ── STEP 3b: Elbow angle (robust to z-error) ──────────────────
echo.
echo [STEP 3b-v8] Estimate elbow angle
python3 "..\pipeline\4_v8_4b_revolute_angle.py" ^
--robot "%ROBOT_JSON%" ^
--aruco "%OUT_DIR%\aruco_positions_optimized.json" ^
--link Ellbow ^
--output "%OUT_DIR%\v8_ellbow_angle.json"
if errorlevel 1 (
echo [ERROR] Elbow angle estimation failed. Aborting v8 pipeline.
exit /b 1
)
REM ── STEP 4: Camera z refinement ───────────────────────────────
echo.
echo [STEP 4-v8] Refine camera z using FK prediction
for %%F in ("%OUT_DIR%\*_camera_pose.json") do (
set POSE_ARGS_V8=!POSE_ARGS_V8! -pose "%%F"
)
python3 "..\pipeline\5_v8_camera_z_refine.py" ^
--angle "%OUT_DIR%\v8_ellbow_angle.json" ^
--robot "%ROBOT_JSON%" ^
--aruco "%OUT_DIR%\aruco_positions_optimized.json" ^
!POSE_ARGS_V8! ^
--outDir "%OUT_DIR%"
if errorlevel 1 (
echo [ERROR] Camera z refinement failed. Aborting v8 pipeline.
exit /b 1
)
REM ── STEP 5: Second bundle adjustment (z-corrected cameras) ────
echo.
echo [STEP 5-v8] Second bundle adjustment with z-corrected cameras
set POSE_ARGS_REFINED=
for %%F in ("%OUT_DIR%\*_camera_pose_v8.json") do (
set POSE_ARGS_REFINED=!POSE_ARGS_REFINED! -pose "%%F"
)
python3 "..\pipeline\3_multiview_bundle_adjustment_v5_board_anchor_patch.py" ^
-robot "%ROBOT_JSON%" ^
-lambdaWeight 100.0 ^
--outDir "%OUT_DIR_V8%" ^
!DET_ARGS! ^
!POSE_ARGS_REFINED!
REM ── STEP 6: Robot state estimation from v8 positions ──────────
echo.
echo [STEP 6-v8] Robot state estimation
python3 "..\pipeline\4_robotState_estimation_v6.py" ^
"%OUT_DIR_V8%\aruco_positions_optimized.json" ^
-robot "%ROBOT_JSON%" ^
-out "%OUT_DIR_V8%\robot_state_v8.json"
echo.
echo [STEP 4] Robotics Pose calculation of angles and joint positions
python3 "..\pipeline\4_v8_4a_base_slider.py" ^
"%OUT_DIR%\aruco_positions_initial.json" ^
-robot "%ROBOT_JSON%" ^
-out "%OUT_DIR%\robot_state.json"
echo [DONE] v8 results in: %OUT_DIR_V8%
echo z-correction summary: %OUT_DIR%\v8_z_correction.json

View File

@@ -1 +1 @@
python3 ../setup/generateSets/render_Loop.py
python3 ../setup/generateSets/render_Loop.py %*