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