Topic4APIR / README.md
ZevonLew's picture
Upload 104 files
e51808a verified
|
Raw History Blame Contribute Delete
8.24 kB
---
title: AI-Powered Image Recognition
emoji: 👁️
colorFrom: blue
colorTo: indigo
sdk: static
app_file: index.html
pinned: false
---
# AI-Powered Image Recognition
## 中文说明
课程入口:[ZevonLew/AI_Powered_Image_Recognition](https://huggingface.co/spaces/ZevonLew/AI_Powered_Image_Recognition)。本项目采用与 `wr92-course/test` 相同的 **Hugging Face Static Space** 方式:直接打开 `index.html`,三项识别在浏览器中运行。无需 Python 后端、Gradio、Docker 或 GPU 服务。
当前运行版本:`20261020-static-1`;图库版本:`20261022-natural-1`。人脸验证、静态手势、英文 OCR 的模型、阈值含义和原有图片保持不变;目录扩充为50例:7个人脸案例、18个手势案例、25个OCR案例。OCR分组“自然图片”保留原手写便条,新增公路牌、候车厅、公交站、商店营业时间、咖啡店门口菜单、超市价签和图书馆导引牌,共8例。新场景图均由AI生成,主文字已人工核对;原始PNG保存在教师素材目录,网页使用保持原分辨率的较小JPEG副本,并按需下载。手势的原共用分组改名为“未支持的手势”。七种命名手势为 Open_Palm、Closed_Fist、Victory、Thumb_Up、Thumb_Down、Pointing_Up、ILoveYou。样例名称描述输入意图,实际结果以模型输出为准。界面默认英文,支持独立中文切换;切换界面语言不会增加中文OCR能力。
图片、模型、运行库均保存在**本 Space 仓库**的 `samples/`、`models/`、`vendor/`,不访问 Dataset。`.gitattributes` 声明大文件存储规则,上传后由平台提供静态文件及文件CDN重定向;代码始终使用稳定的仓库相对路径,不保存会过期的CDN签名地址。下载入口与具体节点速度需要部署后验证。
首页只加载界面、样例目录和默认两张图片;人脸、手势和OCR运行库与模型在对应任务首次运行时才加载。两张人脸图并行下载,完成一张就显示一张;下载期间仍可切换任务、选择样例或上传图片。图片下载20秒超时后显示重试按钮,旧请求不会覆盖新输入,最多复用6张已解码样例。
部署:将教师包 `AI-Powered_Image_Recognition_HF_Static.zip` 解压,把**包内文件和目录直接上传到 Space 根目录**,包括 `.gitattributes`,不要再包一层 `test` 文件夹。README须包含 `sdk: static` 和 `app_file: index.html`。完整步骤及旧后端文件清单见 [DEPLOY_STATIC.md](DEPLOY_STATIC.md)。若通过Git发布,应按说明重新归一化指定大文件;只修改 `.gitattributes` 不会自动转换已有Git文件。
本地预览:在本目录执行 `python -m http.server 8765 --bind 127.0.0.1`,然后打开 `http://127.0.0.1:8765/`。Python仅用于本地静态预览,不是线上运行依赖。
模型为 face-api.js 0.22.2(Tiny Face Detector、68点、128维描述子)、MediaPipe Tasks Vision 0.10.18(最多两手、21点)和 Tesseract.js 5.1.1(英文LSTM数据)。人脸距离阈值越低越严格,手势分数阈值越高越严格,OCR布局6/11/7对应文本块/稀疏文字/单行。当前手势浏览器实现需要WebGL2,不再提供服务器CPU回退。本轮按用户要求不改造该图形兼容问题。
所有上传图片在当前浏览器中处理,不发送到推理服务器;应用不持久保存结果或人脸描述子。请使用合成或已获许可的图片。人脸验证不是身份证明,静态姿势不是手语翻译,OCR重要字符需要人工核对。合成样例不是总体准确率基准。
基础作业:任选一项任务及内置样例,固定输入,只改一个设置运行两次,提交两张截图及四至六句的一页报告;不要求账号、编程、部署、安装或训练,结果不变也有效。[HTML指南](how-to-start.html)与[PDF指南](how-to-start.pdf)提供操作步骤和选做拓展。模型来源和许可证见 [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。
## English
Course lab: [ZevonLew/AI_Powered_Image_Recognition](https://huggingface.co/spaces/ZevonLew/AI_Powered_Image_Recognition). This project uses a **Hugging Face Static Space**, following `wr92-course/test`: `index.html` is the entry and all three recognition tasks run in the browser. No Python backend, Gradio, Docker or GPU service runs on the hosted site.
Runtime release: `20261020-static-1`. Gallery release: `20261022-natural-1`. The models, threshold meanings and existing images are unchanged. The catalog now contains 50 cases: 7 face, 18 gesture and 25 OCR cases. The OCR group **Natural images** contains the existing handwritten note and seven new AI-generated scenes: a road sign, a waiting hall, a bus stop, shop opening hours, a sidewalk cafe menu, supermarket price labels and library directions. Their main visible text was checked manually. The teacher assets retain the original PNG files; the website downloads smaller JPEG copies at the original resolution only when selected. The gesture group is now called **Unsupported gestures**. The seven named gestures are Open_Palm, Closed_Fist, Victory, Thumb_Up, Thumb_Down, Pointing_Up and ILoveYou. Sample names describe intended inputs rather than guaranteed predictions. The interface defaults to English with a separate Chinese switch; changing the UI language does not add Chinese OCR.
Images, models and runtime libraries belong to **this Space repository**, under `samples/`, `models/` and `vendor/`; the app does not access a Dataset. `.gitattributes` declares large-file storage rules. The platform serves static files and redirects large files to its file CDN. The app uses stable repository-relative paths, never expiring signed CDN URLs. Verify actual redirects and node-specific speed after deployment.
The home page loads only the interface, sample catalog and default image pair. Each task's libraries and models load on first use. Face images download in parallel and display independently. Task changes, sample selection and uploads remain available during sample downloads. Downloads time out after 20 seconds with a retry button; stale requests cannot overwrite newer inputs. At most six decoded sample images are reused.
Deployment: extract the instructor's `AI-Powered_Image_Recognition_HF_Static.zip` and upload **its contents directly to the Space root**, including `.gitattributes`, preserving folders. Do not add an enclosing `test` folder. Keep `sdk: static` and `app_file: index.html` in README. See [DEPLOY_STATIC.md](DEPLOY_STATIC.md) for upload steps, obsolete backend files and Git large-file normalization.
Local preview: run `python -m http.server 8765 --bind 127.0.0.1` in this directory and open `http://127.0.0.1:8765/`. Python serves local preview files only; it is not a hosted runtime dependency.
Models are face-api.js 0.22.2 (Tiny Face Detector, 68 landmarks, 128-value descriptors), MediaPipe Tasks Vision 0.10.18 (up to two hands, 21 landmarks) and Tesseract.js 5.1.1 with English LSTM data. Lower face distance thresholds and higher gesture score thresholds are stricter. OCR modes 6/11/7 mean a block, sparse text and a line. The existing browser gesture implementation needs WebGL2; server CPU fallback has been removed, as requested for this Static migration.
Uploaded images are processed locally in the current browser and are not sent to an inference server. The app does not persist results or face descriptors. Use synthetic or permitted images. Face verification is not identity proof, static poses are not sign-language translation, and important OCR characters need manual checking. Synthetic examples do not establish general accuracy.
Core assignment: choose one task and a supplied input, keep the input fixed, run twice with one changed setting, and submit a one-page report with two screenshots and four to six sentences. No account, coding, deployment, installation or training is required; an unchanged result is valid. The [HTML guide](how-to-start.html) and [PDF guide](how-to-start.pdf) include steps and optional extensions. Sources and licenses remain in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).