Skip to main content

Label chess

Description

Desktop application to get pairs of chess board picture and FEN representation from a chess game video and its corresponding PGN encoding.

Aimed at building a dataset to train machine learning models on the task of predicting a FEN representation given a real life picture of a chess board.

Use case

Add files to database

  • Download the app from the latest available release on github (you may need to give the execution rights to the app file).
  • Download a video of a chess game (i.e. from youtube).
  • Download the corresponding pgn file (i.e. from chessgames.com).
  • Start the app.
  • Add the downloaded pgn file to the app database (i.e. click on the Add pgn button and follow the instructions).
  • Add the downloaded video file to the app database (i.e. click on the Add video button and follow the instructions).

Note: You can add as many pgn and video files to the app database.

Start an annotation

  • Select a video from the list available videos (i.e. click on the Select video... button).
  • Select a pgn file from the list available pgn files (i.e. click on the Select pgn... button).
  • Select a downsampling ratio for the video (i.e. click on the FPS ratio... button). Only 1/fps_ratio frame will presented to you during the annotation (where fps_ratio is the selected value).
  • Start an annotation (click on the Start button).

Annotation

  • A visual representation of the first position in the pgn file is loaded on the left part of the screen whereas the first frame of the video is loaded on the right part of the screen.

  • You can go to the next frame by pressing the Next button or the right arrow key.

  • You can go to the previous frame by pressing the Previous button or the left arrow key.

  • Once the position displayed on the left part of the screen matches the actual position on the frame, you can save the pair by pressing the Save button or the up arrow key.

  • You can cancel the last save by pressing the Unsave button or the down arrow key.

  • If there is no good frame available for a given position, you can skip the currently displayed position by pressing the Skip button or the space bar.

  • You can select a part of the frame.

End annotation

  • To cancel the current annotation, click the Cancel button.
  • Once you are done with the annotation, save it by pressing the End button. You will be prompted for a name to give your annotation.

Saved annotations are persisted in the app database and can be recovered after stopping/starting the app.

Export annotation

You can export one or more annotations by clicking on the Export button.

The annotations are exported using csv files.

The main file lists the exported annotations along with the video url and the name of the annotation file for each of the selected annotations.

There is one separate csv file per annotation. Each row contains the following information:

  • video frame id
  • corresponding fen encoding
  • top left corner of the selected part of the video frame (coordinates expressed in percentage of the frame dimensions)
  • bottom right corner of the selected part of the video frame

Database management

The database and its artefacts are stored under the ~/label_chess_database.

When running the application for the first time, click on the Reset DB button.

You can clear the app database and delete its artefacts by clicking on the Reset DB button.

Use this work

You can use this work for non-commercial use.

If you use to produce an academic paper, please refer to this work.

Release

The app has been released using the latest ubuntu version to date (20.04). Therefore there is no guarantee it works on other OS.

Build it yourself

Use the script pyinstaller.sh. You can use the .github/workflows/push_on_main.yaml as an example.

Metadata

Release files for label-chess 0.0.5

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

Source distribution (sdist)

Source distribution for label-chess 0.0.5
File Size Uploaded
label_chess-0.0.5.tar.gz 21.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for label-chess 0.0.5
File Interpreter ABI Platform
label_chess-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 45.8 kB

Release files / label_chess-0.0.5.tar.gz

Download URL label_chess-0.0.5.tar.gz
Size 21.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9d10bfb2ed2b59591556c75561fd94d0a2d3e6e1dbe6d02329f7bd8b01cbe39b
BLAKE2b-256 checksum
How to use checksums
acee2e3c982f5b4511d72bf3ae126570e68301da155a311fdd5a8e443644db82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Release files / label_chess-0.0.5-py3-none-any.whl

Download URL label_chess-0.0.5-py3-none-any.whl
Size 24.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
388504489d752568a542be4cce95eb0881195164e464df9b875fd83d96df77f9
BLAKE2b-256 checksum
How to use checksums
3cace7bfa27b5048ba4120a07faaaa55142ff48030750ab654648667daee41fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

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