This guide explains how to configure smugVision for your SmugMug gallery processing needs.
-
Copy the example configuration file to your user directory:
mkdir -p ~/.smugvision cp config.yaml.example ~/.smugvision/config.yaml
-
Edit
~/.smugvision/config.yamlwith your SmugMug credentials:- Get API credentials from https://api.smugmug.com/api/developer/apply
- Fill in your
api_key,api_secret,user_token, anduser_secret
-
Test your configuration:
python test_config.py
smugVision searches for configuration files in the following order:
~/.smugvision/config.yaml(user home directory - primary location)./config.yaml(current directory - for development/testing)
You can also specify a custom path when loading the configuration programmatically.
If no configuration file is found, smugVision will prompt you for required values:
$ python test_config.py
======================================================================
smugVision Configuration Setup
======================================================================
Some required configuration values are missing.
Please provide the following information:
SmugMug API Key (from https://api.smugmug.com/api/developer/apply)
smugmug.api_key: YOUR_API_KEY
SmugMug API Secret
smugmug.api_secret: YOUR_API_SECRET
SmugMug User OAuth Token
smugmug.user_token: YOUR_USER_TOKEN
SmugMug User OAuth Secret
smugmug.user_secret: YOUR_USER_SECRET
======================================================================
Configuration setup complete!
======================================================================The configuration will be automatically saved to config.yaml in the current directory.
Required fields for SmugMug API access:
smugmug:
api_key: "YOUR_API_KEY_HERE"
api_secret: "YOUR_API_SECRET_HERE"
user_token: "YOUR_USER_TOKEN_HERE"
user_secret: "YOUR_USER_SECRET_HERE"Settings for the AI vision model (Llama 3.2 Vision via Ollama):
vision:
model: "llama3.2-vision" # Model name
endpoint: "http://localhost:11434" # Ollama API endpoint
temperature: 0.7 # Creativity (0.0 = deterministic, 1.0 = creative)
max_tokens: 150 # Maximum length of generated text
timeout: 120 # API timeout in secondsTips:
- Lower
temperature(0.3-0.5) for more consistent, factual captions - Higher
temperature(0.7-0.9) for more creative, varied descriptions - Increase
max_tokensif captions are being cut off - Increase
timeoutif you're getting timeout errors on slower systems
Settings for face detection and recognition:
face_recognition:
enabled: true # Enable/disable face recognition
reference_faces_dir: "~/.smugvision/reference_faces"
tolerance: 0.6 # Matching strictness (0.0-1.0)
model: "cnn" # Detection model: 'hog' or 'cnn'
detection_scale: 0.5 # Image scale for detection (0.1-1.0)
min_confidence: 0.25 # Minimum confidence threshold (0.0-1.0)Face Recognition Setup:
-
Create reference faces directory structure:
~/.smugvision/reference_faces/ ├── John_Doe/ │ ├── photo1.jpg │ ├── photo2.jpg │ └── vacation.png ├── Jane_Smith/ │ ├── profile.jpg │ └── headshot.heic └── ... -
Each person should have their own subdirectory
-
Use the person's name as the directory name (underscores will be replaced with spaces)
-
Add multiple clear photos of each person for better accuracy
Parameter Tuning:
- tolerance: Lower values (0.4-0.5) = stricter matching, fewer false positives
- tolerance: Higher values (0.6-0.7) = more lenient, may catch more faces but with more false positives
- model:
cnnis more accurate but slower,hogis faster but less accurate - detection_scale: Lower values = faster processing but may miss distant faces
- min_confidence: Higher values = only include high-confidence matches in results
Settings for image processing behavior:
processing:
marker_tag: "smugvision" # Tag to mark processed images
generate_captions: true # Generate image captions
generate_tags: true # Generate keyword tags
preserve_existing: true # Keep existing metadata
image_size: "medium" # Download size from SmugMug
use_exif_location: true # Extract GPS location from EXIFCustomize how the AI describes your images:
prompts:
caption: |
Analyze this image and provide a concise, descriptive caption
(1-2 sentences) that describes the main subject, setting, and
any notable activities or features.
tags: |
Generate 5-10 simple, single-word or short-phrase keyword tags.
Focus on main subjects, activities, setting, colors, and mood.Tips for custom prompts:
- Be specific about the format you want (e.g., "1-2 sentences", "comma-separated list")
- Mention what to focus on (subjects, activities, mood, etc.)
- Include examples of desired output format
- Keep prompts concise and clear
Settings for local image caching:
cache:
directory: "~/.smugvision/cache" # Local cache directory
clear_on_exit: false # Auto-clear cache after processing
preserve_structure: true # Mirror SmugMug folder structureSettings for logging output:
logging:
level: "INFO" # DEBUG, INFO, WARNING, ERROR, CRITICAL
file: "~/.smugvision/smugvision.log"
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"Log Levels:
- DEBUG: Very detailed information, useful for troubleshooting
- INFO: General information about processing progress
- WARNING: Important notices (e.g., face not recognized)
- ERROR: Errors that prevent specific images from processing
- CRITICAL: Fatal errors that stop the entire process
You can use the ConfigManager class in your own scripts:
from smugvision.config import ConfigManager
# Load configuration (will prompt for missing values if interactive)
config = ConfigManager.load()
# Get configuration values using dot notation
model_name = config.get("vision.model")
temperature = config.get("vision.temperature")
api_key = config.get("smugmug.api_key")
# Get with default value if not found
timeout = config.get("vision.timeout", 60)
# Set configuration values
config.set("vision.temperature", 0.8)
config.set("processing.marker_tag", "ai-processed")
# Save changes
config.save()
# Get entire config as dictionary
config_dict = config.to_dict()# Load from specific path
config = ConfigManager.load(config_path="/path/to/config.yaml")
# Non-interactive mode (will raise error if required fields missing)
config = ConfigManager.load(interactive=False)
# Don't create config if missing (will raise error)
config = ConfigManager.load(create_if_missing=False)from smugvision.config import ConfigManager, ConfigError
try:
config = ConfigManager.load()
except ConfigError as e:
print(f"Configuration error: {e}")
sys.exit(1)-
Keep credentials secure:
- Never commit
config.yamlto version control - Add
config.yamlto.gitignore - Use environment variables for CI/CD
- Never commit
-
Start with defaults:
- Copy
config.yaml.exampleand modify as needed - Only change values you need to customize
- Copy
-
Test your configuration:
- Run
python test_config.pyto validate settings - Use
test_vision.pyto test with actual images
- Run
-
Face recognition setup:
- Use clear, front-facing photos for reference faces
- Include 2-3 photos per person for better accuracy
- Test with known images before processing entire galleries
-
Prompt tuning:
- Start with default prompts
- Adjust based on results from test images
- Be specific about desired output format
Make sure all SmugMug API credentials are filled in:
smugmug.api_keysmugmug.api_secretsmugmug.user_tokensmugmug.user_secret
- Check that reference faces directory exists and has correct structure
- Ensure
face_recognitionlibrary is installed:pip install face_recognition pip install git+https://github.com/ageitgey/face_recognition_models
- Try adjusting
toleranceandmin_confidencevalues - Use
cnnmodel for better accuracy (but slower)
smugVision searches for configuration in:
~/.smugvision/config.yaml(primary location)./config.yaml(current directory)
The recommended location is ~/.smugvision/config.yaml for consistency with other smugVision configuration files (relationships.yaml, geocoding_config.yaml).
Either create a config file in one of these locations, or specify the path explicitly.
- Check for proper indentation (use spaces, not tabs)
- Ensure strings with special characters are quoted
- Validate YAML syntax online: https://www.yamllint.com/
For more information, see:
- Main README:
README.md - Face Recognition Guide:
README_FACE_RECOGNITION.md - Design Document:
DESIGN.md