arnodjiang commited on
Commit
2d6fbdc
·
verified ·
1 Parent(s): ded2238

Upload 2 files

Browse files
Files changed (1) hide show
  1. index.html +18 -10
index.html CHANGED
@@ -846,6 +846,10 @@
846
  return Number.isFinite(value) ? value.toFixed(6) : "0.000000";
847
  }
848
 
 
 
 
 
849
  function resultLines(box) {
850
  if (!box || !state.image) {
851
  return null;
@@ -861,16 +865,20 @@
861
  const ih = imageHeight();
862
 
863
  return {
864
- absolute: `x1=${x1}, y1=${y1}, x2=${x2}, y2=${y2}`,
865
- size: `x=${box.x}, y=${box.y}, w=${box.width}, h=${box.height}`,
866
- relative: [
867
- `x1=${formatRatio(x1 / iw)}, y1=${formatRatio(y1 / ih)}`,
868
- `x2=${formatRatio(x2 / iw)}, y2=${formatRatio(y2 / ih)}`
869
- ].join("\n"),
870
- yolo: [
871
- `cx=${formatRatio(cx / iw)}, cy=${formatRatio(cy / ih)}`,
872
- `w=${formatRatio(box.width / iw)}, h=${formatRatio(box.height / ih)}`
873
- ].join("\n")
 
 
 
 
874
  };
875
  }
876
 
 
846
  return Number.isFinite(value) ? value.toFixed(6) : "0.000000";
847
  }
848
 
849
+ function formatList(values) {
850
+ return `[${values.join(",")}]`;
851
+ }
852
+
853
  function resultLines(box) {
854
  if (!box || !state.image) {
855
  return null;
 
865
  const ih = imageHeight();
866
 
867
  return {
868
+ absolute: formatList([x1, y1, x2, y2]),
869
+ size: formatList([box.x, box.y, box.width, box.height]),
870
+ relative: formatList([
871
+ formatRatio(x1 / iw),
872
+ formatRatio(y1 / ih),
873
+ formatRatio(x2 / iw),
874
+ formatRatio(y2 / ih)
875
+ ]),
876
+ yolo: formatList([
877
+ formatRatio(cx / iw),
878
+ formatRatio(cy / ih),
879
+ formatRatio(box.width / iw),
880
+ formatRatio(box.height / ih)
881
+ ])
882
  };
883
  }
884