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