[mob] Show debug info on blur
This commit is contained in:
parent
ad73496c4d
commit
78af84450a
|
@ -481,6 +481,16 @@ class FaceMLDataDB {
|
|||
return maps.first['count'] as int;
|
||||
}
|
||||
|
||||
Future<int> getBlurryFaceCount([
|
||||
int blurThreshold = kLaplacianThreshold,
|
||||
]) async {
|
||||
final db = await instance.database;
|
||||
final List<Map<String, dynamic>> maps = await db.rawQuery(
|
||||
'SELECT COUNT(*) as count FROM $facesTable WHERE $faceBlur <= $blurThreshold AND $faceScore > $kMinHighQualityFaceScore',
|
||||
);
|
||||
return maps.first['count'] as int;
|
||||
}
|
||||
|
||||
Future<void> resetClusterIDs() async {
|
||||
final db = await instance.database;
|
||||
await db.execute(dropFaceClustersTable);
|
||||
|
|
|
@ -114,7 +114,9 @@ class _FaceDebugSectionWidgetState extends State<FaceDebugSectionWidget> {
|
|||
.getTotalFaceCount(minFaceScore: 0.75);
|
||||
final faces78 = await FaceMLDataDB.instance
|
||||
.getTotalFaceCount(minFaceScore: kMinHighQualityFaceScore);
|
||||
showShortToast(context, "Faces75: $faces75, Faces78: $faces78");
|
||||
final blurryFaceCount =
|
||||
await FaceMLDataDB.instance.getBlurryFaceCount(15);
|
||||
showShortToast(context, "$blurryFaceCount blurry faces");
|
||||
},
|
||||
),
|
||||
// MenuItemWidget(
|
||||
|
|
|
@ -162,6 +162,12 @@ class _FaceWidgetState extends State<FaceWidget> {
|
|||
style: Theme.of(context).textTheme.bodySmall,
|
||||
maxLines: 1,
|
||||
),
|
||||
if (kDebugMode)
|
||||
Text(
|
||||
'B: ${widget.face.blur.toStringAsFixed(3)}',
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
maxLines: 1,
|
||||
),
|
||||
// if (kDebugMode)
|
||||
// if (highlight)
|
||||
// const Text(
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import "package:flutter/foundation.dart" show kDebugMode;
|
||||
import "package:flutter/material.dart";
|
||||
import "package:logging/logging.dart";
|
||||
import "package:photos/face/db.dart";
|
||||
|
@ -68,8 +69,13 @@ class _FacesItemWidgetState extends State<FacesItemWidget> {
|
|||
),
|
||||
];
|
||||
}
|
||||
if (faces.isEmpty ||
|
||||
faces.every((face) => face.score < 0.75 || face.isBlurry)) {
|
||||
|
||||
// Remove faces with low scores and blurry faces
|
||||
if (!kDebugMode) {
|
||||
faces.removeWhere((face) => (face.isBlurry || face.score < 0.75));
|
||||
}
|
||||
|
||||
if (faces.isEmpty) {
|
||||
return [
|
||||
const ChipButtonWidget(
|
||||
"No faces found",
|
||||
|
@ -81,9 +87,6 @@ class _FacesItemWidgetState extends State<FacesItemWidget> {
|
|||
// Sort the faces by score in descending order, so that the highest scoring face is first.
|
||||
faces.sort((Face a, Face b) => b.score.compareTo(a.score));
|
||||
|
||||
// Remove faces with low scores and blurry faces
|
||||
faces.removeWhere((face) => (face.isBlurry || face.score < 0.75));
|
||||
|
||||
// TODO: add deduplication of faces of same person
|
||||
final faceIdsToClusterIds = await FaceMLDataDB.instance
|
||||
.getFaceIdsToClusterIds(faces.map((face) => face.faceID));
|
||||
|
|
Loading…
Reference in a new issue