跳到正文
Skillpedia
智能体48k · #4844

hugging-face-vision-trainer

它能做什么

这个工具用于训练 AI 模型理解图片。它可以学会识别物体、对图片进行分类,或者分割图片的某些部分。训练全部借助强大的云端计算机完成,并会自动保存结果。

适用场景

  • ✓当你想教 AI 识别照片中的特定物体时。
  • ✓当你想让 AI 给图片分类(例如猫、狗、汽车)时。
  • ✓当你想训练 AI 把图片中的某些部分分离出来,比如背景时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/hugging-face-vision-trainer/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/hugging-face-vision-trainer/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“训练一个模型,使用我的数据集“my-dog-dataset”来检测照片中的狗。”

每周 5 个新技能,1 分钟读完。

工作原理

你需要提供图片数据,并告诉 AI 要学习什么(目标检测、分类或分割)。AI 会利用云端计算机从你的数据中学习,并为你保存训练好的模型。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Vision Model Training on Hugging Face Jobs

Train object detection, image classification, and SAM/SAM2 segmentation models on managed cloud GPUs. No local GPU setup required—results are automatically saved to the Hugging Face Hub.

Detailed Guide

Read the detailed guide before executing this skill. It retains the complete procedure and reference material. Treat its safety, prerequisites, and validation requirements as mandatory. For focused work, load the relevant sections; for end-to-end work, read the guide completely.

When to Use This Skill

Use this skill when users want to:

  • Fine-tune object detection models (D-FINE, RT-DETR v2, DETR, YOLOS) on cloud GPUs or local
  • Fine-tune image classification models (timm: MobileNetV3, MobileViT, ResNet, ViT/DINOv3, or any Transformers classifier) on cloud GPUs or local
  • Fine-tune SAM or SAM2 models for segmentation / image matting using bbox or point prompts
  • Train bounding-box detectors on custom datasets
  • Train image classifiers on custom datasets
  • Train segmentation models on custom mask datasets with prompts
  • Run vision training jobs on Hugging Face Jobs infrastructure
  • Ensure trained vision models are permanently saved to the Hub

Prerequisites Checklist

Before starting any training job, verify:

Account & Authentication

  • Hugging Face Account with Pro, Team, or Enterprise plan (Jobs require paid plan)
  • Authenticated login: Check with hf_whoami() (tool) or hf auth whoami (terminal)
  • Token has write permissions
  • MUST pass token in job secrets — see directive #3 below for syntax (MCP tool vs Python API)

Dataset Requirements — Object Detection

  • Dataset must exist on Hub
  • Annotations must use the objects column with bbox, category (and optionally area) sub-fields
  • Bboxes can be in xywh (COCO) or xyxy (Pascal VOC) format — auto-detected and converted
  • Categories can be integers or strings — strings are auto-remapped to integer IDs
  • image_id column is optional — generated automatically if missing
  • ALWAYS validate unknown datasets before GPU training (see Dataset Validation section)

Dataset Requirements — Image Classification

  • Dataset must exist on Hub
  • Must have an image column (PIL images) and a label column (integer class IDs or strings)
  • The label column can be ClassLabel type (with names) or plain integers/strings — strings are auto-remapped
  • Common column names auto-detected: label, labels, class, fine_label
  • ALWAYS validate unknown datasets before GPU training (see Dataset Validation section)

Dataset Requirements — SAM/SAM2 Segmentation

  • Dataset must exist on Hub
  • Must have an image column (PIL images) and a mask column (binary ground-truth segmentation mask)
  • Must have a prompt — either:
    • A prompt column with JSON containing {"bbox": [x0,y0,x1,y1]} or {"point": [x,y]}
    • OR a dedicated bbox column with [x0,y0,x1,y1] values
    • OR a dedicated point column with [x,y] or [[x,y],...] values
  • Bboxes should be in xyxy format (absolute pixel coordinates)
  • Example dataset: merve/MicroMat-mini (image matting with bbox prompts)
  • ALWAYS validate unknown datasets before GPU training (see Dataset Validation section)

Critical Settings

  • Timeout must exceed expected training time — Default 30min is TOO SHORT. See directive #6 for recommended values.
  • Hub push must be enabled — push_to_hub=True, hub_model_id="username/model-name", token in secrets

Limitations

  • Use this skill only when the task clearly matches its upstream product or API scope.
  • Verify commands, API behavior, pricing, quotas, credentials, and deployment effects against current official documentation before making changes.
  • Do not treat generated examples as a substitute for environment-specific tests, security review, or user approval for destructive or costly actions.
常见问题

我需要高性能电脑吗?

不需要。训练在强大的云端计算机(Hugging Face Jobs)上完成,你只需要一个付费的 Hugging Face 账号。

结果保存在哪里?

训练好的模型会自动保存到 Hugging Face Hub,这是一个用来分享模型的在线平台。

我的数据需要特定格式吗?

需要。你的图片数据要根据训练目标(目标检测、分类或分割)整理在 Hugging Face Hub 上,并附带相应的标注。

详情

作者的原始描述

Train object detection, image classification, and SAM or SAM2 segmentation models locally or on Hugging Face Jobs, with dataset validation and results saved to the Hub.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#4844
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能