一、FiftyOne概述
FiftyOne是用于构建高质量数据集和计算机视觉模型的开源工具,由Python语言实现,支持Windows、Linux、macOS平台。FiftyOne 的设计目的是提供对数据集和标签的用户友好的视图 (包括注释和模型预测),可以使我们更快、更有效地可视化数据集和解释模型,从而增强机器学习工作流程。
1.FiftyOne核心能力
-
导入数据集进行操作,轻松管理数据。
- 支持通用格式与自定义格式
评估模型。
使嵌入数据和模型可视化。
查找标注错误。
管理数据集去除冗余图像。
2.FiftyOne核心概念:
- Python库:提供的Python接口可轻松以多种常见格式加载数据集,并提供以自定义格式加载数据集。
- App:一个图形用户界面,可快速直观了解数据集。
- Brain:强大的机器学习驱动功能库,可提供对数据集的洞察并推荐修改数据集的方法,从而提高模型的性能。
3.应用范围
- Evaluating object detections
- Evaluating a classifier
- Using image embeddings
- Annotating with CVAT
- Working with Open Images
- Exploring image uniqueness
- Finding class mistakes
- Finding detection mistakes
4.FiftyOne加载各种环境的数据
1)加载本地数据
# On local machine
import fiftyone as fo
dataset = fo.Dataset("my-dataset")
session = fo.launch_app(dataset) # (optional) port=XXXX
2)远程数据
-
通过ssh访问
-
在远程机器上使用 Python加载数据集并启动远程会话
# On remote machine import fiftyone as fo dataset = fo.load_dataset(...) session = fo.launch_app(dataset, remote=True) # optional: port=XXXX
-
在本地计算机上打开一个新的终端窗口并执行以下命令来设置端口转发以连接到远程会话
# On local machine ssh -N -L 5151:127.0.0.1:5151 [<username>@]<hostname>
- 保持此进程运行并在浏览器中打开http://localhost:5151以访问该应用程序。
-
如果在本地计算机上安装了 FiftyOne,您可以 使用 CLI自动配置端口转发并在浏览器中打开应用程序
# On local machine fiftyone app connect --destination [<username>@]<hostname>
-
3)云储存
You can work with data in cloud storage buckets in FiftyOne by mounting the buckets as local drives on a cloud compute instance. Such as AWS, Google Cloud, and Miscrosoft Azure.
二、CVAT概述
CVAT(Computer Vision Annotation Tool) 是由intel开源的,用于计算机视觉的免费、在线、交互式视频和图像注释工具。它支持监督与对象检测、图像分类和图像分割有关的机器学习任务。它使用户能够用四种类型的形状注释图像:框、多边形、折线和点 。
1.内部结构图
CVAT 容器运行supervisord进程,该进程在 Django* 环境中生成一些 Python* 进程。
-
Django 环境与两个数据库服务器一起工作。Redis* 服务器存储有关任务队列状态的信息,CVAT 数据库包含有关任务、用户、注释等的所有信息。PostgreSQL(以及开发期间的 SQLite3)用作 CVAT 的数据库管理系统. 所有数据都存储在cvat db volume中。以下卷被挂载到 CVAT 容器中:
- cvat data volume
- cvat keys volume
- cvat logs volume
- cvat shared volume
分析系统包含包装在 Docker 容器中的 Elasticsearch、Logstash 和 Kibana。保存工作后,包括日志在内的所有数据都将传输到服务器。服务器将其传输到 Logstash 中进行过滤,然后日志被传输到 Elasticsearch,并存储在 cvat 事件卷中。之后,用户可以在 Kibana 中查看统计信息和日志。
三、FiftyOne与CVAT安装方法
1.FiftyOne安装
FiftyOne 目前需要 Python 3.6 - 3.9
sudo pip3 install fiftyone
# 如果要使用视频数据集,还要安装ffmpeg
sudo apt install -y ffmpeg
# 卸载FiftyOne
sudo pip3 uninstall fiftyone fiftyone-brain fiftyone-db
测试FiftyOne
import fiftyone as fo
import fiftyone.zoo as foz
dataset = foz.load_zoo_dataset("quickstart")
session = fo.launch_app(dataset)
- App launched. Point your web browser to http://localhost:5151
创建 Python 虚拟环境
2.CVAT安装
1)通过docker安装
git clone https://github.com/opencv/cvat
cd cvat
export CVAT_HOST=your-ip-address
docker-compose up -d
# 为cvat创建superuser
docker exec -it cvat bash -ic 'python3 ~/manage.py createsuperuser'
2)添加共享目录
在cvat目录下添加 docker-compose.override.yml
version: '3.3'
services:
cvat:
environment:
CVAT_SHARE_URL: 'Mounted from {/home/xbkj/nfs} host directory'
volumes:
- cvat_share:/home/django/share:ro
volumes:
cvat_share:
driver_opts:
type: none
device: /home/xbkj/nfs
o: bind
-
注意:CVAT new task时候,即使从share files加载图片,也会保存副本到openvino/cvat_server容器的/home/django/data/data。
django@ef49752df789:~/data$ tree data data/ ├── 2 │ ├── compressed │ │ └── 0.zip │ ├── original │ │ └── 0.zip │ ├── preview.jpeg │ └── raw └── 3 ├── compressed │ └── 0.zip ├── original │ └── 0.zip ├── preview.jpeg └── raw
同时运行多个yml
docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d
四、CVAT使用说明
1.数据标注步骤
-
New annotation task
Name a task
Specify labels and their attributes
-
Choose files to download
- Datasets are loaded from the local file system or a mounted file system inside a container.
- A task can include one image archive, one video, a set or catalogue of images from shared storage.
additional options
image- To specify the URL of a Git-repository for data storage (Dataset Repository)
- To rotate all images 180 degrees (Flip Images)
- To support the layers for a segmentation task (Z-Order)
- To divide a huge dataset into a few smaller segments (Segment Size)
- To specify the quality of uploaded images (Image Quality)
-
Users can follow any link to start the annotation process.
- Each link inside the Jobs section corresponds to one segment.
image -
Users can use four shapes to annotate images: boxes, polygons (generally, for segmentation tasks), polylines (which can be useful for annotating roadmarks), and points (e.g., for annotating face landmarks or pose estimation).
image