@glodon-aiot/dataset-annotation 3.18.0-alpha.11 → 3.18.0-alpha.13
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/dist/es/components/OcrAnnotation/PreLabelOCR/PreLabelModal.mjs +163 -139
- package/dist/es/components/OcrAnnotation/PreLabelOCR/components/PreLabelPreview/index.mjs +310 -0
- package/dist/es/components/OcrAnnotation/PreLabelOCR/components/PreLabelPreview/style.less.mjs +4 -0
- package/dist/es/components/OcrAnnotation/PreLabelOCR/icon_linear.svg.mjs +4 -0
- package/dist/es/components/PreLabelOCR/components/PreLabelPreview/index.mjs +103 -95
- package/dist/es/components/VLMAnnotationDetail/VLMDetail/index.mjs +243 -233
- package/dist/es/index.mjs +1 -1
- package/dist/es/utils/index.mjs +1 -1
- package/dist/lib/index.js +4 -4
- package/dist/src/components/OcrAnnotation/PreLabelOCR/components/PreLabelPreview/index.d.ts +13 -0
- package/package.json +2 -2
|
@@ -1,166 +1,168 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var L = (w, d, r) => new Promise((P, T) => {
|
|
2
|
+
var O = (u) => {
|
|
3
3
|
try {
|
|
4
4
|
m(r.next(u));
|
|
5
|
-
} catch (
|
|
6
|
-
|
|
5
|
+
} catch (y) {
|
|
6
|
+
T(y);
|
|
7
7
|
}
|
|
8
|
-
},
|
|
8
|
+
}, t = (u) => {
|
|
9
9
|
try {
|
|
10
10
|
m(r.throw(u));
|
|
11
|
-
} catch (
|
|
12
|
-
|
|
11
|
+
} catch (y) {
|
|
12
|
+
T(y);
|
|
13
13
|
}
|
|
14
|
-
}, m = (u) => u.done ?
|
|
15
|
-
m((r = r.apply(
|
|
14
|
+
}, m = (u) => u.done ? P(u.value) : Promise.resolve(u.value).then(O, t);
|
|
15
|
+
m((r = r.apply(w, d)).next());
|
|
16
16
|
});
|
|
17
|
-
import { jsx as
|
|
18
|
-
import { useState as
|
|
19
|
-
import { Form as
|
|
17
|
+
import { jsx as l, jsxs as S } from "react/jsx-runtime";
|
|
18
|
+
import { useState as C, useContext as $, useEffect as k } from "react";
|
|
19
|
+
import { Form as v, Modal as ee, Button as N, Space as z, Spin as te, Select as A, Tooltip as G, Tag as le, Radio as M } from "antd";
|
|
20
20
|
import "./style.less.mjs";
|
|
21
|
-
import { detectionPreService as
|
|
21
|
+
import { detectionPreService as ae, ocrPreService as ne } from "../constant.mjs";
|
|
22
22
|
import { PreLabelTaskStatus as p } from "@glodon-aiot/apis";
|
|
23
|
-
import
|
|
24
|
-
|
|
23
|
+
import se from "../../../DatasetContext/index.mjs";
|
|
24
|
+
import re from "../../../Common/ArchiSlider/index.mjs";
|
|
25
|
+
import ie from "./components/PreLabelPreview/index.mjs";
|
|
26
|
+
const Se = (w) => {
|
|
25
27
|
const {
|
|
26
28
|
datasetId: d,
|
|
27
29
|
versionId: r,
|
|
28
|
-
isVisible:
|
|
29
|
-
onClose:
|
|
30
|
-
setIsTaskChange:
|
|
31
|
-
record:
|
|
30
|
+
isVisible: P,
|
|
31
|
+
onClose: T,
|
|
32
|
+
setIsTaskChange: O,
|
|
33
|
+
record: t,
|
|
32
34
|
datasetType: m
|
|
33
|
-
} =
|
|
35
|
+
} = w, [u, y] = C([]), [q, B] = C([]), [b] = v.useForm(), [a, I] = C(), [x, W] = C(), [g, E] = C(""), h = v.useWatch("service", b), [_, D] = C(!1), {
|
|
34
36
|
services: {
|
|
35
37
|
cvforceDatahub: o,
|
|
36
|
-
cvforceModelService:
|
|
38
|
+
cvforceModelService: f
|
|
37
39
|
},
|
|
38
40
|
featuresConfig: {
|
|
39
|
-
labelManager:
|
|
41
|
+
labelManager: oe
|
|
40
42
|
} = {
|
|
41
43
|
labelManager: !1
|
|
42
44
|
}
|
|
43
|
-
} =
|
|
44
|
-
|
|
45
|
+
} = $(se), J = v.useWatch("confidence", b), H = m === "detection" ? ae : ne, V = () => {
|
|
46
|
+
T();
|
|
45
47
|
};
|
|
46
48
|
k(() => {
|
|
47
|
-
|
|
49
|
+
U(), X();
|
|
48
50
|
}, []), k(() => {
|
|
49
|
-
|
|
50
|
-
}, [
|
|
51
|
-
var e,
|
|
51
|
+
t && I(t), t != null && t.lastTaskResult && W(JSON.parse(t == null ? void 0 : t.lastTaskResult));
|
|
52
|
+
}, [t]), k(() => {
|
|
53
|
+
var e, n, s, i, c;
|
|
52
54
|
b.setFieldsValue({
|
|
53
55
|
service: {
|
|
54
56
|
value: (e = a == null ? void 0 : a.params) == null ? void 0 : e.serviceId,
|
|
55
|
-
label: (
|
|
57
|
+
label: (n = a == null ? void 0 : a.params) == null ? void 0 : n.serviceName
|
|
56
58
|
},
|
|
57
|
-
data: ((
|
|
59
|
+
data: ((s = a == null ? void 0 : a.params) == null ? void 0 : s.data) || "nolabel",
|
|
58
60
|
confidence: (c = (i = a == null ? void 0 : a.params) == null ? void 0 : i.confidence) != null ? c : 0.6
|
|
59
|
-
}),
|
|
61
|
+
}), E((a == null ? void 0 : a.state) || "PENDING"), console.log(a, "============");
|
|
60
62
|
}, [a]), k(() => {
|
|
61
|
-
!
|
|
63
|
+
!h || !h.value || m !== "ocr" && Promise.all([K(), Q(h.value)]).then(([e, n]) => {
|
|
62
64
|
if (!e)
|
|
63
65
|
return;
|
|
64
|
-
const
|
|
65
|
-
if (!(
|
|
66
|
+
const s = e.filter((i) => {
|
|
67
|
+
if (!(n != null && n.find((c) => c === i)))
|
|
66
68
|
return i;
|
|
67
69
|
});
|
|
68
|
-
|
|
70
|
+
D(!!s.length), b.validateFields(["service"]);
|
|
69
71
|
});
|
|
70
|
-
}, [
|
|
71
|
-
const
|
|
72
|
+
}, [h]);
|
|
73
|
+
const K = () => {
|
|
72
74
|
if (!(!d || !r))
|
|
73
|
-
return o == null ? void 0 : o.getDatasetsIdVersionsVidLabelcount(d, r).then((e) => e.filter((
|
|
74
|
-
},
|
|
75
|
-
const
|
|
76
|
-
return
|
|
77
|
-
}),
|
|
78
|
-
|
|
79
|
-
signName:
|
|
75
|
+
return o == null ? void 0 : o.getDatasetsIdVersionsVidLabelcount(d, r).then((e) => e.filter((s) => s.label !== "nocode").map((s) => s.label));
|
|
76
|
+
}, Q = (e) => f == null ? void 0 : f.getModelServiceById(e).then((n) => {
|
|
77
|
+
const s = n.deployOptions.confidence;
|
|
78
|
+
return s == null ? void 0 : s.map((c) => c.label);
|
|
79
|
+
}), U = () => {
|
|
80
|
+
f == null || f.openModelServices({
|
|
81
|
+
signName: H,
|
|
80
82
|
state: "Running"
|
|
81
83
|
}).then((e) => {
|
|
82
|
-
const
|
|
84
|
+
const s = (e || []).map((i) => {
|
|
83
85
|
var c;
|
|
84
86
|
return {
|
|
85
87
|
label: i.name,
|
|
86
88
|
value: i.id,
|
|
87
|
-
confidence: ((c = i.deployOptions.confidence) == null ? void 0 : c.map((
|
|
89
|
+
confidence: ((c = i.deployOptions.confidence) == null ? void 0 : c.map((F) => F.label)) || []
|
|
88
90
|
};
|
|
89
91
|
});
|
|
90
|
-
|
|
92
|
+
y(s);
|
|
91
93
|
});
|
|
92
|
-
},
|
|
94
|
+
}, X = () => {
|
|
93
95
|
!d || !r || o == null || o.getDatasetsIdVersionsVidSamples(d, r, {
|
|
94
96
|
labels: "nocode",
|
|
95
97
|
pageNo: 1,
|
|
96
98
|
pageSize: 1
|
|
97
99
|
}).then((e) => {
|
|
98
|
-
const
|
|
100
|
+
const n = e.recordList || [];
|
|
99
101
|
B([{
|
|
100
102
|
label: "全部未标注数据",
|
|
101
103
|
value: "nolabel",
|
|
102
|
-
disabled: !
|
|
104
|
+
disabled: !n.length
|
|
103
105
|
}]);
|
|
104
106
|
});
|
|
105
107
|
}, R = () => {
|
|
106
108
|
!d || !r || !(a != null && a.taskId) || o == null || o.delPreLabelTask(d, r, a.taskId).then((e) => {
|
|
107
|
-
|
|
109
|
+
O((n) => !n), E("PENDING");
|
|
108
110
|
});
|
|
109
|
-
}, X = () => {
|
|
110
|
-
R();
|
|
111
111
|
}, Y = () => {
|
|
112
|
-
R()
|
|
112
|
+
R();
|
|
113
|
+
}, Z = () => {
|
|
114
|
+
R(), b.resetFields(), I(void 0);
|
|
113
115
|
}, j = (e) => {
|
|
114
|
-
var
|
|
116
|
+
var s, i;
|
|
115
117
|
if (!d || !r || !e.service)
|
|
116
118
|
return;
|
|
117
|
-
const
|
|
119
|
+
const n = {
|
|
118
120
|
serviceId: e.service.value,
|
|
119
|
-
serviceName: (
|
|
121
|
+
serviceName: (s = u.find((c) => c.value === e.service.value)) == null ? void 0 : s.label,
|
|
120
122
|
data: "nolabel",
|
|
121
123
|
confidence: (i = e.confidence) != null ? i : 0.6
|
|
122
124
|
};
|
|
123
|
-
o == null || o.postPreLabelTask(d, r,
|
|
124
|
-
|
|
125
|
+
o == null || o.postPreLabelTask(d, r, n).then((c) => {
|
|
126
|
+
O((F) => !F);
|
|
125
127
|
});
|
|
126
128
|
};
|
|
127
|
-
return /* @__PURE__ */
|
|
129
|
+
return /* @__PURE__ */ l(ee, {
|
|
128
130
|
title: "预标注设置",
|
|
129
131
|
wrapClassName: "batch-ocr-modal-wrap",
|
|
130
132
|
className: "batch-ocr-modal",
|
|
131
|
-
open:
|
|
133
|
+
open: P,
|
|
132
134
|
destroyOnClose: !0,
|
|
133
|
-
onCancel:
|
|
134
|
-
width:
|
|
135
|
+
onCancel: V,
|
|
136
|
+
width: "100%",
|
|
135
137
|
maskClosable: !1,
|
|
136
138
|
centered: !0,
|
|
137
|
-
footer:
|
|
138
|
-
onClick:
|
|
139
|
+
footer: g === p.Pending ? [/* @__PURE__ */ l(N, {
|
|
140
|
+
onClick: V,
|
|
139
141
|
children: "取消"
|
|
140
|
-
}, "cancel"), /* @__PURE__ */
|
|
142
|
+
}, "cancel"), /* @__PURE__ */ l(N, {
|
|
141
143
|
type: "primary",
|
|
142
144
|
htmlType: "submit",
|
|
143
145
|
form: "preLabelForm",
|
|
144
146
|
onClick: j,
|
|
145
147
|
children: "确定"
|
|
146
|
-
}, "confirm")] : (
|
|
147
|
-
onClick:
|
|
148
|
+
}, "confirm")] : (t == null ? void 0 : t.state) === p.Started ? [/* @__PURE__ */ l(N, {
|
|
149
|
+
onClick: Y,
|
|
148
150
|
children: "终止"
|
|
149
|
-
}, "abort"), /* @__PURE__ */
|
|
150
|
-
onClick:
|
|
151
|
+
}, "abort"), /* @__PURE__ */ l(N, {
|
|
152
|
+
onClick: V,
|
|
151
153
|
children: "返回"
|
|
152
|
-
}, "cancel")] : [/* @__PURE__ */
|
|
153
|
-
onClick:
|
|
154
|
+
}, "cancel")] : [/* @__PURE__ */ l(N, {
|
|
155
|
+
onClick: Z,
|
|
154
156
|
children: "新建任务"
|
|
155
|
-
}, "abort"), /* @__PURE__ */
|
|
156
|
-
onClick:
|
|
157
|
+
}, "abort"), /* @__PURE__ */ l(N, {
|
|
158
|
+
onClick: V,
|
|
157
159
|
children: "返回"
|
|
158
160
|
}, "cancel")],
|
|
159
|
-
children:
|
|
161
|
+
children: g === p.Started || g === p.Success ? /* @__PURE__ */ l("div", {
|
|
160
162
|
style: {
|
|
161
163
|
padding: "80px 0"
|
|
162
164
|
},
|
|
163
|
-
children: /* @__PURE__ */
|
|
165
|
+
children: /* @__PURE__ */ S(z, {
|
|
164
166
|
className: "mark-status",
|
|
165
167
|
direction: "vertical",
|
|
166
168
|
align: "center",
|
|
@@ -168,85 +170,107 @@ const be = (F) => {
|
|
|
168
170
|
width: "100%"
|
|
169
171
|
},
|
|
170
172
|
size: 24,
|
|
171
|
-
children: [
|
|
173
|
+
children: [g === p.Started && /* @__PURE__ */ l(te, {
|
|
172
174
|
size: "default"
|
|
173
|
-
}), (
|
|
175
|
+
}), (g === p.Started || g === p.Success) && /* @__PURE__ */ S(z, {
|
|
174
176
|
style: {
|
|
175
177
|
marginLeft: 14
|
|
176
178
|
},
|
|
177
179
|
size: 0,
|
|
178
|
-
children: [/* @__PURE__ */
|
|
180
|
+
children: [/* @__PURE__ */ S("span", {
|
|
179
181
|
children: ["已标注数据:", x.completeCount || 0, " 张,"]
|
|
180
|
-
}), /* @__PURE__ */
|
|
182
|
+
}), /* @__PURE__ */ S("span", {
|
|
181
183
|
children: ["共计:", x.allCount || 0, " 张"]
|
|
182
184
|
})]
|
|
183
185
|
})]
|
|
184
186
|
})
|
|
185
|
-
}) : /* @__PURE__ */
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
187
|
+
}) : /* @__PURE__ */ S("div", {
|
|
188
|
+
className: "pre-label-form-wrap",
|
|
189
|
+
children: [/* @__PURE__ */ l("div", {
|
|
190
|
+
className: "pre-label-form",
|
|
191
|
+
children: /* @__PURE__ */ S(v, {
|
|
192
|
+
onFinish: j,
|
|
193
|
+
name: "preLabelForm",
|
|
194
|
+
labelAlign: "right",
|
|
195
|
+
labelCol: {
|
|
196
|
+
style: {
|
|
197
|
+
width: 80
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
form: b,
|
|
201
|
+
children: [/* @__PURE__ */ l(v.Item, {
|
|
202
|
+
label: "选择服务",
|
|
203
|
+
name: "service",
|
|
204
|
+
rules: [{
|
|
205
|
+
required: !0
|
|
206
|
+
}, {
|
|
207
|
+
validator: (e, n) => L(void 0, null, function* () {
|
|
208
|
+
const s = b.getFieldValue("service");
|
|
209
|
+
if (!s.value || !s.label)
|
|
210
|
+
return Promise.reject(new Error("请选择服务"));
|
|
211
|
+
})
|
|
212
|
+
}, {
|
|
213
|
+
validator: (e, n) => L(void 0, null, function* () {
|
|
214
|
+
if (_ && m === "detection")
|
|
215
|
+
return Promise.reject(new Error("所选服务与当前数据集标签不符"));
|
|
216
|
+
})
|
|
217
|
+
}],
|
|
218
|
+
children: /* @__PURE__ */ l(A, {
|
|
219
|
+
labelInValue: !0,
|
|
220
|
+
disabled: (t == null ? void 0 : t.state) === p.Started,
|
|
221
|
+
children: u.map((e) => /* @__PURE__ */ l(A.Option, {
|
|
222
|
+
value: e.value,
|
|
223
|
+
disabled: e.disabled,
|
|
224
|
+
children: /* @__PURE__ */ l(G, {
|
|
225
|
+
title: e.confidence.length ? e.confidence.map((n) => /* @__PURE__ */ l(le, {
|
|
226
|
+
children: n
|
|
227
|
+
}, n)) : null,
|
|
228
|
+
overlayClassName: "service-tag-tooltip",
|
|
229
|
+
children: e.label
|
|
230
|
+
})
|
|
231
|
+
}, e.value))
|
|
224
232
|
})
|
|
225
|
-
},
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
233
|
+
}), /* @__PURE__ */ l(v.Item, {
|
|
234
|
+
label: "处理范围",
|
|
235
|
+
name: "data",
|
|
236
|
+
rules: [{
|
|
237
|
+
required: !0,
|
|
238
|
+
message: "请选择数据"
|
|
239
|
+
}],
|
|
240
|
+
initialValue: "nolabel",
|
|
241
|
+
children: /* @__PURE__ */ l(M.Group, {
|
|
242
|
+
disabled: (t == null ? void 0 : t.state) === p.Started,
|
|
243
|
+
children: q.map((e) => /* @__PURE__ */ l(G, {
|
|
244
|
+
title: e.disabled ? "该数据集下不存在未标注的数据" : "当前数据集版本下所有未标注的数据",
|
|
245
|
+
children: /* @__PURE__ */ l(M, {
|
|
246
|
+
value: e.value,
|
|
247
|
+
disabled: e.disabled,
|
|
248
|
+
children: e.label
|
|
249
|
+
})
|
|
250
|
+
}, e.value))
|
|
251
|
+
})
|
|
252
|
+
}), m === "ocr" && /* @__PURE__ */ l(v.Item, {
|
|
253
|
+
label: "置信度",
|
|
254
|
+
name: "confidence",
|
|
255
|
+
initialValue: 0.6,
|
|
256
|
+
children: /* @__PURE__ */ l(re, {
|
|
257
|
+
min: 0,
|
|
258
|
+
max: 1,
|
|
259
|
+
step: 0.01,
|
|
260
|
+
disabled: (t == null ? void 0 : t.state) === p.Started
|
|
243
261
|
})
|
|
244
|
-
}
|
|
262
|
+
})]
|
|
245
263
|
})
|
|
264
|
+
}), /* @__PURE__ */ l(ie, {
|
|
265
|
+
serviceId: h == null ? void 0 : h.value,
|
|
266
|
+
confidence: J,
|
|
267
|
+
datasetId: d,
|
|
268
|
+
versionId: r,
|
|
269
|
+
isVisible: P
|
|
246
270
|
})]
|
|
247
271
|
})
|
|
248
272
|
});
|
|
249
273
|
};
|
|
250
274
|
export {
|
|
251
|
-
|
|
275
|
+
Se as default
|
|
252
276
|
};
|