Skip to main content

Module vision

Module vision 

Source
Expand description

Reading a chess board from a photo.

Two readers, used in this order:

  • Our board reader (chess-vision, CHESS_VISION_LOCAL_MODEL): a network trained for exactly this, run on this server’s CPU. It gives each square’s piece probabilities, so the app can weigh every legal move against them.
  • A vision language model (CHESS_VISION_ENDPOINT): asked for the piece placement as FEN, which side of the board was nearer the camera, the side to move if the picture shows it, and which squares it wasn’t sure of. Used when there is no board reader, or for its second opinion on a photo the reader isn’t sure of; that answer is also kept as the suggestion the Review page pre-fills.

Either answer is a reading, not a position: the app matches it against the legal moves from the game it is following, or shows it in a board editor to confirm (see chess_analysis::photo).

Structs§

Reading
What the model read.

Functions§

decode_image
The bytes and media type of a data:image/...;base64, URL or bare base64 (taken as JPEG).
enabled
Whether the vision language model is set up.
load_reader
Load the board reader named by CHESS_VISION_LOCAL_MODEL (None when it’s empty).
parse_reply
Parse and sanity-check a reply.
read_board
Ask the model to read image (a data: URL or bare base64 JPEG/PNG).