feat: Implement quality filtering in Identify Panel for enhanced face identification
This commit adds a quality filtering feature to the Identify Panel, allowing users to filter faces based on a quality score (0-100%). The `_get_unidentified_faces()` method has been updated to accept a `min_quality_score` parameter, and the SQL query now includes a WHERE clause for quality filtering. All relevant call sites have been modified to utilize this new feature, improving the user experience during face identification. The unique checkbox default state has also been confirmed to be unchecked, ensuring consistency in the UI behavior.
This commit is contained in:
@@ -264,9 +264,14 @@ class IdentifyPanel:
|
||||
except Exception:
|
||||
batch_size = DEFAULT_BATCH_SIZE
|
||||
|
||||
# Get quality filter
|
||||
min_quality = self.components['quality_filter_var'].get()
|
||||
min_quality_score = min_quality / 100.0
|
||||
|
||||
# Reload faces with current filters
|
||||
self.current_faces = self._get_unidentified_faces(batch_size, date_from, date_to,
|
||||
date_processed_from, date_processed_to)
|
||||
date_processed_from, date_processed_to,
|
||||
min_quality_score)
|
||||
|
||||
print(f"✅ Reloaded: {len(self.current_faces)} faces")
|
||||
|
||||
@@ -491,9 +496,14 @@ class IdentifyPanel:
|
||||
date_processed_from = self.components['date_processed_from_var'].get().strip() or None
|
||||
date_processed_to = self.components['date_processed_to_var'].get().strip() or None
|
||||
|
||||
# Get unidentified faces (without quality filter - we'll filter in display)
|
||||
# Get quality filter
|
||||
min_quality = self.components['quality_filter_var'].get()
|
||||
min_quality_score = min_quality / 100.0
|
||||
|
||||
# Get unidentified faces with quality filter
|
||||
self.current_faces = self._get_unidentified_faces(batch_size, date_from, date_to,
|
||||
date_processed_from, date_processed_to)
|
||||
date_processed_from, date_processed_to,
|
||||
min_quality_score)
|
||||
|
||||
if not self.current_faces:
|
||||
messagebox.showinfo("No Faces", "🎉 All faces have been identified!")
|
||||
@@ -517,8 +527,9 @@ class IdentifyPanel:
|
||||
self.is_active = True
|
||||
|
||||
def _get_unidentified_faces(self, batch_size: int, date_from: str = None, date_to: str = None,
|
||||
date_processed_from: str = None, date_processed_to: str = None) -> List[Tuple]:
|
||||
"""Get unidentified faces from database with optional date filtering"""
|
||||
date_processed_from: str = None, date_processed_to: str = None,
|
||||
min_quality_score: float = 0.0) -> List[Tuple]:
|
||||
"""Get unidentified faces from database with optional date and quality filtering"""
|
||||
with self.db.get_db_connection() as conn:
|
||||
cursor = conn.cursor()
|
||||
|
||||
@@ -533,6 +544,11 @@ class IdentifyPanel:
|
||||
'''
|
||||
params = []
|
||||
|
||||
# Add quality filtering if specified
|
||||
if min_quality_score > 0.0:
|
||||
query += ' AND f.quality_score >= ?'
|
||||
params.append(min_quality_score)
|
||||
|
||||
# Add date taken filtering if specified
|
||||
if date_from:
|
||||
query += ' AND p.date_taken >= ?'
|
||||
@@ -1359,9 +1375,14 @@ class IdentifyPanel:
|
||||
date_processed_from = self.components['date_processed_from_var'].get().strip() or None
|
||||
date_processed_to = self.components['date_processed_to_var'].get().strip() or None
|
||||
|
||||
# Get quality filter
|
||||
min_quality = self.components['quality_filter_var'].get()
|
||||
min_quality_score = min_quality / 100.0
|
||||
|
||||
# Get more faces
|
||||
more_faces = self._get_unidentified_faces(DEFAULT_BATCH_SIZE, date_from, date_to,
|
||||
date_processed_from, date_processed_to)
|
||||
date_processed_from, date_processed_to,
|
||||
min_quality_score)
|
||||
|
||||
if more_faces:
|
||||
# Add to current faces
|
||||
@@ -1551,9 +1572,13 @@ class IdentifyPanel:
|
||||
except Exception:
|
||||
batch_size = DEFAULT_BATCH_SIZE
|
||||
|
||||
# Quality filter is already extracted above in min_quality
|
||||
min_quality_score = min_quality / 100.0
|
||||
|
||||
# Reload faces with new filters
|
||||
self.current_faces = self._get_unidentified_faces(batch_size, date_from, date_to,
|
||||
date_processed_from, date_processed_to)
|
||||
date_processed_from, date_processed_to,
|
||||
min_quality_score)
|
||||
|
||||
if not self.current_faces:
|
||||
messagebox.showinfo("No Faces Found", "No unidentified faces found with the current filters.")
|
||||
|
||||
Reference in New Issue
Block a user