@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,18 +1,18 @@
|
|
|
1
|
-
import { jsxs as a, jsx as
|
|
2
|
-
import { useContext as ze, useState as s, useEffect as
|
|
3
|
-
import { Button as
|
|
1
|
+
import { jsxs as a, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as ze, useState as s, useEffect as k, useRef as q } from "react";
|
|
3
|
+
import { Button as C, Space as fe, Tooltip as _, Empty as me, message as ge } from "antd";
|
|
4
4
|
import { ZoomInOutlined as He, ZoomOutOutlined as Te, FullscreenExitOutlined as De, FullscreenOutlined as Fe } from "@ant-design/icons";
|
|
5
|
-
import { useFullscreen as
|
|
6
|
-
import
|
|
7
|
-
import { tagColors as
|
|
5
|
+
import { useFullscreen as $e } from "ahooks";
|
|
6
|
+
import je from "../../../../DatasetContext/index.mjs";
|
|
7
|
+
import { tagColors as Re } from "../../../../utils/index.mjs";
|
|
8
8
|
import Be from "../../icon_linear.svg.mjs";
|
|
9
9
|
import "./style.less.mjs";
|
|
10
10
|
import he from "../../../Iconfont/index.mjs";
|
|
11
11
|
const ot = (pe) => {
|
|
12
12
|
const {
|
|
13
|
-
serviceId:
|
|
13
|
+
serviceId: v,
|
|
14
14
|
confidence: P,
|
|
15
|
-
datasetId:
|
|
15
|
+
datasetId: E,
|
|
16
16
|
versionId: z,
|
|
17
17
|
isVisible: A
|
|
18
18
|
} = pe, {
|
|
@@ -20,77 +20,79 @@ const ot = (pe) => {
|
|
|
20
20
|
cvforceDatahub: H,
|
|
21
21
|
aiShop: T
|
|
22
22
|
}
|
|
23
|
-
} = ze(
|
|
24
|
-
|
|
25
|
-
!H || !
|
|
23
|
+
} = ze(je), [u, D] = s(), [h, xe] = s([]), [F, G] = s(!1), [M, J] = s([]), [d, ve] = s([]), [I, Ie] = s([]);
|
|
24
|
+
k(() => {
|
|
25
|
+
!H || !E || !z || !A || H.getDatasetsIdVersionsVidSamples(E, z, {
|
|
26
26
|
pageNo: 1,
|
|
27
27
|
pageSize: 10,
|
|
28
28
|
labels: "nocode",
|
|
29
|
-
confirmStatus: 0
|
|
29
|
+
confirmStatus: 0,
|
|
30
|
+
extractPercent: 10,
|
|
31
|
+
extractMax: 10
|
|
30
32
|
}).then((e) => {
|
|
31
|
-
const t = e.recordList || [],
|
|
32
|
-
|
|
33
|
+
const t = e.recordList || [], o = t == null ? void 0 : t[0];
|
|
34
|
+
o != null && o.fileUrl && D(o == null ? void 0 : o.fileUrl), xe(t);
|
|
33
35
|
}).catch(() => !1);
|
|
34
|
-
}, [A,
|
|
35
|
-
!
|
|
36
|
+
}, [A, E, z, H]), k(() => {
|
|
37
|
+
!u || !v || (G(!0), J([]), T == null || T.detectionLayout(v, {
|
|
36
38
|
pages: [{
|
|
37
|
-
image:
|
|
39
|
+
image: u
|
|
38
40
|
}]
|
|
39
41
|
}).then((e) => {
|
|
40
42
|
J(e.prediction);
|
|
41
43
|
}).finally(() => {
|
|
42
44
|
G(!1);
|
|
43
45
|
}));
|
|
44
|
-
}, [
|
|
45
|
-
const e =
|
|
46
|
+
}, [u, v]), k(() => {
|
|
47
|
+
const e = M == null ? void 0 : M.filter((t) => t.score >= (P != null ? P : 0));
|
|
46
48
|
ve(e);
|
|
47
|
-
}, [
|
|
48
|
-
if (!
|
|
49
|
+
}, [M, P]), k(() => {
|
|
50
|
+
if (!d)
|
|
49
51
|
return;
|
|
50
|
-
const e =
|
|
51
|
-
Ie(e.map((t,
|
|
52
|
+
const e = M.map((t) => t.label).reduce((t, o) => t.includes(o) ? t : [...t, o], []);
|
|
53
|
+
Ie(e.map((t, o) => ({
|
|
52
54
|
label: t,
|
|
53
|
-
count:
|
|
54
|
-
color:
|
|
55
|
-
id: `${
|
|
55
|
+
count: d.filter((r) => r.label === t).length,
|
|
56
|
+
color: Re[o],
|
|
57
|
+
id: `${o}_${t}`
|
|
56
58
|
})));
|
|
57
|
-
}, [
|
|
58
|
-
const
|
|
59
|
-
const e =
|
|
59
|
+
}, [d]);
|
|
60
|
+
const Me = () => {
|
|
61
|
+
const e = h.findIndex((t) => t.fileUrl === u);
|
|
60
62
|
if (e <= 0) {
|
|
61
63
|
ge.warning("已经是第一张了");
|
|
62
64
|
return;
|
|
63
65
|
}
|
|
64
|
-
D(
|
|
65
|
-
},
|
|
66
|
-
const e =
|
|
67
|
-
if (e >=
|
|
66
|
+
D(h[e - 1].fileUrl);
|
|
67
|
+
}, ye = () => {
|
|
68
|
+
const e = h.findIndex((t) => t.fileUrl === u);
|
|
69
|
+
if (e >= h.length - 1) {
|
|
68
70
|
ge.warning("已经是最后一张了");
|
|
69
71
|
return;
|
|
70
72
|
}
|
|
71
|
-
D(
|
|
72
|
-
}, w = q(null),
|
|
73
|
-
toggleFullscreen:
|
|
74
|
-
}] =
|
|
73
|
+
D(h[e + 1].fileUrl);
|
|
74
|
+
}, w = q(null), $ = q({}), K = q(null), [Q, {
|
|
75
|
+
toggleFullscreen: Ne
|
|
76
|
+
}] = $e(K), [ee, Ce] = s(0), [te, Pe] = s(0), [c, j] = s(1), [m, p] = s(0), [g, x] = s(0), [we, Se] = s(!1), [oe, ne] = s(-1), [i, R] = s(0), [l, B] = s(0), [se, S] = s(!1), [ce, Ye] = s(), [Y, b] = s({
|
|
75
77
|
x: 0,
|
|
76
78
|
y: 0
|
|
77
|
-
}),
|
|
79
|
+
}), re = 50, ie = 50, le = 50, ae = 50, X = 0.05, O = 3, W = 0.2, be = () => {
|
|
78
80
|
if (!w.current)
|
|
79
81
|
return;
|
|
80
|
-
const e =
|
|
81
|
-
|
|
82
|
-
}, L = (e) => ne(e), Xe = () => ne(-1),
|
|
83
|
-
m < -
|
|
82
|
+
const e = $.current.clientWidth, t = $.current.clientHeight, o = w.current.naturalWidth, r = w.current.naturalHeight, y = e / o, f = t / r, N = y < f ? y : f, ke = (e - o * N) / 2, Ee = (t - r * N) / 2;
|
|
83
|
+
Ce(e), Pe(t), j(N), p(ke), x(Ee), R(o * N), B(r * N), Se(!0);
|
|
84
|
+
}, L = (e) => ne(e), Xe = () => ne(-1), U = () => {
|
|
85
|
+
m < -i + ae && p(-i + ae), g < -l + re && x(-l + re), m > ee - ie && p(ee - ie), g > te - le && x(te - le);
|
|
84
86
|
}, V = () => {
|
|
85
87
|
if (c >= O)
|
|
86
88
|
return;
|
|
87
89
|
let e = c * (1 + X), t = X;
|
|
88
|
-
e >= O && (e = O, t = O / c - 1),
|
|
90
|
+
e >= O && (e = O, t = O / c - 1), p(m - i * (t / 2)), x(g - l * (t / 2)), R(i + i * t), B(l + l * t), j(e), U();
|
|
89
91
|
}, Z = () => {
|
|
90
92
|
if (c <= W)
|
|
91
93
|
return;
|
|
92
94
|
let e = c * (1 - X), t = X;
|
|
93
|
-
e <= W && (e = W, t = 1 - W / c),
|
|
95
|
+
e <= W && (e = W, t = 1 - W / c), p(m - i * (-t / 2)), x(g - l * (-t / 2)), R(i + i * -t), B(l + l * -t), j(e), U();
|
|
94
96
|
};
|
|
95
97
|
window.onmouseup = () => S(!1);
|
|
96
98
|
const Oe = (e) => (e.deltaY < 0 ? V() : Z(), !1), We = (e) => {
|
|
@@ -101,12 +103,12 @@ const ot = (pe) => {
|
|
|
101
103
|
}, Le = (e) => {
|
|
102
104
|
if (!se)
|
|
103
105
|
return;
|
|
104
|
-
const t = e.pageX - Y.x,
|
|
106
|
+
const t = e.pageX - Y.x, o = e.pageY - Y.y;
|
|
105
107
|
b({
|
|
106
108
|
x: e.pageX,
|
|
107
109
|
y: e.pageY
|
|
108
|
-
}),
|
|
109
|
-
}, ue = () => S(!1),
|
|
110
|
+
}), p(m + t), x(g + o), U();
|
|
111
|
+
}, ue = () => S(!1), Ue = (e) => {
|
|
110
112
|
const {
|
|
111
113
|
touches: t
|
|
112
114
|
} = e;
|
|
@@ -115,115 +117,115 @@ const ot = (pe) => {
|
|
|
115
117
|
y: t[0].clientY
|
|
116
118
|
}) : Ye(t);
|
|
117
119
|
}, de = (e, t) => {
|
|
118
|
-
const
|
|
119
|
-
return Math.sqrt(
|
|
120
|
+
const o = t.pageX - e.pageX, r = t.pageY - e.pageY;
|
|
121
|
+
return Math.sqrt(o * o + r * r);
|
|
120
122
|
};
|
|
121
123
|
return /* @__PURE__ */ a("div", {
|
|
122
124
|
className: "pre-label-content",
|
|
123
|
-
children: [
|
|
125
|
+
children: [v && u && /* @__PURE__ */ a("div", {
|
|
124
126
|
className: "pre-label-content-preview",
|
|
125
127
|
ref: K,
|
|
126
|
-
children: [/* @__PURE__ */
|
|
128
|
+
children: [/* @__PURE__ */ n(C, {
|
|
127
129
|
className: "select-prev",
|
|
128
|
-
icon: /* @__PURE__ */
|
|
130
|
+
icon: /* @__PURE__ */ n(he, {
|
|
129
131
|
type: "icon-zuojiantou"
|
|
130
132
|
}),
|
|
131
133
|
disabled: F,
|
|
132
134
|
type: "text",
|
|
133
|
-
onClick: () =>
|
|
135
|
+
onClick: () => Me(),
|
|
134
136
|
tabIndex: 0
|
|
135
137
|
}), /* @__PURE__ */ a("div", {
|
|
136
138
|
className: "select-main",
|
|
137
|
-
children: [/* @__PURE__ */
|
|
139
|
+
children: [/* @__PURE__ */ n("div", {
|
|
138
140
|
className: "marker-action",
|
|
139
|
-
children: /* @__PURE__ */
|
|
141
|
+
children: /* @__PURE__ */ n("div", {
|
|
140
142
|
className: "create-mode-select",
|
|
141
143
|
children: /* @__PURE__ */ a(fe, {
|
|
142
144
|
direction: "vertical",
|
|
143
145
|
size: 16,
|
|
144
|
-
children: [/* @__PURE__ */
|
|
146
|
+
children: [/* @__PURE__ */ n(_, {
|
|
145
147
|
title: "放大-鼠标滚轮前滑",
|
|
146
148
|
placement: "right",
|
|
147
|
-
children: /* @__PURE__ */
|
|
148
|
-
icon: /* @__PURE__ */
|
|
149
|
+
children: /* @__PURE__ */ n(C, {
|
|
150
|
+
icon: /* @__PURE__ */ n(He, {}),
|
|
149
151
|
onClick: V
|
|
150
152
|
})
|
|
151
|
-
}), /* @__PURE__ */
|
|
153
|
+
}), /* @__PURE__ */ n(_, {
|
|
152
154
|
title: "缩小-鼠标滚轮后滑",
|
|
153
155
|
placement: "right",
|
|
154
|
-
children: /* @__PURE__ */
|
|
155
|
-
icon: /* @__PURE__ */
|
|
156
|
+
children: /* @__PURE__ */ n(C, {
|
|
157
|
+
icon: /* @__PURE__ */ n(Te, {}),
|
|
156
158
|
onClick: Z
|
|
157
159
|
})
|
|
158
|
-
}), /* @__PURE__ */
|
|
160
|
+
}), /* @__PURE__ */ n(_, {
|
|
159
161
|
title: Q ? "退出全屏" : "全屏",
|
|
160
162
|
placement: "right",
|
|
161
|
-
children: /* @__PURE__ */
|
|
162
|
-
icon: Q ? /* @__PURE__ */
|
|
163
|
-
onClick:
|
|
163
|
+
children: /* @__PURE__ */ n(C, {
|
|
164
|
+
icon: Q ? /* @__PURE__ */ n(De, {}) : /* @__PURE__ */ n(Fe, {}),
|
|
165
|
+
onClick: Ne
|
|
164
166
|
})
|
|
165
167
|
})]
|
|
166
168
|
})
|
|
167
169
|
})
|
|
168
|
-
}), /* @__PURE__ */
|
|
170
|
+
}), /* @__PURE__ */ n("div", {
|
|
169
171
|
className: "right-col-wrapper",
|
|
170
172
|
children: /* @__PURE__ */ a("div", {
|
|
171
173
|
className: "right-col-img",
|
|
172
|
-
ref:
|
|
174
|
+
ref: $,
|
|
173
175
|
onMouseDown: We,
|
|
174
176
|
onMouseMove: Le,
|
|
175
177
|
onMouseUp: ue,
|
|
176
178
|
onWheel: Oe,
|
|
177
|
-
onTouchStart:
|
|
179
|
+
onTouchStart: Ue,
|
|
178
180
|
onTouchMove: (e) => {
|
|
179
181
|
if (!(!se || !e.touches))
|
|
180
182
|
if (e.touches.length < 2) {
|
|
181
|
-
const t = e.touches[0].clientX - Y.x,
|
|
183
|
+
const t = e.touches[0].clientX - Y.x, o = e.touches[0].clientY - Y.y;
|
|
182
184
|
b({
|
|
183
185
|
x: e.touches[0].clientX,
|
|
184
186
|
y: e.touches[0].clientY
|
|
185
|
-
}),
|
|
187
|
+
}), p(m + t), x(g + o), U();
|
|
186
188
|
} else {
|
|
187
|
-
const t = de(e.touches[0], e.touches[1]),
|
|
188
|
-
t >
|
|
189
|
+
const t = de(e.touches[0], e.touches[1]), o = de(ce[0], ce[1]);
|
|
190
|
+
t > o ? V() : Z();
|
|
189
191
|
}
|
|
190
192
|
},
|
|
191
193
|
onTouchEnd: ue,
|
|
192
|
-
children: [/* @__PURE__ */
|
|
193
|
-
src:
|
|
194
|
+
children: [/* @__PURE__ */ n("img", {
|
|
195
|
+
src: u,
|
|
194
196
|
style: {
|
|
195
197
|
position: "absolute",
|
|
196
198
|
left: m,
|
|
197
199
|
top: g,
|
|
198
|
-
width:
|
|
200
|
+
width: i,
|
|
199
201
|
height: l
|
|
200
202
|
},
|
|
201
203
|
ref: w,
|
|
202
204
|
onLoad: be,
|
|
203
205
|
alt: ""
|
|
204
|
-
}), we && /* @__PURE__ */
|
|
206
|
+
}), we && /* @__PURE__ */ n("svg", {
|
|
205
207
|
style: {
|
|
206
208
|
position: "absolute",
|
|
207
209
|
left: m,
|
|
208
210
|
top: g,
|
|
209
|
-
width:
|
|
211
|
+
width: i,
|
|
210
212
|
height: l
|
|
211
213
|
},
|
|
212
|
-
children: (
|
|
213
|
-
var
|
|
214
|
+
children: (d == null ? void 0 : d.length) && (d == null ? void 0 : d.map((e, t) => {
|
|
215
|
+
var o, r, y;
|
|
214
216
|
return /* @__PURE__ */ a("g", {
|
|
215
|
-
children: [/* @__PURE__ */
|
|
217
|
+
children: [/* @__PURE__ */ n("g", {
|
|
216
218
|
style: {
|
|
217
219
|
cursor: "pointer"
|
|
218
220
|
},
|
|
219
|
-
children: /* @__PURE__ */
|
|
220
|
-
points: (
|
|
221
|
+
children: /* @__PURE__ */ n("polygon", {
|
|
222
|
+
points: (o = e == null ? void 0 : e.box) == null ? void 0 : o.map((f) => `${f[0] * c} ${f[1] * c}`).join(","),
|
|
221
223
|
onMouseOver: () => L(t),
|
|
222
224
|
onMouseEnter: () => L(t),
|
|
223
225
|
onMouseLeave: () => Xe(),
|
|
224
226
|
style: {
|
|
225
|
-
fill: t === oe ? `${(
|
|
226
|
-
stroke: ((
|
|
227
|
+
fill: t === oe ? `${(r = I == null ? void 0 : I.find((f) => f.label === e.label)) == null ? void 0 : r.color}59` : "transparent",
|
|
228
|
+
stroke: ((y = I == null ? void 0 : I.find((f) => f.label === e.label)) == null ? void 0 : y.color) || "",
|
|
227
229
|
strokeWidth: 2,
|
|
228
230
|
cursor: "pointer"
|
|
229
231
|
}
|
|
@@ -238,7 +240,7 @@ const ot = (pe) => {
|
|
|
238
240
|
cursor: "pointer"
|
|
239
241
|
},
|
|
240
242
|
fill: "#fff",
|
|
241
|
-
children: [/* @__PURE__ */
|
|
243
|
+
children: [/* @__PURE__ */ n("text", {
|
|
242
244
|
x: e.box[0][0] * c + 4,
|
|
243
245
|
y: e.box[0][1] * c + 16,
|
|
244
246
|
children: e.label
|
|
@@ -254,36 +256,42 @@ const ot = (pe) => {
|
|
|
254
256
|
}, t) || null]
|
|
255
257
|
}, t);
|
|
256
258
|
}))
|
|
257
|
-
}), F && /* @__PURE__ */
|
|
259
|
+
}), F && /* @__PURE__ */ n("img", {
|
|
258
260
|
className: "pic-curr-linear",
|
|
259
261
|
src: Be,
|
|
260
262
|
alt: ""
|
|
261
263
|
})]
|
|
262
264
|
})
|
|
265
|
+
}), /* @__PURE__ */ n("div", {
|
|
266
|
+
className: "page-info",
|
|
267
|
+
children: (() => {
|
|
268
|
+
const e = h.findIndex((o) => o.fileUrl === u);
|
|
269
|
+
return `${e >= 0 ? e + 1 : 0}/${h.length}`;
|
|
270
|
+
})()
|
|
263
271
|
})]
|
|
264
|
-
}), /* @__PURE__ */
|
|
272
|
+
}), /* @__PURE__ */ n(C, {
|
|
265
273
|
className: "select-next",
|
|
266
274
|
disabled: F,
|
|
267
|
-
icon: /* @__PURE__ */
|
|
275
|
+
icon: /* @__PURE__ */ n(he, {
|
|
268
276
|
type: "icon-youjiantou"
|
|
269
277
|
}),
|
|
270
278
|
type: "text",
|
|
271
|
-
onClick: () =>
|
|
279
|
+
onClick: () => ye()
|
|
272
280
|
})]
|
|
273
|
-
}),
|
|
281
|
+
}), v && !u && /* @__PURE__ */ n("div", {
|
|
274
282
|
className: "pre-label-content-nodata",
|
|
275
|
-
children: /* @__PURE__ */
|
|
283
|
+
children: /* @__PURE__ */ n(me, {
|
|
276
284
|
description: "暂无未标注的图片"
|
|
277
285
|
})
|
|
278
|
-
}), !
|
|
286
|
+
}), !v && /* @__PURE__ */ n("div", {
|
|
279
287
|
className: "pre-label-content-nodata",
|
|
280
|
-
children: /* @__PURE__ */
|
|
288
|
+
children: /* @__PURE__ */ n(me, {
|
|
281
289
|
description: /* @__PURE__ */ a(fe, {
|
|
282
290
|
direction: "vertical",
|
|
283
291
|
size: 8,
|
|
284
|
-
children: [/* @__PURE__ */
|
|
292
|
+
children: [/* @__PURE__ */ n("div", {
|
|
285
293
|
children: "选择服务,查看预览测试效果"
|
|
286
|
-
}), /* @__PURE__ */
|
|
294
|
+
}), /* @__PURE__ */ n("div", {
|
|
287
295
|
children: "随机抽取占比不超过未标注总的 10%,最少1张最高不超过 10 张"
|
|
288
296
|
})]
|
|
289
297
|
})
|