Skip to content

Commit 058c2d3

Browse files
committed
[fix]update workflow
1 parent 68441d3 commit 058c2d3

2 files changed

Lines changed: 32 additions & 7 deletions

File tree

.github/workflows/docker-build.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build reComputer-RK-CV Images (Multi-Platform)
22

33
on:
44
push:
5-
branches: [main, master]
5+
branches: [main, master, debug]
66
paths:
77
- 'src/rk3588/**'
88
- 'src/rk3576/**'
@@ -56,10 +56,24 @@ jobs:
5656
- name: Prepare Image Name
5757
if: steps.check_changes.outputs.build == 'true'
5858
run: |
59-
# Use reComputer-RK-CV as the base repo name if renamed, otherwise use repo name
59+
# 默认基础名称
6060
REPO_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
61-
IMAGE_NAME="${{ matrix.platform }}-yolo"
62-
echo "GHCR_IMAGE=ghcr.io/${REPO_NAME}/${IMAGE_NAME}" >> $GITHUB_ENV
61+
IMAGE_BASE="${{ matrix.platform }}-yolo"
62+
63+
# 处理 rk3576 的特殊命名要求 (rk35756)
64+
if [[ "${{ matrix.platform }}" == "rk3576" ]]; then
65+
IMAGE_BASE="rk35756-yolo"
66+
fi
67+
68+
# 根据分支判断镜像路径
69+
if [[ "${{ github.ref_name }}" == "debug" ]]; then
70+
# debug 分支特定命名: recomputer-rk-cv/debug/...
71+
GHCR_IMAGE="ghcr.io/recomputer-rk-cv/debug/${IMAGE_BASE}"
72+
else
73+
GHCR_IMAGE="ghcr.io/${REPO_NAME}/${IMAGE_BASE}"
74+
fi
75+
76+
echo "GHCR_IMAGE=${GHCR_IMAGE}" >> $GITHUB_ENV
6377
6478
TAG="latest"
6579
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then

src/rk3588/web_detection.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,23 @@ async def list_videos():
211211
@app.post("/api/video/analyze")
212212
async def analyze_video(filename: str = Form(...)):
213213
input_path = os.path.join(UPLOAD_DIR, filename)
214-
output_filename = f"analyzed_{filename}"
215-
output_path = os.path.join(OUTPUT_DIR, output_filename)
216-
217214
if not os.path.exists(input_path):
218215
raise HTTPException(status_code=404, detail="Video not found")
219216

217+
# 获取视频分辨率以生成文件名
218+
cap = cv2.VideoCapture(input_path)
219+
if not cap.isOpened():
220+
raise HTTPException(status_code=400, detail="Cannot open video file")
221+
222+
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
223+
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
224+
cap.release()
225+
226+
# 格式化输出文件名:原名_宽x高_results.mp4
227+
name_base = os.path.splitext(filename)[0]
228+
output_filename = f"{name_base}_{width}x{height}_results.mp4"
229+
output_path = os.path.join(OUTPUT_DIR, output_filename)
230+
220231
success = video_analyzer.start_analysis(input_path, output_path)
221232
if success:
222233
return {"status": "started", "output": output_filename}

0 commit comments

Comments
 (0)