[mob][photos] More robust automatic merges

This commit is contained in:
laurenspriem 2024-05-07 13:38:55 +05:30
parent 0ecbb73f1e
commit dc5a8ebd44
2 changed files with 6 additions and 5 deletions

View file

@ -163,12 +163,12 @@ class FaceMLDataDB {
Future<Set<int>> getPersonIgnoredClusters(String personID) async {
final db = await instance.asyncDB;
// find out clusterIds that are assigned to other persons using the clusters table
final List<Map<String, dynamic>> maps = await db.getAll(
final List<Map<String, dynamic>> otherPersonMaps = await db.getAll(
'SELECT $clusterIDColumn FROM $clusterPersonTable WHERE $personIdColumn != ? AND $personIdColumn IS NOT NULL',
[personID],
);
final Set<int> ignoredClusterIDs =
maps.map((e) => e[clusterIDColumn] as int).toSet();
otherPersonMaps.map((e) => e[clusterIDColumn] as int).toSet();
final List<Map<String, dynamic>> rejectMaps = await db.getAll(
'SELECT $clusterIDColumn FROM $notPersonFeedback WHERE $personIdColumn = ?',
[personID],

View file

@ -246,6 +246,7 @@ class ClusterFeedbackService {
}) async {
final faceMlDb = FaceMLDataDB.instance;
final faceIDs = await faceMlDb.getFaceIDsForCluster(personClusterID);
final ignoredClusters = await faceMlDb.getPersonIgnoredClusters(p.remoteID);
if (faceIDs.length < 2 * kMinimumClusterSizeSearchResult) {
final fileIDs = faceIDs.map(getFileIdFromFaceId).toSet();
if (fileIDs.length < kMinimumClusterSizeSearchResult) {
@ -264,7 +265,7 @@ class ClusterFeedbackService {
final EnteWatch watch = EnteWatch("ClusterFeedbackService")..start();
final Map<int, Vector> clusterAvg = await _getUpdateClusterAvg(
allClusterIdsToCountMap,
{},
ignoredClusters,
minClusterSize: kMinimumClusterSizeSearchResult,
);
watch.log('computed avg for ${clusterAvg.length} clusters');
@ -273,8 +274,8 @@ class ClusterFeedbackService {
final List<(int, double)> suggestions = await calcSuggestionsMeanInComputer(
clusterAvg,
{personClusterID},
{},
0.34,
ignoredClusters,
0.32,
);
if (suggestions.isEmpty) {