swim-action-gif-contrast

Swim action comparison tool: Clips incorrect swim actions from video into GIFs and generates code-produced standard stroke illustration animations for side-by-side comparison; optionally uses MediaPipe to auto-detect swim errors and produce joint-highlighted GIFs. Outputs as ordinary folder format ready for dashboard viewing; part of a fitness-assist series.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "swim-action-gif-contrast" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-36ce1d9759af5042daa74668df41990b4c04e738e54d81bb4b39c9709d916cb2. Verify the upstream source and version against https://skillhub.cn/skills/user_159a690e/swim-action-gif-contrast before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Swim action comparison tool: Clips incorrect swim actions from video into GIFs and generates code-produced standard stroke illustration animations for side-by-side comparison; optionally uses MediaPipe to auto-detect swim errors and produce joint-highlighted GIFs. Outputs as ordinary folder format ready for dashboard viewing; part of a fitness-assist series.

0 Downloads

Introduction source: third_party · user_159a690e · 1.0.0 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Audience
Not specified in the source documentation.
Inputs and outputs
Not specified in the source documentation.
Software, accounts and paid services
Translation pending; see source documentation.
Limits and differences
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: swim-action-gif-contrast
slug: swim-action-gif-contrast
displayName: 游泳动作GIF对照
version: 1.3
category: ["健身运动", "视频分析"]
tags: ["游泳", "动作纠错", "GIF", "多模态", "姿态识别", "MediaPipe"]
trigger: "游泳视频 GIF、动作对照、泳姿纠错动图、生成标准动作GIF、视频做成GIF、把错误动作做成动图、自动识别泳姿错误、AI 帮我看游泳动作哪里错"
description: 把游泳视频错误动作截成 GIF,并用代码生成标准泳姿示意动画对照;可选 MediaPipe 自动识别泳姿错误并生成标红关节 GIF。输出普通文件夹即进看板,无需 Obsidian。健身辅助系列成员。

🌱 Deep Garden 游泳训练体系 · 个人 IP 内容。本技能由 Deep Garden 整理沉淀,与「游泳训练追踪」技能同属 Deep Garden 运动健康方向。同作者 SkillHub 投资研究系列:DeepGarden。转载 / 二次创作请注明出处「Deep Garden」。

游泳动作GIF对照

何时用

用户发来游泳训练视频(或指向含视频的文件夹),要求:

  • 把视频里「我的错误动作」做成动图(GIF)
  • 同时呈现「标准动作」的对应 GIF,便于对照学习
  • (可选)自动识别泳姿错误:用 MediaPipe 在本地离线分析人体 33 个关键点,给出错误清单 + 标红关节点 GIF,无需人工逐帧看
  • 把两组 GIF 用于「我的看板」或(可选)Obsidian 复盘报告

✅ 不装 Obsidian 也能完整使用本技能。 Obsidian 只是可选的复盘笔记工具,不是前置依赖。 ✅ 自动识别全程本地离线:视频与关节坐标不上传任何第三方服务器,隐私安全。

前置环境(通用,不绑定特定机器)

  • 推荐按 安装说明.md 安装基础依赖(OpenCV / imageio / imageio-ffmpeg / numpy),并可选安装 MediaPipe(自动识别用)。
  • 手动安装:
    • 基础(必装):pip install opencv-python-headless imageio imageio-ffmpeg numpy
    • 自动识别(可选):pip install mediapipe
    • 模型文件 assets/pose_landmarker_full.task 首次使用时会自动从 MediaPipe 官方地址下载到本地,无需手动放置。若你环境无法联网,可手动下载并放到 assets/。
  • 本技能自带 scripts/gen_gifs.py,可直接运行: python scripts/gen_gifs.py 你的错误视频1.mp4 [错误视频2.mp4 ...] 脚本会:① 为传入的每个视频生成 wrong_xxx.gif(错误动作截段);② 自动生成 correct_freestyle.gif / correct_breaststroke.gif(标准动作关节示意动画)。
  • 若装了 mediapipe,脚本会自动为每个视频追加:③ report_xxx.json(结构化错误清单);④ annotated_xxx.gif(标红问题关节/肢体的动画)。不装 mediapipe 则只产出 ①②,自动跳过识别。
  • 输出目录默认 ./output_gifs,可用环境变量 GIF_OUT 覆盖。
  • 若你本机已有一个隔离的 OpenCV 环境,可在运行前设置 PYTHONPATH 指向它;脚本对此做了兼容。

自动识别(MediaPipe,可选增强)

  • 原理:用 MediaPipe Tasks Vision 的 PoseLandmarker(本地 .task 模型,33 个全身关键点)逐帧识别,提取肩/肘/腕/髋/膝/踝等角度与对称性,按游泳专项规则判定错误。
  • 置信度过滤:关键点 visibility < 0.6 直接舍弃;跨多帧平滑;以完整划手周期的平均角度判定,避免单帧抖动误报。
  • 判定覆盖:
    • 自由泳:拖肘(低肘划水)/ 顺拐(同侧手脚发力)/ 抬头换气(应侧转换气)/ 转体不足
    • 蛙泳:宽膝(宽蛙腿、膝外扩过大)/ 蹬水无效(无蹬夹推进)
    • 仰泳 / 蝶泳:基础错误(如蝶泳二次腿时机、仰泳头位偏移)
  • 输出:report_xxx.json 含每个错误的 name / harm / standard / correction / encourage / confidence;annotated_xxx.gif 把问题肢体/关节标红,直观定位。
  • 泳姿判定:默认按文件名或 --stroke 参数;也可不改参数让其按文件名中的 freestyle/breaststroke/backstroke/butterfly 关键词自动选。

可靠度边界(重要 · 预期管理)

自动识别不是 100% 准确,请如实告知用户它的能力上限,避免售后落差:

  • ✅ 侧面全身清晰、水面齐平机位、光线充足:检出率与判定准确率 ≥ 90%,可作为可靠纠错参考。
  • ⚠️ 以下情况会显著误判/漏判,工具会诚实报告并建议重拍:
    • 水下/夜拍/逆光导致画面过暗 → 人体检出率骤降(实测水下视频检出率低至 0–18%,此时脚本会输出"检出率=0% 跳过分析"而非编造错误)
    • 俯拍、跟拍、局部特写(只拍上半身)→ 关键下肢/全身关键点缺失,角度无法计算
    • 多人同框、严重遮挡 → 只取单人且遮挡帧自动剔除
  • 🔒 侧面纯视角局限:左右肩/膝重合,凡涉及"左右对称"的错误(如顺拐、宽膝)置信度自动降级并提示"建议 3/4 侧前方机位复测",绝不编造高置信结论。
  • 📌 定位:自动识别是"辅助初筛 + 标红引导",最终纠错仍以真人教练或用户对照标准 GIF 自判为准。报告里永远带 reliability_note 诚实说明本次检出质量。

步骤

  1. (可选)自动识别初筛:若装了 mediapipe,直接跑 gen_gifs.py,它会产出 report_xxx.json + annotated_xxx.gif,先看这份初筛结论与标红位置。
  2. 抽帧核查(可选补充):用 cv2 把视频均匀抽 ~10 帧到 ./_frames/,逐帧看,判断泳姿与主要错误点。判定标准优先参考 ../swim-training-tracker/ima/ima-knowledge-base/ 的 08 自由泳打腿节奏(数一个完整划手周期的打腿次数匹配二次/四次/六次腿)、09 蛙泳休闲与竞速(头部抬升高度、膝盖收腿宽度、手脚节奏区分休闲/竞速)、10 AI视频抽帧比对规则(错误→影响→标准→整改练习→正向鼓励的输出结构)。
  3. 生成错误 GIF:scripts/gen_gifs.py 读原始 mp4 → 截中间段 (0.18–0.82) → 降采样 6fps → 缩放到 380 宽 → 写 GIF(loop=0)。单段控制在 ~40 帧、≤3MB。
  4. 生成标准 GIF:脚本自动用 cv2 逐帧画关节 stick-figure 动画(浅灰空气区 + 浅蓝水区,水面线 y=150):
    • 自由泳:侧转换气(下巴贴肩、头不抬)、高肘(肘始终高于手连线)、小幅打腿;阶段标注 ENTRY/CATCH/PULL/RECOVERY/BREATH
    • 蛙泳:收腿膝外展 → 翻 → 蹬夹 → 并拢滑行 (GLIDE);抬头只在蹬夹瞬间短促;阶段 OUT-SWEEP/CATCH/RECOVER/EXTEND/KICK
    • ⚠️ cv2.putText 不支持中文,GIF 内只用英文阶段标签,中文解释放看板/报告里
  5. 落盘到输出文件夹:GIF 默认写在 ./output_gifs/(或 GIF_OUT 指定的目录)。
  6. 消费方式(二选一,都不强制 Obsidian):
    • 方式 A · 进看板(推荐,零 Obsidian):把 wrong_*.gif 与 correct_*.gif(以及可选 annotated_*.gif)复制到 swim-training-tracker 看板的 assets/ 目录,并在 swim-data.json 的 strokeGifLog 里登记,看板「动作对照」面板自动并排展示「我的 vs 标准」。
    • 方式 B · 进 Obsidian 复盘(可选):若你用 Obsidian,把 GIF cp 到你的 vault 子目录(如 <你的vault>/动作对照/),在报告加「★ 动作对照」章节,表格并排 ![[动作对照/wrong_xxx.gif]] 与 ![[动作对照/correct_xxx.gif]],配中文「看哪里」说明,并注明标准 GIF 为示意动画非真实录像。

Obsidian vault 注意(仅方式 B 需要)

  • 报告必须落在「已注册的 vault」子目录,否则 Obsidian 看不到。注册新 vault:编辑 Obsidian 配置(vaults 字段)并建 .obsidian/workspace.json,再重启 Obsidian。
  • 不同用户 vault 路径不同,脚本不硬编码,请自行 cp 到你的 vault。
  • 不装 Obsidian 的用户直接走方式 A 即可。

参考脚本

  • scripts/gen_gifs.py —— GIF 生成主入口(含 wrong/correct × freestyle/breaststroke,已中性化、不依赖特定机器路径;自动检测 mediapipe 是否安装)
  • scripts/pose_analyze.py —— MediaPipe 姿态识别与游泳专项判定模块(含 ERROR_LIB 错误库,镜像 IMA 知识库 11–14 的内容;PoseAnalyzer.analyze() 返回 report dict;make_annotated_gif() 生成标红动画)
  • assets/pose_landmarker_full.task —— MediaPipe 本地模型(首次使用自动下载,也可手动放置)

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value88/100

Highlights

  • 解决游泳动作纠错这一明确健身需求,提供视频转 GIF 与标准动作对照功能
  • 支持 MediaPipe 自动识别泳姿错误并生成标红关节动画,提升纠错效率
  • 输出兼容普通文件夹与 Obsidian,灵活适配不同用户工作流
Trigger Precision92/100

Highlights

  • 触发词覆盖‘游泳视频 GIF’‘动作对照’‘泳姿纠错’等多种用户表达,边界清晰
  • 无明显歧义或与其他 Skill 重叠风险
Structure and Standards95/100

Areas to improve

  • description 内容重复 Reported severity: Minor

    顶层 frontmatter 与 skill_body 内部均含 description 字段,内容一致但冗余

    Recommendation: 建议仅保留一处 description,避免维护不一致风险

Highlights

  • 文档结构清晰,含‘何时用’‘前置环境’‘步骤’等完整 Phase
  • 提供端到端脚本调用示例,frontmatter 信息完整
Execution Reliability90/100

Highlights

  • 依赖明确(OpenCV/imageio/mediapipe),安装说明清晰
  • 自动识别模块具备置信度过滤与异常处理(如检出率低时跳过分析)
  • MediaPipe 模型支持自动下载,降低用户使用门槛
Evidence Verifiability (mean of the first four)91/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Install or fetch external dependencies

    Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.

    Mentioned in main document · lines 29, 30

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Translation pending; see source documentation.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.