From 96d521be98e407c66a1b7d055cf31ce44c173ba3 Mon Sep 17 00:00:00 2001 From: 2509165008 <2509165008@student.edu.cn> Date: Thu, 25 Jun 2026 15:54:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 736 -------------------- data/images/标注练习1.jpg | Bin 0 -> 41330 bytes data/reviews.json | 7 + detection_label/0000264_03801_d_0000213.jpg | Bin 158488 -> 0 bytes detection_label/9999937_00000_d_0000063.jpg | Bin 332128 -> 0 bytes detection_label/9999937_00000_d_0000073.jpg | Bin 440245 -> 0 bytes detection_label/9999956_00000_d_0000049.jpg | Bin 292537 -> 0 bytes detection_label/9999964_00000_d_0000083.jpg | Bin 174502 -> 0 bytes detection_label/9999972_00000_d_0000053.jpg | Bin 411254 -> 0 bytes detection_label/9999984_00000_d_0000096.jpg | Bin 320763 -> 0 bytes detection_label/9999985_00000_d_0000021.jpg | Bin 236865 -> 0 bytes detection_label/9999998_00302_d_0000255.jpg | Bin 720083 -> 0 bytes detection_label/9999999_00434_d_0000192.jpg | Bin 346568 -> 0 bytes project-14-22.json | 1 - project-14-22coco.zip | Bin 12686 -> 0 bytes q2_1_crawler/move.html | 102 +++ q2_1_crawler/movie.json | 102 +++ q2_1_crawler/q2_1.py | 65 ++ q2_1_crawler/q2_2.py | 43 ++ q3/q3_1/q3_1_image_label.zip | Bin 0 -> 893 bytes q3/q3_2/q3_2_takeout_reviews.json | 1 + q3/q3_3_质量自评.md | 13 + q4/q4_1/q4_1.py | 33 + q4/q4_1/q4_1_bar.png | Bin 0 -> 15637 bytes q4/q4_2/q4_2.py | 24 + q4/q4_2/q4_2_scatter.png | Bin 0 -> 30633 bytes q4/q4_3a/q4_3a.py | 19 + q4/q4_3a/q4_3a_hist.png | Bin 0 -> 19044 bytes q4/q4_3b/q4_3b.py | 19 + q4/q4_3b/q4_3b_hist.png | Bin 0 -> 19691 bytes 30 files changed, 428 insertions(+), 737 deletions(-) delete mode 100644 README.md create mode 100644 data/images/标注练习1.jpg create mode 100644 data/reviews.json delete mode 100644 detection_label/0000264_03801_d_0000213.jpg delete mode 100644 detection_label/9999937_00000_d_0000063.jpg delete mode 100644 detection_label/9999937_00000_d_0000073.jpg delete mode 100644 detection_label/9999956_00000_d_0000049.jpg delete mode 100644 detection_label/9999964_00000_d_0000083.jpg delete mode 100644 detection_label/9999972_00000_d_0000053.jpg delete mode 100644 detection_label/9999984_00000_d_0000096.jpg delete mode 100644 detection_label/9999985_00000_d_0000021.jpg delete mode 100644 detection_label/9999998_00302_d_0000255.jpg delete mode 100644 detection_label/9999999_00434_d_0000192.jpg delete mode 100644 project-14-22.json delete mode 100644 project-14-22coco.zip create mode 100644 q2_1_crawler/move.html create mode 100644 q2_1_crawler/movie.json create mode 100644 q2_1_crawler/q2_1.py create mode 100644 q2_1_crawler/q2_2.py create mode 100644 q3/q3_1/q3_1_image_label.zip create mode 100644 q3/q3_2/q3_2_takeout_reviews.json create mode 100644 q3/q3_3_质量自评.md create mode 100644 q4/q4_1/q4_1.py create mode 100644 q4/q4_1/q4_1_bar.png create mode 100644 q4/q4_2/q4_2.py create mode 100644 q4/q4_2/q4_2_scatter.png create mode 100644 q4/q4_3a/q4_3a.py create mode 100644 q4/q4_3a/q4_3a_hist.png create mode 100644 q4/q4_3b/q4_3b.py create mode 100644 q4/q4_3b/q4_3b_hist.png diff --git a/README.md b/README.md deleted file mode 100644 index d36b842..0000000 --- a/README.md +++ /dev/null @@ -1,736 +0,0 @@ -# 4-2 图像标注实战(Label Studio) - -## 学习目标 - -1. 掌握 Label Studio 的安装、启动与界面使用 -2. 学会配置三种图像标注类型(分类、目标检测、语义分割) -3. 独立完成边界框、多边形、关键点的标注 -4. 理解 VOC / YOLO / COCO 三种导出格式的区别 - ---- - -## 1. Label Studio 简介 - -### 1.1 一句话定义 - -**Label Studio**:一个开源的、**多模态**数据标注平台,支持图像、文本、语音、视频等几乎所有数据类型的标注与团队协作。 - -### 1.2 为什么选它 - -我们这门课统一用 Label Studio 的原因: - -| 需求 | Label Studio 对应能力 | -|------|---------------------| -| 多种数据类型 | 图像 / 文本 / 语音 / 视频 / 时序,一站式 | -| 不用写代码 | 通过 XML 标签可视化配置标注界面 | -| 团队协作 | 内置成员管理、角色权限、任务分配 | -| 格式灵活 | 内置 YOLO、COCO、VOC、JSON、CSV 导出 | -| 本地部署 | 数据不出学校,开源免费 | - -``` -传统方案(多工具切换): - 图像 → LabelImg - 文本 → Doccano - 语音 → Audacity / ELAN - 协作 → Excel 邮件 - -Label Studio 一站式: - 图像 / 文本 / 语音 / 协作 → Label Studio -``` - -### 1.3 与其他工具的对比 - -| 工具 | 类型 | 适用场景 | 本课程 | -|------|------|---------|--------| -| **Label Studio** | 开源/多模态 | 课程学习 / 中小团队 / 综合项目 | 主选 | -| LabelImg | 开源/图像 | 极简目标检测 | 仅做对比 | -| CVAT | 开源/图像视频 | 大型分割、视频跟踪 | 了解 | -| Doccano | 开源/文本 | 简单文本分类 | 已弃用 | -| Scale AI | 商业 | 企业级标注 | 了解 | - ---- - -## 2. Label Studio 安装与启动 - -### 2.1 环境要求 - -- Python 3.8 及以上 -- 浏览器(Chrome / Edge / Firefox) -- 建议 8G 以上内存 - -### 2.2 pip 安装(推荐) - -```bash -# 在命令行中执行 -pip install label-studio - -# 启动 Label Studio -label-studio -``` - -启动后命令行会显示: - -``` -[INFO] Label Studio is running at http://localhost:8080 -[INFO] Open it in your browser to start labeling -``` - -### 2.3 第一次打开 - -1. 浏览器访问 `http://localhost:8080` -2. 第一次进入需要 **Sign Up** 注册管理员账号(用你的邮箱 + 密码) -3. 注册后自动登录到主界面 - -``` -┌────────────────────────────────────────────────────────┐ -│ Label Studio │ -│ Sign Up │ -├────────────────────────────────────────────────────────┤ -│ │ -│ Email: [___________________________] │ -│ Username: [___________________________] │ -│ Password: [___________________________] │ -│ │ -│ [ Create Account ] │ -│ │ -└────────────────────────────────────────────────────────┘ -``` - -### 2.4 安装常见问题 - -| 问题 | 解决 | -|------|------| -| 端口 8080 被占用 | `label-studio --port 8001` | -| 启动报错找不到模块 | `pip install --upgrade label-studio` | -| 中文乱码 | 系统区域设置改为 UTF-8 | -| 浏览器无法打开 | 检查防火墙、放行端口 | - ---- - -## 3. 主界面导览 - -登录后看到的主界面: - -``` -┌──────────────────────────────────────────────────────────────┐ -│ [Label Studio] Projects Members Settings [用户头像] │ -├──────────────────────────────────────────────────────────────┤ -│ │ -│ My Projects │ -│ │ -│ ┌────────────────────────────────────────────────┐ │ -│ │ + Create Project │ │ -│ └────────────────────────────────────────────────┘ │ -│ │ -│ 没有任何项目,点上面按钮开始 │ -│ │ -└──────────────────────────────────────────────────────────────┘ -``` - -**主要功能区**: -- **Projects**:项目列表,每个项目对应一个标注任务 -- **Members**:成员管理(管理员可见) -- **Settings**:个人设置 - ---- - -## 4. 创建第一个项目:图像分类 - -### 4.1 任务说明 - -**任务**:对 10 张动物图片进行分类,类别有:cat / dog / bird - -### 4.2 创建项目 - -1. 点击 `+ Create Project` -2. 填写: - - **Project Name**:`animal_classification` - - **Description**:动物图片三分类 -3. 点击 `Save` - -### 4.3 配置标注界面 - -进入项目后,先点 `Settings` → `Labeling Interface` → `Code`: - -```xml - - - - - - - - -``` - -**逐行解释**: - -``` - ← 整个标注界面的根标签 - ← 显示图像($image 是任务数据里的字段名) - ← 单选/多选控件 - ← 一个选项 - -``` - -**关键参数**: -- `toName="image"`:告诉 Label Studio,这个控件是对上面 `Image` 控件的结果 -- `choice="single"`:单选(可选 `single-radio`、`multiple`) - -保存后点 `Label All Tasks` 就能看到标注界面。 - -### 4.4 导入数据 - -在项目页 → `Settings` → `Data Import`: - -**方式 A:上传本地文件** - -``` -1. 准备文件夹 - images/ - ├── cat_001.jpg - ├── cat_002.jpg - ├── dog_001.jpg - └── bird_001.jpg - -2. 拖拽到上传区域 - 或点击 Upload Files 选中文件夹 -``` - -**方式 B:上传 CSV / JSONL(推荐,标签稳定)** - -`tasks.csv`: - -```csv -image -images/cat_001.jpg -images/cat_002.jpg -images/dog_001.jpg -images/bird_001.jpg -``` - -**方式 C:粘贴 URL** - -```csv -image -https://example.com/cat_001.jpg -https://example.com/dog_001.jpg -``` - -上传完后点 `Save` → 任务列表里就会看到每一张图对应一行任务。 - -### 4.5 开始标注 - -1. 点击 `Label All Tasks` -2. 进入标注界面: - - 上面是图片 - - 下面是三个单选按钮 -3. 选中正确类别 -4. 点击右下角 `Submit` 进入下一张 -5. 全部完成后回到项目页,可以看到完成进度 - -``` -┌──────────────────────────────────────────────────┐ -│ Project: animal_classification │ -├──────────────────────────────────────────────────┤ -│ Tasks: 10 total / 7 done / 3 skipped │ -│ Progress: ████████████░░░░░░ 70% │ -└──────────────────────────────────────────────────┘ -``` - -### 4.6 导出数据 - -项目页 → `Export`: - -- 格式选 `JSON` -- 下载得到 `project-1-at-2024-05-20.json` - -导出内容示例: - -```json -[ - { - "id": 1, - "data": {"image": "images/cat_001.jpg"}, - "annotations": [{ - "result": [{ - "from_name": "label", - "to_name": "image", - "type": "choices", - "value": {"choices": ["cat"]} - }] - }] - } -] -``` - ---- - -## 5. 创建第二个项目:目标检测(边界框) - -### 5.1 任务说明 - -**任务**:对 10 张街景图进行目标检测,标出每张图中的 `person`、`car`、`bicycle` - -### 5.2 项目配置 XML - -```xml - - - - - -``` - -**新增标签**: -- ``:矩形框 + 标签(Label Studio 专门用于目标检测) -- `