Skip to content

Commit

Permalink
fix: 将 ADE20K 改为 Mask
Browse files Browse the repository at this point in the history
  • Loading branch information
laoluo committed Dec 6, 2021
1 parent 0715dd2 commit 8e8b19e
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 32 deletions.
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<a href="./README_zh-CN.md" >简体中文</a>
</p>
</article>
<img src="./docs/assets/main.png">
<img src="./docs/assets/main2.png">

</div>

Expand All @@ -22,10 +22,10 @@
- 💻 Multiple operating systems: Mac / Linux / Windows
- 🏁 Support Data Formats

| | General Data | COCO | Semantic Segmentation Mask |
| ------- | ------------- |-------| --------------------------- |
| Export | ✔️ | ✔️ | ✔️ |
| Import | ✔️ | | |
| | General Data | COCO | Semantic Segmentation Mask |
| ------ | ------------ | ---- | -------------------------- |
| Export | ✔️ | ✔️ | ✔️ |
| Import | ✔️ || |

## Support Scenes

Expand All @@ -39,10 +39,6 @@
<p align="center">
<img src="./docs/assets/annotation-detection-segmentation.gif">
<i style="text-align: center;">Detection / Segmentation </i>

<img src="./docs/assets/annotation-line-point-text.gif">
<i style="text-align: center;">Line / Point / Text </i>

</p>

## Usage
Expand Down
18 changes: 10 additions & 8 deletions docs/annotation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ LabelBee-Client 的`目标检测`、`语义分割`支持直接导出 COCO 数据
- 语义的唯一性:语义分割的属性标注配置
- 导出内容:
- JSON 文件: 表示当前语义与颜色的索引关系
- 彩色 Mask
- Mask
- 彩色图(xx_segmentation.png):用于结果校验
- 灰度图(xx_labelTrainIds.png)


```json
Expand All @@ -80,14 +82,14 @@ LabelBee-Client 的`目标检测`、`语义分割`支持直接导出 COCO 数据
]
```

| 名称 | 描述 |
| --------- | ------------------------------ |
| attribute | 当前语义 |
| color | 当前语义颜色 |
| trainIds | 训练使用的 ID (灰度值 1 - N) |
| 名称 | 描述 |
| --------- | ------------------------------------------ |
| attribute | 当前语义 |
| color | 当前语义颜色 |
| trainIds | 训练使用的 ID (灰度值 1 - N,0 表示背景|


- 可使用下方脚本将导出的 Mask 按照上方 JSON 文件 Color => TrainIds 的映射转换为灰度图,以用于[mmsegmentation](https://github.com/open-mmlab/mmsegmentation) 训练
- 可使用下方脚本将导出的 Mask (xxx_labelTrainIds.png 四通道图片)转换为(单通道)灰度图,以用于[mmsegmentation](https://github.com/open-mmlab/mmsegmentation) 训练


```python
Expand All @@ -97,7 +99,7 @@ from pathlib import Path, PurePath
folder_path = './img/' # Your Export Folder

p = Path(folder_path)
files = [x for x in p.iterdir() if PurePath(x).match('*.png')]
files = [x for x in p.iterdir() if PurePath(x).match('*_labelTrainIds.png')]

for file in files:
p_path = file
Expand Down
Binary file added docs/assets/main2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion electron/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ipcListen } from './ipcEvent';
const electron = require('electron');
const platform = require('os').platform(); // 获取平台:https://nodejs.org/api/os.html#os_os_platform
const version = '1.1.4';
const version = '0.1.0';

// 控制app生命周期.
const app = electron.app;
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"main": "./electron/dist/electron/main.js",
"dependencies": {
"@ant-design/icons": "^4.6.2",
"@labelbee/lb-components": "^1.2.1",
"@labelbee/lb-annotation": "^1.5.2",
"@labelbee/lb-components": "^1.2.2",
"@labelbee/lb-annotation": "^1.5.3",
"antd": "~4.15.0",
"classnames": "^2.3.1",
"fs-extra": "^8.1.0",
Expand Down Expand Up @@ -249,4 +249,4 @@
},
"publish": null
}
}
}
12 changes: 6 additions & 6 deletions src/ProjectPlatform/ProjectList/ExportData/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const ExportData = (props: IProps) => {
projectInfo?.toolName === EToolName.Rect || projectInfo?.toolName === EToolName.Polygon;

/**
* 是否允许被转换的成 ADE20K
* 是否允许被转换的成 Mask
*/
const isTransfer2ACE20k = projectInfo?.toolName === EToolName.Polygon;
const onOk = () => {
Expand All @@ -66,8 +66,8 @@ const ExportData = (props: IProps) => {
name = `${projectInfo.name}-coco`;
break;

case 'ADE20K':
name = `${projectInfo.name}-ADE20K`;
case 'Mask':
name = `${projectInfo.name}-Mask`;
suffix = 'png';

fileList.forEach((file, i) => {
Expand Down Expand Up @@ -170,11 +170,11 @@ const ExportData = (props: IProps) => {
)}
</Radio.Button>
<Radio.Button value='default'>{t('StandardFormat')}</Radio.Button>
<Radio.Button value='ADE20K' disabled={!isTransfer2ACE20k}>
<Radio.Button value='Mask' disabled={!isTransfer2ACE20k}>
{isTransfer2ACE20k ? (
'ADE20K'
'Mask'
) : (
<Popover content={t('ExportADE20KLimitMsg')}>ADE20K</Popover>
<Popover content={t('ExportMaskLimitMsg')}>Mask</Popover>
)}
</Radio.Button>
</Radio.Group>
Expand Down
6 changes: 2 additions & 4 deletions src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,9 @@ const resources = {
SelectExportFormat: 'Select export Format',
ExportFormat: 'Export format',
StandardFormat: 'LabelBee format',
ADE20kFormat: 'ADE20K format',
ExportSuccess: 'Export successfully',
ExportCOCOLimitMsg: 'Only rectTool and polygonTool can realize the conversion of coco data',
ExportADE20KLimitMsg: 'Only polygonTool can realize the conversion of ADE20K data',
ExportMaskLimitMsg: 'Only polygonTool can realize the conversion of Mask',
SelectedExportPath: 'Choose Export path',
MultiSelect: 'multi-select',
DefaultOption: 'Default Option',
Expand Down Expand Up @@ -171,10 +170,9 @@ const resources = {
SelectExportFormat: '选择导出格式',
ExportFormat: '导出格式',
StandardFormat: 'labelbee 格式',
ADE20kFormat: 'ADE20K 格式',
ExportSuccess: '导出成功',
ExportCOCOLimitMsg: '仅限拉框、多边形工具可以实现 coco 数据的转换',
ExportADE20KLimitMsg: '仅限多边形工具可以实现 ADE20K 数据的转换',
ExportMaskLimitMsg: '仅限多边形工具可以实现 Mask 数据的转换',
SelectedExportPath: '选择导出的路径',
MultiSelect: '多选',
DefaultOption: '默认选择',
Expand Down
2 changes: 1 addition & 1 deletion src/utils/DataTransfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ export default class DataTransfer {
}

/**
* 导出 ADE20K 的格式数据
* 导出 Mask 的格式数据
* @param width
* @param height
* @param polygon
Expand Down

0 comments on commit 8e8b19e

Please sign in to comment.