ChessPrism/cline_docs/techContext.md
2025-01-08 09:34:22 -06:00

1.7 KiB

Technologies Used

Core ML & Vision

  • ChessPieceClassifier.mlmodel for piece recognition
  • VNCoreMLModel for image classification
  • Vision framework for board detection

Image Processing

  • CoreImage for preprocessing
  • CIColorControls and CIUnsharpMask filters
  • CGImage for image manipulation

Development Environment

  • Xcode for Swift development
  • Create ML for model training
  • SwiftUI for UI components

Technical Constraints

ML Model Capabilities

  1. Classification Types:

    • Pieces: pawn, rook, knight, bishop, queen, king
    • Colors: black, white
    • Empty squares: dark, light
    • Label formats: color_piece, empty_color
  2. Recognition Features:

    • Multi-class classification
    • Per-class confidence scores
    • Position-aware validation
    • Piece count tracking

Processing Requirements

  1. Image Requirements:

    • Square dimensions (1:1 ±10%)
    • Non-zero dimensions
    • Center-cropped squares
    • Clear piece visibility
  2. Recognition Rules:

    • Empty squares: exact class match with >0.9 confidence
    • Pieces: strict format with >0.98 confidence
    • Separation ratio: >5.0 between predictions
    • Position validation: essential rules only
  3. Error Prevention:

    • Early empty square detection
    • Strict label validation
    • Safe optional handling
    • Clear error messages

Performance Considerations

  1. Processing Flow:

    • Early validation checks
    • Fast empty square detection
    • Efficient error handling
    • Quick rejection paths
  2. Resource Optimization:

    • GPU acceleration for ML
    • Minimal preprocessing
    • Optimized validation
    • Efficient logging

Development Setup

  1. Clone repository
  2. Open ChessPrism.xcodeproj
  3. Build and run on macOS
  4. Model at ChessPrism/ChessPieceClassifier.mlmodel