@glodon-aiot/dataset-annotation 3.10.0-snapshot.17 → 3.10.0-snapshot.18

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.
@@ -14,7 +14,7 @@ import { jsx as E } from "react/jsx-runtime";
14
14
  import { useState as I, useContext as ge, useEffect as B } from "react";
15
15
  import ce from "./LableEditor.mjs";
16
16
  import { fabric as X } from "fabric";
17
- import oe from "ahooks/lib/useKeyPress";
17
+ import { useKeyPress as oe } from "ahooks";
18
18
  import { Spin as le } from "antd";
19
19
  import he from "react-dom";
20
20
  import { getUuid as K } from "../../../../utils/index.mjs";
@@ -22,7 +22,7 @@ var ge = (r, m) => {
22
22
  import { jsx as S, jsxs as Xe } from "react/jsx-runtime";
23
23
  import { useState as U, useEffect as F } from "react";
24
24
  import { fabric as z } from "fabric";
25
- import le from "ahooks/lib/useKeyPress";
25
+ import { useKeyPress as le } from "ahooks";
26
26
  import { Spin as $e, Space as Ie, Radio as me, Tooltip as se, Button as he } from "antd";
27
27
  import Me from "react-dom";
28
28
  import "./style.less.mjs";
@@ -1,12 +1,12 @@
1
- var ul = Object.defineProperty;
1
+ var ml = Object.defineProperty;
2
2
  var Ve = Object.getOwnPropertySymbols;
3
- var ml = Object.prototype.hasOwnProperty, fl = Object.prototype.propertyIsEnumerable;
4
- var Pe = (z, e, i) => e in z ? ul(z, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : z[e] = i, Me = (z, e) => {
3
+ var fl = Object.prototype.hasOwnProperty, hl = Object.prototype.propertyIsEnumerable;
4
+ var Pe = (z, e, i) => e in z ? ml(z, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : z[e] = i, Me = (z, e) => {
5
5
  for (var i in e || (e = {}))
6
- ml.call(e, i) && Pe(z, i, e[i]);
6
+ fl.call(e, i) && Pe(z, i, e[i]);
7
7
  if (Ve)
8
8
  for (var i of Ve(e))
9
- fl.call(e, i) && Pe(z, i, e[i]);
9
+ hl.call(e, i) && Pe(z, i, e[i]);
10
10
  return z;
11
11
  };
12
12
  var ce = (z, e, i) => new Promise((m, K) => {
@@ -26,24 +26,21 @@ var ce = (z, e, i) => new Promise((m, K) => {
26
26
  T((i = i.apply(z, e)).next());
27
27
  });
28
28
  import { jsxs as d, Fragment as de, jsx as l } from "react/jsx-runtime";
29
- import { useContext as hl, useState as r, useRef as gl, useEffect as O } from "react";
30
- import { Form as V, message as $, Modal as H, Button as P, Radio as k, Tooltip as Cl, Space as je, Upload as Ge, Row as pe, Col as bl, Spin as yl, Result as De } from "antd";
29
+ import { useContext as gl, useState as r, useRef as Cl, useEffect as O } from "react";
30
+ import { Form as V, message as $, Modal as H, Button as P, Radio as k, Tooltip as bl, Space as je, Upload as De, Row as pe, Col as yl, Spin as Sl, Result as Ke } from "antd";
31
31
  import "./style.less.mjs";
32
- import { InfoCircleOutlined as Sl, CloudUploadOutlined as zl, PaperClipOutlined as wl, DeleteOutlined as El, PlusOutlined as Nl } from "@ant-design/icons";
33
- import vl from "browser-md5-file";
34
- import { initMinio as Ke, putObjectBuffer as _e } from "@glodon-aiot/minio";
35
- import xl from "./pic_zip.svg.mjs";
36
- import Al from "./pic_zip_json.svg.mjs";
37
- import Fl from "./pic_vlm_json_zip.svg.mjs";
38
- import Rl from "./pic_vlm_zip.svg.mjs";
39
- import { MB as Ze, GB as Bl } from "../../constant.mjs";
40
- import { fileSuffixToLowerCase as $l } from "../../utils/index.mjs";
41
- import kl from "../../DatasetContext/index.mjs";
42
- import { EXAMPLE_SRC_ROOT as Tl, VLM_EXAMPLE_SRC_ROOT as Ul } from "../../featuresConfig.mjs";
43
- import { getImportConfig as Ll } from "./config.mjs";
44
- const {
45
- Dragger: Ol
46
- } = Ge;
32
+ import { InfoCircleOutlined as zl, CloudUploadOutlined as wl, PaperClipOutlined as El, DeleteOutlined as Nl, PlusOutlined as vl } from "@ant-design/icons";
33
+ import xl from "browser-md5-file";
34
+ import { initMinio as _e, putObjectBuffer as Ze } from "@glodon-aiot/minio";
35
+ import Al from "./pic_zip.svg.mjs";
36
+ import Fl from "./pic_zip_json.svg.mjs";
37
+ import Rl from "./pic_vlm_json_zip.svg.mjs";
38
+ import Bl from "./pic_vlm_zip.svg.mjs";
39
+ import { MB as Ge, GB as $l } from "../../constant.mjs";
40
+ import { fileSuffixToLowerCase as kl } from "../../utils/index.mjs";
41
+ import Tl from "../../DatasetContext/index.mjs";
42
+ import { EXAMPLE_SRC_ROOT as Ul, VLM_EXAMPLE_SRC_ROOT as Ll } from "../../featuresConfig.mjs";
43
+ import { getImportConfig as Ol } from "./config.mjs";
47
44
  let f = 0, G = 0, M = 0, I = 0;
48
45
  const nt = (z) => {
49
46
  const {
@@ -68,13 +65,15 @@ const nt = (z) => {
68
65
  exampleSrcRoot: fe,
69
66
  vlmExampleSrcRoot: he
70
67
  } = {
71
- exampleSrcRoot: Tl,
72
- vlmExampleSrcRoot: Ul
68
+ exampleSrcRoot: Ul,
69
+ vlmExampleSrcRoot: Ll
73
70
  }
74
- } = hl(kl), [w, Ie] = r(0), [E, qe] = r(0), [Y, Xe] = r([]), [j, Je] = r(), [ge, Vl] = r([]), [ee, X] = r(!1), [Ce, le] = r(!1), [Z, te] = r(!1), [se, We] = r(0), [be, He] = r(0), [J, ye] = r(-1), [ie, Pl] = r([]), [Se, Ml] = r([]), [ze, ne] = r(!1), Qe = new vl(), [W] = V.useForm(), n = V.useWatch("acceptType", W), F = V.useWatch("labelState", W), [C, we] = r([]), [R, Ee] = r([]), [B, Ye] = r(), [Ne, ve] = r(0), [xe, Ae] = r(!1), [jl, Fe] = r(""), [el, Re] = r(!1), [Be, ll] = r(
71
+ } = gl(Tl), [w, Ie] = r(0), [E, qe] = r(0), [Y, Xe] = r([]), [j, Je] = r(), [ge, Vl] = r([]), [ee, X] = r(!1), [Ce, le] = r(!1), [Z, te] = r(!1), [se, We] = r(0), [be, He] = r(0), [J, ye] = r(-1), [ie, Pl] = r([]), [Se, Ml] = r([]), [ze, ne] = r(!1), Qe = new xl(), [W] = V.useForm(), n = V.useWatch("acceptType", W), F = V.useWatch("labelState", W), [C, we] = r([]), [R, Ee] = r([]), [B, Ye] = r(), [Ne, ve] = r(0), [xe, Ae] = r(!1), [jl, Fe] = r(""), [el, Re] = r(!1), [Be, ll] = r(
75
72
  "unlabeled"
76
73
  /* Unlabeled */
77
- ), oe = gl(!0), g = Ll(h), ae = g.imageMimeTypes, $e = g.imageAccept, re = g.maxImageSize;
74
+ ), oe = Cl(!0), {
75
+ Dragger: tl
76
+ } = De, g = Ol(h), ae = g.imageMimeTypes, $e = g.imageAccept, re = g.maxImageSize;
78
77
  O(() => {
79
78
  f = 0, G = 0, M = 0, I = 0, te(!1), _ && (oe.current = !1, q && q());
80
79
  }, [_]);
@@ -105,7 +104,7 @@ const nt = (z) => {
105
104
  } else
106
105
  return !1;
107
106
  } else {
108
- if (t.size > 2 * Bl)
107
+ if (t.size > 2 * $l)
109
108
  return $.error(`${t.name}文件总大小不能超过2G`), !1;
110
109
  const a = (o = t.name) == null ? void 0 : o.substring(t.name.lastIndexOf("."));
111
110
  if (n === "zip" && a !== ".zip")
@@ -115,21 +114,21 @@ const nt = (z) => {
115
114
  return !1;
116
115
  };
117
116
  O(() => {
118
- ze !== !1 && (!w && !E && !f || (f = f - I - w - E, f < 101 ? w > 0 && E > 0 ? ($.error(`${w + E}个文件添加失败,格式、大小或数量不符合要求`), f = f - w - E) : w > 0 && E === 0 ? $.error(`${w}个文件添加失败,格式不符合要求`) : w === 0 && E > 0 ? $.error(`${E}个文件添加失败,单张图片超过${g.maxImageSize / Ze}M`) : w === 0 && E === 0 && $.success("校验成功") : w + E === 0 ? ($.error(`${f - 100}个文件添加失败,超过数量限制`), f = 100) : ($.error(`${f - 100 + w + E}个文件添加失败,格式、大小或数量不符合要求`), f = f < 101 ? f : 100), ne(!1)));
117
+ ze !== !1 && (!w && !E && !f || (f = f - I - w - E, f < 101 ? w > 0 && E > 0 ? ($.error(`${w + E}个文件添加失败,格式、大小或数量不符合要求`), f = f - w - E) : w > 0 && E === 0 ? $.error(`${w}个文件添加失败,格式不符合要求`) : w === 0 && E > 0 ? $.error(`${E}个文件添加失败,单张图片超过${g.maxImageSize / Ge}M`) : w === 0 && E === 0 && $.success("校验成功") : w + E === 0 ? ($.error(`${f - 100}个文件添加失败,超过数量限制`), f = 100) : ($.error(`${f - 100 + w + E}个文件添加失败,格式、大小或数量不符合要求`), f = f < 101 ? f : 100), ne(!1)));
119
118
  }, [ze]);
120
- const tl = (t) => {
119
+ const sl = (t) => {
121
120
  const s = t.originFileObj;
122
121
  return new Promise((o, a) => {
123
122
  Qe.md5(s, (u, c) => {
124
- u && a(u), il(c, s), o(c);
123
+ u && a(u), nl(c, s), o(c);
125
124
  });
126
125
  });
127
- }, sl = () => ce(void 0, null, function* () {
126
+ }, il = () => ce(void 0, null, function* () {
128
127
  if (!C)
129
128
  return;
130
129
  const t = [];
131
130
  for (let s = 0; s < C.length; s++) {
132
- const o = C[s], a = yield tl(o);
131
+ const o = C[s], a = yield sl(o);
133
132
  t.push(a);
134
133
  }
135
134
  !i || t.length === 0 || p == null || p.getDeduplication(t, i).then((s) => {
@@ -137,9 +136,9 @@ const nt = (z) => {
137
136
  });
138
137
  });
139
138
  O(() => {
140
- sl();
139
+ il();
141
140
  }, [C]);
142
- const il = (t, s) => {
141
+ const nl = (t, s) => {
143
142
  s.md5 = t, ge.push(s);
144
143
  }, Te = ({
145
144
  fileList: t
@@ -151,7 +150,7 @@ const nt = (z) => {
151
150
  s.splice(100, s.length), s.length < C.length ? (we(s), I++) : (M = M - I, I = 0, M++, M == s.length && we(s), M > s.length && (M = s.length));
152
151
  }, Ue = () => {
153
152
  n === "zip" && (oe.current = !0), T(!1);
154
- }, nl = () => {
153
+ }, ol = () => {
155
154
  if (n === "image") {
156
155
  if (!j)
157
156
  return;
@@ -178,16 +177,16 @@ const nt = (z) => {
178
177
  "Content-Type": "application/octet-stream",
179
178
  "X-Amz-Meta-Width": b == null ? void 0 : b.width,
180
179
  "X-Amz-Meta-Height": b == null ? void 0 : b.height
181
- }, x = `dataset/${i}/sample/${a}${$l(S)}`;
180
+ }, x = `dataset/${i}/sample/${a}${kl(S)}`;
182
181
  delete c.md5;
183
182
  const A = new FileReader();
184
183
  A.readAsArrayBuffer(c), A.onload = (U) => {
185
- Ke({
184
+ _e({
186
185
  endPoint: e == null ? void 0 : e.endpoints[0],
187
186
  useSSL: e == null ? void 0 : e.useSSL,
188
187
  accessKey: e == null ? void 0 : e.accessKey,
189
188
  secretKey: e == null ? void 0 : e.secretKey
190
- }), _e(K, x, U.target.result, D, (L, Dl) => {
189
+ }), Ze(K, x, U.target.result, D, (L, Dl) => {
191
190
  X(!0), s += 1, L && (t += 1, He(t)), We(s), Se.push({
192
191
  labels: [],
193
192
  fileKey: `${K}/${x}`,
@@ -221,8 +220,8 @@ const nt = (z) => {
221
220
  });
222
221
  }
223
222
  } else
224
- ol(R);
225
- }, ol = (t) => {
223
+ al(R);
224
+ }, al = (t) => {
226
225
  !i || !m || t.map((s, o) => {
227
226
  var S;
228
227
  const a = {
@@ -234,7 +233,7 @@ const nt = (z) => {
234
233
  secretKey: e == null ? void 0 : e.secretKey
235
234
  }, c = (e == null ? void 0 : e.prefix) + ((S = t[0]) == null ? void 0 : S.name), y = new FileReader();
236
235
  y.readAsArrayBuffer(s), y.onload = (b) => {
237
- Ke(u), _e(e == null ? void 0 : e.bucket, c, b.target.result, a, (D, x) => {
236
+ _e(u), Ze(e == null ? void 0 : e.bucket, c, b.target.result, a, (D, x) => {
238
237
  if (D)
239
238
  console.log(D);
240
239
  else {
@@ -280,23 +279,23 @@ const nt = (z) => {
280
279
  }, [se]), O(() => {
281
280
  J !== -1 && (le(!0), te(!1));
282
281
  }, [J]);
283
- const al = () => {
282
+ const rl = () => {
284
283
  Oe(), le(!1), me && me();
285
284
  }, Oe = () => {
286
285
  N(), X(!1), T(!1), ue && ue(), q && q();
287
- }, rl = /* @__PURE__ */ d("div", {
288
- children: [/* @__PURE__ */ l(Nl, {}), /* @__PURE__ */ l("div", {
286
+ }, cl = /* @__PURE__ */ d("div", {
287
+ children: [/* @__PURE__ */ l(vl, {}), /* @__PURE__ */ l("div", {
289
288
  style: {
290
289
  marginTop: 8
291
290
  },
292
291
  children: "添加图片"
293
292
  })]
294
- }), cl = (t) => {
293
+ }), dl = (t) => {
295
294
  const s = R.filter((o) => o.uid !== t.uid);
296
295
  Ee(s);
297
- }, dl = () => {
298
- F === "labeled" ? h === "vlm" ? window.location.href = `${he}/%E6%9C%89%E6%A0%87%E6%B3%A8%E7%A4%BA%E4%BE%8B.zip` : window.location.href = `${fe}/%E6%A0%87%E6%B3%A8%E6%A0%BC%E5%BC%8F%E7%A4%BA%E4%BE%8B.zip` : h === "vlm" ? window.location.href = `${he}/%E6%97%A0%E6%A0%87%E6%B3%A8%E7%A4%BA%E4%BE%8B.zip` : window.location.href = `${fe}/%E7%A4%BA%E4%BE%8B%E5%8E%8B%E7%BC%A9%E5%8C%85.zip`;
299
296
  }, pl = () => {
297
+ F === "labeled" ? h === "vlm" ? window.location.href = `${he}/%E6%9C%89%E6%A0%87%E6%B3%A8%E7%A4%BA%E4%BE%8B.zip` : window.location.href = `${fe}/%E6%A0%87%E6%B3%A8%E6%A0%BC%E5%BC%8F%E7%A4%BA%E4%BE%8B.zip` : h === "vlm" ? window.location.href = `${he}/%E6%97%A0%E6%A0%87%E6%B3%A8%E7%A4%BA%E4%BE%8B.zip` : window.location.href = `${fe}/%E7%A4%BA%E4%BE%8B%E5%8E%8B%E7%BC%A9%E5%8C%85.zip`;
298
+ }, ul = () => {
300
299
  N(), Ae(!1), X(!1), T(!1);
301
300
  };
302
301
  return O(() => {
@@ -325,7 +324,7 @@ const nt = (z) => {
325
324
  disabled: n === "image" && !C.length || n === "zip" && !R.length || ee && Ne == 0 || el,
326
325
  loading: Z == !0,
327
326
  onClick: () => {
328
- nl(), te(!0);
327
+ ol(), te(!0);
329
328
  },
330
329
  children: "导入"
331
330
  }, "confirm")],
@@ -362,9 +361,9 @@ const nt = (z) => {
362
361
  children: "无标注信息"
363
362
  }), /* @__PURE__ */ d(k, {
364
363
  value: "labeled",
365
- children: ["有标注信息", h === "vlm" && /* @__PURE__ */ l(Cl, {
364
+ children: ["有标注信息", h === "vlm" && /* @__PURE__ */ l(bl, {
366
365
  title: "支持上传带OCR标注信息的数据",
367
- children: /* @__PURE__ */ l(Sl, {
366
+ children: /* @__PURE__ */ l(zl, {
368
367
  style: {
369
368
  cursor: "pointer",
370
369
  marginLeft: 4,
@@ -407,7 +406,7 @@ const nt = (z) => {
407
406
  })
408
407
  }), /* @__PURE__ */ d("div", {
409
408
  className: "file-upload",
410
- children: [(n === "image" && !C.length || n === "zip") && /* @__PURE__ */ d(Ol, {
409
+ children: [(n === "image" && !C.length || n === "zip") && /* @__PURE__ */ d(tl, {
411
410
  name: "file",
412
411
  showUploadList: !1,
413
412
  multiple: !0,
@@ -418,7 +417,7 @@ const nt = (z) => {
418
417
  disabled: n === "zip" ? R.length === 1 : !1,
419
418
  children: [/* @__PURE__ */ l("span", {
420
419
  className: "file-upload-icon",
421
- children: /* @__PURE__ */ l(zl, {})
420
+ children: /* @__PURE__ */ l(wl, {})
422
421
  }), /* @__PURE__ */ d(je, {
423
422
  className: "file-upload-action",
424
423
  children: [n === "image" && "拖拽图片至此,或者", n === "zip" && "拖拽包含“图片”的压缩包至此,或者", /* @__PURE__ */ l(P, {
@@ -436,7 +435,7 @@ const nt = (z) => {
436
435
  },
437
436
  children: [/* @__PURE__ */ d("div", {
438
437
  className: "item-upload-desc item-upload-desc__1",
439
- children: ["1. 支持", g.imageFormatsText, "格式,单张图片不超过", g.maxImageSize / Ze, "M;"]
438
+ children: ["1. 支持", g.imageFormatsText, "格式,单张图片不超过", g.maxImageSize / Ge, "M;"]
440
439
  }), /* @__PURE__ */ l("div", {
441
440
  className: "item-upload-desc",
442
441
  children: "2. 单次上传最多可选择100个文件。"
@@ -464,7 +463,7 @@ const nt = (z) => {
464
463
  })]
465
464
  }), n === "image" && C.length ? /* @__PURE__ */ l("div", {
466
465
  className: "picture-upload",
467
- children: /* @__PURE__ */ l(Ge, {
466
+ children: /* @__PURE__ */ l(De, {
468
467
  listType: "picture-card",
469
468
  fileList: C,
470
469
  multiple: !0,
@@ -474,7 +473,7 @@ const nt = (z) => {
474
473
  beforeUpload: ke,
475
474
  accept: $e,
476
475
  onChange: Te,
477
- children: C.length < 100 ? rl : null
476
+ children: C.length < 100 ? cl : null
478
477
  })
479
478
  }) : /* @__PURE__ */ l(de, {}), n === "zip" && /* @__PURE__ */ d("div", {
480
479
  className: "upload-wrapper",
@@ -483,7 +482,7 @@ const nt = (z) => {
483
482
  children: /* @__PURE__ */ l(pe, {
484
483
  gutter: [24, 8],
485
484
  className: "upload-pannel",
486
- children: R.map((t) => /* @__PURE__ */ l(bl, {
485
+ children: R.map((t) => /* @__PURE__ */ l(yl, {
487
486
  span: 24,
488
487
  className: "upload-item",
489
488
  children: /* @__PURE__ */ d(pe, {
@@ -493,7 +492,7 @@ const nt = (z) => {
493
492
  align: "middle",
494
493
  children: [/* @__PURE__ */ l("span", {
495
494
  className: "upload-item-file-icon",
496
- children: /* @__PURE__ */ l(wl, {})
495
+ children: /* @__PURE__ */ l(El, {})
497
496
  }), /* @__PURE__ */ l("span", {
498
497
  className: "upload-item-name",
499
498
  children: t.name
@@ -502,8 +501,8 @@ const nt = (z) => {
502
501
  className: "upload-item-upload-delete",
503
502
  type: "link",
504
503
  disabled: Z,
505
- onClick: () => cl(t),
506
- children: /* @__PURE__ */ l(El, {})
504
+ onClick: () => dl(t),
505
+ children: /* @__PURE__ */ l(Nl, {})
507
506
  })]
508
507
  })
509
508
  }, t.uid))
@@ -522,7 +521,7 @@ const nt = (z) => {
522
521
  padding: 0
523
522
  },
524
523
  onClick: (t) => {
525
- t.stopPropagation(), dl();
524
+ t.stopPropagation(), pl();
526
525
  },
527
526
  children: "下载示例 >"
528
527
  })]
@@ -530,7 +529,7 @@ const nt = (z) => {
530
529
  }), /* @__PURE__ */ l("div", {
531
530
  className: "upload-example-main",
532
531
  children: /* @__PURE__ */ l("img", {
533
- src: F === "labeled" ? h === "vlm" ? Fl : Al : h === "vlm" ? Rl : xl
532
+ src: F === "labeled" ? h === "vlm" ? Rl : Fl : h === "vlm" ? Bl : Al
534
533
  })
535
534
  })]
536
535
  })]
@@ -550,7 +549,7 @@ const nt = (z) => {
550
549
  footer: null,
551
550
  children: /* @__PURE__ */ l("div", {
552
551
  className: "upload-spin",
553
- children: /* @__PURE__ */ l(yl, {
552
+ children: /* @__PURE__ */ l(Sl, {
554
553
  tip: n === "image" ? `数据导入中(${se}/${C.length}),请耐心等待` : `处理中(${Ne}/100%),请耐心等待`,
555
554
  size: "large",
556
555
  children: /* @__PURE__ */ l("div", {
@@ -567,11 +566,11 @@ const nt = (z) => {
567
566
  footer: null,
568
567
  children: /* @__PURE__ */ l("div", {
569
568
  className: "upload-result",
570
- children: /* @__PURE__ */ l(De, {
569
+ children: /* @__PURE__ */ l(Ke, {
571
570
  status: "success",
572
571
  title: n === "image" ? `数据导入完成,成功${J}个,失败${be}个,去重${C.length - J - be}个` : B && `数据导入完成,格式不符合的图片${B.formatErrorCount || 0}个,成功${B.successCount || 0}个,去重${B.repeatCount || 0}个,失败${B.failedCount || 0}个` + (F === "labeled" ? `(${(g.labelFormat || "json").toUpperCase()}格式不符合${B.labelErrorCount}个)` : ""),
573
572
  extra: [/* @__PURE__ */ l(P, {
574
- onClick: al,
573
+ onClick: rl,
575
574
  children: "关闭"
576
575
  }, "close")]
577
576
  })
@@ -585,11 +584,11 @@ const nt = (z) => {
585
584
  footer: null,
586
585
  children: /* @__PURE__ */ l("div", {
587
586
  className: "upload-result",
588
- children: /* @__PURE__ */ l(De, {
587
+ children: /* @__PURE__ */ l(Ke, {
589
588
  status: "error",
590
589
  title: "文件处理失败",
591
590
  extra: [/* @__PURE__ */ l(P, {
592
- onClick: pl,
591
+ onClick: ul,
593
592
  children: "关闭"
594
593
  }, "close")]
595
594
  })