Files
AI-tianyan/start.sh
master ee9be85292 fix: ACL bytes_to_ptr GC bug + 添加 NPU 模型转换指南
python/infer_server.py:
- 修复 acl.util.bytes_to_ptr() 后 bytes 被 GC 回收导致全零输出的 bug
- 保持 bytes 引用直到 memcpy 完成
- 正确解析 FP16 模型输出 (half precision -> float32)

docs/CONVERSION_GUIDE.md:
- 完整的 YOLOv8 ONNX->OM 转换流程文档
- ATC 转换参数详解及低内存设备配置
- 已知问题排查表 (OOM/全零输出/算子不支持)
- 其他 YOLOv8 尺寸模型参考

start.sh: 一键启动脚本
2026-05-06 23:30:49 +08:00

50 lines
1.3 KiB
Bash

#!/usr/bin/env bash
# 一键启动脚本
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"
echo "=========================================="
echo " Tianyan Edge - 启动脚本"
echo "=========================================="
# 检查模型
if [ ! -f model/model.om ]; then
echo "[错误] model/model.om 不存在,请先转换模型"
echo "使用方法: atc --model=yolov8n.onnx --framework=5 --output=model/model.om --soc_version=Ascend310B4 --input_format=NCHW --input_shape=\"images:1,3,640,640\""
exit 1
fi
# 创建必要的目录
mkdir -p logs
# 启动推理服务(后台)
echo "[1/2] 启动推理服务..."
if systemctl is-active --quiet edge-infer 2>/dev/null; then
echo " edge-infer 已在运行"
else
python3 python/infer_server.py > logs/infer.log 2>&1 &
INFER_PID=$!
echo " 推理服务 PID: $INFER_PID"
sleep 2
fi
# 启动 Go Agent
echo "[2/2] 启动 Go Agent..."
if systemctl is-active --quiet edge-agent 2>/dev/null; then
echo " edge-agent 已在运行"
else
./build/edge-agent -config config/edge.yaml 2>&1 | tee logs/agent.log &
AGENT_PID=$!
echo " Agent PID: $AGENT_PID"
fi
echo ""
echo "启动完成!按 Ctrl+C 停止"
echo "推理日志: logs/infer.log"
echo "Agent日志: logs/agent.log"
# 等待
wait