A comprehensive GUI application built with Python and Tkinter that performs image recognition using Google Cloud Vision API, with Firebase authentication and Google Cloud Storage for persistent storage.
- Firebase email/password authentication
- Secure login and signup functionality
- User-specific data storage
- Label Detection: Identifies objects and concepts in images
- Object Localization: Detects and locates specific objects
- Text Detection (OCR): Extracts text from images
- Face Detection: Identifies faces and emotions
- Landmark Detection: Recognizes famous landmarks
- Dominant Color Analysis: Analyzes color composition
- Automatic upload of analyzed images to Google Cloud Storage
- Results saved as JSON files
- User-specific storage paths:
{UID}/images/and{UID}/results/
- View all previous analyses
- Detailed view of analysis results
- Delete unwanted history items
- Automatic cleanup of associated files
- Python 3.7+
- Google Cloud Platform account with:
- Vision API enabled
- Cloud Storage bucket created
- Service account credentials
- Firebase project with Authentication enabled
-
Clone or download the project
-
Install required dependencies:
pip install -r requirements.txt-
Create a GCP Project:
- Go to Google Cloud Console
- Create a new project or select existing one
-
Enable APIs:
- Enable Cloud Vision API
- Enable Cloud Storage API
-
Create Service Account:
- Go to IAM & Admin > Service Accounts
- Create a service account with appropriate permissions
- Download the JSON key file
- Rename it to match the one in the code or update the path in
main.py
-
Create Storage Bucket:
- Go to Cloud Storage
- Create a bucket (e.g.,
image-recognition-storage-project) - Update the bucket name in
main.pyif different
-
Create Firebase Project:
- Go to Firebase Console
- Create a new project
-
Enable Authentication:
- In Firebase Console, go to Authentication
- Enable Email/Password sign-in method
-
Get Configuration:
- Go to Project Settings
- Copy your Web API Key and Project ID
- Update the Firebase configuration in
main.py:
firebase_config = { "apiKey": "YOUR_API_KEY", "authDomain": "YOUR_PROJECT_ID.firebaseapp.com", "projectId": "YOUR_PROJECT_ID", "storageBucket": "YOUR_PROJECT_ID.appspot.com", "messagingSenderId": "YOUR_MESSAGING_ID", "appId": "YOUR_APP_ID", "databaseURL": "" }
- Run the application:
python main.py-
First Time Users:
- Click "Sign Up" to create an account
- Enter your email and password (minimum 6 characters)
- Click "Sign Up" to create your account
-
Returning Users:
- Enter your email and password
- Click "Login" to access the application
-
Analyze Images:
- Click "π Upload Image" to select an image
- Click "π Analyze & Save" to perform analysis
- Results will be displayed and automatically saved to cloud
-
View History:
- Click "π View History" to see all your previous analyses
- Select an item and click "View Details" to see full results
- Click "Delete" to remove unwanted items
- Click "Refresh" to reload the history list
-
Logout:
- Click "Logout" button in the top-right corner
cloud_image_recognition/
βββ main.py # Main application file
βββ requirements.txt # Python dependencies
βββ README.md # This file
βββ python-project-476206-*.json # GCP service account credentials
- Path:
{UID}/images/{timestamp}_{filename} - Example:
abc123/images/20250125_143022_photo.jpg
- Path:
{UID}/results/{timestamp}_{filename}.json - Example:
abc123/results/20250125_143022_photo.json
{
"timestamp": "20250125_143022",
"original_filename": "photo.jpg",
"image_path": "abc123/images/20250125_143022_photo.jpg",
"labels": [
{"description": "Cat", "score": 0.95},
{"description": "Pet", "score": 0.92}
],
"objects": [
{"name": "Cat", "score": 0.89}
],
"text": "Detected text from image",
"faces": 0
}- Login/Signup screen on startup
- Credentials validated through Firebase
- User session maintained throughout app usage
- Secure logout functionality
- User uploads an image
- Image is analyzed using Google Cloud Vision API
- Results are displayed in real-time
- Both image and results are saved to GCS
- Files organized by user UID
- List all user's previous analyses
- View detailed results for any analysis
- Delete analyses (removes both image and JSON)
- Real-time list updates
- "API not initialized": Check your GCP credentials file path
- "Permission denied": Ensure service account has proper permissions
- "Bucket not found": Verify bucket name and existence
- "Invalid email or password": Check credentials
- "Email already exists": Use login instead of signup
- "Weak password": Use at least 6 characters
- "Failed to upload": Check internet connection and GCS permissions
- "Failed to load history": Verify bucket access permissions
- Never commit your service account JSON file to version control
- Keep your Firebase API key secure
- Use environment variables for sensitive configuration in production
- Implement proper IAM policies for GCS bucket access
- Image filters and preprocessing
- Batch image processing
- Export reports as PDF
- Image comparison features
- Custom model integration
- Modify UI colors and layout in the respective setup functions
- Add new Vision API features (SafeSearch, Web Detection, etc.)
- Customize storage paths in the analysis function
- Extend JSON structure for additional metadata
This project is provided as-is for educational purposes.
For issues related to:
- Google Cloud: GCP Documentation
- Firebase: Firebase Documentation
- Python/Tkinter: Python Documentation
- v2.0 (Current): Added Firebase authentication and GCS storage with history management
- v1.0: Basic image recognition with Google Cloud Vision API
Note: Make sure to replace placeholder values in the configuration with your actual Firebase and GCP credentials before running the application.