GithubHelp home page GithubHelp logo

hyoungsooo / board_to_fen Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mcdominik/board_to_fen

0.0 0.0 0.0 21.62 MB

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

Home Page: https://pypi.org/project/board-to-fen/

License: MIT License

Python 100.00%

board_to_fen's Introduction

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_path

print(get_fen_from_image_path(PATH_TO_CHESSBOARD_IMAGE))

or, if you want you can load image object by yourself:

from PIL import Image
from board_to_fen.predict import get_fen_from_image

img = Image.open(PATH_TO_CHESSBOARD_IMAGE)

print(get_fen_from_image(img))

Note: The package uses tensorflow+keras API. They are pretty heavy.

Customization

get_fen_from_image_path 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
  • february 2023 version 0.1.0-0.1.1

    • migratation from cv2 to PIL
    • new function for direct image object load
    • add simple tests
    • 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

board_to_fen's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.