-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chess board to FEN working correctly on DEMO, but not locally #41
Comments
Just tried the example_input.png image, and that works as well, with 100% accuracy. |
Likely the JavaScript online model and the local Python one have some
preprocessing step differences such as image resize etc. , Have a look in
https://github.com/Elucidation/ChessboardFenTensorflowJs
I don't remember if the model used between the two of those is the same or
different, that's possibly another reason.
If you don't find anything let me know
…On Sat, Jul 22, 2023, 06:09 Tomas Tillmann ***@***.***> wrote:
Just tried the example_input.png image, and that works as well, with 100%
accuracy.
—
Reply to this email directly, view it on GitHub
<#41 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADKF3PBIZMOIW46DFAING3XRPGG7ANCNFSM6AAAAAA2T2LIWQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I think it's perhaps about the dimensions of the input picture. Does it have to be on some specified dimensions? It seems to me like the web version scales it, and this one doesn't. |
There's no specific preferred size, it eventually gets scaled down to
something like 32x32 pixels per chessboard tile, so possibly what's going
on is the lined pattern texture from the image you shared is confusing the
Python model whereas the JavaScript web one has scaled it down to where
it's blurry enough to not interfere. You can test this by manually trying
different resizes and see what works for you
…On Sat, Jul 22, 2023, 11:54 Tomas Tillmann ***@***.***> wrote:
I think it's perhaps about the dimensions of the input picture. Does it
have to be on some specified dimensions? It seems to me like the web
version scales it, and this one doesn't.
—
Reply to this email directly, view it on GitHub
<#41 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADKF3OT2UD3JL25GVUYLSLXRQOX5ANCNFSM6AAAAAA2T2LIWQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Yes, that seems to be the reason. Thanks. Do you think it could be possible to do something about it though? I experimted a bit, and if I blur the image, making the quality of the image lower, it works correctly. But that feels like a hack ..., and it also makes the work for the model harder, since the pieces are not as sharp as they could be. Potentially leading to wrong piece prediction. I think it would be very nice for the chessboard recognizer to understand even if the black tiles are hatched and not fully black colored, where the grid lines are. Do you think it could be done? Perhaps by feeding it boards with hatched black tiles? I feel like majority of chess pdf books are having black tiles hatched, so it could be a really useful improvement. |
Good to hear, and yes there are 2 parts,
- 1 is that the model isn't really trained on those type of images so it
could definitely benefit from further training on those sorts of labeled
images.
- 2 is that likely the issue is more on the computer vision chessboard
detection side, not the ML piece recognition side, where the chessboard
detection routine essentially looks for certain X and Y gradient patterns,
and the hatched pattern is disrupting that at full resolution, but those
gradients go away when blurred.
The 2nd part can be tackled by modifying the chessboard detection routine,
either naively by blurring/reducing high frequency gradients like the hatch
pattern, or something more sophisticated (probably unnecessary). And then
once the board and tiles have been detected, use pass the the original
image resolution tiles to the ML model.
I'll open an issue for this
…On Tue, Jul 25, 2023 at 9:30 AM Tomas Tillmann ***@***.***> wrote:
Yes, that seems to be the reason. Thanks.
Do you think it could be possible to do something about it though? I
experimted a bit, and if I blur the image, making the quality of the image
lower, it works correctly. But that feels like a hack ..., and it also
makes the work for the model harder, since the pieces are not as sharp as
they could be. Potentially leading to wrong piece prediction.
I think it would be very nice for the chessboard recognizer to understand
even if the black tiles are hatched and not fully black colored, where the
grid lines are. Do you think it could be done? Perhaps by feeding it boards
with hatched black tiles?
I feel like majority of chess pdf books are having black tiles hatched, so
it could be a really useful improvement.
To name some: The woodpecker method, Encyclopedia of chess tactics, ...
—
Reply to this email directly, view it on GitHub
<#41 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADKF3ILYYFGFRWNGNJHIMDXR7YBFANCNFSM6AAAAAA2T2LIWQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Hi,
not sure what I'm doing wrong, for this image:
, the website demo returnes correct fen string, but local installation doesnt' work.
Interestingly, the example --url image works locally just fine.
pip list
output:python --version
output:Executing by:
python .\tensorflow_chessbot.py --filepath "C:\Users\tomas\Pictures\Screenshots\whole-board.png"
Output:
Thanks.
The text was updated successfully, but these errors were encountered: