@@ -2266,7 +2266,7 @@ https://github.com/Tencent/APIJSON/issues
2266
2266
for (var i = 0; i < apis.length; i++) {
2267
2267
var item = apis[i]
2268
2268
var req = item == null ? null : item.request
2269
- var urlObj = req.url || {}
2269
+ var urlObj = ( req == null ? null : req .url) || {}
2270
2270
var path = urlObj.path
2271
2271
var url = path instanceof Array ? '/' + path.join('/') : (typeof urlObj == 'string' ? urlObj : urlObj.raw)
2272
2272
if (StringUtil.isEmpty(url, true)) {
@@ -5665,6 +5665,7 @@ https://github.com/Tencent/APIJSON/issues
5665
5665
// }
5666
5666
5667
5667
//App.onChange(false)
5668
+ App.summary()
5668
5669
}
5669
5670
},
5670
5671
@@ -7038,7 +7039,11 @@ https://github.com/Tencent/APIJSON/issues
7038
7039
detection[stage + 'PrecisionStr'] = (100*precision).toFixed(0) + '%';
7039
7040
detection[stage + 'F1Str'] = (100*f1).toFixed(0) + '%';
7040
7041
})
7042
+ },
7041
7043
7044
+ summary: function() {
7045
+ const detection = this.detection || {};
7046
+ var total = detection.total;
7042
7047
if (total <= 0) {
7043
7048
detection.total = total = detection.afterCorrect || detection.beforeCorrect;
7044
7049
}
@@ -7220,7 +7225,7 @@ https://github.com/Tencent/APIJSON/issues
7220
7225
.replaceAll(/'new'/ig, '').replaceAll('测试', '')
7221
7226
.replaceAll('未命名', '').replaceAll('未知', '')
7222
7227
.replaceAll('示例', '').replaceAll('新建', '')
7223
- .replaceAll('图片', '');
7228
+ .replaceAll('图片', '').replaceAll('照片', '').replaceAll('相片', '') ;
7224
7229
7225
7230
var dotInd = file.lastIndexOf('.');
7226
7231
file = dotInd >= 0 ? file.substring(0, dotInd).trim() : file.trim();
@@ -7305,13 +7310,13 @@ https://github.com/Tencent/APIJSON/issues
7305
7310
});
7306
7311
7307
7312
// 如果需要也展示 before 中 unmatched 的box,可遍历 beforeBoxes 进行差异补充
7308
- var diff = this. detection.diff || {};
7313
+ var diff = detection.diff || {};
7309
7314
diff.bboxes = diffBoxes;
7310
- this.$set(this.detection, 'diff', { bboxes: diffBoxes });
7311
- this.$set(this.detection, 'after', { bboxes: afterBoxes }); // 确保 after 被更新到 Vue
7315
+ detection.diff = diff;
7316
+ this.detection = detection;
7317
+
7312
7318
this.drawAll();
7313
7319
this.compute();
7314
- this.detection.diff = diff;
7315
7320
return diff;
7316
7321
},
7317
7322
@@ -7348,24 +7353,41 @@ https://github.com/Tencent/APIJSON/issues
7348
7353
const img = this.imgMap[stage];
7349
7354
const canvas = this.canvasMap[stage];
7350
7355
const [x, y] = this.getCanvasXY(stage, event);
7356
+
7357
+ const height = canvas.height || (img || {}).height;
7358
+ const width = canvas.width || (img || {}).width;
7359
+ const nw = img == null ? 0 : (img.naturalWidth || 0);
7360
+ const nh = img == null ? 0 : (img.naturalHeight || 0);
7361
+ const xRate = nw < 1 ? 1 : width/nw;
7362
+ const yRate = nh < 1 ? 1 : height/nh;
7363
+
7351
7364
let found = null;
7352
7365
var bboxes = JSONResponse.getBboxes(this.detection[stage]) || []
7353
7366
let len = bboxes.length;
7354
- var range = ((canvas || {}).height || (img || {}).height || 240) * (len <= 1 ? 0.5 : (len <= 5 ? 0.1/len : 0.02));
7355
- for (const item of bboxes) {
7356
- var bbox = JSONResponse.getXYWHD(JSONResponse.getBbox(item));
7357
- if (JSONResponse.isOnBorder(x, y, bbox, range)) {
7358
- found = item.id;
7367
+ var range = (height || 240) * (len <= 1 ? 0.5 : (len <= 5 ? 0.1/len : 0.02));
7368
+ for (var i = 0; i < len; i++) {
7369
+ const item = bboxes[i];
7370
+ if (item == null) {
7371
+ continue;
7372
+ }
7373
+
7374
+ var [bx, by, bw, bh, bd] = JSONResponse.getXYWHD(JSONResponse.getBbox(item));
7375
+ const isRate = Math.abs(bx) < 1 && Math.abs(by) < 1 && Math.abs(bw) < 1 && Math.abs(bh) < 1;
7376
+ bx = isRate ? bx*width : bx*xRate;
7377
+ by = isRate ? by*height : by*yRate;
7378
+ bw = isRate ? bw*width : bw*xRate;
7379
+ bh = isRate ? bh*height : bh*yRate;
7380
+ if (JSONResponse.isOnBorder(x, y, [bx, by, bw, bh, bd], range)) {
7381
+ found = i;
7359
7382
break;
7360
7383
}
7361
7384
}
7362
7385
7363
- if (found == null || found == this.hoverIds[stage]) {
7386
+ if (found == this.hoverIds[stage]) {
7364
7387
return
7365
7388
}
7366
7389
7367
7390
this.hoverIds[stage] = found;
7368
- this.$set(this.hoverIds, stage, found);
7369
7391
this.draw(stage);
7370
7392
},
7371
7393
onClickFullScreen: function(event) {
@@ -7388,6 +7410,14 @@ https://github.com/Tencent/APIJSON/issues
7388
7410
const img = this.imgMap[stage];
7389
7411
const canvas = this.canvasMap[stage];
7390
7412
const [x, y] = this.getCanvasXY(stage, event);
7413
+
7414
+ const height = canvas.height || (img || {}).height;
7415
+ const width = canvas.width || (img || {}).width;
7416
+ const nw = img == null ? 0 : (img.naturalWidth || 0);
7417
+ const nh = img == null ? 0 : (img.naturalHeight || 0);
7418
+ const xRate = nw < 1 ? 1 : width/nw;
7419
+ const yRate = nh < 1 ? 1 : height/nh;
7420
+
7391
7421
const corrects = detection.corrects = detection.corrects || [];
7392
7422
const wrongs = detection.wrongs = detection.wrongs || [];
7393
7423
@@ -7400,7 +7430,12 @@ https://github.com/Tencent/APIJSON/issues
7400
7430
continue;
7401
7431
}
7402
7432
7403
- const [bx, by, bw, bh, d] = JSONResponse.getXYWHD(JSONResponse.getBbox(item));
7433
+ var [bx, by, bw, bh, bd] = JSONResponse.getXYWHD(JSONResponse.getBbox(item));
7434
+ const isRate = Math.abs(bx) < 1 && Math.abs(by) < 1 && Math.abs(bw) < 1 && Math.abs(bh) < 1;
7435
+ bx = isRate ? bx*width : bx*xRate;
7436
+ by = isRate ? by*height : by*yRate;
7437
+ bw = isRate ? bw*width : bw*xRate;
7438
+ bh = isRate ? bh*height : bh*yRate;
7404
7439
7405
7440
// 无效
7406
7441
// const labelX = bx + bw + 4; // 和 drawDetections 中计算按钮位置保持一致
@@ -10404,9 +10439,8 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
10404
10439
getDoc4TestCase: function () {
10405
10440
var list = this.remotes || []
10406
10441
var doc = ''
10407
- var item
10408
10442
for (var i = 0; i < list.length; i ++) {
10409
- item = list[i] == null ? null : list[i].Document
10443
+ var item = list[i] == null ? null : list[i].Document
10410
10444
if (item == null || item.name == null) {
10411
10445
continue
10412
10446
}
@@ -12818,6 +12852,7 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
12818
12852
// }
12819
12853
12820
12854
App.updateTestRecord(0, list, index, item, rawRspStr == null ? null : parseJSON(rawRspStr), isRandom, true, App.currentAccountIndex, isCross)
12855
+ App.summary()
12821
12856
}
12822
12857
12823
12858
})
0 commit comments