Refactor PhotoTagger to support separate first and last name fields in the database. Update GUI to include dedicated input fields for first and last names, enhancing user experience with smart name parsing and improved dropdown functionality. Revise README to reflect these changes and highlight new features.

This commit is contained in:
tanyar09
2025-09-22 15:56:55 -04:00
parent 6a5bafef50
commit 52b9d37d8c
2 changed files with 324 additions and 104 deletions
+47 -8
View File
@@ -128,7 +128,8 @@ python3 photo_tagger.py auto-match --auto --show-faces
**🎯 New GUI-Based Identification Features:**
- 🖼️ **Visual Face Display** - See individual face crops in the GUI
- 📝 **Dropdown Name Selection** - Choose from known people or type new names
- 📝 **Separate Name Fields** - Dedicated "Last name" and "First name" input fields with dropdowns
- 🎯 **Smart Name Parsing** - Supports "Last, First" format that gets properly parsed and stored
- ☑️ **Compare with Similar Faces** - Compare current face with similar unidentified faces
- 🎨 **Modern Interface** - Clean, intuitive GUI with buttons and input fields
- 💾 **Window Size Memory** - Remembers your preferred window size
@@ -140,6 +141,7 @@ python3 photo_tagger.py auto-match --auto --show-faces
- ⚠️ **Smart Navigation Warnings** - Prevents accidental loss of selected similar faces
- 💾 **Quit Confirmation** - Saves pending identifications when closing the application
-**Performance Optimized** - Pre-fetched data for faster similar faces display
- 🎯 **Clean Database Storage** - Names are stored as separate first_name and last_name fields without commas
**🎯 New Auto-Match GUI Features:**
- 📊 **Person-Centric View** - Shows matched person on left, all their unidentified faces on right
@@ -163,9 +165,11 @@ python3 photo_tagger.py modifyidentified
This GUI lets you quickly review all identified people, rename them, and temporarily unmatch faces before committing.
**Left Panel (People):**
- 👥 **People List** - Shows all identified people with face counts
- 👥 **People List** - Shows all identified people with face counts in "Last, First" format
- 🖱️ **Clickable Names** - Click to select a person (selected name is bold)
- ✏️ **Edit Name Icon** - Rename a person; tooltip shows "Update name"
- ✏️ **Edit Name Icon** - Rename a person with separate first/last name fields; tooltip shows "Update name"
- 📝 **Separate Name Fields** - Edit with dedicated "Last name" and "First name" text boxes
- 💡 **Help Text** - Small labels below text boxes showing "Last" and "First"
**Right Panel (Faces):**
- 🧩 **Person Faces** - Thumbnails of all faces identified as the selected person
@@ -177,10 +181,16 @@ This GUI lets you quickly review all identified people, rename them, and tempora
- 💾 **Save changes** - Commits all pending unmatched faces across all people to the database
-**Quit** - Closes the window (unsaved temporary changes are discarded)
**Performance Features:**
-**Optimized Database Access** - Loads all people data once when opening, saves only when needed
- 🚫 **No Database Queries During Editing** - All editing operations use pre-loaded data
- 💾 **Single Save Transaction** - Database updated only when clicking "Save changes"
Notes:
- Changes are temporary until you click "Save changes" at the bottom.
- Undo restores only the currently viewed person's faces.
- Saving updates the database and refreshes counts.
- Names are stored cleanly as separate first_name and last_name fields without commas.
## 🧠 Advanced Algorithm Features
@@ -269,10 +279,20 @@ python3 photo_tagger.py tag --pattern "birthday"
## 🗃️ Database
The tool uses SQLite database (`data/photos.db` by default) with these tables:
### Core Tables
- **photos** - Photo file paths and processing status
- **people** - Known people names
- **faces** - Face encodings and locations
- **people** - Known people with separate first_name and last_name fields
- **faces** - Face encodings, locations, and quality scores
- **tags** - Custom tags for photos
- **person_encodings** - Face encodings for each person (for matching)
### Database Schema Improvements
- **Clean Name Storage** - People table uses separate `first_name` and `last_name` fields
- **No Comma Issues** - Names are stored without commas, displayed as "Last, First" format
- **Quality Scoring** - Faces table includes quality scores for better matching
- **Optimized Queries** - Efficient indexing and query patterns for fast performance
- **Data Integrity** - Proper foreign key relationships and constraints
## ⚙️ Configuration
@@ -560,17 +580,36 @@ The auto-match feature now works in a **person-centric** way:
This is now a minimal, focused tool. Key principles:
- Keep it simple and fast
- CLI-only interface
- GUI-enhanced interface for identification
- Minimal dependencies
- Clear, readable code
- **Always use python3** commands
## 🆕 Recent Improvements (Latest Version)
### Name Handling & Database
-**Fixed Comma Issues** - Names are now stored cleanly without commas in database
-**Separate Name Fields** - First name and last name are stored in separate database columns
-**Smart Parsing** - Supports "Last, First" input format that gets properly parsed
-**Optimized Database Access** - Single load/save operations for better performance
### GUI Enhancements
-**Improved Edit Interface** - Separate text boxes for first and last names with help text
-**Better Layout** - Help text positioned below input fields for clarity
-**Tooltips** - Edit buttons show helpful tooltips
-**Responsive Design** - Face grids adapt to window size
### Performance & Reliability
-**Efficient Database Operations** - Pre-loads data, saves only when needed
-**Fixed Virtual Environment** - Run script now works properly with dependencies
-**Clean Code Structure** - Improved error handling and state management
---
**Total project size**: ~300 lines of Python code
**Total project size**: ~3,400 lines of Python code
**Dependencies**: 6 essential packages
**Setup time**: ~5 minutes
**Perfect for**: Batch processing personal photo collections
**Perfect for**: Batch processing personal photo collections with modern GUI interface
## 🔄 Common Commands Cheat Sheet