How mnnlr/chess_vision_backend works
Key Components to Include:
Client Layer
• A note about image upload functionality
API Layer
• Main endpoint "/fen-string"
• Form-data handling for image upload
Core Processing Layer (divide into three main components)
• Board Detection Module (board.py)
• Chess Piece Detection Module (predict.py)
• FEN String Generation Module (fenstring.py)
ML Model Layer
• YOLOv7 Model component (stored in models/best.pt)
• PyTorch runtime environment
• [Client Layer]
• ↓
• [API Layer (Flask)]
• ↓
• [Core Processing Layer]
• ↓
• [ML Model Layer]
Component Relationships
• Client → Flask Server
• Flask Server → Board Detection
• Board Detection → Piece Detection
• Piece Detection → YOLOv7 Model
• Piece Detection → FEN Generator
• FEN Generator → Flask Server
• Flask Server → Client
Processing Steps
Numbered steps showing the process:
1. Image Upload
2. Board Detection & Cropping
3. Piece Detection using YOLOv7
4. FEN String Generation
5. Response Return
Technical Details
• Input: Image file (form-data)
• Output: JSON response with FEN string
• Model: YOLOv7 (best.pt)
• Framework: Flask
• Key Dependencies: OpenCV, PyTorch
Additional Elements
• Input/output data formats at each step
• System requirements in a side note
Optimization Notes
• Caching mechanisms
• Where parallel processing could occur
• Potential scaling points
• The clear separation between the API interface and processing logic
• The sequential nature of the image processing pipeline
• The integration of the ML model within the system
• The modular design allowing for component replacement or upgrade
Remember to:
• Keep the main flow clear and centered
• Necessary labels and annotations
• Maintain proper spacing between components
• Version information and date
• Relevant environment variables or configuration requirements