-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun_compare_blend.sh
More file actions
executable file
·104 lines (90 loc) · 3.14 KB
/
Copy pathrun_compare_blend.sh
File metadata and controls
executable file
·104 lines (90 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
python_has() {
"$1" -c "import $2" >/dev/null 2>&1
}
collect_python_candidates() {
local seen="|"
local candidate
add_candidate() {
candidate="$1"
[ -z "$candidate" ] && return
[ ! -x "$candidate" ] && return
case "$seen" in *"|$candidate|"*) return ;; esac
seen="${seen}${candidate}|"
printf '%s\n' "$candidate"
}
add_candidate "${VIBEPHYSICS_PYTHON:-}"
add_candidate "${PYTHON:-}"
add_candidate "${CONDA_PREFIX:+$CONDA_PREFIX/bin/python}"
shopt -s nullglob
for candidate in \
"$HOME/anaconda3/envs/"*/bin/python \
"$HOME/miniconda3/envs/"*/bin/python \
"/opt/homebrew/anaconda3/envs/"*/bin/python \
"/opt/homebrew/Caskroom/miniconda/base/envs/"*/bin/python; do
add_candidate "$candidate"
done
shopt -u nullglob
add_candidate "$(command -v python3.11 2>/dev/null)"
add_candidate "$(command -v python 2>/dev/null)"
add_candidate "$(command -v python3 2>/dev/null)"
}
resolve_python() {
local candidate
while IFS= read -r candidate; do
if python_has "$candidate" bpy; then
PYTHON="$candidate"
return 0
fi
done < <(collect_python_candidates)
return 1
}
usage() {
echo "Usage: $0 --left <path> --right <path> [--output <path.blend>] [--layout left-right|top-down]"
echo ""
echo "Each side can be predictions.npz or a COLMAP sparse model folder (sparse/0)."
echo "Default layout is left-right; top-down stacks the first input above the second."
echo ""
echo "Examples:"
echo " # GLOMAP vs LingBot-Map (same video, same fps in both configs)"
echo " $0 \\"
echo " --left mapping_output/test_home_glomap/sparse/0 \\"
echo " --right feedforward_output/lingbot_map_test_home/predictions.npz \\"
echo " --output compare_output/glomap_vs_lingbot.blend"
echo ""
echo " # Feedforward vs feedforward"
echo " $0 \\"
echo " --left feedforward_output/vggt_omega_test/predictions.npz \\"
echo " --right feedforward_output/lingbot_map_test/predictions.npz \\"
echo " --output feedforward_output/compare_vggt_lingbot.blend"
exit 1
}
while [[ "$#" -gt 0 ]]; do
case $1 in
--left) LEFT="$2"; shift ;;
--right) RIGHT="$2"; shift ;;
--output) OUTPUT="$2"; shift ;;
--layout) LAYOUT="$2"; shift ;;
-h|--help) usage ;;
*) echo "Unknown parameter: $1"; usage ;;
esac
shift
done
if [[ -z "$LEFT" || -z "$RIGHT" ]]; then
usage
fi
if ! resolve_python; then
echo "Error: no Python with PyPI bpy found." >&2
echo "Use Python 3.11 with: pip install vibephysics bpy" >&2
echo "Or set VIBEPHYSICS_PYTHON=/path/to/python" >&2
exit 1
fi
OUTPUT="${OUTPUT:-$SCRIPT_DIR/feedforward_output/compare.blend}"
LAYOUT="${LAYOUT:-left-right}"
export PYTHONPATH="${SCRIPT_DIR}/src${PYTHONPATH:+:$PYTHONPATH}"
echo "--- [run_compare_blend] Python: $PYTHON ---"
exec "$PYTHON" -m vibephysics.feedforward.export compare \
--inputs "$LEFT" "$RIGHT" \
--output "$OUTPUT" \
--layout "$LAYOUT"