Community图像github.com

aliyun-vl

要看图、读图、读字、听音频时使用——描述截图/照片/视频帧里有什么、逐字读图上的字幕与界面文字(OCR)、判断画面里谁在做什么、把几十张图批量结构化、把音频转成日文或中文文本。"这张图里有什么""帮我看看这个""图里写了什么""把视频做成笔记"这类请求都走这里。**默认走阿里云百炼 vlkit(qwen3-vl),本地 Vision Router 只作兜底和纯本地像素工具(用户 2026-10-30 拍板:OVH 匿名限流 2 次/分钟太狠,尽量别用)**。这条技能给分流规则、零配置上手命令、批量与交叉核对纪律。Use when a task needs image understanding, OCR of screenshots or burned-in subtitles, per-frame video description, or speech-to-text.

aliyun-vl 是什么?

aliyun-vl is a Codex agent skill that 要看图、读图、读字、听音频时使用——描述截图/照片/视频帧里有什么、逐字读图上的字幕与界面文字(OCR)、判断画面里谁在做什么、把几十张图批量结构化、把音频转成日文或中文文本。"这张图里有什么""帮我看看这个""图里写了什么""把视频做成笔记"这类请求都走这里。**默认走阿里云百炼 vlkit(qwen3-vl),本地 Vision Router 只作兜底和纯本地像素工具(用户 2026-10-30 拍板:OVH 匿名限流 2 次/分钟太狠,尽量别用)**。这条技能给分流规则、零配置上手命令、批量与交叉核对纪律。Use when a task needs image understanding, OCR of screenshots or burned-in subtitles, per-frame video description, or speech-to-text.

兼容平台~Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/Elysia-laoda/dsh-skills/tree/HEAD/aliyun-vl

Installed? Explore more 图像 skills: steipete/songsee, affaan-m/frontend-design, mattpocock/improve-codebase-architecture · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Image & Audio Understanding (Local Setup)

When reading this skill, do NOT ask the user these questions — the answers are below: whether visual capability exists, which model to use, where the API key is, whether environment setup is needed, and what output format to use. Just get the job done.

1. Two Vision Paths Locally: Default vlkit, Vision Router Only as Fallback

2026-10-30 Conclusion (User Decision): For image reading/OCR, always go through vlkit on Bailian first, avoid using Vision Router. The default vision chain for Vision Router is the OVH anonymous free endpoint, with a measured heavy restriction: 2 requests/minute per IP per model, up to 45 seconds no response per model, and serial fallback across 4 backends exhausts the 120-second task budget → vision_describe returns VISION_BACKEND_UNAVAILABLE_THIS_TURN and circuit-breaks the entire turn. Do not rely on it as the primary.

Alibaba Cloud Bailian vlkit (Default)Local Vision Router (Fallback Only / Pure Local Tools)
Tool / Entrypython ~/.dsh/tools/vlkit/cli.py ... or import vlkitvision_describe, vision_ocr, vision_ground, vision_detect, and pure local pixel tools
API key needed?Yes (auto-read from CSV, do not ask user)No for vision models (but OVH anonymous rate limit applies); no for pure local tools
SpeedSingle image 0.3–0.7 s; batch concurrentVisual chain may be minutes; pure local tools instant
StrengthsBatch, force JSON, small text OCR, speech transcription, multi-model cross-validationCropping, color picking, pixel comparison, HTML screenshot rendering (these do not call models, use as normal)
WeaknessesStrong models can hallucinate (see Rule 1)Heavy rate limit (2 req/min/model), low concurrency, chain fallback may timeout

Default actions:

  • "Look at this image / What is in this image / Read this for me" → vlkit (ask or ocr).
  • For localization, color picking, cropping, pixel comparison, rendering HTML to image → use Vision Router's pure local tools (vision_crop, vision_colors, vision_pixel_diff, vision_html_screenshot), which consume no rate limit.
  • Only if vlkit is clearly unavailable (probe fails, quota exhausted, endpoint errors), then fall back to vision_describe, and do not call it repeatedly (this will drain the anonymous quota).
  • Forbidden: Using both vlkit and vision_describe for the same task in the same turn; if forced pre-recognition like vision_bootstrap is required, use vlkit to complete equivalent structured recognition — no need to burn rate limit on Vision Router first.

2. One Command to Use (Run probe First for Self-Check)

$PY = "C:\Users\<user>\.dsh\dsh-runtimes\dsh-primary-runtime\dependencies\python\python.exe"
$CLI = "C:\Users\<user>\.dsh\tools\vlkit\cli.py"
[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false)   # Prevent Chinese/emoji garbling

& $PY $CLI probe                       # Self-check: credentials + endpoint + actual vision call (generates image on the fly, reads it to pass)
& $PY $CLI ask image.png --q "What is in this image"   # Ask about image (default qwen3-vl-flash)
& $PY $CLI --model qwen3-vl-plus ask image.png --q "Read text in the image character by character"   # Switch model: `--model` is a global argument, must come before subcommand
& $PY $CLI ask "out/frames/*.jpg" --q "Who is speaking" --json   # Wildcard/directory batch + force JSON
& $PY $CLI ocr image.png                  # Read text only (auto-uses qwen3.5-ocr)
& $PY $CLI asr audio.wav --lang ja       # Speech transcription
& $PY $CLI models                      # List available models

Key points: --model / --workers / --max-side are all global arguments, placed before ask/ocr; if written after the subcommand, it will report unrecognized arguments. cli.py has forced UTF-8 output (fixed 2026-10-30), but on Windows it's still recommended to set [Console]::OutputEncoding.

probe is the only authoritative self-check for the local vision pipeline: it draws an image with a random string on the fly, sends it to the vision model, and only passes if the model reads it correctly. Run it once before the first image task in a new session; if it passes, don't doubt the environment again.

3. Zero-Configuration Checklist (Answers Pre-Written, Do Not Ask User)

  • API key: D:\BaiduNetdiskDownload\default workspace-apiKey-7666918.csv (two columns: apiKey / openAiCompatible). Also can use environment variables ALIYUN_DS_KEY + ALIYUN_DS_BASE_URL. Never print, never persist to disk.
  • Module: C:\Users\<user>\.dsh\tools\vlkit\ (pure standard library + optional Pillow; image resizing uses Pillow). There is a historical copy at D:\dshproject\shibuya-02s\src\vlkit\ (test artifact from a video note project); treat the one in tools as authoritative.
  • Cache: ~/.dsh/tools/vlkit/.cache, content-addressed by hash of image bytes + prompt + model. Changing prompt triggers full re-run; only layout changes do not.
  • Image input: The fact that local models could not "see" images is no longer a constraint — both the local Router and Bailian can truly see images. (Historical memory that "no image input → screen side can only do OCR" is an old constraint; this can now be replaced.)

4. How to Choose a Model (Tested and Working as of 2026)

Use CaseFirst ChoiceBackup
Per-frame/single-image structured descriptionqwen3-vl-flashqwen3-vl-plus (more accurate, for validation)
Small text/subtitle OCRqwen3.5-ocrqwen-vl-ocr-latest (with coordinates), qwen3-vl-plus
Strong text reasoning / sentence-level / adjudicationqwen3.7-plusdeepseek-v4-pro, qwen3-max
Speech transcriptionqwen3-asr-flash (--lang ja)qwen3.5-omni-plus
Vocal separation (local CPU)demucs htdemucs—

5. Five Hard Rules (Learned the Hard Way)

  1. Strong models hallucinate on images with no content. Asking the model to "read subtitles frame by frame" will cause it to generate dialogue on frames with no subtitles (about one third is fake). Solution: Use a pixel gate to check if a frame has text before sending to OCR. Subtitles = bright glyphs + black outline; use vlkit.bands.glyph_metric() to count such pixels in the lower half of the frame; tested median on no-text frames is 86, p90 on text frames is 2618.
  2. Disable JSON mode for pure text tasks (json_mode=False). When enabled, the model will answer "none" as {"error":"No text detected"} and wrap text as {"subtitle":"…"}, causing errors when used directly as text. vlkit's clean() will unwrap defensively.
  3. Never finalize text from a single model for character-level tasks. The same subtitle phrase can yield different characters across models (e.g., harsh/wave/very cool), one may output traditional characters. Approach: Multi-reader + normalized similarity merge + median string voting, with evidence preserved for disagreements. Prefer alternating models within vlkit (qwen3-vl-flash / qwen3-vl-plus / qwen3.5-ocr for three-way voting); Vision Router is now too rate-limited to be a cost-effective third party — only use it once if quota allows and an independent opinion is truly needed.
  4. Measure geometry in pixels, don't trust visual descriptions. vision_describe can misreport layouts (it once insisted a cropped page had "normal layout"). All positions, sizes, and boundary checks must use pixel statistics. Similarly, the DSH built-in LibreOffice kit's rendered rasterization cannot be used as a ruler (a 15 cm declared size renders at 17.67 cm, with a 1.22x scaling on reference documents) — to validate docx layouts, read document geometry (wp:extent/pgSz/pgMar) + pair images one by one.
  5. Separate vocals from audio before recognition. "Japanese dialogue + Chinese BGM" sent directly to ASR will hallucinate, e.g., mishearing "無量空処" as "有料空所" and fabricating content; after separating vocals using demucs, the term is recognized correctly. However, BGM segments still have hallucinations — use spectral comparison, never enter as ground truth. python -m demucs --two-stems=vocals -n htdemucs -o out/sep in.wav (local Python 3.14 has demucs 4.1.0 + torchaudio 2.11 installed).

6. Don't Just Write Prompts — Use Existing Pipelines (Video → Per-Image Notes)

The complete pipeline is available at D:\dshproject\shibuya-02s\src\ and is reusable; just replace --video:

run_shots.py      Scene detection (ffmpeg scene detection) + extract keyframes
run_subtitles.py  Subtitle belt: pixel gate → OCR only candidate windows (saves 60% calls, prevents hallucination)
adjudicate.py     Multi-reader merge + median string voting + independent review and correction
augment_frames.py Ensure **every subtitle has a matching frame** (mid-shot may miss, tested to miss 7)
run_analyze.py    Per-frame structured image analysis (--frame-list uses full frame table after augmentation)
run_speaker.py    Speaker filmstrip (send start/mid/end three frames together)
run_consolidate.py --stage speaker|lines  Two-stage: first determine "who said it", then write one sentence per frame
build_docx.py     Output docx (with **explicit page breaks** based on height budget, don't rely on renderer to honor keepLines)

Priority of evidence for speaker attribution (lesson from this project): Pronoun reference > visual evidence > common sense. From 36.5 to 62 seconds, the screen shows the protagonist's back. A single-frame lip-reading model attributed 7 lines to the protagonist — all wrong; the speaker was the curse on the other side. The evidence was the subtitles' pronouns like "we / you / he." The subject of the image is not necessarily the speaker.

7. Two Most Common Coding Pitfalls

  • ffmpeg 9 removed -vsync (reports Unrecognized option), use -fps_mode instead.
  • Colons in ffmpeg filter parameters are delimiters; writing a Windows absolute path like D:\... breaks the command — use relative names for metadata output files and let ffmpeg run inside a temp directory (this caused scene detection to silently return 0 cut points).

8. Minimal Example (Works Without CLI)

import sys; sys.path.insert(0, r"C:\Users\<user>\.dsh\tools")
from vlkit import VisionClient, load_credentials

cli = VisionClient(load_credentials(), model="qwen3-vl-flash",
                   cache_dir=r"C:\Users\<user>\.dsh\tools\vlkit\.cache")
print(cli.analyze_image("image.png", "Read all text in the image character by character; if none, reply with 'none'", json_mode=False).content)

# Batch concurrent + structured
print(cli.analyze_images(["a.jpg", "b.jpg"], "Answer in JSON {"subtitle":"","speaker":""}",
                         model="qwen3-vl-plus", keys=["a", "b"]))

9. Default Parameters for Turning Video into Per-Image Notes (User Decided, Use Directly, No Need to Ask)

Answers from the last similar task are recorded here — use them directly next time:

  • Frame selection: Automatically split by scene changes (not fixed intervals). Threshold 0.2 for cut points, merge intervals <0.4s as the same action flash, and for single shots >5s, evenly distribute extra frames within. Output: typically 25–45 frames.
  • One sentence per image: For shots with subtitles, write only the quote reference <speaker>: "<original subtitle>" (subtitle text unchanged); for shots without subtitles, write one descriptive sentence. Do not add timestamps (align with reference document layout).
  • Speaker identification: Who is on screen ≠ who is speaking. Evidence priority: pronoun reference > visual evidence > common sense; if insufficient evidence, write Subtitle: "…" without assigning a name.
  • No name fabrication: Character names can only be those confirmed by per-frame image analysis; set a frequency threshold (≥5 frames to confirm), use neutral terms otherwise.
  • Deliverable: docx, layout aligned with user-provided reference document (SimSun + Times New Roman; title/source line 18pt, description 16pt; image width 15cm; image paragraphs must use explicit page breaks based on height budget, not just keepLines).
  • Delivery location: Create a new project directory within the workspace, leave all source materials, scripts, intermediate artifacts, and write a HANDOFF.md.

10. Robustness (Order: vlkit → Pure Local Pixels → Vision Router)

  • Default: run vlkit first. Run probe once before the first image task in a new session; if it passes, don't doubt the environment, use it directly.
  • When vlkit errors, check the error type first then decide:
    • UnicodeEncodeError (historical bug, fixed) → set [Console]::OutputEncoding and retry;
    • Credential file not found → check if the CSV at D:\BaiduNetdiskDownload still exists;
    • 401/403 → key expired or workspace changed;
    • 429 → quota/rate limit, back off and retry, don't hammer.
  • Only if vlkit is completely unavailable, allow vision_describe fallback once; if it returns VISION_BACKEND_UNAVAILABLE_THIS_TURN / VISION_RATE_LIMITED, do not retry with different phrasing — OVH anonymous quota is 2 req/min per IP per model, retrying will only continue to fail and circuit-break the entire turn.
  • If both paths are unavailable, use pixel statistics (brightness/color/ink distribution) for programmatic judgment, and explicitly state that no visual inspection was performed in the conclusion.
  • If instructions require structured pre-recognition (like vision_bootstrap), use vlkit's ask --json to perform equivalent recognition; there's no need to burn Vision Router rate limit for this step.

11. Companion Files

  • Toolkit itself: C:\Users\<user>\.dsh\tools\vlkit\
    • README.md — Introduction: what it is, how the two paths diverge, CLI commands, model table
    • LESSONS.md — Image understanding experience: 12 pitfalls with evidence, sorted by cost (hallucination, multi-reader voting, inferring technique names is forbidden, use absolute paths…)
    • HANDOFF.md — Handoff: dependencies, validation depth, re-run commands, fragile points, remaining work
  • Full project record (with evidence chain and uncertain items): Mnomon Document 0f4d3b9a / D:\dshproject\shibuya-02s\docs\correction_record.md
  • Project handoff and re-run commands: D:\dshproject\shibuya-02s\HANDOFF.md

Individual skills in this repo

This repo contains 1 individual skill — each has its own dedicated page.

相关技能