tensorflow_chessbot icon indicating copy to clipboard operation
tensorflow_chessbot copied to clipboard

CV detection handle high-freq gradients (like hatch), pass full res to model

Open Elucidation opened this issue 2 years ago • 0 comments

The chessboard detection routine looks for certain X and Y gradient patterns, and the hatched pattern often disrupts this at full resolution, but those gradients go away when blurred. Example image from Tomas original issue #41

image

Could 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.

secondary note is that the model is only trained on lichess/chess type images, so for these types of images the model will perform poorly. At some point consider retraining/fine tuning the model. Alternatively a simpler approach is since this style is common/uniform just do some simple CV-based approach and drop the ML

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 https://github.com/Elucidation/tensorflow_chessbot/issues/41#issuecomment-1650163565, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADKF3ILYYFGFRWNGNJHIMDXR7YBFANCNFSM6AAAAAA2T2LIWQ . You are receiving this because you commented.Message ID: @.***>

Originally posted by @Elucidation in https://github.com/Elucidation/tensorflow_chessbot/issues/41#issuecomment-1650322696

Elucidation avatar Jul 25 '23 18:07 Elucidation