#!/bin/bash
# 快速运行脚本

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
MODEL_PATH="/Users/chenyouyuan/cyy_ws/jetson_nx_yolo/RobotDetectionModel/Model/0526.onnx"

# 默认参数
IMAGE=""
COLOR=0

# 解析参数
while [[ $# -gt 0 ]]; do
    case $1 in
        --image)
            IMAGE="$2"
            shift 2
            ;;
        --color)
            COLOR="$2"
            shift 2
            ;;
        --video)
            VIDEO="$2"
            shift 2
            ;;
        *)
            echo "Unknown option: $1"
            exit 1
            ;;
    esac
done

cd "$SCRIPT_DIR"

if [ -n "$VIDEO" ]; then
    echo "Running video inference: $VIDEO"
    python yolo_inference.py --video "$VIDEO" --model "$MODEL_PATH" --color "$COLOR"
elif [ -n "$IMAGE" ]; then
    echo "Running image inference: $IMAGE"
    python yolo_inference.py --image "$IMAGE" --model "$MODEL_PATH" --color "$COLOR"
else
    echo "Usage: ./run_inference.sh --image <path> [--color 0|1]"
    echo "       ./run_inference.sh --video <path> [--color 0|1]"
    exit 1
fi
