{"id":"1961361f-ccb2-4dca-9d5f-949022c57f5d","entityType":"agent","slug":"clawhub-smyx-sunjinhui-smyx-child-drowsiness-fatigue-detection-","name":"Child Drowsiness / Fatigue Detection | 儿童打瞌睡/疲劳检测","canonicalUrl":"https://www.xpersona.co/agent/clawhub-smyx-sunjinhui-smyx-child-drowsiness-fatigue-detection-","canonicalPath":"/agent/clawhub-smyx-sunjinhui-smyx-child-drowsiness-fatigue-detection-","generatedAt":"2026-10-10T09:09:50.183Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T03:53:15.048Z","emptyReason":null},"description":"Using a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。","descriptionLabel":"Source description","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 1.7K downloads reported by the source. Last updated 10/10/2026.","installCommand":"clawhub skill install s17cfv2h26b7hq5w47tgfy23xx83z9x6:smyx-child-drowsiness-fatigue-detection-analysis","sourceUrl":"https://clawhub.ai/smyx-sunjinhui/smyx-child-drowsiness-fatigue-detection-analysis","homepage":"https://clawhub.ai/smyx-sunjinhui/skills/smyx-child-drowsiness-fatigue-detection-analysis","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/smyx-sunjinhui/smyx-child-drowsiness-fatigue-detection-analysis","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/smyx-sunjinhui/skills/smyx-child-drowsiness-fatigue-detection-analysis","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":65,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Child Drowsiness / Fatigue Detection | 儿童打瞌睡/疲劳检测 technical dossier on Xpersona with agent coverage, OPENCLEW support, and live trust metadata."},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-10T03:53:15.048Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T03:53:15.048Z","emptyReason":null},"stars":null,"forks":null,"downloads":1712,"packageName":null,"latestVersion":"1.0.11","tractionLabel":"1.7K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T03:53:14.954Z","emptyReason":null},"lastUpdatedAt":"2026-10-10T03:53:15.048Z","lastCrawledAt":"2026-10-10T03:53:14.954Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-11T03:53:14.954Z","lastVerifiedAt":null,"highlights":[{"version":"1.0.11","createdAt":"2026-10-02T10:55:28.320Z","changelog":"- Updated version number in SKILL.md from 1.0.15 to 1.0.16. - Removed the file skill-card.md. - No functional changes to skill logic or capabilities. Documentation and resource structure remain consistent.","fileCount":31,"zipByteSize":40382},{"version":"1.0.10","createdAt":"2026-09-24T12:24:27.115Z","changelog":"- Updated skill version to 1.0.15. - SKILL.md revised to reflect latest version and potential content tweaks. - Internal references to versioning and documentation improved for clarity. - Removed obsolete skill-card.md file.","fileCount":31,"zipByteSize":40473},{"version":"1.0.9","createdAt":"2026-09-09T06:03:29.585Z","changelog":"- Version updated from 1.0.11 to 1.0.14 in SKILL.md - Documentation (SKILL.md) revised and updated - Outdated file skill-card.md removed","fileCount":31,"zipByteSize":40511},{"version":"1.0.8","createdAt":"2026-08-28T23:03:30.061Z","changelog":"- Removed the file: skill-card.md. - No functional or behavioral changes to the skill itself.","fileCount":31,"zipByteSize":40493},{"version":"1.0.7","createdAt":"2026-08-19T01:40:48.836Z","changelog":"- Updated skill version to 1.0.11. - SKILL.md: Version and metadata bumped; main documentation content remains unchanged. - Minor configuration updates in skills/smyx_common/scripts/config.yaml. - Removed redundant documentation file (skill-card.md).","fileCount":31,"zipByteSize":40555},{"version":"1.0.6","createdAt":"2026-08-10T05:58:32.257Z","changelog":"- Updated version to 1.0.9 in SKILL.md. - Removed the skill-card.md file. - No functional or feature changes; documentation and file organization only.","fileCount":31,"zipByteSize":40510},{"version":"1.0.5","createdAt":"2026-08-07T11:02:40.036Z","changelog":"- Removed the file: skill-card.md - No changes to features or functionality in this version.","fileCount":31,"zipByteSize":40425},{"version":"1.0.4","createdAt":"2026-08-01T19:19:36.867Z","changelog":"- Updated documentation version to 1.0.8 in SKILL.md. - Refined and updated the SKILL.md content. - Removed the file skill-card.md.","fileCount":31,"zipByteSize":40437}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s17cfv2h26b7hq5w47tgfy23xx83z9x6:smyx-child-drowsiness-fatigue-detection-analysis","setupComplexity":"low","setupSteps":["Install using `clawhub skill install s17cfv2h26b7hq5w47tgfy23xx83z9x6:smyx-child-drowsiness-fatigue-detection-analysis` in an isolated environment before connecting it to live workloads.","No published capability contract is available yet, so validate auth and request/response behavior manually.","Review the upstream CLAWHUB listing at https://clawhub.ai/smyx-sunjinhui/smyx-child-drowsiness-fatigue-detection-analysis before using production credentials."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-child-drowsiness-fatigue-detection-/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-child-drowsiness-fatigue-detection-/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-child-drowsiness-fatigue-detection-/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-child-drowsiness-fatigue-detection-/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-child-drowsiness-fatigue-detection-/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-child-drowsiness-fatigue-detection-/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-10T09:09:50.180Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-child-drowsiness-fatigue-detection-/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-child-drowsiness-fatigue-detection-/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-child-drowsiness-fatigue-detection-/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-child-drowsiness-fatigue-detection-/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T03:53:15.048Z","emptyReason":null},"readme":"Skill: Child Drowsiness / Fatigue Detection | 儿童打瞌睡/疲劳检测\n\nOwner: smyx-sunjinhui\n\nSummary: Using a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。\n\nTags: latest:1.0.11\n\nVersion history:\n\nv1.0.11 | 2026-10-02T10:55:28.320Z | auto\n\n- Updated version number in SKILL.md from 1.0.15 to 1.0.16.\n- Removed the file skill-card.md.\n- No functional changes to skill logic or capabilities. Documentation and resource structure remain consistent.\n\nv1.0.10 | 2026-09-24T12:24:27.115Z | auto\n\n- Updated skill version to 1.0.15.\n- SKILL.md revised to reflect latest version and potential content tweaks.\n- Internal references to versioning and documentation improved for clarity.\n- Removed obsolete skill-card.md file.\n\nv1.0.9 | 2026-09-09T06:03:29.585Z | auto\n\n- Version updated from 1.0.11 to 1.0.14 in SKILL.md\n- Documentation (SKILL.md) revised and updated\n- Outdated file skill-card.md removed\n\nv1.0.8 | 2026-08-28T23:03:30.061Z | auto\n\n- Removed the file: skill-card.md.\n- No functional or behavioral changes to the skill itself.\n\nv1.0.7 | 2026-08-19T01:40:48.836Z | auto\n\n- Updated skill version to 1.0.11.\n- SKILL.md: Version and metadata bumped; main documentation content remains unchanged.\n- Minor configuration updates in skills/smyx_common/scripts/config.yaml.\n- Removed redundant documentation file (skill-card.md).\n\nv1.0.6 | 2026-08-10T05:58:32.257Z | auto\n\n- Updated version to 1.0.9 in SKILL.md.\n- Removed the skill-card.md file.\n- No functional or feature changes; documentation and file organization only.\n\nv1.0.5 | 2026-08-07T11:02:40.036Z | auto\n\n- Removed the file: skill-card.md\n- No changes to features or functionality in this version.\n\nv1.0.4 | 2026-08-01T19:19:36.867Z | auto\n\n- Updated documentation version to 1.0.8 in SKILL.md.\n- Refined and updated the SKILL.md content.\n- Removed the file skill-card.md.\n\nv1.0.3 | 2026-07-16T13:59:30.326Z | auto\n\n- Updated version to 1.0.6 in SKILL.md.\n- Refreshed documentation in SKILL.md for clarity and version consistency.\n- Removed the redundant or outdated file: skill-card.md.\n\nv1.0.2 | 2026-07-08T08:59:27.089Z | auto\n\nNo changes detected in this version.\n\n- No file changes or content updates were made from the previous version.\n\nv1.0.1 | 2026-07-05T05:47:28.434Z | auto\n\n**Changelog for version 1.0.1:**\n\n- Overhauled SKILL.md for improved clarity, modularity, and bilingual (EN/中文) documentation.\n- Greatly simplified user interaction: user identity is now handled automatically by the system; users are never asked for open-id or personal details.\n- Strengthened security and privacy: strict no-leak policy for user/internal identity, with all identity management performed in background.\n- Reworked historical report retrieval mechanism: historical queries now always pull results live from the cloud API, disallowing local or memory-based report aggregation.\n- Aligned all command usage and documentation to new unified internal-identity handling; usage examples updated.\n- Minor file organization changes: some scripts restructured or removed (e.g. deletion of scripts/api_service.py).\n\nv1.0.0 | 2026-05-25T14:17:28.582Z | auto\n\n- Initial release of child drowsiness and fatigue detection skill (version 1.0.0)\n- Real-time analysis of children’s facial features from camera video to detect drowsiness (PERCLOS, head nods, eye glossiness)\n- Computes a comprehensive fatigue index (0-100) and classifies fatigue levels\n- Supports automatic reminders or voice prompts when fatigue exceeds threshold\n- Strict open-id acquisition and privacy safeguards enforced before analysis or report queries\n- Can display historical fatigue reports as Markdown tables with direct report links\n\nArchive index:\n\nArchive v1.0.11: 31 files, 40382 bytes\n\nFiles: references/api_doc.md (2460b), scripts/__init__.py (62b), scripts/config.py (691b), scripts/config.yaml (3b), scripts/skill.py (577b), scripts/smyx_child_drowsiness_fatigue_detection_analysis.py (3625b), skill-card.md (2290b), SKILL.md (11741b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (473b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (168b)\n\nFile v1.0.11:SKILL.md\n\n---\nname: \"smyx-child-drowsiness-fatigue-detection-analysis\"\ndescription: \"Using a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。\"\nversion: \"1.0.16\"\nlicense: \"MIT-0\"\n---\n\n# 😴 Child Drowsiness / Fatigue Detection | 儿童打瞌睡/疲劳检测\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **儿童打瞌睡/疲劳检测** |\n| 🎯 核心目标 | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_CHILD_DROWSINESS_FATIGUE_DETECTION_ANALYSIS` |\n\nUsing a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). The skill helps teachers or parents detect drowsiness in time and adjust learning schedules or remind the child to rest. Application scenarios: classrooms, home desks, online classes. The system monitors in real time and, when the fatigue index exceeds a threshold, pushes reminders or triggers voice prompts (e.g., 'kid, time to take a break'). Skill features: safeguarding sleep health.\n\n通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。应用场景：教室、家庭书桌、在线课堂。系统实时监测，当疲劳指数超过阈值时，推送提醒或触发语音提示（如'小朋友，休息一下吧'）。技能特点：保障睡眠健康。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的儿童学习疲劳监测 AI。你的任务是分析儿童面部视频，检测眼部闭合状态和头部点头动作，计算疲劳指数。不要提供医疗诊断或睡眠障碍诊断，仅输出基于视觉的疲劳评估结果与方向性休息提醒。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于教室/家庭书桌摄像头视频，量化儿童眼部闭合（PERCLOS）+ 点头动作 + 眼部光泽度变化，输出 0-100 疲劳指数与等级判定\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 儿童面部检测 |\n| 2 | 眼部状态识别（闭合 / 半闭 / 睁开） |\n| 3 | PERCLOS 计算 |\n| 4 | 连续闭眼时长 |\n| 5 | 眨眼频次 |\n| 6 | 点头次数与角度 |\n| 7 | 眼部光泽度变化 |\n| 8 | 疲劳综合得分（0-100） |\n| 9 | 疲劳等级（alert / mild_fatigue / moderate_fatigue / drowsy） |\n| 10 | 打瞌睡事件列表 |\n| 11 | 语音提醒文本生成 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供儿童面部学习区域视频 URL 或文件需要分析时，默认触发本技能进行打瞌睡/疲劳检测 |\n| 🔎 明确分析意图 | 当用户明确提及打瞌睡、疲劳、困倦、PERCLOS、点头、眨眼、上课走神、写作业犯困、智能台灯疲劳提醒等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看儿童疲劳历史报告、打瞌睡报告清单、疲劳指数报告清单、查询历史疲劳记录、显示所有儿童疲劳检测报告、显示儿童睡眠健康诊断报告，查询疲劳提醒清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备儿童面部学习区域视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 系统自动完成身份关联 | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行儿童打瞌睡/疲劳检测 | 调用 `-m scripts.smyx_child_drowsiness_fatigue_detection_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地儿童面部学习区域视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络儿童面部学习区域视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，儿童学习疲劳监测场景默认 `other` | 按需填写 |\n| `--list` | 显示儿童打瞌睡/疲劳历史检测报告列表清单（可以输入起始日期参数过滤数据范围） | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_child_drowsiness_fatigue_detection_analysis.py`](scripts/smyx_child_drowsiness_fatigue_detection_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov 视频，最大 10MB；建议正对面部、≥ 15 FPS |\n| 🧑‍⚖️ 结果性质 | 检测结果仅作为学习/课堂辅助参考，本工具不替代家长/教师的实际观察与教育判断，疑似长期严重困倦请就医 |\n| 🔏 隐私合规 | 隐私合规：儿童学习场景视频涉及未成年人隐私，使用前需取得监护人知情同意，并妥善保管/加密相关录像 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input /path/to/class.mp4\n\n# 分析网络儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --url https://example.com/class.mp4\n\n# 显示历史儿童疲劳检测报告（自动触发关键词：查看儿童疲劳历史报告、打瞌睡报告清单等）\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --output result.json\n```\n\nFile v1.0.11:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-child-drowsiness-fatigue-detection-analysis\",\n  \"version\": \"1.0.11\",\n  \"publishedAt\": 1790938528320\n}\n\nFile v1.0.11:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放儿童打瞌睡/疲劳检测 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动儿童疲劳检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取分析结果（疲劳指数 + 提醒）\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史疲劳检测记录\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出完整报告\n\n## 场景代码\n\n- `SMYX_CHILD_DROWSINESS_FATIGUE_DETECTION_ANALYSIS` - 儿童打瞌睡/疲劳检测\n\n## 输入约束\n\n- 摄像头建议正对儿童面部（教室或书桌正前方/智能台灯内置）\n- 视频帧率建议 ≥ 15 FPS，确保眼部状态采样精度\n- 光照均匀，避免逆光或镜片反光遮挡眼部\n\n## 关键观测指标\n\n- `perclos` - 单位时间内眼睛闭合超过 80% 的时间占比（0-1）\n- `eye_closure_duration_sec` - 最长一次连续闭眼秒数\n- `blink_rate_per_min` - 眨眼频次（次/分钟）\n- `nod_frequency_per_min` - 点头次数（次/分钟，快速下点后抬起）\n- `head_drop_angle_deg` - 单次最大头部下垂角度（°）\n- `eye_region_glossiness_drop` - 眼部光泽度变化（参考特征）\n\n## 疲劳指数（0-100，综合得分）\n\n- 0-30 - 清醒（alert）\n- 30-50 - 轻度疲劳（mild_fatigue）\n- 50-70 - 中度疲劳（moderate_fatigue）\n- 70-100 - 重度疲劳/疑似打瞌睡（drowsy）\n\n## 默认告警阈值（可由调用方覆盖）\n\n- PERCLOS 阈值：> 0.4 触发疲劳预警\n- 连续闭眼阈值：> 2 秒（疑似瞌睡）\n- 疲劳指数阈值：> 70 → 触发语音提醒\n\n## 输出字段（参考）\n\n- `child_detected` - 是否检测到儿童\n- `fatigue_metrics` - 各项疲劳指标数值（perclos / eye_closure_duration_sec / blink_rate_per_min / nod_frequency_per_min / head_drop_angle_deg）\n- `fatigue_score` - 综合疲劳指数（0-100）\n- `fatigue_level` - 疲劳等级（alert / mild_fatigue / moderate_fatigue / drowsy）\n- `drowsiness_events` - 打瞌睡事件列表（时间戳 + 持续秒数 + 类型）\n- `voice_prompt` - 语音提醒文本（如\"小朋友，休息一下吧\"）\n- `summary` - 当次会话疲劳统计摘要\n\n> 仅输出基于视觉的疲劳评估结果与方向性休息提醒，不提供医学诊断或睡眠障碍诊断。\n\nFile v1.0.11:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.11:scripts/config.yaml\n\n{}\n\nFile v1.0.11:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.11:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.11:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.11:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: prod\n\nFile v1.0.11:skill-card.md\n\n## Description:\n\nAnalyzes children's classroom or desk videos for visual signs of drowsiness and returns a fatigue score and report.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nTeachers and parents use the skill to review children's learning-session videos, check fatigue indicators and report history, and decide when a break or closer observation is needed. It is not a medical diagnostic tool.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Children's videos or video URLs are sent to cloud services.\n\nMitigation: Obtain guardian or school consent and verify the service's retention and deletion practices before use.\n\nRisk: The skill may silently create or reuse an identity and store service tokens locally.\n\nMitigation: Review local data storage, protect workspace access, and clear stored credentials when no longer needed.\n\nRisk: Automatic access to prior reports may expose children's sensitive history.\n\nMitigation: Limit report access to authorized users and review report-sharing behavior before installation.\n\nRisk: Visual fatigue estimates may be mistaken for medical diagnoses.\n\nMitigation: Use reports only as observational aids; rely on adult judgment and seek professional care for persistent concerns.\n\n## Reference(s):\n\n- [Skill release on ClawHub](https://clawhub.ai/smyx-sunjinhui/skills/smyx-child-drowsiness-fatigue-detection-analysis)\n- [API documentation](artifact/references/api_doc.md)\n- [Skill demonstration](https://lifeemergence.com/sample.html)\n\n## Skill Output:\n\n**Output Type(s):** [Text, Markdown, JSON]\n\n**Output Format:** [Structured report or Markdown summary with fatigue indicators, score, level, and report links]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Can list previous reports or save a report to a file.]\n\n## Skill Version(s):\n\n1.0.11 (source: server-resolved ClawHub release)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.11:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.11:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.10: 31 files, 40473 bytes\n\nFiles: references/api_doc.md (2460b), scripts/__init__.py (62b), scripts/config.py (691b), scripts/config.yaml (3b), scripts/skill.py (577b), scripts/smyx_child_drowsiness_fatigue_detection_analysis.py (3625b), skill-card.md (2569b), SKILL.md (11741b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (473b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (168b)\n\nFile v1.0.10:SKILL.md\n\n---\nname: \"smyx-child-drowsiness-fatigue-detection-analysis\"\ndescription: \"Using a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。\"\nversion: \"1.0.15\"\nlicense: \"MIT-0\"\n---\n\n# 😴 Child Drowsiness / Fatigue Detection | 儿童打瞌睡/疲劳检测\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **儿童打瞌睡/疲劳检测** |\n| 🎯 核心目标 | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_CHILD_DROWSINESS_FATIGUE_DETECTION_ANALYSIS` |\n\nUsing a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). The skill helps teachers or parents detect drowsiness in time and adjust learning schedules or remind the child to rest. Application scenarios: classrooms, home desks, online classes. The system monitors in real time and, when the fatigue index exceeds a threshold, pushes reminders or triggers voice prompts (e.g., 'kid, time to take a break'). Skill features: safeguarding sleep health.\n\n通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。应用场景：教室、家庭书桌、在线课堂。系统实时监测，当疲劳指数超过阈值时，推送提醒或触发语音提示（如'小朋友，休息一下吧'）。技能特点：保障睡眠健康。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的儿童学习疲劳监测 AI。你的任务是分析儿童面部视频，检测眼部闭合状态和头部点头动作，计算疲劳指数。不要提供医疗诊断或睡眠障碍诊断，仅输出基于视觉的疲劳评估结果与方向性休息提醒。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于教室/家庭书桌摄像头视频，量化儿童眼部闭合（PERCLOS）+ 点头动作 + 眼部光泽度变化，输出 0-100 疲劳指数与等级判定\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 儿童面部检测 |\n| 2 | 眼部状态识别（闭合 / 半闭 / 睁开） |\n| 3 | PERCLOS 计算 |\n| 4 | 连续闭眼时长 |\n| 5 | 眨眼频次 |\n| 6 | 点头次数与角度 |\n| 7 | 眼部光泽度变化 |\n| 8 | 疲劳综合得分（0-100） |\n| 9 | 疲劳等级（alert / mild_fatigue / moderate_fatigue / drowsy） |\n| 10 | 打瞌睡事件列表 |\n| 11 | 语音提醒文本生成 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供儿童面部学习区域视频 URL 或文件需要分析时，默认触发本技能进行打瞌睡/疲劳检测 |\n| 🔎 明确分析意图 | 当用户明确提及打瞌睡、疲劳、困倦、PERCLOS、点头、眨眼、上课走神、写作业犯困、智能台灯疲劳提醒等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看儿童疲劳历史报告、打瞌睡报告清单、疲劳指数报告清单、查询历史疲劳记录、显示所有儿童疲劳检测报告、显示儿童睡眠健康诊断报告，查询疲劳提醒清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备儿童面部学习区域视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 系统自动完成身份关联 | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行儿童打瞌睡/疲劳检测 | 调用 `-m scripts.smyx_child_drowsiness_fatigue_detection_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地儿童面部学习区域视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络儿童面部学习区域视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，儿童学习疲劳监测场景默认 `other` | 按需填写 |\n| `--list` | 显示儿童打瞌睡/疲劳历史检测报告列表清单（可以输入起始日期参数过滤数据范围） | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_child_drowsiness_fatigue_detection_analysis.py`](scripts/smyx_child_drowsiness_fatigue_detection_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov 视频，最大 10MB；建议正对面部、≥ 15 FPS |\n| 🧑‍⚖️ 结果性质 | 检测结果仅作为学习/课堂辅助参考，本工具不替代家长/教师的实际观察与教育判断，疑似长期严重困倦请就医 |\n| 🔏 隐私合规 | 隐私合规：儿童学习场景视频涉及未成年人隐私，使用前需取得监护人知情同意，并妥善保管/加密相关录像 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input /path/to/class.mp4\n\n# 分析网络儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --url https://example.com/class.mp4\n\n# 显示历史儿童疲劳检测报告（自动触发关键词：查看儿童疲劳历史报告、打瞌睡报告清单等）\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --output result.json\n```\n\nFile v1.0.10:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-child-drowsiness-fatigue-detection-analysis\",\n  \"version\": \"1.0.10\",\n  \"publishedAt\": 1790252667115\n}\n\nFile v1.0.10:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放儿童打瞌睡/疲劳检测 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动儿童疲劳检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取分析结果（疲劳指数 + 提醒）\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史疲劳检测记录\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出完整报告\n\n## 场景代码\n\n- `SMYX_CHILD_DROWSINESS_FATIGUE_DETECTION_ANALYSIS` - 儿童打瞌睡/疲劳检测\n\n## 输入约束\n\n- 摄像头建议正对儿童面部（教室或书桌正前方/智能台灯内置）\n- 视频帧率建议 ≥ 15 FPS，确保眼部状态采样精度\n- 光照均匀，避免逆光或镜片反光遮挡眼部\n\n## 关键观测指标\n\n- `perclos` - 单位时间内眼睛闭合超过 80% 的时间占比（0-1）\n- `eye_closure_duration_sec` - 最长一次连续闭眼秒数\n- `blink_rate_per_min` - 眨眼频次（次/分钟）\n- `nod_frequency_per_min` - 点头次数（次/分钟，快速下点后抬起）\n- `head_drop_angle_deg` - 单次最大头部下垂角度（°）\n- `eye_region_glossiness_drop` - 眼部光泽度变化（参考特征）\n\n## 疲劳指数（0-100，综合得分）\n\n- 0-30 - 清醒（alert）\n- 30-50 - 轻度疲劳（mild_fatigue）\n- 50-70 - 中度疲劳（moderate_fatigue）\n- 70-100 - 重度疲劳/疑似打瞌睡（drowsy）\n\n## 默认告警阈值（可由调用方覆盖）\n\n- PERCLOS 阈值：> 0.4 触发疲劳预警\n- 连续闭眼阈值：> 2 秒（疑似瞌睡）\n- 疲劳指数阈值：> 70 → 触发语音提醒\n\n## 输出字段（参考）\n\n- `child_detected` - 是否检测到儿童\n- `fatigue_metrics` - 各项疲劳指标数值（perclos / eye_closure_duration_sec / blink_rate_per_min / nod_frequency_per_min / head_drop_angle_deg）\n- `fatigue_score` - 综合疲劳指数（0-100）\n- `fatigue_level` - 疲劳等级（alert / mild_fatigue / moderate_fatigue / drowsy）\n- `drowsiness_events` - 打瞌睡事件列表（时间戳 + 持续秒数 + 类型）\n- `voice_prompt` - 语音提醒文本（如\"小朋友，休息一下吧\"）\n- `summary` - 当次会话疲劳统计摘要\n\n> 仅输出基于视觉的疲劳评估结果与方向性休息提醒，不提供医学诊断或睡眠障碍诊断。\n\nFile v1.0.10:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.10:scripts/config.yaml\n\n{}\n\nFile v1.0.10:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.10:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.10:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.10:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: prod\n\nFile v1.0.10:skill-card.md\n\n## Description:\n\nAnalyzes child face videos from classroom or home desk settings to estimate visual drowsiness indicators such as PERCLOS, nodding frequency, eye-region changes, and a 0-100 fatigue score.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nTeachers, parents, and developers use this skill to submit child study-area videos or video URLs for drowsiness and fatigue analysis, receive structured fatigue indicators, and query cloud-hosted historical reports.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Child face videos or video URLs are sent to the configured Life Emergence cloud service.\n\nMitigation: Use the skill only with guardian or school authorization, avoid highly sensitive footage, and confirm that the configured cloud service is acceptable for the deployment.\n\nRisk: Analysis history is associated with an automatically managed local or cloud identity.\n\nMitigation: Review identity and history-report behavior before enabling the skill, and prefer explicit confirmation before running history-report queries.\n\nRisk: Workspace data or tokens may be stored locally while the skill accesses cloud APIs.\n\nMitigation: Review workspace data and token storage, restrict workspace access, and rotate or remove tokens when the skill is no longer needed.\n\n## Reference(s):\n\n- [Child Drowsiness / Fatigue Detection API Documentation](references/api_doc.md)\n- [SMYX Analysis API Documentation](skills/smyx_analysis/references/api_doc.md)\n- [Skill demo](https://lifeemergence.com/sample.html)\n- [ClawHub skill page](https://clawhub.ai/smyx-sunjinhui/skills/smyx-child-drowsiness-fatigue-detection-analysis)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, json, shell commands, files]\n\n**Output Format:** [Markdown or JSON structured analysis report, with optional saved text output file.]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May include fatigue metrics, drowsiness events, voice-prompt text, report links, and history-report tables returned from the configured cloud service.]\n\n## Skill Version(s):\n\n1.0.10 (source: server release metadata; artifact frontmatter reports 1.0.15)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.10:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.10:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.9: 31 files, 40511 bytes\n\nFiles: references/api_doc.md (2460b), scripts/__init__.py (62b), scripts/config.py (691b), scripts/config.yaml (3b), scripts/skill.py (577b), scripts/smyx_child_drowsiness_fatigue_detection_analysis.py (3625b), skill-card.md (2558b), SKILL.md (11741b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (472b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (167b)\n\nFile v1.0.9:SKILL.md\n\n---\nname: \"smyx-child-drowsiness-fatigue-detection-analysis\"\ndescription: \"Using a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。\"\nversion: \"1.0.14\"\nlicense: \"MIT-0\"\n---\n\n# 😴 Child Drowsiness / Fatigue Detection | 儿童打瞌睡/疲劳检测\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **儿童打瞌睡/疲劳检测** |\n| 🎯 核心目标 | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_CHILD_DROWSINESS_FATIGUE_DETECTION_ANALYSIS` |\n\nUsing a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). The skill helps teachers or parents detect drowsiness in time and adjust learning schedules or remind the child to rest. Application scenarios: classrooms, home desks, online classes. The system monitors in real time and, when the fatigue index exceeds a threshold, pushes reminders or triggers voice prompts (e.g., 'kid, time to take a break'). Skill features: safeguarding sleep health.\n\n通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。应用场景：教室、家庭书桌、在线课堂。系统实时监测，当疲劳指数超过阈值时，推送提醒或触发语音提示（如'小朋友，休息一下吧'）。技能特点：保障睡眠健康。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的儿童学习疲劳监测 AI。你的任务是分析儿童面部视频，检测眼部闭合状态和头部点头动作，计算疲劳指数。不要提供医疗诊断或睡眠障碍诊断，仅输出基于视觉的疲劳评估结果与方向性休息提醒。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于教室/家庭书桌摄像头视频，量化儿童眼部闭合（PERCLOS）+ 点头动作 + 眼部光泽度变化，输出 0-100 疲劳指数与等级判定\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 儿童面部检测 |\n| 2 | 眼部状态识别（闭合 / 半闭 / 睁开） |\n| 3 | PERCLOS 计算 |\n| 4 | 连续闭眼时长 |\n| 5 | 眨眼频次 |\n| 6 | 点头次数与角度 |\n| 7 | 眼部光泽度变化 |\n| 8 | 疲劳综合得分（0-100） |\n| 9 | 疲劳等级（alert / mild_fatigue / moderate_fatigue / drowsy） |\n| 10 | 打瞌睡事件列表 |\n| 11 | 语音提醒文本生成 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供儿童面部学习区域视频 URL 或文件需要分析时，默认触发本技能进行打瞌睡/疲劳检测 |\n| 🔎 明确分析意图 | 当用户明确提及打瞌睡、疲劳、困倦、PERCLOS、点头、眨眼、上课走神、写作业犯困、智能台灯疲劳提醒等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看儿童疲劳历史报告、打瞌睡报告清单、疲劳指数报告清单、查询历史疲劳记录、显示所有儿童疲劳检测报告、显示儿童睡眠健康诊断报告，查询疲劳提醒清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备儿童面部学习区域视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 系统自动完成身份关联 | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行儿童打瞌睡/疲劳检测 | 调用 `-m scripts.smyx_child_drowsiness_fatigue_detection_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地儿童面部学习区域视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络儿童面部学习区域视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，儿童学习疲劳监测场景默认 `other` | 按需填写 |\n| `--list` | 显示儿童打瞌睡/疲劳历史检测报告列表清单（可以输入起始日期参数过滤数据范围） | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_child_drowsiness_fatigue_detection_analysis.py`](scripts/smyx_child_drowsiness_fatigue_detection_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov 视频，最大 10MB；建议正对面部、≥ 15 FPS |\n| 🧑‍⚖️ 结果性质 | 检测结果仅作为学习/课堂辅助参考，本工具不替代家长/教师的实际观察与教育判断，疑似长期严重困倦请就医 |\n| 🔏 隐私合规 | 隐私合规：儿童学习场景视频涉及未成年人隐私，使用前需取得监护人知情同意，并妥善保管/加密相关录像 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input /path/to/class.mp4\n\n# 分析网络儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --url https://example.com/class.mp4\n\n# 显示历史儿童疲劳检测报告（自动触发关键词：查看儿童疲劳历史报告、打瞌睡报告清单等）\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --output result.json\n```\n\nFile v1.0.9:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-child-drowsiness-fatigue-detection-analysis\",\n  \"version\": \"1.0.9\",\n  \"publishedAt\": 1788933809585\n}\n\nFile v1.0.9:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放儿童打瞌睡/疲劳检测 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动儿童疲劳检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取分析结果（疲劳指数 + 提醒）\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史疲劳检测记录\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出完整报告\n\n## 场景代码\n\n- `SMYX_CHILD_DROWSINESS_FATIGUE_DETECTION_ANALYSIS` - 儿童打瞌睡/疲劳检测\n\n## 输入约束\n\n- 摄像头建议正对儿童面部（教室或书桌正前方/智能台灯内置）\n- 视频帧率建议 ≥ 15 FPS，确保眼部状态采样精度\n- 光照均匀，避免逆光或镜片反光遮挡眼部\n\n## 关键观测指标\n\n- `perclos` - 单位时间内眼睛闭合超过 80% 的时间占比（0-1）\n- `eye_closure_duration_sec` - 最长一次连续闭眼秒数\n- `blink_rate_per_min` - 眨眼频次（次/分钟）\n- `nod_frequency_per_min` - 点头次数（次/分钟，快速下点后抬起）\n- `head_drop_angle_deg` - 单次最大头部下垂角度（°）\n- `eye_region_glossiness_drop` - 眼部光泽度变化（参考特征）\n\n## 疲劳指数（0-100，综合得分）\n\n- 0-30 - 清醒（alert）\n- 30-50 - 轻度疲劳（mild_fatigue）\n- 50-70 - 中度疲劳（moderate_fatigue）\n- 70-100 - 重度疲劳/疑似打瞌睡（drowsy）\n\n## 默认告警阈值（可由调用方覆盖）\n\n- PERCLOS 阈值：> 0.4 触发疲劳预警\n- 连续闭眼阈值：> 2 秒（疑似瞌睡）\n- 疲劳指数阈值：> 70 → 触发语音提醒\n\n## 输出字段（参考）\n\n- `child_detected` - 是否检测到儿童\n- `fatigue_metrics` - 各项疲劳指标数值（perclos / eye_closure_duration_sec / blink_rate_per_min / nod_frequency_per_min / head_drop_angle_deg）\n- `fatigue_score` - 综合疲劳指数（0-100）\n- `fatigue_level` - 疲劳等级（alert / mild_fatigue / moderate_fatigue / drowsy）\n- `drowsiness_events` - 打瞌睡事件列表（时间戳 + 持续秒数 + 类型）\n- `voice_prompt` - 语音提醒文本（如\"小朋友，休息一下吧\"）\n- `summary` - 当次会话疲劳统计摘要\n\n> 仅输出基于视觉的疲劳评估结果与方向性休息提醒，不提供医学诊断或睡眠障碍诊断。\n\nFile v1.0.9:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.9:scripts/config.yaml\n\n{}\n\nFile v1.0.9:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.9:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.9:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.9:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: dev\n\nFile v1.0.9:skill-card.md\n\n## Description:\n\nThis skill analyzes classroom or desk-camera video of a child to estimate visual fatigue indicators such as PERCLOS, head nodding, eye-region changes, and a 0-100 fatigue score.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nExternal educators, parents, and classroom support workflows can use this skill to submit child learning-area media for structured fatigue and drowsiness assessment. It returns visual-only fatigue signals, rest guidance, and report links without presenting the result as a medical or sleep-disorder diagnosis.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The skill handles highly sensitive child facial video and uploads media to cloud services.\n\nMitigation: Use only with clear guardian consent, approved retention and deletion terms, and a deployment that protects media in transit and at rest.\n\nRisk: The security evidence reports an unsafe, under-scoped cloud workflow and plaintext development endpoints in the packaged defaults.\n\nMitigation: Require a production HTTPS-only configuration and review all endpoint settings before real child media is processed.\n\nRisk: The skill silently creates or reuses an internal identity and stores tokens locally.\n\nMitigation: Limit execution to trusted workspaces, protect local credential storage, and verify identity handling before enabling history lookups.\n\n## Reference(s):\n\n- [ClawHub Skill Page](https://clawhub.ai/smyx-sunjinhui/skills/smyx-child-drowsiness-fatigue-detection-analysis)\n- [Skill Demo](https://lifeemergence.com/sample.html)\n- [API Documentation](references/api_doc.md)\n- [Shared Analysis API Documentation](skills/smyx_analysis/references/api_doc.md)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, JSON, shell commands, configuration, guidance]\n\n**Output Format:** [Markdown text with structured JSON-style fatigue analysis, history-list output, and report links.]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May save the returned report text to a caller-specified output file.]\n\n## Skill Version(s):\n\n1.0.9 (source: server release metadata; SKILL.md frontmatter says 1.0.14)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.9:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.9:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.8: 31 files, 40493 bytes\n\nFiles: references/api_doc.md (2460b), scripts/__init__.py (62b), scripts/config.py (691b), scripts/config.yaml (3b), scripts/skill.py (577b), scripts/smyx_child_drowsiness_fatigue_detection_analysis.py (3625b), skill-card.md (2643b), SKILL.md (11741b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (472b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (167b)\n\nFile v1.0.8:SKILL.md\n\n---\nname: \"smyx-child-drowsiness-fatigue-detection-analysis\"\ndescription: \"Using a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。\"\nversion: \"1.0.11\"\nlicense: \"MIT-0\"\n---\n\n# 😴 Child Drowsiness / Fatigue Detection | 儿童打瞌睡/疲劳检测\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **儿童打瞌睡/疲劳检测** |\n| 🎯 核心目标 | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_CHILD_DROWSINESS_FATIGUE_DETECTION_ANALYSIS` |\n\nUsing a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). The skill helps teachers or parents detect drowsiness in time and adjust learning schedules or remind the child to rest. Application scenarios: classrooms, home desks, online classes. The system monitors in real time and, when the fatigue index exceeds a threshold, pushes reminders or triggers voice prompts (e.g., 'kid, time to take a break'). Skill features: safeguarding sleep health.\n\n通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。应用场景：教室、家庭书桌、在线课堂。系统实时监测，当疲劳指数超过阈值时，推送提醒或触发语音提示（如'小朋友，休息一下吧'）。技能特点：保障睡眠健康。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的儿童学习疲劳监测 AI。你的任务是分析儿童面部视频，检测眼部闭合状态和头部点头动作，计算疲劳指数。不要提供医疗诊断或睡眠障碍诊断，仅输出基于视觉的疲劳评估结果与方向性休息提醒。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于教室/家庭书桌摄像头视频，量化儿童眼部闭合（PERCLOS）+ 点头动作 + 眼部光泽度变化，输出 0-100 疲劳指数与等级判定\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 儿童面部检测 |\n| 2 | 眼部状态识别（闭合 / 半闭 / 睁开） |\n| 3 | PERCLOS 计算 |\n| 4 | 连续闭眼时长 |\n| 5 | 眨眼频次 |\n| 6 | 点头次数与角度 |\n| 7 | 眼部光泽度变化 |\n| 8 | 疲劳综合得分（0-100） |\n| 9 | 疲劳等级（alert / mild_fatigue / moderate_fatigue / drowsy） |\n| 10 | 打瞌睡事件列表 |\n| 11 | 语音提醒文本生成 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供儿童面部学习区域视频 URL 或文件需要分析时，默认触发本技能进行打瞌睡/疲劳检测 |\n| 🔎 明确分析意图 | 当用户明确提及打瞌睡、疲劳、困倦、PERCLOS、点头、眨眼、上课走神、写作业犯困、智能台灯疲劳提醒等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看儿童疲劳历史报告、打瞌睡报告清单、疲劳指数报告清单、查询历史疲劳记录、显示所有儿童疲劳检测报告、显示儿童睡眠健康诊断报告，查询疲劳提醒清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备儿童面部学习区域视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 系统自动完成身份关联 | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行儿童打瞌睡/疲劳检测 | 调用 `-m scripts.smyx_child_drowsiness_fatigue_detection_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地儿童面部学习区域视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络儿童面部学习区域视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，儿童学习疲劳监测场景默认 `other` | 按需填写 |\n| `--list` | 显示儿童打瞌睡/疲劳历史检测报告列表清单（可以输入起始日期参数过滤数据范围） | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_child_drowsiness_fatigue_detection_analysis.py`](scripts/smyx_child_drowsiness_fatigue_detection_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov 视频，最大 10MB；建议正对面部、≥ 15 FPS |\n| 🧑‍⚖️ 结果性质 | 检测结果仅作为学习/课堂辅助参考，本工具不替代家长/教师的实际观察与教育判断，疑似长期严重困倦请就医 |\n| 🔏 隐私合规 | 隐私合规：儿童学习场景视频涉及未成年人隐私，使用前需取得监护人知情同意，并妥善保管/加密相关录像 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input /path/to/class.mp4\n\n# 分析网络儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --url https://example.com/class.mp4\n\n# 显示历史儿童疲劳检测报告（自动触发关键词：查看儿童疲劳历史报告、打瞌睡报告清单等）\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --output result.json\n```\n\nFile v1.0.8:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-child-drowsiness-fatigue-detection-analysis\",\n  \"version\": \"1.0.8\",\n  \"publishedAt\": 1787958210061\n}\n\nFile v1.0.8:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放儿童打瞌睡/疲劳检测 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动儿童疲劳检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取分析结果（疲劳指数 + 提醒）\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史疲劳检测记录\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出完整报告\n\n## 场景代码\n\n- `SMYX_CHILD_DROWSINESS_FATIGUE_DETECTION_ANALYSIS` - 儿童打瞌睡/疲劳检测\n\n## 输入约束\n\n- 摄像头建议正对儿童面部（教室或书桌正前方/智能台灯内置）\n- 视频帧率建议 ≥ 15 FPS，确保眼部状态采样精度\n- 光照均匀，避免逆光或镜片反光遮挡眼部\n\n## 关键观测指标\n\n- `perclos` - 单位时间内眼睛闭合超过 80% 的时间占比（0-1）\n- `eye_closure_duration_sec` - 最长一次连续闭眼秒数\n- `blink_rate_per_min` - 眨眼频次（次/分钟）\n- `nod_frequency_per_min` - 点头次数（次/分钟，快速下点后抬起）\n- `head_drop_angle_deg` - 单次最大头部下垂角度（°）\n- `eye_region_glossiness_drop` - 眼部光泽度变化（参考特征）\n\n## 疲劳指数（0-100，综合得分）\n\n- 0-30 - 清醒（alert）\n- 30-50 - 轻度疲劳（mild_fatigue）\n- 50-70 - 中度疲劳（moderate_fatigue）\n- 70-100 - 重度疲劳/疑似打瞌睡（drowsy）\n\n## 默认告警阈值（可由调用方覆盖）\n\n- PERCLOS 阈值：> 0.4 触发疲劳预警\n- 连续闭眼阈值：> 2 秒（疑似瞌睡）\n- 疲劳指数阈值：> 70 → 触发语音提醒\n\n## 输出字段（参考）\n\n- `child_detected` - 是否检测到儿童\n- `fatigue_metrics` - 各项疲劳指标数值（perclos / eye_closure_duration_sec / blink_rate_per_min / nod_frequency_per_min / head_drop_angle_deg）\n- `fatigue_score` - 综合疲劳指数（0-100）\n- `fatigue_level` - 疲劳等级（alert / mild_fatigue / moderate_fatigue / drowsy）\n- `drowsiness_events` - 打瞌睡事件列表（时间戳 + 持续秒数 + 类型）\n- `voice_prompt` - 语音提醒文本（如\"小朋友，休息一下吧\"）\n- `summary` - 当次会话疲劳统计摘要\n\n> 仅输出基于视觉的疲劳评估结果与方向性休息提醒，不提供医学诊断或睡眠障碍诊断。\n\nFile v1.0.8:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.8:scripts/config.yaml\n\n{}\n\nFile v1.0.8:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.8:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.8:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.8:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: dev\n\nFile v1.0.8:skill-card.md\n\n## Description:\n\nThis skill analyzes classroom, home desk, or online class face video to estimate child drowsiness from visual fatigue indicators such as PERCLOS, head nodding, eye-region changes, and a 0-100 fatigue score.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nTeachers, parents, and education technology operators use this skill to assess visible signs of child fatigue from learning-area video, generate structured fatigue reports, and retrieve prior reports from the publisher's cloud service. The output is for learning support and rest reminders, not medical diagnosis.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Children's face videos or video URLs are sent to the publisher's cloud service.\n\nMitigation: Use only with guardian consent, submit only necessary media, and confirm the publisher's data handling practices before use.\n\nRisk: Historical reports are queried from the publisher's service and local identity or token records may be created or reused.\n\nMitigation: Run in an isolated workspace with appropriate access controls, and avoid shared environments unless identity and report access are clearly separated per user.\n\nRisk: Visual fatigue scores and reminder text could be mistaken for medical or sleep-disorder diagnosis.\n\nMitigation: Present outputs as observational learning support only, and route persistent or severe drowsiness concerns to qualified care.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/smyx-sunjinhui/skills/smyx-child-drowsiness-fatigue-detection-analysis)\n- [API documentation](references/api_doc.md)\n- [Analysis API documentation](skills/smyx_analysis/references/api_doc.md)\n- [Skill demo](https://lifeemergence.com/sample.html)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, shell commands, configuration, guidance]\n\n**Output Format:** [Markdown summaries and JSON-structured analysis results, with optional saved output files and report links.]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Outputs may include fatigue metrics, fatigue level, drowsiness events, reminder text, and cloud report links.]\n\n## Skill Version(s):\n\n1.0.8 (source: server release metadata; skill frontmatter reports 1.0.11)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.8:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.8:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.7: 31 files, 40555 bytes\n\nFiles: references/api_doc.md (2460b), scripts/__init__.py (62b), scripts/config.py (691b), scripts/config.yaml (3b), scripts/skill.py (577b), scripts/smyx_child_drowsiness_fatigue_detection_analysis.py (3625b), skill-card.md (2731b), SKILL.md (11741b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (472b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (167b)\n\nFile v1.0.7:SKILL.md\n\n---\nname: \"smyx-child-drowsiness-fatigue-detection-analysis\"\ndescription: \"Using a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。\"\nversion: \"1.0.11\"\nlicense: \"MIT-0\"\n---\n\n# 😴 Child Drowsiness / Fatigue Detection | 儿童打瞌睡/疲劳检测\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **儿童打瞌睡/疲劳检测** |\n| 🎯 核心目标 | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_CHILD_DROWSINESS_FATIGUE_DETECTION_ANALYSIS` |\n\nUsing a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). The skill helps teachers or parents detect drowsiness in time and adjust learning schedules or remind the child to rest. Application scenarios: classrooms, home desks, online classes. The system monitors in real time and, when the fatigue index exceeds a threshold, pushes reminders or triggers voice prompts (e.g., 'kid, time to take a break'). Skill features: safeguarding sleep health.\n\n通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。应用场景：教室、家庭书桌、在线课堂。系统实时监测，当疲劳指数超过阈值时，推送提醒或触发语音提示（如'小朋友，休息一下吧'）。技能特点：保障睡眠健康。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的儿童学习疲劳监测 AI。你的任务是分析儿童面部视频，检测眼部闭合状态和头部点头动作，计算疲劳指数。不要提供医疗诊断或睡眠障碍诊断，仅输出基于视觉的疲劳评估结果与方向性休息提醒。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于教室/家庭书桌摄像头视频，量化儿童眼部闭合（PERCLOS）+ 点头动作 + 眼部光泽度变化，输出 0-100 疲劳指数与等级判定\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 儿童面部检测 |\n| 2 | 眼部状态识别（闭合 / 半闭 / 睁开） |\n| 3 | PERCLOS 计算 |\n| 4 | 连续闭眼时长 |\n| 5 | 眨眼频次 |\n| 6 | 点头次数与角度 |\n| 7 | 眼部光泽度变化 |\n| 8 | 疲劳综合得分（0-100） |\n| 9 | 疲劳等级（alert / mild_fatigue / moderate_fatigue / drowsy） |\n| 10 | 打瞌睡事件列表 |\n| 11 | 语音提醒文本生成 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供儿童面部学习区域视频 URL 或文件需要分析时，默认触发本技能进行打瞌睡/疲劳检测 |\n| 🔎 明确分析意图 | 当用户明确提及打瞌睡、疲劳、困倦、PERCLOS、点头、眨眼、上课走神、写作业犯困、智能台灯疲劳提醒等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看儿童疲劳历史报告、打瞌睡报告清单、疲劳指数报告清单、查询历史疲劳记录、显示所有儿童疲劳检测报告、显示儿童睡眠健康诊断报告，查询疲劳提醒清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备儿童面部学习区域视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 系统自动完成身份关联 | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行儿童打瞌睡/疲劳检测 | 调用 `-m scripts.smyx_child_drowsiness_fatigue_detection_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地儿童面部学习区域视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络儿童面部学习区域视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，儿童学习疲劳监测场景默认 `other` | 按需填写 |\n| `--list` | 显示儿童打瞌睡/疲劳历史检测报告列表清单（可以输入起始日期参数过滤数据范围） | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_child_drowsiness_fatigue_detection_analysis.py`](scripts/smyx_child_drowsiness_fatigue_detection_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov 视频，最大 10MB；建议正对面部、≥ 15 FPS |\n| 🧑‍⚖️ 结果性质 | 检测结果仅作为学习/课堂辅助参考，本工具不替代家长/教师的实际观察与教育判断，疑似长期严重困倦请就医 |\n| 🔏 隐私合规 | 隐私合规：儿童学习场景视频涉及未成年人隐私，使用前需取得监护人知情同意，并妥善保管/加密相关录像 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input /path/to/class.mp4\n\n# 分析网络儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --url https://example.com/class.mp4\n\n# 显示历史儿童疲劳检测报告（自动触发关键词：查看儿童疲劳历史报告、打瞌睡报告清单等）\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --output result.json\n```\n\nFile v1.0.7:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-child-drowsiness-fatigue-detection-analysis\",\n  \"version\": \"1.0.7\",\n  \"publishedAt\": 1787103648836\n}\n\nFile v1.0.7:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放儿童打瞌睡/疲劳检测 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动儿童疲劳检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取分析结果（疲劳指数 + 提醒）\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史疲劳检测记录\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出完整报告\n\n## 场景代码\n\n- `SMYX_CHILD_DROWSINESS_FATIGUE_DETECTION_ANALYSIS` - 儿童打瞌睡/疲劳检测\n\n## 输入约束\n\n- 摄像头建议正对儿童面部（教室或书桌正前方/智能台灯内置）\n- 视频帧率建议 ≥ 15 FPS，确保眼部状态采样精度\n- 光照均匀，避免逆光或镜片反光遮挡眼部\n\n## 关键观测指标\n\n- `perclos` - 单位时间内眼睛闭合超过 80% 的时间占比（0-1）\n- `eye_closure_duration_sec` - 最长一次连续闭眼秒数\n- `blink_rate_per_min` - 眨眼频次（次/分钟）\n- `nod_frequency_per_min` - 点头次数（次/分钟，快速下点后抬起）\n- `head_drop_angle_deg` - 单次最大头部下垂角度（°）\n- `eye_region_glossiness_drop` - 眼部光泽度变化（参考特征）\n\n## 疲劳指数（0-100，综合得分）\n\n- 0-30 - 清醒（alert）\n- 30-50 - 轻度疲劳（mild_fatigue）\n- 50-70 - 中度疲劳（moderate_fatigue）\n- 70-100 - 重度疲劳/疑似打瞌睡（drowsy）\n\n## 默认告警阈值（可由调用方覆盖）\n\n- PERCLOS 阈值：> 0.4 触发疲劳预警\n- 连续闭眼阈值：> 2 秒（疑似瞌睡）\n- 疲劳指数阈值：> 70 → 触发语音提醒\n\n## 输出字段（参考）\n\n- `child_detected` - 是否检测到儿童\n- `fatigue_metrics` - 各项疲劳指标数值（perclos / eye_closure_duration_sec / blink_rate_per_min / nod_frequency_per_min / head_drop_angle_deg）\n- `fatigue_score` - 综合疲劳指数（0-100）\n- `fatigue_level` - 疲劳等级（alert / mild_fatigue / moderate_fatigue / drowsy）\n- `drowsiness_events` - 打瞌睡事件列表（时间戳 + 持续秒数 + 类型）\n- `voice_prompt` - 语音提醒文本（如\"小朋友，休息一下吧\"）\n- `summary` - 当次会话疲劳统计摘要\n\n> 仅输出基于视觉的疲劳评估结果与方向性休息提醒，不提供医学诊断或睡眠障碍诊断。\n\nFile v1.0.7:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.7:scripts/config.yaml\n\n{}\n\nFile v1.0.7:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.7:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.7:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.7:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: dev\n\nFile v1.0.7:skill-card.md\n\n## Description:\n\nAnalyzes classroom or home-study child face videos to estimate visual drowsiness indicators such as PERCLOS, head-nodding frequency, eye-region changes, fatigue score, fatigue level, and rest reminders.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nTeachers, parents, and developers can use this skill to submit child study-area video files or URLs for visual fatigue assessment and to query previously generated fatigue reports. It is an auxiliary monitoring aid and not a medical or sleep-disorder diagnostic tool.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Sensitive child video data and report history may be handled by remote services.\n\nMitigation: Obtain guardian consent before use, verify the configured API endpoint, and confirm retention, deletion, and access-control practices before uploading classroom or home-study videos.\n\nRisk: The skill silently reuses or creates cloud-linked identities and stores local token/report state.\n\nMitigation: Run the skill in an isolated workspace, restrict access to local data files, and review or clear locally stored identity and token state when changing users or environments.\n\nRisk: Visual fatigue scores and reminders could be mistaken for medical or sleep-disorder diagnosis.\n\nMitigation: Present outputs as auxiliary rest-reminder guidance only and route persistent or severe drowsiness concerns to parents, teachers, or qualified medical professionals.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/smyx-sunjinhui/skills/smyx-child-drowsiness-fatigue-detection-analysis)\n- [Publisher profile](https://clawhub.ai/user/smyx-sunjinhui)\n- [Skill demo](https://lifeemergence.com/sample.html)\n- [Child drowsiness/fatigue API reference](references/api_doc.md)\n- [Shared analysis API reference](skills/smyx_analysis/references/api_doc.md)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, JSON, shell commands, guidance]\n\n**Output Format:** [Markdown report text with JSON-structured analysis content and report links]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May include fatigue metrics, drowsiness events, voice-prompt text, history-list records, and report export URLs.]\n\n## Skill Version(s):\n\n1.0.7 (source: ClawHub release evidence; artifact frontmatter reports 1.0.11)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.7:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.7:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.6: 31 files, 40510 bytes\n\nFiles: references/api_doc.md (2460b), scripts/__init__.py (62b), scripts/config.py (691b), scripts/config.yaml (3b), scripts/skill.py (577b), scripts/smyx_child_drowsiness_fatigue_detection_analysis.py (3625b), skill-card.md (2660b), SKILL.md (11740b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (473b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (167b)\n\nFile v1.0.6:SKILL.md\n\n---\nname: \"smyx-child-drowsiness-fatigue-detection-analysis\"\ndescription: \"Using a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。\"\nversion: \"1.0.9\"\nlicense: \"MIT-0\"\n---\n\n# 😴 Child Drowsiness / Fatigue Detection | 儿童打瞌睡/疲劳检测\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **儿童打瞌睡/疲劳检测** |\n| 🎯 核心目标 | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_CHILD_DROWSINESS_FATIGUE_DETECTION_ANALYSIS` |\n\nUsing a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). The skill helps teachers or parents detect drowsiness in time and adjust learning schedules or remind the child to rest. Application scenarios: classrooms, home desks, online classes. The system monitors in real time and, when the fatigue index exceeds a threshold, pushes reminders or triggers voice prompts (e.g., 'kid, time to take a break'). Skill features: safeguarding sleep health.\n\n通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。应用场景：教室、家庭书桌、在线课堂。系统实时监测，当疲劳指数超过阈值时，推送提醒或触发语音提示（如'小朋友，休息一下吧'）。技能特点：保障睡眠健康。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的儿童学习疲劳监测 AI。你的任务是分析儿童面部视频，检测眼部闭合状态和头部点头动作，计算疲劳指数。不要提供医疗诊断或睡眠障碍诊断，仅输出基于视觉的疲劳评估结果与方向性休息提醒。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于教室/家庭书桌摄像头视频，量化儿童眼部闭合（PERCLOS）+ 点头动作 + 眼部光泽度变化，输出 0-100 疲劳指数与等级判定\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 儿童面部检测 |\n| 2 | 眼部状态识别（闭合 / 半闭 / 睁开） |\n| 3 | PERCLOS 计算 |\n| 4 | 连续闭眼时长 |\n| 5 | 眨眼频次 |\n| 6 | 点头次数与角度 |\n| 7 | 眼部光泽度变化 |\n| 8 | 疲劳综合得分（0-100） |\n| 9 | 疲劳等级（alert / mild_fatigue / moderate_fatigue / drowsy） |\n| 10 | 打瞌睡事件列表 |\n| 11 | 语音提醒文本生成 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供儿童面部学习区域视频 URL 或文件需要分析时，默认触发本技能进行打瞌睡/疲劳检测 |\n| 🔎 明确分析意图 | 当用户明确提及打瞌睡、疲劳、困倦、PERCLOS、点头、眨眼、上课走神、写作业犯困、智能台灯疲劳提醒等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看儿童疲劳历史报告、打瞌睡报告清单、疲劳指数报告清单、查询历史疲劳记录、显示所有儿童疲劳检测报告、显示儿童睡眠健康诊断报告，查询疲劳提醒清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备儿童面部学习区域视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 系统自动完成身份关联 | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行儿童打瞌睡/疲劳检测 | 调用 `-m scripts.smyx_child_drowsiness_fatigue_detection_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地儿童面部学习区域视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络儿童面部学习区域视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，儿童学习疲劳监测场景默认 `other` | 按需填写 |\n| `--list` | 显示儿童打瞌睡/疲劳历史检测报告列表清单（可以输入起始日期参数过滤数据范围） | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_child_drowsiness_fatigue_detection_analysis.py`](scripts/smyx_child_drowsiness_fatigue_detection_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov 视频，最大 10MB；建议正对面部、≥ 15 FPS |\n| 🧑‍⚖️ 结果性质 | 检测结果仅作为学习/课堂辅助参考，本工具不替代家长/教师的实际观察与教育判断，疑似长期严重困倦请就医 |\n| 🔏 隐私合规 | 隐私合规：儿童学习场景视频涉及未成年人隐私，使用前需取得监护人知情同意，并妥善保管/加密相关录像 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input /path/to/class.mp4\n\n# 分析网络儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --url https://example.com/class.mp4\n\n# 显示历史儿童疲劳检测报告（自动触发关键词：查看儿童疲劳历史报告、打瞌睡报告清单等）\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --output result.json\n```\n\nFile v1.0.6:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-child-drowsiness-fatigue-detection-analysis\",\n  \"version\": \"1.0.6\",\n  \"publishedAt\": 1786341512257\n}\n\nFile v1.0.6:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放儿童打瞌睡/疲劳检测 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动儿童疲劳检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取分析结果（疲劳指数 + 提醒）\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史疲劳检测记录\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出完整报告\n\n## 场景代码\n\n- `SMYX_CHILD_DROWSINESS_FATIGUE_DETECTION_ANALYSIS` - 儿童打瞌睡/疲劳检测\n\n## 输入约束\n\n- 摄像头建议正对儿童面部（教室或书桌正前方/智能台灯内置）\n- 视频帧率建议 ≥ 15 FPS，确保眼部状态采样精度\n- 光照均匀，避免逆光或镜片反光遮挡眼部\n\n## 关键观测指标\n\n- `perclos` - 单位时间内眼睛闭合超过 80% 的时间占比（0-1）\n- `eye_closure_duration_sec` - 最长一次连续闭眼秒数\n- `blink_rate_per_min` - 眨眼频次（次/分钟）\n- `nod_frequency_per_min` - 点头次数（次/分钟，快速下点后抬起）\n- `head_drop_angle_deg` - 单次最大头部下垂角度（°）\n- `eye_region_glossiness_drop` - 眼部光泽度变化（参考特征）\n\n## 疲劳指数（0-100，综合得分）\n\n- 0-30 - 清醒（alert）\n- 30-50 - 轻度疲劳（mild_fatigue）\n- 50-70 - 中度疲劳（moderate_fatigue）\n- 70-100 - 重度疲劳/疑似打瞌睡（drowsy）\n\n## 默认告警阈值（可由调用方覆盖）\n\n- PERCLOS 阈值：> 0.4 触发疲劳预警\n- 连续闭眼阈值：> 2 秒（疑似瞌睡）\n- 疲劳指数阈值：> 70 → 触发语音提醒\n\n## 输出字段（参考）\n\n- `child_detected` - 是否检测到儿童\n- `fatigue_metrics` - 各项疲劳指标数值（perclos / eye_closure_duration_sec / blink_rate_per_min / nod_frequency_per_min / head_drop_angle_deg）\n- `fatigue_score` - 综合疲劳指数（0-100）\n- `fatigue_level` - 疲劳等级（alert / mild_fatigue / moderate_fatigue / drowsy）\n- `drowsiness_events` - 打瞌睡事件列表（时间戳 + 持续秒数 + 类型）\n- `voice_prompt` - 语音提醒文本（如\"小朋友，休息一下吧\"）\n- `summary` - 当次会话疲劳统计摘要\n\n> 仅输出基于视觉的疲劳评估结果与方向性休息提醒，不提供医学诊断或睡眠障碍诊断。\n\nFile v1.0.6:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.6:scripts/config.yaml\n\n{}\n\nFile v1.0.6:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.6:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.6:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.6:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: prod\n\nFile v1.0.6:skill-card.md\n\n## Description:\n\nAnalyzes child classroom or desk video for visual fatigue indicators such as PERCLOS, head nodding, and eye-region glossiness to produce a 0-100 fatigue index and rest-oriented reminders.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nExternal educators, parents, and developers use this skill to analyze child learning-area images or videos, surface visual fatigue indicators, and retrieve associated cloud report history. Results should be treated as learning-support signals, not medical or sleep-disorder diagnosis.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Sensitive child images or videos may be sent to a configured cloud service, linked to an automatically resolved identity, and associated with cloud report history.\n\nMitigation: Use only with clear guardian consent, documented retention and deletion terms, and a visible option to avoid account-linked history or remote processing.\n\nRisk: Stored account tokens and cloud report history can associate analysis results with a user over time.\n\nMitigation: Review token storage and access controls before deployment, restrict use to approved environments, and rotate or revoke credentials according to policy.\n\nRisk: Visual fatigue scores can be affected by video quality and are not medical or sleep-disorder diagnoses.\n\nMitigation: Present outputs as classroom or learning-support signals, require adult review, and enforce clear video capture requirements.\n\n## Reference(s):\n\n- [ClawHub Skill Page](https://clawhub.ai/smyx-sunjinhui/skills/smyx-child-drowsiness-fatigue-detection-analysis)\n- [API Documentation](references/api_doc.md)\n- [SMYX Analysis API Documentation](skills/smyx_analysis/references/api_doc.md)\n- [Skill Demo](https://lifeemergence.com/sample.html)\n\n## Skill Output:\n\n**Output Type(s):** [Text, Markdown, JSON, Shell commands, Files, Guidance]\n\n**Output Format:** [Markdown text with embedded structured JSON and report links]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May write an optional output file when requested; cloud report history can be listed as structured Markdown or JSON.]\n\n## Skill Version(s):\n\n1.0.6 (source: server release metadata; artifact SKILL.md frontmatter reports 1.0.9)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.6:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.6:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.5: 31 files, 40425 bytes\n\nFiles: references/api_doc.md (2460b), scripts/__init__.py (62b), scripts/config.py (691b), scripts/config.yaml (3b), scripts/skill.py (577b), scripts/smyx_child_drowsiness_fatigue_detection_analysis.py (3625b), skill-card.md (2475b), SKILL.md (11740b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (473b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (167b)\n\nFile v1.0.5:SKILL.md\n\n---\nname: \"smyx-child-drowsiness-fatigue-detection-analysis\"\ndescription: \"Using a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。\"\nversion: \"1.0.8\"\nlicense: \"MIT-0\"\n---\n\n# 😴 Child Drowsiness / Fatigue Detection | 儿童打瞌睡/疲劳检测\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **儿童打瞌睡/疲劳检测** |\n| 🎯 核心目标 | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_CHILD_DROWSINESS_FATIGUE_DETECTION_ANALYSIS` |\n\nUsing a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). The skill helps teachers or parents detect drowsiness in time and adjust learning schedules or remind the child to rest. Application scenarios: classrooms, home desks, online classes. The system monitors in real time and, when the fatigue index exceeds a threshold, pushes reminders or triggers voice prompts (e.g., 'kid, time to take a break'). Skill features: safeguarding sleep health.\n\n通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。应用场景：教室、家庭书桌、在线课堂。系统实时监测，当疲劳指数超过阈值时，推送提醒或触发语音提示（如'小朋友，休息一下吧'）。技能特点：保障睡眠健康。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的儿童学习疲劳监测 AI。你的任务是分析儿童面部视频，检测眼部闭合状态和头部点头动作，计算疲劳指数。不要提供医疗诊断或睡眠障碍诊断，仅输出基于视觉的疲劳评估结果与方向性休息提醒。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于教室/家庭书桌摄像头视频，量化儿童眼部闭合（PERCLOS）+ 点头动作 + 眼部光泽度变化，输出 0-100 疲劳指数与等级判定\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 儿童面部检测 |\n| 2 | 眼部状态识别（闭合 / 半闭 / 睁开） |\n| 3 | PERCLOS 计算 |\n| 4 | 连续闭眼时长 |\n| 5 | 眨眼频次 |\n| 6 | 点头次数与角度 |\n| 7 | 眼部光泽度变化 |\n| 8 | 疲劳综合得分（0-100） |\n| 9 | 疲劳等级（alert / mild_fatigue / moderate_fatigue / drowsy） |\n| 10 | 打瞌睡事件列表 |\n| 11 | 语音提醒文本生成 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供儿童面部学习区域视频 URL 或文件需要分析时，默认触发本技能进行打瞌睡/疲劳检测 |\n| 🔎 明确分析意图 | 当用户明确提及打瞌睡、疲劳、困倦、PERCLOS、点头、眨眼、上课走神、写作业犯困、智能台灯疲劳提醒等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看儿童疲劳历史报告、打瞌睡报告清单、疲劳指数报告清单、查询历史疲劳记录、显示所有儿童疲劳检测报告、显示儿童睡眠健康诊断报告，查询疲劳提醒清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备儿童面部学习区域视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 系统自动完成身份关联 | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行儿童打瞌睡/疲劳检测 | 调用 `-m scripts.smyx_child_drowsiness_fatigue_detection_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地儿童面部学习区域视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络儿童面部学习区域视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，儿童学习疲劳监测场景默认 `other` | 按需填写 |\n| `--list` | 显示儿童打瞌睡/疲劳历史检测报告列表清单（可以输入起始日期参数过滤数据范围） | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_child_drowsiness_fatigue_detection_analysis.py`](scripts/smyx_child_drowsiness_fatigue_detection_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov 视频，最大 10MB；建议正对面部、≥ 15 FPS |\n| 🧑‍⚖️ 结果性质 | 检测结果仅作为学习/课堂辅助参考，本工具不替代家长/教师的实际观察与教育判断，疑似长期严重困倦请就医 |\n| 🔏 隐私合规 | 隐私合规：儿童学习场景视频涉及未成年人隐私，使用前需取得监护人知情同意，并妥善保管/加密相关录像 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input /path/to/class.mp4\n\n# 分析网络儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --url https://example.com/class.mp4\n\n# 显示历史儿童疲劳检测报告（自动触发关键词：查看儿童疲劳历史报告、打瞌睡报告清单等）\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --output result.json\n```\n\nFile v1.0.5:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-child-drowsiness-fatigue-detection-analysis\",\n  \"version\": \"1.0.5\",\n  \"publishedAt\": 1786100560036\n}\n\nFile v1.0.5:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放儿童打瞌睡/疲劳检测 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动儿童疲劳检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取分析结果（疲劳指数 + 提醒）\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史疲劳检测记录\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出完整报告\n\n## 场景代码\n\n- `SMYX_CHILD_DROWSINESS_FATIGUE_DETECTION_ANALYSIS` - 儿童打瞌睡/疲劳检测\n\n## 输入约束\n\n- 摄像头建议正对儿童面部（教室或书桌正前方/智能台灯内置）\n- 视频帧率建议 ≥ 15 FPS，确保眼部状态采样精度\n- 光照均匀，避免逆光或镜片反光遮挡眼部\n\n## 关键观测指标\n\n- `perclos` - 单位时间内眼睛闭合超过 80% 的时间占比（0-1）\n- `eye_closure_duration_sec` - 最长一次连续闭眼秒数\n- `blink_rate_per_min` - 眨眼频次（次/分钟）\n- `nod_frequency_per_min` - 点头次数（次/分钟，快速下点后抬起）\n- `head_drop_angle_deg` - 单次最大头部下垂角度（°）\n- `eye_region_glossiness_drop` - 眼部光泽度变化（参考特征）\n\n## 疲劳指数（0-100，综合得分）\n\n- 0-30 - 清醒（alert）\n- 30-50 - 轻度疲劳（mild_fatigue）\n- 50-70 - 中度疲劳（moderate_fatigue）\n- 70-100 - 重度疲劳/疑似打瞌睡（drowsy）\n\n## 默认告警阈值（可由调用方覆盖）\n\n- PERCLOS 阈值：> 0.4 触发疲劳预警\n- 连续闭眼阈值：> 2 秒（疑似瞌睡）\n- 疲劳指数阈值：> 70 → 触发语音提醒\n\n## 输出字段（参考）\n\n- `child_detected` - 是否检测到儿童\n- `fatigue_metrics` - 各项疲劳指标数值（perclos / eye_closure_duration_sec / blink_rate_per_min / nod_frequency_per_min / head_drop_angle_deg）\n- `fatigue_score` - 综合疲劳指数（0-100）\n- `fatigue_level` - 疲劳等级（alert / mild_fatigue / moderate_fatigue / drowsy）\n- `drowsiness_events` - 打瞌睡事件列表（时间戳 + 持续秒数 + 类型）\n- `voice_prompt` - 语音提醒文本（如\"小朋友，休息一下吧\"）\n- `summary` - 当次会话疲劳统计摘要\n\n> 仅输出基于视觉的疲劳评估结果与方向性休息提醒，不提供医学诊断或睡眠障碍诊断。\n\nFile v1.0.5:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.5:scripts/config.yaml\n\n{}\n\nFile v1.0.5:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.5:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.5:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.5:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: prod\n\nFile v1.0.5:skill-card.md\n\n## Description:\n\nAnalyzes child face video from classroom, desk, or online-learning settings to estimate visual fatigue indicators such as PERCLOS, eye-closure duration, nodding, and a 0-100 fatigue score.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nExternal users such as teachers, parents, and education-support agents use this skill to analyze uploaded or URL-based child learning videos for drowsiness indicators, fatigue level, rest reminders, report links, and historical fatigue reports. Outputs are visual fatigue assessments only and are not medical or sleep-disorder diagnoses.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Child media and identity-linked report data are sent to cloud services.\n\nMitigation: Verify backend privacy terms, retention and deletion controls, and guardian consent before installing or using the skill.\n\nRisk: The skill silently creates or reuses local identities and tokens for analysis and history lookup.\n\nMitigation: Confirm local token storage, identity reuse behavior, and automatic history access are acceptable for the deployment environment.\n\nRisk: Fatigue results could be mistaken for medical conclusions.\n\nMitigation: Present outputs as visual fatigue assessments and rest guidance only, not as medical or sleep-disorder diagnoses.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/smyx-sunjinhui/skills/smyx-child-drowsiness-fatigue-detection-analysis)\n- [Publisher profile](https://clawhub.ai/user/smyx-sunjinhui)\n- [Skill demo](https://lifeemergence.com/sample.html)\n- [Child fatigue detection API reference](references/api_doc.md)\n\n## Skill Output:\n\n**Output Type(s):** [analysis, markdown, JSON, files, shell commands, guidance]\n\n**Output Format:** [Markdown text or JSON analysis with optional saved output file and report link]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May query cloud history and return Markdown tables for prior reports.]\n\n## Skill Version(s):\n\n1.0.5 (source: server release evidence; artifact frontmatter reports 1.0.8)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.5:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.5:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.4: 31 files, 40437 bytes\n\nFiles: references/api_doc.md (2460b), scripts/__init__.py (62b), scripts/config.py (691b), scripts/config.yaml (3b), scripts/skill.py (577b), scripts/smyx_child_drowsiness_fatigue_detection_analysis.py (3625b), skill-card.md (2519b), SKILL.md (11740b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (473b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (167b)\n\nFile v1.0.4:SKILL.md\n\n---\nname: \"smyx-child-drowsiness-fatigue-detection-analysis\"\ndescription: \"Using a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。\"\nversion: \"1.0.8\"\nlicense: \"MIT-0\"\n---\n\n# 😴 Child Drowsiness / Fatigue Detection | 儿童打瞌睡/疲劳检测\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **儿童打瞌睡/疲劳检测** |\n| 🎯 核心目标 | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_CHILD_DROWSINESS_FATIGUE_DETECTION_ANALYSIS` |\n\nUsing a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). The skill helps teachers or parents detect drowsiness in time and adjust learning schedules or remind the child to rest. Application scenarios: classrooms, home desks, online classes. The system monitors in real time and, when the fatigue index exceeds a threshold, pushes reminders or triggers voice prompts (e.g., 'kid, time to take a break'). Skill features: safeguarding sleep health.\n\n通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。应用场景：教室、家庭书桌、在线课堂。系统实时监测，当疲劳指数超过阈值时，推送提醒或触发语音提示（如'小朋友，休息一下吧'）。技能特点：保障睡眠健康。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的儿童学习疲劳监测 AI。你的任务是分析儿童面部视频，检测眼部闭合状态和头部点头动作，计算疲劳指数。不要提供医疗诊断或睡眠障碍诊断，仅输出基于视觉的疲劳评估结果与方向性休息提醒。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于教室/家庭书桌摄像头视频，量化儿童眼部闭合（PERCLOS）+ 点头动作 + 眼部光泽度变化，输出 0-100 疲劳指数与等级判定\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 儿童面部检测 |\n| 2 | 眼部状态识别（闭合 / 半闭 / 睁开） |\n| 3 | PERCLOS 计算 |\n| 4 | 连续闭眼时长 |\n| 5 | 眨眼频次 |\n| 6 | 点头次数与角度 |\n| 7 | 眼部光泽度变化 |\n| 8 | 疲劳综合得分（0-100） |\n| 9 | 疲劳等级（alert / mild_fatigue / moderate_fatigue / drowsy） |\n| 10 | 打瞌睡事件列表 |\n| 11 | 语音提醒文本生成 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供儿童面部学习区域视频 URL 或文件需要分析时，默认触发本技能进行打瞌睡/疲劳检测 |\n| 🔎 明确分析意图 | 当用户明确提及打瞌睡、疲劳、困倦、PERCLOS、点头、眨眼、上课走神、写作业犯困、智能台灯疲劳提醒等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看儿童疲劳历史报告、打瞌睡报告清单、疲劳指数报告清单、查询历史疲劳记录、显示所有儿童疲劳检测报告、显示儿童睡眠健康诊断报告，查询疲劳提醒清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备儿童面部学习区域视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 系统自动完成身份关联 | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行儿童打瞌睡/疲劳检测 | 调用 `-m scripts.smyx_child_drowsiness_fatigue_detection_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地儿童面部学习区域视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络儿童面部学习区域视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，儿童学习疲劳监测场景默认 `other` | 按需填写 |\n| `--list` | 显示儿童打瞌睡/疲劳历史检测报告列表清单（可以输入起始日期参数过滤数据范围） | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_child_drowsiness_fatigue_detection_analysis.py`](scripts/smyx_child_drowsiness_fatigue_detection_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov 视频，最大 10MB；建议正对面部、≥ 15 FPS |\n| 🧑‍⚖️ 结果性质 | 检测结果仅作为学习/课堂辅助参考，本工具不替代家长/教师的实际观察与教育判断，疑似长期严重困倦请就医 |\n| 🔏 隐私合规 | 隐私合规：儿童学习场景视频涉及未成年人隐私，使用前需取得监护人知情同意，并妥善保管/加密相关录像 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input /path/to/class.mp4\n\n# 分析网络儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --url https://example.com/class.mp4\n\n# 显示历史儿童疲劳检测报告（自动触发关键词：查看儿童疲劳历史报告、打瞌睡报告清单等）\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --output result.json\n```\n\nFile v1.0.4:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-child-drowsiness-fatigue-detection-analysis\",\n  \"version\": \"1.0.4\",\n  \"publishedAt\": 1785611976867\n}\n\nFile v1.0.4:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放儿童打瞌睡/疲劳检测 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动儿童疲劳检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取分析结果（疲劳指数 + 提醒）\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史疲劳检测记录\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出完整报告\n\n## 场景代码\n\n- `SMYX_CHILD_DROWSINESS_FATIGUE_DETECTION_ANALYSIS` - 儿童打瞌睡/疲劳检测\n\n## 输入约束\n\n- 摄像头建议正对儿童面部（教室或书桌正前方/智能台灯内置）\n- 视频帧率建议 ≥ 15 FPS，确保眼部状态采样精度\n- 光照均匀，避免逆光或镜片反光遮挡眼部\n\n## 关键观测指标\n\n- `perclos` - 单位时间内眼睛闭合超过 80% 的时间占比（0-1）\n- `eye_closure_duration_sec` - 最长一次连续闭眼秒数\n- `blink_rate_per_min` - 眨眼频次（次/分钟）\n- `nod_frequency_per_min` - 点头次数（次/分钟，快速下点后抬起）\n- `head_drop_angle_deg` - 单次最大头部下垂角度（°）\n- `eye_region_glossiness_drop` - 眼部光泽度变化（参考特征）\n\n## 疲劳指数（0-100，综合得分）\n\n- 0-30 - 清醒（alert）\n- 30-50 - 轻度疲劳（mild_fatigue）\n- 50-70 - 中度疲劳（moderate_fatigue）\n- 70-100 - 重度疲劳/疑似打瞌睡（drowsy）\n\n## 默认告警阈值（可由调用方覆盖）\n\n- PERCLOS 阈值：> 0.4 触发疲劳预警\n- 连续闭眼阈值：> 2 秒（疑似瞌睡）\n- 疲劳指数阈值：> 70 → 触发语音提醒\n\n## 输出字段（参考）\n\n- `child_detected` - 是否检测到儿童\n- `fatigue_metrics` - 各项疲劳指标数值（perclos / eye_closure_duration_sec / blink_rate_per_min / nod_frequency_per_min / head_drop_angle_deg）\n- `fatigue_score` - 综合疲劳指数（0-100）\n- `fatigue_level` - 疲劳等级（alert / mild_fatigue / moderate_fatigue / drowsy）\n- `drowsiness_events` - 打瞌睡事件列表（时间戳 + 持续秒数 + 类型）\n- `voice_prompt` - 语音提醒文本（如\"小朋友，休息一下吧\"）\n- `summary` - 当次会话疲劳统计摘要\n\n> 仅输出基于视觉的疲劳评估结果与方向性休息提醒，不提供医学诊断或睡眠障碍诊断。\n\nFile v1.0.4:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.4:scripts/config.yaml\n\n{}\n\nFile v1.0.4:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.4:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.4:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.4:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: prod\n\nFile v1.0.4:skill-card.md\n\n## Description: <br>\nAnalyzes classroom or home-desk child face videos to estimate drowsiness from PERCLOS, nodding, eye-region changes, and return a 0-100 fatigue index with rest guidance. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nTeachers, parents, and education technology operators use this skill to assess child fatigue in classroom, home-desk, or online-class videos. It returns visual fatigue metrics, a structured fatigue assessment, rest reminders, and report links without providing a medical diagnosis. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: The skill sends children's video files or video URLs to the publisher's remote service for analysis. <br>\nMitigation: Use only with guardian consent, process only media the user is authorized to submit, and avoid sending unnecessary or sensitive recordings. <br>\nRisk: The skill can create or reuse a local identity and maintain token-backed account state. <br>\nMitigation: Run it in a controlled environment, review local account and token storage, and clear local state when it is no longer needed. <br>\nRisk: The skill can retrieve cloud report history associated with the resolved identity. <br>\nMitigation: Use accounts scoped to the intended child or classroom context and restrict access to users authorized to view those reports. <br>\n\n\n## Reference(s): <br>\n- [ClawHub Skill Page](https://clawhub.ai/smyx-sunjinhui/skills/smyx-child-drowsiness-fatigue-detection-analysis) <br>\n- [API Documentation](references/api_doc.md) <br>\n- [Skill Demo](https://lifeemergence.com/sample.html) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [Text, Markdown, JSON, Guidance] <br>\n**Output Format:** [Markdown or JSON structured analysis reports] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May include fatigue metrics, fatigue score and level, drowsiness events, voice prompt text, summary text, and report links.] <br>\n\n## Skill Version(s): <br>\n1.0.4 (source: server release metadata; artifact frontmatter states 1.0.8) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nFile v1.0.4:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.4:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.3: 31 files, 40648 bytes\n\nFiles: references/api_doc.md (2460b), scripts/__init__.py (62b), scripts/config.py (691b), scripts/config.yaml (3b), scripts/skill.py (577b), scripts/smyx_child_drowsiness_fatigue_detection_analysis.py (3625b), skill-card.md (3107b), SKILL.md (11740b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (473b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (167b)\n\nFile v1.0.3:SKILL.md\n\n---\nname: \"smyx-child-drowsiness-fatigue-detection-analysis\"\ndescription: \"Using a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。\"\nversion: \"1.0.6\"\nlicense: \"MIT-0\"\n---\n\n# 😴 Child Drowsiness / Fatigue Detection | 儿童打瞌睡/疲劳检测\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **儿童打瞌睡/疲劳检测** |\n| 🎯 核心目标 | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_CHILD_DROWSINESS_FATIGUE_DETECTION_ANALYSIS` |\n\nUsing a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). The skill helps teachers or parents detect drowsiness in time and adjust learning schedules or remind the child to rest. Application scenarios: classrooms, home desks, online classes. The system monitors in real time and, when the fatigue index exceeds a threshold, pushes reminders or triggers voice prompts (e.g., 'kid, time to take a break'). Skill features: safeguarding sleep health.\n\n通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。应用场景：教室、家庭书桌、在线课堂。系统实时监测，当疲劳指数超过阈值时，推送提醒或触发语音提示（如'小朋友，休息一下吧'）。技能特点：保障睡眠健康。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的儿童学习疲劳监测 AI。你的任务是分析儿童面部视频，检测眼部闭合状态和头部点头动作，计算疲劳指数。不要提供医疗诊断或睡眠障碍诊断，仅输出基于视觉的疲劳评估结果与方向性休息提醒。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于教室/家庭书桌摄像头视频，量化儿童眼部闭合（PERCLOS）+ 点头动作 + 眼部光泽度变化，输出 0-100 疲劳指数与等级判定\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 儿童面部检测 |\n| 2 | 眼部状态识别（闭合 / 半闭 / 睁开） |\n| 3 | PERCLOS 计算 |\n| 4 | 连续闭眼时长 |\n| 5 | 眨眼频次 |\n| 6 | 点头次数与角度 |\n| 7 | 眼部光泽度变化 |\n| 8 | 疲劳综合得分（0-100） |\n| 9 | 疲劳等级（alert / mild_fatigue / moderate_fatigue / drowsy） |\n| 10 | 打瞌睡事件列表 |\n| 11 | 语音提醒文本生成 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供儿童面部学习区域视频 URL 或文件需要分析时，默认触发本技能进行打瞌睡/疲劳检测 |\n| 🔎 明确分析意图 | 当用户明确提及打瞌睡、疲劳、困倦、PERCLOS、点头、眨眼、上课走神、写作业犯困、智能台灯疲劳提醒等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看儿童疲劳历史报告、打瞌睡报告清单、疲劳指数报告清单、查询历史疲劳记录、显示所有儿童疲劳检测报告、显示儿童睡眠健康诊断报告，查询疲劳提醒清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备儿童面部学习区域视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 系统自动完成身份关联 | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行儿童打瞌睡/疲劳检测 | 调用 `-m scripts.smyx_child_drowsiness_fatigue_detection_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地儿童面部学习区域视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络儿童面部学习区域视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，儿童学习疲劳监测场景默认 `other` | 按需填写 |\n| `--list` | 显示儿童打瞌睡/疲劳历史检测报告列表清单（可以输入起始日期参数过滤数据范围） | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_child_drowsiness_fatigue_detection_analysis.py`](scripts/smyx_child_drowsiness_fatigue_detection_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov 视频，最大 10MB；建议正对面部、≥ 15 FPS |\n| 🧑‍⚖️ 结果性质 | 检测结果仅作为学习/课堂辅助参考，本工具不替代家长/教师的实际观察与教育判断，疑似长期严重困倦请就医 |\n| 🔏 隐私合规 | 隐私合规：儿童学习场景视频涉及未成年人隐私，使用前需取得监护人知情同意，并妥善保管/加密相关录像 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input /path/to/class.mp4\n\n# 分析网络儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --url https://example.com/class.mp4\n\n# 显示历史儿童疲劳检测报告（自动触发关键词：查看儿童疲劳历史报告、打瞌睡报告清单等）\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --output result.json\n```\n\nFile v1.0.3:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-child-drowsiness-fatigue-detection-analysis\",\n  \"version\": \"1.0.3\",\n  \"publishedAt\": 1784210370326\n}\n\nFile v1.0.3:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放儿童打瞌睡/疲劳检测 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动儿童疲劳检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取分析结果（疲劳指数 + 提醒）\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史疲劳检测记录\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出完整报告\n\n## 场景代码\n\n- `SMYX_CHILD_DROWSINESS_FATIGUE_DETECTION_ANALYSIS` - 儿童打瞌睡/疲劳检测\n\n## 输入约束\n\n- 摄像头建议正对儿童面部（教室或书桌正前方/智能台灯内置）\n- 视频帧率建议 ≥ 15 FPS，确保眼部状态采样精度\n- 光照均匀，避免逆光或镜片反光遮挡眼部\n\n## 关键观测指标\n\n- `perclos` - 单位时间内眼睛闭合超过 80% 的时间占比（0-1）\n- `eye_closure_duration_sec` - 最长一次连续闭眼秒数\n- `blink_rate_per_min` - 眨眼频次（次/分钟）\n- `nod_frequency_per_min` - 点头次数（次/分钟，快速下点后抬起）\n- `head_drop_angle_deg` - 单次最大头部下垂角度（°）\n- `eye_region_glossiness_drop` - 眼部光泽度变化（参考特征）\n\n## 疲劳指数（0-100，综合得分）\n\n- 0-30 - 清醒（alert）\n- 30-50 - 轻度疲劳（mild_fatigue）\n- 50-70 - 中度疲劳（moderate_fatigue）\n- 70-100 - 重度疲劳/疑似打瞌睡（drowsy）\n\n## 默认告警阈值（可由调用方覆盖）\n\n- PERCLOS 阈值：> 0.4 触发疲劳预警\n- 连续闭眼阈值：> 2 秒（疑似瞌睡）\n- 疲劳指数阈值：> 70 → 触发语音提醒\n\n## 输出字段（参考）\n\n- `child_detected` - 是否检测到儿童\n- `fatigue_metrics` - 各项疲劳指标数值（perclos / eye_closure_duration_sec / blink_rate_per_min / nod_frequency_per_min / head_drop_angle_deg）\n- `fatigue_score` - 综合疲劳指数（0-100）\n- `fatigue_level` - 疲劳等级（alert / mild_fatigue / moderate_fatigue / drowsy）\n- `drowsiness_events` - 打瞌睡事件列表（时间戳 + 持续秒数 + 类型）\n- `voice_prompt` - 语音提醒文本（如\"小朋友，休息一下吧\"）\n- `summary` - 当次会话疲劳统计摘要\n\n> 仅输出基于视觉的疲劳评估结果与方向性休息提醒，不提供医学诊断或睡眠障碍诊断。\n\nFile v1.0.3:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.3:scripts/config.yaml\n\n{}\n\nFile v1.0.3:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.3:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.3:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.3:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: prod\n\nFile v1.0.3:skill-card.md\n\n## Description: <br>\nAnalyzes child or student facial video from a classroom, desk, or online learning setting to estimate drowsiness indicators such as eye closure, PERCLOS, nodding, eye-region glossiness changes, and a 0-100 fatigue score. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nParents, guardians, teachers, and administrators can use this skill to analyze child learning-area video and generate structured fatigue indicators, rest reminders, and report links. It is intended as a visual fatigue-assessment aid, not as medical diagnosis or sleep-disorder diagnosis. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Sensitive child facial video can be uploaded or submitted to the configured cloud analysis service. <br>\nMitigation: Use only with clear parent, guardian, school, or administrator consent, and require explicit opt-in before any upload or URL-based analysis. <br>\nRisk: The skill can silently create or reuse an account-linked identity and retrieve report history. <br>\nMitigation: Deploy only where account-linked history retrieval is expected, disclosed to users, and limited to authorized administrators or guardians. <br>\nRisk: Local identity and token storage can expose account-linked access if the workspace is shared or poorly protected. <br>\nMitigation: Store the workspace on protected local storage, restrict file permissions, and review retention and token-handling policies before installation. <br>\nRisk: Fatigue scores and reminders may be mistaken for clinical findings. <br>\nMitigation: Present results as visual learning-support signals only, and avoid using the skill as medical diagnosis or sleep-disorder diagnosis. <br>\n\n\n## Reference(s): <br>\n- [ClawHub Skill Page](https://clawhub.ai/smyx-sunjinhui/skills/smyx-child-drowsiness-fatigue-detection-analysis) <br>\n- [Child Drowsiness Fatigue Detection API Documentation](artifact/references/api_doc.md) <br>\n- [SMYX Analysis API Documentation](artifact/skills/smyx_analysis/references/api_doc.md) <br>\n- [Skill Demo](https://lifeemergence.com/sample.html) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [text, markdown, shell commands, configuration, guidance] <br>\n**Output Format:** [Markdown and JSON-style structured analysis reports with fatigue metrics, event summaries, reminders, and report links.] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [Supports local video file input, video URL input, optional report-history listing, and optional output-file writing.] <br>\n\n## Skill Version(s): <br>\n1.0.3 (source: server release metadata; artifact frontmatter reports 1.0.6) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nFile v1.0.3:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.3:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.2: 31 files, 40406 bytes\n\nFiles: references/api_doc.md (2460b), scripts/__init__.py (62b), scripts/config.py (691b), scripts/config.yaml (3b), scripts/skill.py (577b), scripts/smyx_child_drowsiness_fatigue_detection_analysis.py (3625b), skill-card.md (2684b), SKILL.md (11740b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (473b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28605b), _meta.json (167b)\n\nFile v1.0.2:SKILL.md\n\n---\nname: \"smyx-child-drowsiness-fatigue-detection-analysis\"\ndescription: \"Using a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。\"\nversion: \"1.0.4\"\nlicense: \"MIT-0\"\n---\n\n# 😴 Child Drowsiness / Fatigue Detection | 儿童打瞌睡/疲劳检测\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **儿童打瞌睡/疲劳检测** |\n| 🎯 核心目标 | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_CHILD_DROWSINESS_FATIGUE_DETECTION_ANALYSIS` |\n\nUsing a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). The skill helps teachers or parents detect drowsiness in time and adjust learning schedules or remind the child to rest. Application scenarios: classrooms, home desks, online classes. The system monitors in real time and, when the fatigue index exceeds a threshold, pushes reminders or triggers voice prompts (e.g., 'kid, time to take a break'). Skill features: safeguarding sleep health.\n\n通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。应用场景：教室、家庭书桌、在线课堂。系统实时监测，当疲劳指数超过阈值时，推送提醒或触发语音提示（如'小朋友，休息一下吧'）。技能特点：保障睡眠健康。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的儿童学习疲劳监测 AI。你的任务是分析儿童面部视频，检测眼部闭合状态和头部点头动作，计算疲劳指数。不要提供医疗诊断或睡眠障碍诊断，仅输出基于视觉的疲劳评估结果与方向性休息提醒。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于教室/家庭书桌摄像头视频，量化儿童眼部闭合（PERCLOS）+ 点头动作 + 眼部光泽度变化，输出 0-100 疲劳指数与等级判定\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 儿童面部检测 |\n| 2 | 眼部状态识别（闭合 / 半闭 / 睁开） |\n| 3 | PERCLOS 计算 |\n| 4 | 连续闭眼时长 |\n| 5 | 眨眼频次 |\n| 6 | 点头次数与角度 |\n| 7 | 眼部光泽度变化 |\n| 8 | 疲劳综合得分（0-100） |\n| 9 | 疲劳等级（alert / mild_fatigue / moderate_fatigue / drowsy） |\n| 10 | 打瞌睡事件列表 |\n| 11 | 语音提醒文本生成 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供儿童面部学习区域视频 URL 或文件需要分析时，默认触发本技能进行打瞌睡/疲劳检测 |\n| 🔎 明确分析意图 | 当用户明确提及打瞌睡、疲劳、困倦、PERCLOS、点头、眨眼、上课走神、写作业犯困、智能台灯疲劳提醒等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看儿童疲劳历史报告、打瞌睡报告清单、疲劳指数报告清单、查询历史疲劳记录、显示所有儿童疲劳检测报告、显示儿童睡眠健康诊断报告，查询疲劳提醒清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备儿童面部学习区域视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 系统自动完成身份关联 | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行儿童打瞌睡/疲劳检测 | 调用 `-m scripts.smyx_child_drowsiness_fatigue_detection_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地儿童面部学习区域视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络儿童面部学习区域视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，儿童学习疲劳监测场景默认 `other` | 按需填写 |\n| `--list` | 显示儿童打瞌睡/疲劳历史检测报告列表清单（可以输入起始日期参数过滤数据范围） | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_child_drowsiness_fatigue_detection_analysis.py`](scripts/smyx_child_drowsiness_fatigue_detection_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov 视频，最大 10MB；建议正对面部、≥ 15 FPS |\n| 🧑‍⚖️ 结果性质 | 检测结果仅作为学习/课堂辅助参考，本工具不替代家长/教师的实际观察与教育判断，疑似长期严重困倦请就医 |\n| 🔏 隐私合规 | 隐私合规：儿童学习场景视频涉及未成年人隐私，使用前需取得监护人知情同意，并妥善保管/加密相关录像 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input /path/to/class.mp4\n\n# 分析网络儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --url https://example.com/class.mp4\n\n# 显示历史儿童疲劳检测报告（自动触发关键词：查看儿童疲劳历史报告、打瞌睡报告清单等）\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --output result.json\n```\n\nFile v1.0.2:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-child-drowsiness-fatigue-detection-analysis\",\n  \"version\": \"1.0.2\",\n  \"publishedAt\": 1783501167089\n}\n\nFile v1.0.2:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放儿童打瞌睡/疲劳检测 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动儿童疲劳检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取分析结果（疲劳指数 + 提醒）\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史疲劳检测记录\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出完整报告\n\n## 场景代码\n\n- `SMYX_CHILD_DROWSINESS_FATIGUE_DETECTION_ANALYSIS` - 儿童打瞌睡/疲劳检测\n\n## 输入约束\n\n- 摄像头建议正对儿童面部（教室或书桌正前方/智能台灯内置）\n- 视频帧率建议 ≥ 15 FPS，确保眼部状态采样精度\n- 光照均匀，避免逆光或镜片反光遮挡眼部\n\n## 关键观测指标\n\n- `perclos` - 单位时间内眼睛闭合超过 80% 的时间占比（0-1）\n- `eye_closure_duration_sec` - 最长一次连续闭眼秒数\n- `blink_rate_per_min` - 眨眼频次（次/分钟）\n- `nod_frequency_per_min` - 点头次数（次/分钟，快速下点后抬起）\n- `head_drop_angle_deg` - 单次最大头部下垂角度（°）\n- `eye_region_glossiness_drop` - 眼部光泽度变化（参考特征）\n\n## 疲劳指数（0-100，综合得分）\n\n- 0-30 - 清醒（alert）\n- 30-50 - 轻度疲劳（mild_fatigue）\n- 50-70 - 中度疲劳（moderate_fatigue）\n- 70-100 - 重度疲劳/疑似打瞌睡（drowsy）\n\n## 默认告警阈值（可由调用方覆盖）\n\n- PERCLOS 阈值：> 0.4 触发疲劳预警\n- 连续闭眼阈值：> 2 秒（疑似瞌睡）\n- 疲劳指数阈值：> 70 → 触发语音提醒\n\n## 输出字段（参考）\n\n- `child_detected` - 是否检测到儿童\n- `fatigue_metrics` - 各项疲劳指标数值（perclos / eye_closure_duration_sec / blink_rate_per_min / nod_frequency_per_min / head_drop_angle_deg）\n- `fatigue_score` - 综合疲劳指数（0-100）\n- `fatigue_level` - 疲劳等级（alert / mild_fatigue / moderate_fatigue / drowsy）\n- `drowsiness_events` - 打瞌睡事件列表（时间戳 + 持续秒数 + 类型）\n- `voice_prompt` - 语音提醒文本（如\"小朋友，休息一下吧\"）\n- `summary` - 当次会话疲劳统计摘要\n\n> 仅输出基于视觉的疲劳评估结果与方向性休息提醒，不提供医学诊断或睡眠障碍诊断。\n\nFile v1.0.2:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.2:scripts/config.yaml\n\n{}\n\nFile v1.0.2:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.2:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.2:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.2:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: prod\n\nFile v1.0.2:skill-card.md\n\n## Description: <br>\nAnalyzes classroom or home desk video for child drowsiness signals such as PERCLOS, nodding, and eye-region changes, then returns a fatigue score, level, reminders, and report links. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nExternal users such as teachers, parents, or classroom-support developers use this skill to submit child study-area video or video URLs for visual drowsiness and fatigue assessment and report-history retrieval. The output is an auxiliary observation aid, not a medical diagnosis. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Children's video or video URLs are sent to a vendor cloud service. <br>\nMitigation: Use only with guardian or school consent, confirm retention and deletion terms, and avoid sending footage that is not needed for the fatigue assessment. <br>\nRisk: The skill creates or reuses a local identity and stores tokens for report history. <br>\nMitigation: Run in a controlled workspace, restrict access to the workspace data directory, and review token storage and account access before deployment. <br>\nRisk: Fatigue results could be mistaken for medical or sleep-disorder diagnosis. <br>\nMitigation: Present results as visual fatigue indicators and direct users to qualified professionals for persistent or severe concerns. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/smyx-sunjinhui/skills/smyx-child-drowsiness-fatigue-detection-analysis) <br>\n- [Skill demo](https://lifeemergence.com/sample.html) <br>\n- [Child drowsiness fatigue detection API documentation](references/api_doc.md) <br>\n- [Common analysis API documentation](skills/smyx_analysis/references/api_doc.md) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [text, markdown, JSON, shell commands, guidance] <br>\n**Output Format:** [Markdown text with structured JSON report content, history tables, reminders, and report links.] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May save analysis output to a user-specified file; report history is retrieved from the vendor cloud service.] <br>\n\n## Skill Version(s): <br>\n1.0.2 (source: server release metadata; artifact frontmatter says 1.0.4) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nFile v1.0.2:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.2:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3","readmeExcerpt":"Skill: Child Drowsiness / Fatigue Detection | 儿童打瞌睡/疲劳检测 Owner: smyx-sunjinhui Summary: Using a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-regio","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"python -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list"},{"language":"text","snippet":"requests>=2.28.0"},{"language":"bash","snippet":"# 分析本地儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input /path/to/class.mp4\n\n# 分析网络儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --url https://example.com/class.mp4\n\n# 显示历史儿童疲劳检测报告（自动触发关键词：查看儿童疲劳历史报告、打瞌睡报告清单等）\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --output result.json"},{"language":"bash","snippet":"python -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list"},{"language":"text","snippet":"requests>=2.28.0"},{"language":"bash","snippet":"# 分析本地儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input /path/to/class.mp4\n\n# 分析网络儿童学习面部视频\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --url https://example.com/class.mp4\n\n# 显示历史儿童疲劳检测报告（自动触发关键词：查看儿童疲劳历史报告、打瞌睡报告清单等）\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_child_drowsiness_fatigue_detection_analysis --input class.mp4 --output result.json"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: \"smyx-child-drowsiness-fatigue-detection-analysis\"\ndescription: \"Using a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。\"\nversion: \"1.0.16\"\nlicense: \"MIT-0\"\n---\n\n# 😴 Child Drowsiness / Fatigue Detection | 儿童打瞌睡/疲劳检测\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **儿童打瞌睡/疲劳检测** |\n| 🎯 核心目标 | 通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_CHILD_DROWSINESS_FATIGUE_DETECTION_ANALYSIS` |\n\nUsing a fixed camera in the classroom or above the home desk, the system analyzes the child's (student's) facial video in real time, detecting eye closure ratio (PERCLOS — the proportion of time eyes are closed more than 80% within a unit time), head-nodding frequency (rapid downward nod followed by lift), and changes in eye-region glossiness, and computes a comprehensive fatigue index (0-100). The skill helps teachers or parents detect drowsiness in time and adjust learning schedules or remind the child to rest. Application scenarios: classrooms, home desks, online classes. The system monitors in real time and, when the fatigue index exceeds a threshold, pushes reminders or triggers voice prompts (e.g., 'kid, time to take a break'). Skill features: safeguarding sleep health.\n\n通过教室或家庭书桌的固定摄像头，实时分析儿童（学生）的面部视频，检测眼部闭合比例（PERCLOS，单位时间内眼睛闭合超过80%的时间占比）、点头动作频率（头部快速下点后抬起）以及眼部区域的光泽度变化，综合计算疲劳指数（0-100）。该技能可帮助教师或家长及时发现儿童困倦状态，调整学习安排或提醒休息。应用场景：教室、家庭书桌、在线课堂。系统实时监测，当疲劳指数超过阈值时，推送提醒或触发语音提示（如'小朋友，休息一下吧'）。技能特点：保障睡眠健康。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的儿童学习疲劳监测 AI。你的任务是分析儿童面部视频，检测眼部闭合状态和头部点头动作，计算疲劳指数。不要提供医疗诊断或睡眠障碍诊断，仅输出基于视觉的疲劳评估结果与方向性休息提醒。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于教室/家庭书桌摄像头视频，量化儿童眼部闭合（PERCLOS）+ 点头动作 + 眼部光泽度变化，输出 0-100 疲劳指数与等级判定\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 儿童面部检测 |\n| 2 | 眼部状态识别（闭合 / 半闭 / 睁开） |\n| 3 | PERCLOS 计算 |\n| 4 | 连续闭眼时长 |\n| 5 | 眨眼频次 |\n| 6 | 点头次数与角度 |\n| 7 | 眼部光泽度变化 |\n| 8 | 疲劳综合得分（0-100） |\n| 9 | 疲劳等级（alert / mild_fatigue / moderate_fatigue / drowsy） |\n| 10 | 打瞌睡事件列表 |\n| 11 | 语音提醒文本生成 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供儿童面部学习区域视频 URL 或文件需要分析时，默认触发本技能进行打瞌睡/疲劳检测 |\n| 🔎 明确分析意图 | 当用户明确提及打瞌睡、疲劳、困倦、PERCLOS、点头、眨眼、上课走神、写作业犯困、智能台灯疲劳提醒等关键词，并且上传了视频文件 |\n| 📚 历史报告查询"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-child-drowsiness-fatigue-detection-analysis\",\n  \"version\": \"1.0.11\",\n  \"publishedAt\": 1790938528320\n}"},{"path":"references/api_doc.md","content":"# API 接口文档\n\n此处用于存放儿童打瞌睡/疲劳检测 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动儿童疲劳检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取分析结果（疲劳指数 + 提醒）\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史疲劳检测记录\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出完整报告\n\n## 场景代码\n\n- `SMYX_CHILD_DROWSINESS_FATIGUE_DETECTION_ANALYSIS` - 儿童打瞌睡/疲劳检测\n\n## 输入约束\n\n- 摄像头建议正对儿童面部（教室或书桌正前方/智能台灯内置）\n- 视频帧率建议 ≥ 15 FPS，确保眼部状态采样精度\n- 光照均匀，避免逆光或镜片反光遮挡眼部\n\n## 关键观测指标\n\n- `perclos` - 单位时间内眼睛闭合超过 80% 的时间占比（0-1）\n- `eye_closure_duration_sec` - 最长一次连续闭眼秒数\n- `blink_rate_per_min` - 眨眼频次（次/分钟）\n- `nod_frequency_per_min` - 点头次数（次/分钟，快速下点后抬起）\n- `head_drop_angle_deg` - 单次最大头部下垂角度（°）\n- `eye_region_glossiness_drop` - 眼部光泽度变化（参考特征）\n\n## 疲劳指数（0-100，综合得分）\n\n- 0-30 - 清醒（alert）\n- 30-50 - 轻度疲劳（mild_fatigue）\n- 50-70 - 中度疲劳（moderate_fatigue）\n- 70-100 - 重度疲劳/疑似打瞌睡（drowsy）\n\n## 默认告警阈值（可由调用方覆盖）\n\n- PERCLOS 阈值：> 0.4 触发疲劳预警\n- 连续闭眼阈值：> 2 秒（疑似瞌睡）\n- 疲劳指数阈值：> 70 → 触发语音提醒\n\n## 输出字段（参考）\n\n- `child_detected` - 是否检测到儿童\n- `fatigue_metrics` - 各项疲劳指标数值（perclos / eye_closure_duration_sec / blink_rate_per_min / nod_frequency_per_min / head_drop_angle_deg）\n- `fatigue_score` - 综合疲劳指数（0-100）\n- `fatigue_level` - 疲劳等级（alert / mild_fatigue / moderate_fatigue / drowsy）\n- `drowsiness_events` - 打瞌睡事件列表（时间戳 + 持续秒数 + 类型）\n- `voice_prompt` - 语音提醒文本（如\"小朋友，休息一下吧\"）\n- `summary` - 当次会话疲劳统计摘要\n\n> 仅输出基于视觉的疲劳评估结果与方向性休息提醒，不提供医学诊断或睡眠障碍诊断。"},{"path":"skills/smyx_analysis/references/api_doc.md","content":"# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |"},{"path":"scripts/config.yaml","content":"{}"}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":null,"editorialQuality":{"score":100,"threshold":65,"status":"thin","wordCount":1026,"uniquenessScore":43,"reasons":["uniqueness-below-45"]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-10T03:53:15.048Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-10T03:53:15.048Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-10T09:09:50.183Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}