Skip to content

Commit 3d9d2c8

Browse files
committed
Update readme to link to uploaded model and explanation [Resolve Elucidation#23]
1 parent 7abcd69 commit 3d9d2c8

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

readme.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,55 @@ A [TensorFlow](www.tensorflow.org) [Convolutional Neural Network](https://en.wik
1313

1414
Yes, using a CNN is kinda overkill, but it is *exciting*.
1515

16+
### Running Tensorflow_Chessbot on images locally and via URLs
17+
18+
On a linux machine which has Tensorflow and SciPy installed
19+
20+
* [Tensorflow Install instructions](https://www.tensorflow.org/versions/r0.9/get_started/os_setup.html)
21+
* [SciPy Install Instructions](https://www.scipy.org/install.html), possibly as easy as this on Ubuntu
22+
23+
sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose
24+
25+
Download and unzip this directory somewhere : [tensorflow_chessbot](https://github.com/Elucidation/tensorflow_chessbot/archive/master.zip)
26+
27+
Then, download and unzip this saved model to the same directory : [tensorflow_chessbot_model_v01.zip](https://drive.google.com/open?id=0BwW6qsUNa47xeUNvQ2M0a053Y0U)
28+
29+
The directory structure should look like `<SOMEWHERE>\tensorflow_chessbot-master\saved_models`
30+
31+
Now, to run pass the following arguments to `tensorflow_chessbot.py`
32+
33+
$ ./tensorflow_chessbot.py -h
34+
usage: tensorflow_chessbot.py [-h] [--url URL] [--filepath FILEPATH]
35+
36+
Predict a chessboard FEN from supplied local image link or URL
37+
38+
optional arguments:
39+
-h, --help show this help message and exit
40+
--url URL URL of image (ex. http://imgur.com/u4zF5Hj.png)
41+
--filepath FILEPATH filepath to image (ex. u4zF5Hj.png)
42+
43+
By default, it will try and load the URL `http://imgur.com/u4zF5Hj.png` and make a prediction in it, otherwise, you could pass a local file like so (for example with an image file `u4zF5Hj.png` located in the same directory):
44+
45+
./tensorflow_chessbot.py --filepath u4zF5Hj.png
46+
47+
Which should output something like:
48+
49+
./tensorflow_chessbot.py --filepath ./u4zF5Hj.png
50+
Setting up CNN TensorFlow graph...
51+
I tensorflow/core/common_runtime/local_device.cc:40] Local device intra op parallelism threads: 2
52+
I tensorflow/core/common_runtime/direct_session.cc:58] Direct session inter op parallelism threads: 2
53+
Loading model 'saved_models/model_10000.ckpt'
54+
Model restored.
55+
Certainty range [0.999545 - 1], Avg: 0.999977, Overall: 0.998546
56+
Predicted FEN: 11111111/11111p11/11111k1P/11p1111P/1p1p1111/11111111/111K1111/11111111
57+
Certainty: 99.9%
58+
Done
59+
60+
61+
Similarly, a URL can be tested by calling with a URL:
62+
63+
$ ./tensorflow_chessbot.py --url http://imgur.com/u4zF5Hj.png
64+
1665
### Reddit Bot
1766

1867
[/u/ChessFenBot](https://www.reddit.com/user/ChessFenBot) will automatically reply to [reddit /r/chess](https://www.reddit.com/r/) new topic image posts that contain detectable online chessboard screenshots. A screenshot either ends in `.png`, `.jpg`, `.gif`, or is an `imgur` link.

0 commit comments

Comments
 (0)