@glodon-aiot/dataset-annotation 3.0.5-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.git.md +73 -0
- package/README.lib.md +262 -0
- package/dist/dataset-annotation.js +123598 -0
- package/dist/dataset-annotation.umd.cjs +1017 -0
- package/dist/example/DatasetAnnotationDemo.d.ts +3 -0
- package/dist/example/DemoTabs.d.ts +3 -0
- package/dist/example/DetectionDatasetDemo.d.ts +5 -0
- package/dist/example/DetectionImageDemo.d.ts +5 -0
- package/dist/example/OcrDatasetDemo.d.ts +5 -0
- package/dist/example/OcrImageDemo.d.ts +5 -0
- package/dist/example/OcrkvcDatasetDemo.d.ts +5 -0
- package/dist/example/constant.local.d.ts +6 -0
- package/dist/example/index.d.ts +1 -0
- package/dist/src/Common/Page/index.d.ts +9 -0
- package/dist/src/Common/PageContent/index.d.ts +6 -0
- package/dist/src/Common/PageHeader/index.d.ts +12 -0
- package/dist/src/DatasetContext/index.d.ts +22 -0
- package/dist/src/api.d.ts +2 -0
- package/dist/src/components/CompositionInput/index.d.ts +7 -0
- package/dist/src/components/DataEmpty/index.d.ts +14 -0
- package/dist/src/components/DetectionAnnotation/PreSamplesPage/index.d.ts +13 -0
- package/dist/src/components/DetectionAnnotation/components/DetailPageHeader/index.d.ts +5 -0
- package/dist/src/components/DetectionAnnotation/components/DisabledTooltip/index.d.ts +8 -0
- package/dist/src/components/DetectionAnnotation/components/ImageDetail/index.d.ts +27 -0
- package/dist/src/components/DetectionAnnotation/components/LabelMaker/Drawable.d.ts +8 -0
- package/dist/src/components/DetectionAnnotation/components/LabelMaker/FabricCustomize.d.ts +2 -0
- package/dist/src/components/DetectionAnnotation/components/LabelMaker/RectLabel.d.ts +63 -0
- package/dist/src/components/DetectionAnnotation/components/LabelMaker/index.d.ts +33 -0
- package/dist/src/components/DetectionAnnotation/components/Labels/index.d.ts +19 -0
- package/dist/src/components/DetectionAnnotation/components/TagItem/index.d.ts +21 -0
- package/dist/src/components/DetectionAnnotation/components/TagList/index.d.ts +8 -0
- package/dist/src/components/DetectionAnnotation/index.d.ts +7 -0
- package/dist/src/components/DetectionImageAnnotation/index.d.ts +22 -0
- package/dist/src/components/Iconfont/index.d.ts +3 -0
- package/dist/src/components/MarkDescriptions/index.d.ts +9 -0
- package/dist/src/components/OCRImageViewer/index.d.ts +36 -0
- package/dist/src/components/OcrAnnotation/MarkKVOCRModal/CategoryDrawer.d.ts +8 -0
- package/dist/src/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LabelEditorInput.d.ts +12 -0
- package/dist/src/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LabelEditorItem.d.ts +22 -0
- package/dist/src/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LableEditor.d.ts +17 -0
- package/dist/src/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/index.d.ts +16 -0
- package/dist/src/components/OcrAnnotation/MarkKVOCRModal/index.d.ts +14 -0
- package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/ImageDetail/index.d.ts +17 -0
- package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/LabelEditorInput.d.ts +12 -0
- package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/LabelEditorItem.d.ts +22 -0
- package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/LableEditor.d.ts +17 -0
- package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/index.d.ts +20 -0
- package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/index.d.ts +14 -0
- package/dist/src/components/OcrAnnotation/OcrModal/index.d.ts +18 -0
- package/dist/src/components/OcrAnnotation/PreLabelOCR/PreLabelModal.d.ts +18 -0
- package/dist/src/components/OcrAnnotation/PreLabelOCR/index.d.ts +13 -0
- package/dist/src/components/OcrAnnotation/constant.d.ts +2 -0
- package/dist/src/components/OcrAnnotation/index.d.ts +7 -0
- package/dist/src/components/OcrImageAnnotation/index.d.ts +20 -0
- package/dist/src/components/PageNav/index.d.ts +10 -0
- package/dist/src/components/PicZipImportModal/index.d.ts +43 -0
- package/dist/src/components/PreLabelOCR/PreLabelModal.d.ts +18 -0
- package/dist/src/components/PreLabelOCR/index.d.ts +13 -0
- package/dist/src/components/ScanTable/index.d.ts +10 -0
- package/dist/src/components/Thumbnail/index.d.ts +10 -0
- package/dist/src/components/hooks/Prompt.d.ts +6 -0
- package/dist/src/components/hooks/useBlocker.d.ts +2 -0
- package/dist/src/constant.d.ts +14 -0
- package/dist/src/createDatasetAnnotation/index.d.ts +16 -0
- package/dist/src/createDetectionDatasetAnnotation/index.d.ts +16 -0
- package/dist/src/createDetectionImageAnnotation/index.d.ts +18 -0
- package/dist/src/createOcrDatasetAnnotation/index.d.ts +16 -0
- package/dist/src/createOcrImageAnnotation/index.d.ts +19 -0
- package/dist/src/featuresConfig.d.ts +50 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/utils/color.d.ts +15 -0
- package/dist/src/utils/index.d.ts +18 -0
- package/dist/src/utils/sign.d.ts +8 -0
- package/package.json +128 -0
package/README.git.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
git 使用文档 | [组件库使用文档](./README.lib.md)
|
|
2
|
+
|
|
3
|
+
## 模板工程使用:
|
|
4
|
+
|
|
5
|
+
### 模板代码拉取与安装
|
|
6
|
+
|
|
7
|
+
`git clone https://geek.glodon.com/scm/gos/aiot-standard-frontend.git`,克隆代码。
|
|
8
|
+
|
|
9
|
+
`yarn install`,安装项目所有依赖。
|
|
10
|
+
|
|
11
|
+
yarn 安装可参考:https://blog.csdn.net/qq_45112637/article/details/125543953
|
|
12
|
+
|
|
13
|
+
`yarn start`,运行模板项目。
|
|
14
|
+
|
|
15
|
+
### 贡献代码
|
|
16
|
+
|
|
17
|
+
`git switch master`,切换分支 master。
|
|
18
|
+
|
|
19
|
+
`git pull`,获取 master 最新代码。
|
|
20
|
+
|
|
21
|
+
`git switch –c feature/xxx`,在 master 分支下创建并切换到新分支 feature/xxx。
|
|
22
|
+
|
|
23
|
+
在新分支编写代码。
|
|
24
|
+
|
|
25
|
+
`git add .`,把所有文件修改添加到暂存区。
|
|
26
|
+
|
|
27
|
+
`git commit -m "备注信息"`,将暂存区内容添加到本地仓库。
|
|
28
|
+
|
|
29
|
+
`git push`,把本地仓库的更新推到远程仓库。
|
|
30
|
+
|
|
31
|
+
分支代码完成后提 PR,将分支`feature/xxx`merge 到 develop 分支。
|
|
32
|
+
|
|
33
|
+
- 若有冲突,`git switch feature/xxx`切换到该分支,然后`git pull origin develop`,手动解决冲突之后再次提交代码。
|
|
34
|
+
- 没有冲突且测试没有问题,再提 PR,将 develop 分支 merge 到 master 分支。
|
|
35
|
+
|
|
36
|
+
### 更换远程仓库
|
|
37
|
+
|
|
38
|
+
**可向自己的代码仓库提交代码,不要在模板项目上提交代码哦~**
|
|
39
|
+
|
|
40
|
+
关联远程库例子:`git remote add origin git@server-name:path/repo-name.git`,可参考https://www.liaoxuefeng.com/wiki/896043488029600/898732864121440。
|
|
41
|
+
|
|
42
|
+
`git add .`,把所有文件修改添加到暂存区。
|
|
43
|
+
|
|
44
|
+
`git commit -m "备注信息"`,将暂存区内容添加到本地仓库。
|
|
45
|
+
|
|
46
|
+
`git push`,把本地仓库的更新推到远程仓库。
|
|
47
|
+
|
|
48
|
+
## 代码提交规范:
|
|
49
|
+
|
|
50
|
+
[@commitlint/config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-conventional)
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
{
|
|
54
|
+
'build': 打包
|
|
55
|
+
'chore': 性能,
|
|
56
|
+
'ci': 脚手架/工程化,
|
|
57
|
+
'docs': 文档,
|
|
58
|
+
'feat' : 新功能,
|
|
59
|
+
'fix': 修改bug,
|
|
60
|
+
'perf': 性能优化,
|
|
61
|
+
'refactor': 重构,
|
|
62
|
+
'revert': 回退,
|
|
63
|
+
'style': 样式,
|
|
64
|
+
'test': 单元测试
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
举个例子
|
|
69
|
+
```
|
|
70
|
+
git commit -m "fix: some bug"
|
|
71
|
+
|
|
72
|
+
git commit -m "feat: some feautre"
|
|
73
|
+
```
|
package/README.lib.md
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
# 安装依赖
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# 快速启动
|
|
5
|
+
支持两种引入方式:npm依赖包方式或script脚本引入方式。
|
|
6
|
+
|
|
7
|
+
## npm依赖引用
|
|
8
|
+
### 配置.npmrc
|
|
9
|
+
项目根目录添加.npmrc,与package.json同级,文档中添加以下内容,可点击复制
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
@aiot:registry=https://packages.glodon.com/artifactory/api/npm/npm-GGM-releases/
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### 安装依赖
|
|
16
|
+
#### npm
|
|
17
|
+
`npm install @glodon-aiot/dataset-annotation`
|
|
18
|
+
|
|
19
|
+
#### yarn
|
|
20
|
+
`yarn add @glodon-aiot/dataset-annotation`
|
|
21
|
+
|
|
22
|
+
### 项目中引用
|
|
23
|
+
#### 物体检测数据集标注工具
|
|
24
|
+
这个工具提供了[行业AI平台](https://copilot.glodon.com/)的物体检测类型数据集管理功能,只需通过数据集ID和行业AI平台token即可集成到自己的业务平台中。
|
|
25
|
+
|
|
26
|
+
```javascript
|
|
27
|
+
import {createDetectionDatasetAnnotation} from '@glodon-aiot/dataset-annotation';
|
|
28
|
+
|
|
29
|
+
createDetectionDatasetAnnotation({
|
|
30
|
+
getContainer: () => ref.current || document.body,
|
|
31
|
+
token: 'your token goes here',
|
|
32
|
+
datasetId: 'dataset ID',
|
|
33
|
+
versionId: 'version ID', //不设置versionId默认查看最新版本
|
|
34
|
+
errorHandlers: {
|
|
35
|
+
aiotToken: (error) => console.error(error),
|
|
36
|
+
},
|
|
37
|
+
//其他配置参数
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
在线预览:
|
|
42
|
+
|
|
43
|
+
[物体检测数据集标注工具Demo](https://code.juejin.cn/pen/7473020574709579785)
|
|
44
|
+
|
|
45
|
+
#### 物体检测图片标注工具
|
|
46
|
+
该工具提供了单张物体检测类型图片的标注数据展示。
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
49
|
+
import {createDetectionImageAnnotation} from '@glodon-aiot/dataset-annotation';
|
|
50
|
+
|
|
51
|
+
createDetectionImageAnnotation({
|
|
52
|
+
getContainer: () => ref.current || document.body,
|
|
53
|
+
data: {
|
|
54
|
+
fileUrl: 'image-url', // 图片地址
|
|
55
|
+
labels: [], // 标注框信息
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
在线预览:
|
|
61
|
+
|
|
62
|
+
[码上掘金](https://code.juejin.cn/pen/7475246522045890610)
|
|
63
|
+
|
|
64
|
+
## script脚本引入
|
|
65
|
+
### 添加脚本标签
|
|
66
|
+
在HTML文档的`**<body>**`标签下添加script引用。
|
|
67
|
+
|
|
68
|
+
```html
|
|
69
|
+
<!DOCTYPE html>
|
|
70
|
+
<html>
|
|
71
|
+
<!-- 省略其他内容 -->
|
|
72
|
+
<body>
|
|
73
|
+
<!-- 省略其他内容 -->
|
|
74
|
+
<script src="https://cv-cdn.obs.cn-north-4.myhuaweicloud.com/glodon/libs/dataset-annotation/latest/dataset-annotation.umd.cjs"></script>
|
|
75
|
+
<div id="root" style="height: 100%;"></div>
|
|
76
|
+
</body>
|
|
77
|
+
</html>
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 使用工具
|
|
82
|
+
```javascript
|
|
83
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
84
|
+
const createDetectionDatasetAnnotation = DatasetAnnotation.createDetectionDatasetAnnotation;
|
|
85
|
+
|
|
86
|
+
createDetectionDatasetAnnotation({
|
|
87
|
+
getContainer: () => document.getElementById('root'),
|
|
88
|
+
// 请替换新的token
|
|
89
|
+
token: 'your token goes here',
|
|
90
|
+
datasetId: '64dccb29-37f5-49f3-a294-21d041676ccd',
|
|
91
|
+
versionId: 'version ID', //不设置versionId默认查看最新版本
|
|
92
|
+
errorHandlers: {
|
|
93
|
+
aiotToken: (error) => console.error(error),
|
|
94
|
+
},
|
|
95
|
+
//其他配置参数
|
|
96
|
+
});
|
|
97
|
+
})
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
# 配置
|
|
101
|
+
## 物体检测数据集工具配置项
|
|
102
|
+
| 名称 | 数据类型 | 描述 | 必填 | 默认值 |
|
|
103
|
+
| --- | --- | --- | --- | --- |
|
|
104
|
+
| getContainer | `() => HTMLElement` | 获取容器元素 | | |
|
|
105
|
+
| token | `string` | AIoT平台用户租户token | 是 | - |
|
|
106
|
+
| datasetId | `string` | 数据集ID | 是 | - |
|
|
107
|
+
| version | `string` | 版本ID | 否 | 最新版本ID |
|
|
108
|
+
| labelManager | `false`|`[LabelManager](https://glodon-cv-help.yuque.com/yfmkyg/sgbna6/evrhc5fhz8no2nlx#yni3d)` | 数据集标签管理是否开启 | 否 | `false` |
|
|
109
|
+
| datasetManager | `false`|`[DatasetManager](https://glodon-cv-help.yuque.com/yfmkyg/sgbna6/evrhc5fhz8no2nlx#j68ow)` | 数据集管理是否开启 | 否 | `false` |
|
|
110
|
+
| filterSwitch | `[FilterSwitch](https://glodon-cv-help.yuque.com/yfmkyg/sgbna6/evrhc5fhz8no2nlx#lJ1Jk)` | 列表过滤器开关,分别表述以下过滤器是否可见:有无标注tabs、标签选择器 | 否 | {<br/>tabs: true,<br/>labels: true<br/>} |
|
|
111
|
+
| mode | `'manage' | 'label' | 'view'` | `manage`模式下可以删除数据、管理标签列表、导入数据;<br/>`label`模式下可标注数据;<br/>`view`模式下只能查看数据;<br/>更多说明请看[各种模式的默认配置](#G3fjR) | 否 | 'label' |
|
|
112
|
+
| header | `false` | `[HeaderConfig](https://glodon-cv-help.yuque.com/yfmkyg/sgbna6/evrhc5fhz8no2nlx#BsNya)` | | | |
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
interface FilterSwitch {
|
|
117
|
+
tabs: boolean;
|
|
118
|
+
labels: boolean;
|
|
119
|
+
search: boolean;
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
interface HeaderConfig {
|
|
125
|
+
versionSelect?: boolean; // 是否可选择版本
|
|
126
|
+
onBackClick?: VoidFunction; //返回按钮回调。没有传递该回调时,不显示返回按钮
|
|
127
|
+
onVersionChange?: (version: string) => void;
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
interface DatasetManager{
|
|
133
|
+
add?: boolean;
|
|
134
|
+
delete?: boolean;
|
|
135
|
+
label?: boolean;
|
|
136
|
+
preLabel?: boolean;
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
interface LabelManager{
|
|
142
|
+
add?: boolean;
|
|
143
|
+
delete?: boolean;
|
|
144
|
+
edit?: boolean;
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### 各种模式的默认配置
|
|
149
|
+
#### manage模式
|
|
150
|
+
适用于拥有完全的数据集管理权限的角色
|
|
151
|
+
|
|
152
|
+
```json
|
|
153
|
+
{
|
|
154
|
+
labelManager: {
|
|
155
|
+
visible: true,
|
|
156
|
+
add: true,
|
|
157
|
+
delete: true,
|
|
158
|
+
edit: true,
|
|
159
|
+
},
|
|
160
|
+
datasetManager: {
|
|
161
|
+
add: true,
|
|
162
|
+
delete: true,
|
|
163
|
+
label: true,
|
|
164
|
+
preLabel: true
|
|
165
|
+
},
|
|
166
|
+
annotation: {
|
|
167
|
+
zoomable: true,
|
|
168
|
+
draggable: true,
|
|
169
|
+
readonly: false,
|
|
170
|
+
},
|
|
171
|
+
filterSwitch: {
|
|
172
|
+
tabs: true,
|
|
173
|
+
labels: true,
|
|
174
|
+
search: true,
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
#### label模式
|
|
180
|
+
适用于标注用户
|
|
181
|
+
|
|
182
|
+
```json
|
|
183
|
+
{
|
|
184
|
+
labelManager: {
|
|
185
|
+
visible: false,
|
|
186
|
+
add: true,
|
|
187
|
+
delete: false,
|
|
188
|
+
edit: false,
|
|
189
|
+
},
|
|
190
|
+
datasetManager: {
|
|
191
|
+
add: false,
|
|
192
|
+
delete: false,
|
|
193
|
+
label: true,
|
|
194
|
+
preLabel: false
|
|
195
|
+
},
|
|
196
|
+
annotation: {
|
|
197
|
+
zoomable: true,
|
|
198
|
+
draggable: true,
|
|
199
|
+
readonly: false,
|
|
200
|
+
},
|
|
201
|
+
filterSwitch: {
|
|
202
|
+
tabs: true,
|
|
203
|
+
labels: true,
|
|
204
|
+
search: true,
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
#### view模式
|
|
210
|
+
适用于没有任何数据操作权限的用户
|
|
211
|
+
|
|
212
|
+
```json
|
|
213
|
+
{
|
|
214
|
+
labelManager: {
|
|
215
|
+
visible: false,
|
|
216
|
+
add: false,
|
|
217
|
+
delete: false,
|
|
218
|
+
edit: false,
|
|
219
|
+
},
|
|
220
|
+
datasetManager: {
|
|
221
|
+
add: false,
|
|
222
|
+
delete: false,
|
|
223
|
+
label: false,
|
|
224
|
+
preLabel: false
|
|
225
|
+
},
|
|
226
|
+
annotation: {
|
|
227
|
+
zoomable: true,
|
|
228
|
+
draggable: true,
|
|
229
|
+
readonly: true,
|
|
230
|
+
},
|
|
231
|
+
filterSwitch: {
|
|
232
|
+
tabs: true,
|
|
233
|
+
labels: true,
|
|
234
|
+
search: true,
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## 物体检测单张图片标注工具配置项
|
|
240
|
+
| 名称 | 数据类型 | 描述 | 必填 | 默认值 |
|
|
241
|
+
| --- | --- | --- | --- | --- |
|
|
242
|
+
| data | `[Sample](https://glodon-cv-help.yuque.com/yfmkyg/sgbna6/evrhc5fhz8no2nlx#Bsu16)` | 查看器需要提供图片文件地址和标注框信息 | 是 | |
|
|
243
|
+
| readonly | `boolean` | 是否支持编辑 | 否 | `true` |
|
|
244
|
+
| showLabelList | `boolean` | 是否展示标签列表 | 否 | `false` |
|
|
245
|
+
| onDataChange | `(v:[Sample](https://glodon-cv-help.yuque.com/yfmkyg/sgbna6/evrhc5fhz8no2nlx#Bsu16)) => void` | 标注框变动时该方法会被调用 | 否 | - |
|
|
246
|
+
| onNextClick | VoidFunction | 下一张按钮被点击时调用,不传递该回调时隐藏下一张按钮 | 否 | - |
|
|
247
|
+
| onPrevClick | VoidFunction | 上一张按钮被点击时调用,不传递该回调时隐藏上一张按钮 | 否 | - |
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
interface Sample {
|
|
252
|
+
fileUrl: string;
|
|
253
|
+
labels: DetectionInfer[];
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
interface DetectionInfer {
|
|
257
|
+
id: string;
|
|
258
|
+
label: string;
|
|
259
|
+
box: [number, number][];
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|