Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5db695b

Browse files
CVAuto:测完图片后自动显示第一张效果,完善总计指标统计,断言通过的图片在调整画框 ✓ 对 X 错后变成蓝色可纠错,兼容对象格式的 Polygon,Line,Point,只在机器学习开启时用 missTruth 补充漏检 等
1 parent 1c330c6 commit 5db695b

File tree

2 files changed

+251
-158
lines changed

2 files changed

+251
-158
lines changed

‎APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/cv/apijson/JSONResponse.js

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2461,20 +2461,59 @@ var JSONResponse = {
24612461

24622462
return detection.polygons
24632463
},
2464+
getPolygon: function (item) {
2465+
if (JSONResponse.isString(item)) {
2466+
return StringUtil.split(item);
2467+
}
2468+
if (item instanceof Array) {
2469+
return item;
2470+
}
2471+
if (! JSONResponse.isObject(item)) {
2472+
return null;
2473+
}
2474+
2475+
return item.polygon || item
2476+
},
24642477
getLines: function (detection) {
24652478
if (! JSONResponse.isObject(detection)) {
24662479
return null;
24672480
}
24682481

24692482
return detection.lines || detection.keyLines || detection.key_lines
24702483
},
2484+
getLine: function (item) {
2485+
if (JSONResponse.isString(item)) {
2486+
return StringUtil.split(item);
2487+
}
2488+
if (item instanceof Array) {
2489+
return item;
2490+
}
2491+
if (! JSONResponse.isObject(item)) {
2492+
return null;
2493+
}
2494+
2495+
return item.line || item.keyLine || item.key_line || item
2496+
},
24712497
getPoints: function (detection) {
24722498
if (! JSONResponse.isObject(detection)) {
24732499
return null;
24742500
}
24752501

24762502
return detection.points || detection.keyPoints || detection.key_points
24772503
},
2504+
getPoint: function (item) {
2505+
if (JSONResponse.isString(item)) {
2506+
return StringUtil.split(item);
2507+
}
2508+
if (item instanceof Array) {
2509+
return item;
2510+
}
2511+
if (! JSONResponse.isObject(item)) {
2512+
return null;
2513+
}
2514+
2515+
return item.point || item.keyPoint || item.key_point || item
2516+
},
24782517
getBboxes: function (detection) {
24792518
if (! JSONResponse.isObject(detection)) {
24802519
return null;
@@ -2483,7 +2522,10 @@ var JSONResponse = {
24832522
return detection.bboxes || detection.boxes || detection.targets
24842523
},
24852524
getBbox: function (item) {
2486-
if (item instanceof Array || JSONResponse.isString(item)) {
2525+
if (JSONResponse.isString(item)) {
2526+
return StringUtil.split(item);
2527+
}
2528+
if (item instanceof Array) {
24872529
return item;
24882530
}
24892531
if (! JSONResponse.isObject(item)) {
@@ -2696,7 +2738,7 @@ var JSONResponse = {
26962738
return;
26972739
}
26982740

2699-
var [x, y, x2, y2, d] = JSONResponse.getXYXYD(item, width, height, xRate, yRate);
2741+
var [x, y, x2, y2, d] = JSONResponse.getXYXYD(JSONResponse.getLine(item)||item, width, height, xRate, yRate);
27002742

27012743
const color = JSONResponse.getColor(item) || JSONResponse.getColor(detection) || JSONResponse.getColor(detection.bbox);
27022744
const rgba = color == null || color.length <= 0 ? null : `rgba(${color.join(',')})`;
@@ -2728,7 +2770,7 @@ var JSONResponse = {
27282770
return;
27292771
}
27302772

2731-
var [x, y, w, h, d] = JSONResponse.getXYWHD(item, width, height, xRate, yRate);
2773+
var [x, y, w, h, d] = JSONResponse.getXYWHD(JSONResponse.getPoint(item)||item, width, height, xRate, yRate);
27322774

27332775
const color = JSONResponse.getColor(item) || JSONResponse.getColor(detection) || JSONResponse.getColor(detection.bbox);
27342776
const rgba = color == null || color.length <= 0 ? null : `rgba(${color.join(',')})`;
@@ -2739,7 +2781,8 @@ var JSONResponse = {
27392781

27402782
ctx.beginPath();
27412783
ctx.arc(x, y, Math.max(2, height*0.005), 0, 2*Math.PI);
2742-
if (JSONResponse.getFill(item) != false) {
2784+
let fill = JSONResponse.getFill(item);
2785+
if (fill || (fill == null && JSONResponse.getFill(detection) != false)) {
27432786
ctx.fill();
27442787
}
27452788

@@ -2761,7 +2804,8 @@ var JSONResponse = {
27612804
return;
27622805
}
27632806

2764-
var points = JSONResponse.getPoints(item) || item;
2807+
var polygon = JSONResponse.getPolygon(item) || item;
2808+
var points = JSONResponse.getPoints(polygon) || item;
27652809
if (points instanceof Array) {
27662810
const color = JSONResponse.getColor(item) || JSONResponse.getColor(detection) || JSONResponse.getColor(detection.bbox);
27672811
if (color != null && color.length >= 3) {
@@ -2777,8 +2821,8 @@ var JSONResponse = {
27772821
}
27782822

27792823
ctx.beginPath();
2780-
points.forEach((item, i) => {
2781-
var [x, y, w, h, d] = JSONResponse.getXYWHD(item, width, height, xRate, yRate);
2824+
points.forEach((item2, i) => {
2825+
var [x, y, w, h, d] = JSONResponse.getXYWHD(JSONResponse.getPoint(item2)||item2, width, height, xRate, yRate);
27822826

27832827
if (i <= 0) {
27842828
ctx.moveTo(x, y);
@@ -2788,7 +2832,8 @@ var JSONResponse = {
27882832
});
27892833
ctx.closePath();
27902834
ctx.stroke();
2791-
if (JSONResponse.getFill(item)) {
2835+
let fill = JSONResponse.getFill(item);
2836+
if (fill || (fill == null && JSONResponse.getFill(detection))) {
27922837
ctx.fill();
27932838
}
27942839
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /