diff --git a/h5/js/capture-quality.js b/h5/js/capture-quality.js index ecd6d9a..a0d33b1 100644 --- a/h5/js/capture-quality.js +++ b/h5/js/capture-quality.js @@ -6,7 +6,7 @@ 'use strict'; // Real-phone feedback: ease alignment and normal hand/head movement while // retaining two checked frames, one face, framing and final JPEG validation. - var config = Object.freeze({ version: '2026-10-16-front-detection-v8', score: 0.4, frontScore: 0.3, + var config = Object.freeze({ version: '2026-10-16-confidence-v9', score: 0.3, frontScore: 0.25, near: 0.30, far: 0.68, center: 0.16, edge: 0.01, dark: 110, bright: 220, holdMs: 450, minFrames: 2, maxGapMs: 2000, yawDrift: 8, pitchDrift: 8, centerDrift: 0.055, sizeDrift: 0.065 }); diff --git a/h5/test/customer-feedback-fourth.js b/h5/test/customer-feedback-fourth.js index 2ac19f5..9e78e7f 100644 --- a/h5/test/customer-feedback-fourth.js +++ b/h5/test/customer-feedback-fourth.js @@ -73,11 +73,12 @@ for (const changes of [{ height: 179 }, { height: 410 }, { x: -10 }, { y: 5 }]) const d = face(); Object.assign(d.detection.box, changes); assert(!check(d).ok); } const weak = face(); weak.detection.score = .45; assert(check(weak).ok); -for(const score of [.3,.35,.3999]){const d=face();d.detection.score=score;assert(check(d).ok,'relaxed front confidence');} -const low=face();low.detection.score=.2999;assert.equal(check(low).hint,'请保持面部清晰'); -for(const target of ['left','right']){const d=face(target==='left'?-45:45);d.detection.score=.35;assert.equal(check(d,{target}).hint,'请保持面部清晰');d.detection.score=.4;assert(check(d,{target}).ok);} -assert.equal(Quality.scoreThreshold('front'),.3);assert.equal(Quality.scoreThreshold('left'),.4);assert.equal(Quality.scoreThreshold('right'),.4); -weak.detection.score = .29; assert(!check(weak).ok); +for(const score of [.25,.29,.3,.35,.3999]){const d=face();d.detection.score=score;assert(check(d).ok,'relaxed front confidence');} +const low=face();low.detection.score=.2499;assert.equal(check(low).hint,'请保持面部清晰'); +for(const target of ['left','right']){const d=face(target==='left'?-45:45);d.detection.score=.2999;assert.equal(check(d,{target}).hint,'请保持面部清晰');for(const score of [.3,.35,.4]){d.detection.score=score;assert(check(d,{target}).ok);}} +assert.equal(Quality.scoreThreshold('front'),.25);assert.equal(Quality.scoreThreshold('left'),.3);assert.equal(Quality.scoreThreshold('right'),.3); +for(const target of ['front','left','right']) for(const score of [0,-1,NaN,Infinity]){const d=face(target==='front'?0:target==='left'?-45:45);d.detection.score=score;assert.equal(check(d,{target}).hint,'请保持面部清晰');} +weak.detection.score = .24; assert(!check(weak).ok); const obs = check(face()).observation; let held = Quality.hold(null, obs, 1000); assert(!held.ready); held = Quality.hold(held.state, obs, 1400); assert(!held.ready); @@ -120,7 +121,7 @@ assert.equal(Diagnostics.assess(raw).views.right.status, 'valid'); const normalized = Diagnostics.normalize({ version: Quality.config.version, secret: 'discard', views: { front: { mode: 'live', yaw: 1, score: .9, luma: Infinity, secret: 'discard' }, left: { mode: 'unchecked', reason: 'model-unavailable' } } }); assert.equal(normalized.policy.capture.holdMs, 450); assert.equal(normalized.policy.capture.minFrames, 2); -assert.equal(normalized.version, '2026-10-16-front-detection-v8'); +assert.equal(normalized.version, '2026-10-16-confidence-v9'); assert.equal(normalized.views.front.luma, undefined); assert(!JSON.stringify(normalized).includes('discard')); assert.equal(Diagnostics.normalize({ version: '