feat: refine role expression and diagnose camera context in 0.5.2
This commit is contained in:
@@ -25,5 +25,13 @@ fun main() {
|
||||
check(result.cue == if(t==800L) FaceCue.BROW_FURROWED else FaceCue.UNKNOWN)
|
||||
}
|
||||
checkUnknown(obs=face(.1f,.4f),t=900)
|
||||
check(rules.evaluate(null,0,false,1000).reason == FaceCueReason.NO_FACE)
|
||||
check(rules.evaluate(face(),2,true,1100).reason == FaceCueReason.MULTIPLE_FACES)
|
||||
check(rules.evaluate(face(),1,false,1200).reason == FaceCueReason.POOR_QUALITY)
|
||||
check(rules.evaluate(face(.1f,.1f),1,true,1300).reason == FaceCueReason.NO_CLEAR_CUE)
|
||||
check(rules.evaluate(face(.9f,.9f),1,true,1400).reason == FaceCueReason.CONFLICT)
|
||||
check(rules.evaluate(face(),1,true,1500).reason == FaceCueReason.STABILIZING)
|
||||
check(rules.evaluate(face(Float.NaN),1,true,1600).reason == FaceCueReason.INVALID_COEFFICIENTS)
|
||||
check(rules.evaluate(FaceObservation(emptyMap(),null),1,true,1700).reason == FaceCueReason.MISSING_COEFFICIENTS)
|
||||
println("PASS: sustained bilateral cues, hysteresis, conflict/multiple/no face/poor quality/invalid score/stale reset; no gaze/eye emotion inference")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import com.gorios.lanvoice.expression.*
|
||||
|
||||
fun main() {
|
||||
val camera = CameraAnalysisDiagnostics()
|
||||
check(camera.snapshot().reason == FaceCueReason.NO_FRAME)
|
||||
var summaries = 0
|
||||
for (time in 0L..600_000L step 100) {
|
||||
camera.received()
|
||||
camera.processed(0, FaceCueObservation(reason = FaceCueReason.NO_FACE), 8)
|
||||
if (camera.summary(time) != null) summaries++
|
||||
}
|
||||
check(summaries == 61) // 10Hz samples, <=1 summary/10s including first.
|
||||
check(camera.snapshot().received == 6001 && camera.snapshot().processed == 6001)
|
||||
check(camera.snapshot().faceCount == 0 && camera.snapshot().reason == FaceCueReason.NO_FACE)
|
||||
camera.processed(1, FaceCueObservation(FaceCue.SMILING, .9f, 900, 0, FaceCueReason.STABLE), 12)
|
||||
camera.failed(CameraFailure.ANALYSIS)
|
||||
check(camera.snapshot().cue == FaceCue.SMILING && camera.snapshot().failures == 1)
|
||||
check(camera.summary(600_001) == null)
|
||||
val final = checkNotNull(camera.summary(600_001, force = true))
|
||||
check("failure=analysis" in final && "cue=smiling" in final)
|
||||
check(listOf("landmark", "blendshape", "image", "prompt", "reply").none { it in final })
|
||||
val send = FaceTransmissionDiagnostics()
|
||||
check(send.snapshot().reason == FaceSendReason.SHARING_OFF)
|
||||
send.record(FaceSendReason.NO_STABLE_CUE)
|
||||
check(send.snapshot().attempts == 0)
|
||||
send.record(FaceSendReason.SENT, FaceCue.SMILING)
|
||||
send.record(FaceSendReason.CLEARED)
|
||||
send.record(FaceSendReason.SEND_FAILED)
|
||||
send.record(FaceSendReason.STALE)
|
||||
check(send.snapshot().attempts == 3 && send.snapshot().sent == 1 && send.snapshot().clears == 1 && send.snapshot().failures == 1)
|
||||
check(send.summary(0) != null && send.summary(9999) == null && send.summary(10000) != null)
|
||||
println("PASS: enum-only camera/frame/send snapshots, failure counters, 10s rate bound, no-face/stable/stale/clear accounting")
|
||||
}
|
||||
Reference in New Issue
Block a user