Skip to main content

board_to_fen

Python package that converts digital chessboard image into Forsyth-Edwards notation (FEN) notation

Downloads License: MIT PyPI GitHub last commit

Installation

board_to_fen is available on PyPI:

$ pip3 install board_to_fen

Quick Start

from board_to_fen.predict import get_fen_from_image

print(get_fen_from_image(PATH_TO_CHESSBOARD_IMAGE))

Note: The package uses tensorflow+keras and python-opencv API. They are pretty heavy.

Customization

get_fen_from_image takes has 3 arguments:

  • image_path [required]
  • end_of_row '/' by default
  • black_view False by default -> set True if chessboard is provided from black player perspective

Web version (currently may not work)

Available at: https://board2fen.bieda.it

Training

For training You would probably want to download the source code by cloning the repository:

$ git clone https://github.com/mcdominik/board_to_fen.git

Download training data from:
I will supply url for data in the future

In the main repository dir, run

$ python3 ./board_to_fen/train_model.py

Version history

  • january 2023
    • versions 0.0.17-25
    • added simple board validation
    • bug fixes

Warnings

  • Image has to be provided in neutral angle (white or black player's perspective).
  • Image has to be square (~3% tolerance depending on image resolution).
  • Image can't contain paddings, board borders etc. other than 64 squares (with pieces) itself.

References:

https://www.kaggle.com/datasets/koryakinp/chess-positions

Release files for board-to-fen 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for board-to-fen 0.1.1
File Size Uploaded
board_to_fen-0.1.1.tar.gz 22.9 MB Details

Release files / board_to_fen-0.1.1.tar.gz

Download URL board_to_fen-0.1.1.tar.gz
Size 22.9 MB
Tags Source
SHA-256 checksum
How to use checksums
87f27f72ced2fafa54c29f7a91851cacc4d9a9a68567016e1f8fd9a0bf3100db
BLAKE2b-256 checksum
How to use checksums
3fa8d9e685d6d8046475c520cf7d0cb975564a236119897d12bd199ae2b81d80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.2

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

0.1.0

1 release file

0.0.25

1 release file

0.0.24

1 release file

0.0.23

1 release file

0.0.22

1 release file

0.0.21

1 release file

0.0.20

1 release file

0.0.19

1 release file

0.0.18

1 release file

0.0.17

1 release file

0.0.16

1 release file

0.0.15

1 release file

0.0.13

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page