The Character Classification System is an AI-based image recognition tool specifically designed to identify characters from games and anime. The system uses advanced deep learning techniques to quickly and accurately identify characters in uploaded images, now with support for end-to-end character detection workflows.
✨ Core Features
Image/Video Upload Recognition: Supports multiple image and video formats for upload, automatically identifies game characters in images and videos
High Accuracy: Uses CLIP model and Faiss indexing for high recognition accuracy
DeepDanbooru Integration: Integrates DeepDanbooru for anime tag recognition to improve classification accuracy
Click the "Select Image File" button to choose the image to be recognized
Click the "Identify Character" button, and the system will automatically analyze the image
Wait for the analysis to complete, and view the recognition result and confidence
Role Detection Workflow
Open your browser and visit http://127.0.0.1:5001/workflow
Enter character information in JSON format (e.g., [{"name": "Aimi Kanazawa", "series": "bangdream_mygo"}])
Enter test image path
Adjust training parameters (batch size, epochs, learning rate, etc.)
Click "Start Workflow" to begin end-to-end process
Monitor progress in the terminal
API Call
bash
1# Use curl to upload image and identify (default method)2curl -X POST -F "file=@path/to/image.jpg" http://127.0.0.1:5001/api/classify
34# Use curl with dedicated model5curl -X POST -F "file=@path/to/image.jpg" -F "use_model=true" http://127.0.0.1:5001/api/classify
67# Use curl with DeepDanbooru integration8curl -X POST -F "file=@path/to/image.jpg" -F "use_deepdanbooru=true" http://127.0.0.1:5001/api/classify
Fallback to single GPU mode if only one GPU is available
Expected Speedup:
2 GPUs: ~2x faster training
4 GPUs: ~4x faster training
8 GPUs: ~8x faster training
Note: Distributed training requires at least 2 GPUs to be effective.
DeepDanbooru Integration
Implementation Principle
The system integrates DeepDanbooru for anime tag recognition to improve classification accuracy. The implementation follows the Tag-assisted Inference approach:
Tag Extraction: Uses DeepDanbooru to extract tags from input images
Tag Mapping: Maps extracted tags to character attributes
Score Adjustment: Adjusts classification scores based on tag matching
Result Reordering: Reorders classification results based on adjusted scores
Key Advantages
Solves "Sameface Syndrome": DeepDanbooru can identify distinguishing features like hair color, eye color, and clothing
Improves Robustness: Even with different art styles, the system can recognize characters based on key features
Faster Convergence: The model learns faster when guided by tag information
Model Update: Regularly updates models to maintain system performance
Usage Method
1. Collect Classification Logs
The system automatically collects results from each classification, including:
Uploaded images
Extracted feature vectors
Classification results
Confidence scores
2. Fuse Features to Build New Model
bash
1# Run log fusion script2python3 src/core/log_fusion/log_fusion.py --log_dir ./logs --output_model ./models/fused_model
3. Use New Model for Classification
The system automatically uses the latest built model for classification without additional configuration.
📊 Global Logging System
System Overview
The global logging system is a unified log management module that records system status, model inference results, model training results, and error logs. It is based on the loguru library and provides a directory structure organized by log type and log rotation functionality.
Log Directory Structure
The global logging system stores log files in directories organized by type:
logs/
├── system/ # System status logs
├── inference/ # Model inference result logs
├── training/ # Model training result logs
└── error/ # Error logs
Log Rotation Configuration
The global logging system is configured with the following log rotation policies:
Log Type
Rotation Policy
Retention Period
Compression
System Logs
100 MB
7 days
zip
Inference Logs
100 MB
14 days
zip
Training Logs
200 MB
30 days
zip
Error Logs
50 MB
30 days
zip
Usage Method
In modules that need to use logging, import the global logging system and use it:
python
1from src.core.logging.global_logger import(2 get_logger, log_system, log_inference, log_training, log_error
3)45# Use convenience functions to record logs6log_system("System started successfully")7log_inference("Model inference completed, recognition result: Character A, similarity: 0.95")8log_training("Model training completed, accuracy: 98.5%")9log_error("File upload failed: File too large")1011# Use custom logger object12logger = get_logger("module_name")13logger.info("Module initialized successfully")14logger.error("Module error: Invalid parameter")
Log Levels
The global logging system supports the following log levels:
DEBUG: Detailed debug information
INFO: General information
WARNING: Warning information
ERROR: Error information
CRITICAL: Critical error information
🤝 Contribution Guide
Welcome to submit Issues and Pull Requests to jointly improve system performance and functionality.
📄 License
This project is open source under the MIT license.
📞 Contact Us
If you have any questions or suggestions, please contact us through: