@@ -2266,7 +2266,7 @@ https://github.com/Tencent/APIJSON/issues
22662266 for (var i = 0; i < apis.length; i++) {
22672267 var item = apis[i]
22682268 var req = item == null ? null : item.request
2269- var urlObj = req.url || {}
2269+ var urlObj = ( req == null ? null : req .url) || {}
22702270 var path = urlObj.path
22712271 var url = path instanceof Array ? '/' + path.join('/') : (typeof urlObj == 'string' ? urlObj : urlObj.raw)
22722272 if (StringUtil.isEmpty(url, true)) {
@@ -5665,6 +5665,7 @@ https://github.com/Tencent/APIJSON/issues
56655665 // }
56665666
56675667 //App.onChange(false)
5668+ App.summary()
56685669 }
56695670 },
56705671
@@ -7038,7 +7039,11 @@ https://github.com/Tencent/APIJSON/issues
70387039 detection[stage + 'PrecisionStr'] = (100*precision).toFixed(0) + '%';
70397040 detection[stage + 'F1Str'] = (100*f1).toFixed(0) + '%';
70407041 })
7042+ },
70417043
7044+ summary: function() {
7045+ const detection = this.detection || {};
7046+ var total = detection.total;
70427047 if (total <= 0) {
70437048 detection.total = total = detection.afterCorrect || detection.beforeCorrect;
70447049 }
@@ -7220,7 +7225,7 @@ https://github.com/Tencent/APIJSON/issues
72207225 .replaceAll(/'new'/ig, '').replaceAll('测试', '')
72217226 .replaceAll('未命名', '').replaceAll('未知', '')
72227227 .replaceAll('示例', '').replaceAll('新建', '')
7223- .replaceAll('图片', '');
7228+ .replaceAll('图片', '').replaceAll('照片', '').replaceAll('相片', '') ;
72247229
72257230 var dotInd = file.lastIndexOf('.');
72267231 file = dotInd >= 0 ? file.substring(0, dotInd).trim() : file.trim();
@@ -7305,13 +7310,13 @@ https://github.com/Tencent/APIJSON/issues
73057310 });
73067311
73077312 // 如果需要也展示 before 中 unmatched 的box,可遍历 beforeBoxes 进行差异补充
7308- var diff = this. detection.diff || {};
7313+ var diff = detection.diff || {};
73097314 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+
73127318 this.drawAll();
73137319 this.compute();
7314- this.detection.diff = diff;
73157320 return diff;
73167321 },
73177322
@@ -7348,24 +7353,41 @@ https://github.com/Tencent/APIJSON/issues
73487353 const img = this.imgMap[stage];
73497354 const canvas = this.canvasMap[stage];
73507355 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+
73517364 let found = null;
73527365 var bboxes = JSONResponse.getBboxes(this.detection[stage]) || []
73537366 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;
73597382 break;
73607383 }
73617384 }
73627385
7363- if (found == null || found == this.hoverIds[stage]) {
7386+ if (found == this.hoverIds[stage]) {
73647387 return
73657388 }
73667389
73677390 this.hoverIds[stage] = found;
7368- this.$set(this.hoverIds, stage, found);
73697391 this.draw(stage);
73707392 },
73717393 onClickFullScreen: function(event) {
@@ -7388,6 +7410,14 @@ https://github.com/Tencent/APIJSON/issues
73887410 const img = this.imgMap[stage];
73897411 const canvas = this.canvasMap[stage];
73907412 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+
73917421 const corrects = detection.corrects = detection.corrects || [];
73927422 const wrongs = detection.wrongs = detection.wrongs || [];
73937423
@@ -7400,7 +7430,12 @@ https://github.com/Tencent/APIJSON/issues
74007430 continue;
74017431 }
74027432
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;
74047439
74057440 // 无效
74067441 // const labelX = bx + bw + 4; // 和 drawDetections 中计算按钮位置保持一致
@@ -10404,9 +10439,8 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
1040410439 getDoc4TestCase: function () {
1040510440 var list = this.remotes || []
1040610441 var doc = ''
10407- var item
1040810442 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
1041010444 if (item == null || item.name == null) {
1041110445 continue
1041210446 }
@@ -12818,6 +12852,7 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
1281812852 // }
1281912853
1282012854 App.updateTestRecord(0, list, index, item, rawRspStr == null ? null : parseJSON(rawRspStr), isRandom, true, App.currentAccountIndex, isCross)
12855+ App.summary()
1282112856 }
1282212857
1282312858 })
0 commit comments