Skip to content

Commit

Permalink
Update training docs. (#1234)
Browse files Browse the repository at this point in the history
  • Loading branch information
KazusaW1999 authored Aug 19, 2021
1 parent 5bd2f36 commit 22d91b9
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 297 deletions.
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ PaddleSeg是基于飞桨[PaddlePaddle](https://www.paddlepaddle.org.cn)开发的
* PaddleSeg二次开发教程
* [配置文件详解](./docs/design/use/use_cn.md)
* [如何创造自己的模型](./docs/design/create/add_new_model_cn.md)
* [模型训练](/docs/train/train.md)
* [模型训练](/docs/train/train_cn.md)
* [模型评估](./docs/evaluation/evaluate/evaluate.md)
* [模型导出](./docs/export/export/model_export.md)

Expand Down
135 changes: 4 additions & 131 deletions docs/data/transform/transform.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,137 +2,10 @@ English|[简体中文](transform_cn.md)
# Annotating Tutorial

Whether it is semantic segmentation, panoramic segmentation, or instance segmentation, we all need sufficient training data. If you want to use an unlabeled original dataset for segmentation tasks, you must first annotate the original image. If you are using a dataset with segmentation annotations such as `Cityscapes`, you can skip this step.
- This document will provide tutorials for using 2 kinds of labeling tools: [EISeg](#1、EISeg), [LabelMe](#2、LabelMe).
- This document will provide tutorials for using 2 kinds of labeling tools: EISeg, LabelMe.

# 1、EISeg

EISeg(Efficient Interactive Segmentation) is an efficient and intelligent interactive segmentation and annotation software developed based on [PaddlePaddle](https://www.paddlepaddle.org.cn/). It covers high-quality interactive segmentation models in different directions such as high-precision and lightweight, which is convenient for developers to quickly implement semantic and instance label labeling, and reduce labeling costs. In addition, by applying the annotations obtained by EISeg to other segmentation models provided by PaddleSeg for training, a high-precision model of a customized scene can be obtained, and the entire process of segmentation tasks from data annotation to model training and prediction can be opened up.

## Demo

![eiseg-demo](../../images/eiseg_demo.gif)

## <span id = "jump">Model Preparation</span>

Before using EIseg, please download the model parameters first. EISeg has opened four labeling models trained on COCO+LVIS and large-scale portrait data to meet the labeling requirements of general scenes and portrait scenes. The model structure corresponds to the network selection module in the EISeg interactive tool, and users need to select different network structures and loading parameters according to their own scenario requirements.

| Model Type | Applicable Scene | Model Structure | Download |
| --- | --- | --- | ---|
| High-precision model | Suitable for general scenes |HRNet18_OCR64 | [hrnet18_ocr64_cocolvis](https://bj.bcebos.com/paddleseg/dygraph/interactive_segmentation/ritm/hrnet18_ocr64_cocolvis.pdparams) |
| Lightweight model | Suitable for general scenes |HRNet18s_OCR48 | [hrnet18s_ocr48_cocolvis](https://bj.bcebos.com/paddleseg/dygraph/interactive_segmentation/ritm/hrnet18s_ocr48_cocolvis.pdparams) |
| High-precision model | Suitable for portrait marking scenes |HRNet18_OCR64 | [hrnet18_ocr64_human](https://bj.bcebos.com/paddleseg/dygraph/interactive_segmentation/ritm/hrnet18_ocr64_human.pdparams) |
| Lightweight model | Suitable for portrait marking scenes |HRNet18s_OCR48 | [hrnet18s_ocr48_human](https://bj.bcebos.com/paddleseg/dygraph/interactive_segmentation/ritm/hrnet18s_ocr48_human.pdparams) |


* 1.Installation

EISeg provides a variety of installation methods, among which [pip](#PIP), [conda](#Conda) and [Run Code](#Code) are compatible with Windows, Mac OS and Linux. In order to avoid environment conflicts, it is recommended to install in a virtual environment created by conda.


Requirements:

* PaddlePaddle >= 2.1.0

Please refer to [Official Website](https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/pip/windows-pip.html) for PaddlePaddle installation.

### PIP

The pip installation method is as follows:

```shell
pip install eiseg
```
pip will automatically install dependencies. After the installation is complete, enter the command line:
```shell
eiseg
```
then can run the software.

### Conda
First install Anaconda or Miniconda, refer to [Tsinghua Mirror Tutorial](https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/).

```shell
conda create -n eiseg python=3.8
conda activate eiseg
conda install qtpy
pip install eiseg
eiseg
```

### Windows exe

EISeg uses [QPT](https://github.com/GT-ZhangAcer/QPT) for packaging. You can download the latest EISeg from [Baidu Cloud Disk](https://pan.baidu.com/s/1KXJ9PYjbnBgQozZJEJE-bA) (extraction code: 82z9). After decompression, double-click the launcher.exe to run the program. The first time the program runs, it will initialize the packages needed for installation. Please wait a moment.

### Code

First clone this project to the local.
```shell
git clone https://github.com/PaddlePaddle/PaddleSeg
cd PaddleSeg/contrib/EISeg
pip install -r requirements.txt
python -m eiseg
```
then start execution.



## UI

![eiseg-ui](../../images/eiseg_ui.png)

The interface of EISeg mainly consists of 4 parts, `namely menu & toolbar`, `status bar`, `image display area` and `work area`.

- The menu bar, toolbar and status bar are PyQt defaults. The toolbar can be dragged to any position, or placed at the top and bottom ends. The introduction of related tools is displayed in the status bar when the mouse is hovered.
-The work area adopts QDockWidget, which can also be dragged and placed to any position or fixed on the left and right ends. The work area can be mainly set and switched.
-The image display area is responsible for the display and interaction of images. Use QGraphicsView, load QGraphicsScene, and add images in the form of Qpixmap. When the image is loaded, the zoom ratio is automatically calculated according to the image size to ensure that the image is displayed completely.



* 2.Using

Before marking, you need to make the following settings:

1. **Load Parameters**

Select the appropriate network and load the corresponding model parameters. In EISeg, the current network is divided into `HRNet18s_OCR48` and `HRNet18_OCR64`, and two model parameters of portrait and general are provided respectively. For download of model parameters, please refer to [Model Preparation](#jump). After the model parameters are loaded correctly, the status bar in the lower right corner will give instructions. If the network parameters do not match the model parameters, a warning will pop up. At this time, the loading fails and you need to reload. The correctly loaded model parameters will be recorded in the `Recent Model Parameters`, which can be easily switched, and the model parameters at the time of exit will be automatically loaded when the software is opened next time.

2. **Load Images**

​ Open the image/image folder. When you see that the main interface image is loaded correctly, the image path appears correctly in the `data list`, it done.

3. **Annotation Adding/Loading**

​ You can create a new label through `Add label`. The label is divided into 4 columns, corresponding to pixel value, description, color, and deletion. The newly created label can be saved as a txt file through `Save label list`, and other collaborators can import the label through `Load label list`. Labels imported by loading method will be automatically loaded after restarting the software.

4. **Automatically Saving Setting**

​ You can set the `auto save` setting and set the folder (currently only supports the English path), so that when you switch the image during use, the marked image will be automatically saved.

When the setting is completed, you can start marking. By default, the commonly used keys/shortcut keys are:

| Keys/Shortcuts | Effection |
| --------------------- | ---------------- |
| **Leftmouse** | **Add positive sample points** |
| **Rightmouse** | **Add negative sample points** |
| MMB | Image translation |
| Ctrl+MMB(wheel) | Image scaling |
| S | Switch to the previous image |
| F | Switch to the next image |
| Space(空格) | Complete annotating |
| Ctrl+Z | Undo one click |
| Ctrl+Shift+Z | Clear all clicks |
| Ctrl+Y | Undo one click |
| Ctrl+A | Open image |
| Shift+A | Open folder |
| Ctrl+M | Load model parameters|

# Developers

[Yuying Hao](https://github.com/haoyuying), [Yizhou Chen](https://github.com/geoyee), [Lin Han](https://github.com/linhandev/), [GT](https://github.com/GT-ZhangAcer), [Zhiliang Yu](https://github.com/yzl19940819)



# 2、LabelMe
# 1、LabelMe
* 1.Installation

After the user has collected the images for training, evaluation, and prediction, he needs to use the data labeling tool [LabelMe] (https://github.com/wkentaro/labelme) to complete the data labeling. LabelMe supports the use of Windows/macOS/Linux three systems, and the label format under the three systems is the same. For the specific installation process, please refer to the [Official Installation Guide](https://github.com/wkentaro/labelme).
Expand Down Expand Up @@ -262,9 +135,9 @@ The converted dataset can refer to the [folder] (https://github.com/PaddlePaddle
<p>Figure 8 : Schematic diagram of the contents of each catalog of the dataset after format conversion</p>
</div>

# 2、EISeg



For the use of EISeg, please refer to [Document](../../../contrib/EISeg/README.md)



135 changes: 4 additions & 131 deletions docs/data/transform/transform_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,137 +2,9 @@
# 数据标注教程

无论是语义分割,全景分割,还是实例分割,我们都需要充足的训练数据。如果你想使用没有标注的原始数据集做分割任务,你必须先为原始图像作出标注。如果你使用的是Cityscapes等已有分割标注的数据集,你可以跳过本步骤。
- 本文档将提供2种标注工具的使用教程:[EISeg](#一、EISeg)[LabelMe](#二、LabelMe)
- 本文档将提供2种标注工具的使用教程:EISegLabelMe。

# 一、EISeg
# EISeg

EISeg(Efficient Interactive Segmentation)是基于飞桨开发的一个高效智能的交互式分割标注软件。它涵盖了高精度和轻量级等不同方向的高质量交互式分割模型,方便开发者快速实现语义及实例标签的标注,降低标注成本。 另外,将EISeg获取到的标注应用到PaddleSeg提供的其他分割模型进行训练,便可得到定制化场景的高精度模型,打通分割任务从数据标注到模型训练及预测的全流程。

## 演示

![eiseg-demo](../../images/eiseg_demo.gif)

## <span id = "jump">模型准备</span>

在使用EIseg前,请先下载模型参数。EISeg开放了在COCO+LVIS和大规模人像数据上训练的四个标注模型,满足通用场景和人像场景的标注需求。其中模型结构对应EISeg交互工具中的网络选择模块,用户需要根据自己的场景需求选择不同的网络结构和加载参数。

| 模型类型 | 适用场景 | 模型结构 | 下载地址|
| --- | --- | --- | ---|
| 高精度模型 | 适用于通用场景的图像标注。 |HRNet18_OCR64 | [hrnet18_ocr64_cocolvis](https://bj.bcebos.com/paddleseg/dygraph/interactive_segmentation/ritm/hrnet18_ocr64_cocolvis.pdparams) |
| 轻量化模型 | 适用于通用场景的图像标注。 |HRNet18s_OCR48 | [hrnet18s_ocr48_cocolvis](https://bj.bcebos.com/paddleseg/dygraph/interactive_segmentation/ritm/hrnet18s_ocr48_cocolvis.pdparams) |
| 高精度模型 | 适用于人像标注场景。 |HRNet18_OCR64 | [hrnet18_ocr64_human](https://bj.bcebos.com/paddleseg/dygraph/interactive_segmentation/ritm/hrnet18_ocr64_human.pdparams) |
| 轻量化模型 | 适用于人像标注场景。 |HRNet18s_OCR48 | [hrnet18s_ocr48_human](https://bj.bcebos.com/paddleseg/dygraph/interactive_segmentation/ritm/hrnet18s_ocr48_human.pdparams) |


* 1.安装

EISeg提供多种安装方式,其中使用[pip](#PIP)[conda](#Conda)[运行代码](#运行代码)方式可兼容Windows,Mac OS和Linux。为了避免环境冲突,推荐在conda创建的虚拟环境中安装。

版本要求:

* PaddlePaddle >= 2.1.0

PaddlePaddle安装请参考[官网](https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/pip/windows-pip.html)

### PIP

pip安装方式如下:

```shell
pip install eiseg
```
pip会自动安装依赖。安装完成后命令行输入:
```shell
eiseg
```
即可运行软件。

### Conda
首先安装Anaconda或Miniconda,过程参考[清华镜像教程](https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/)

```shell
conda create -n eiseg python=3.8
conda activate eiseg
conda install qtpy
pip install eiseg
eiseg
```

### Windows exe

EISeg使用[QPT](https://github.com/GT-ZhangAcer/QPT)进行打包。可以从[百度云盘](https://pan.baidu.com/s/1KXJ9PYjbnBgQozZJEJE-bA)(提取码:82z9)下载最新EISeg。解压后双击启动程序.exe即可运行程序。程序第一次运行会初始化安装所需要的包,请稍等片刻。

### 运行代码

首先clone本项目到本地。
```shell
git clone https://github.com/PaddlePaddle/PaddleSeg
cd PaddleSeg/contrib/EISeg
pip install -r requirements.txt
python -m eiseg
```
即可开始执行。



## 界面

![eiseg-ui](../../images/eiseg_ui.png)

EISeg的界面主要有4个部分组成,分别是菜单&工具栏、状态栏、图像显示区和工作区。

- 菜单栏、工具栏和状态栏为PyQt默认。工具栏可拖动到任意位置,或放置上下两端。相关工具的介绍当鼠标悬停时显示在状态栏中。
- 工作区采用QDockWidget,也可以进行拖动,放置到任意位置,或固定在左右两端。工作区主要可以进行相关的设置和切换。
- 图像显示区负责图像的显示和交互。采用QGraphicsView,其中加载QGraphicsScene,图像以Qpixmap的形式加入。在图像加载时会自动根据图像大小计算缩放比例,确保图像完整显示。



* 2.使用

打开软件后,在对项目进行标注前,需要进行如下设置:

1. **模型参数加载**

​ 选择合适的网络,并加载对应的模型参数。在EISeg中,目前网络分为`HRNet18s_OCR48``HRNet18_OCR64`,并分别提供了人像和通用两种模型参数,模型参数下载参见[模型准备](#jump)。在正确加载模型参数后,右下角状态栏会给予说明。若网络参数与模型参数不符,将会弹出警告,此时加载失败需重新加载。正确加载的模型参数会记录在`近期模型参数`中,可以方便切换,并且下次打开软件时自动加载退出时的模型参数。

2. **图像加载**

​ 打开图像/图像文件夹。当看到主界面图像正确加载,`数据列表`正确出现图像路径即可。

3. **标签添加/加载**

​ 可以通过`添加标签`新建标签,标签分为4列,分别对应像素值、说明、颜色和删除。新建好的标签可以通过`保存标签列表`保存为txt文件,其他合作者可以通过`加载标签列表`将标签导入。通过加载方式导入的标签,重启软件后会自动加载。

4. **自动保存设置**

​ 在使用中可以将`自动保存`设置上,设定好文件夹(目前只支持英文路径)即可,这样在使用时切换图像会自动将完成标注的图像进行保存。

当设置完成后即可开始进行标注,默认情况下常用的按键/快捷键有:

| 按键/快捷键 | 功能 |
| --------------------- | ---------------- |
| **鼠标左键** | **增加正样本点** |
| **鼠标右键** | **增加负样本点** |
| 鼠标中键 | 平移图像 |
| Ctrl+鼠标中键(滚轮) | 缩放图像 |
| S | 切换上一张图 |
| F | 切换下一张图 |
| Space(空格) | 完成标注 |
| Ctrl+Z | 撤销一次点击 |
| Ctrl+Shift+Z | 清除全部点击 |
| Ctrl+Y | 重做一次点击 |
| Ctrl+A | 打开图像 |
| Shift+A | 打开文件夹 |
| Ctrl+M | 加载模型参数 |

# 开发者

[Yuying Hao](https://github.com/haoyuying), [Yizhou Chen](https://github.com/geoyee), [Lin Han](https://github.com/linhandev/), [GT](https://github.com/GT-ZhangAcer), [Zhiliang Yu](https://github.com/yzl19940819)



# 二、LabelMe
# 一、LabelMe
* 1.LabelMe的安装

用户在采集完用于训练、评估和预测的图片之后,需使用数据标注工具[LabelMe](https://github.com/wkentaro/labelme)完成数据标注。LabelMe支持在Windows/macOS/Linux三个系统上使用,且三个系统下的标注格式是一样。具体的安装流程请参见[官方安装指南](https://github.com/wkentaro/labelme)
Expand Down Expand Up @@ -264,7 +136,8 @@ python tools/labelme2seg.py docs/annotation/labelme_demo/
</div>



# 二、EISeg
EISeg的使用请参考[文档](../../../contrib/EISeg/README.md)



2 changes: 1 addition & 1 deletion docs/quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ How to use your own dataset for training is the most concerned thing for develop
...
```

The format of the dataset we just downloaded is similar (label.txt is optional). If users want to label and divide the dataset, please refer to [Data Marking Document](data/marker/marker_c.md) and [ dataset division document](data/custom/data_prepare.md).
The format of the dataset we just downloaded is similar (label.txt is optional). If users want to label and divide the dataset, please refer to [Data Marking Document](data/marker/marker.md) and [ dataset division document](data/custom/data_prepare.md).

我们一般推荐用户将数据集放置在PaddleSeg下的data文件夹下。

Expand Down
2 changes: 1 addition & 1 deletion docs/quick_start_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ cd ..
...
```

我们刚刚下载的数据集格式也与之类似(label.txt可有可以无),如果用户要进行数据集标注和数据划分,请参考[数据标注文档](data/marker/marker_c.md)[数据集划分文档](data/custom/data_prepare.md)
我们刚刚下载的数据集格式也与之类似(label.txt可有可以无),如果用户要进行数据集标注和数据划分,请参考[数据标注文档](data/marker/marker_cn.md)[数据集划分文档](data/custom/data_prepare_cn.md)

我们一般推荐用户将数据集放置在PaddleSeg下的dataset文件夹下。

Expand Down
Loading

0 comments on commit 22d91b9

Please sign in to comment.