1

Sorry, I have some background on AI, but very little experience.

I am facing an image classification problem:

I need to detect whether an image is background or not (images are always of the same size, which may vary from 15x15 pixels to 70x70 pixels, depending on the context)

Is there any easy and light (and preferrably standard) algorithm to be applied to detect that?

The model should have to be trained with only 10 (or more) background image examples, and 10 or less not background image examples.

Modification

The algorithm will be applied for detecting empty boxes at a chess board.

Each box might be empty (background) or with a chess figurine (not background).

The model or the image feature, will have to be extracted from a pair [ image, FEN string ]

  • The image is a chess board image
  • The FEN string is a string that defines univocaly the position of the figurines inside the chess board.

The current algorithm is able to split the chess board into 64 separate boxes.

So now is the turn to create a model that is able to decide whether a box is empty or not.

There will be two kind of boxes (the white ones and the black ones).

There are then, at most, 16 figurines per player (32 figurines).

Hopefully, there will be more than 10 examples of empty white boxes, and 10 examples of empty black boxes. And hopefully, there will be at least one not background example for white and black boxes.

So, the meaning of background in this case is: an uniform texture or flat color at the whole of the image. And not background, is an image with our background as background, but with any other overlapping shape as foreground.

Update (2024-03-03)

Thanks for your answer, Adrien.

I have just done a look on your proposal.

And, based on canny outputs got from an image set, I have inferred that the idea might work for a flat color background, but it is not so easy to distinguish whether the image is background or not based only basing on a canny output when the background is a texture.

I have calculated the canny outputs using a code I found on the internet some years ago, and configuring the algorithm with different parameters.

You can download the results here: https://frojasg1.com/stackOverflow/20240303.imageClassification/20240303.canny.7z

Any other ideas are welcome!

Update 2024-03-17

They have asked me to attach some examples, and here they are:

The examples

They are organized in folders.

All images in a particular folder, have the same board box size.

There are some images in tiff format (tiff was chosen for avoiding loosing quality for compression).

The name of files say which chess figurine they represent.

There can be black or white figurines, over black or white board boxes, and the letters for those figurines are the initial letters (KQRBNP): King, Queen, Rook, Bishop, Knight and Pawn.

The patterns that represent empty board boxes, have a name with four letters: WWWW for empty white board boxes, and BBBB for empty black board boxes.

The examples in the zip file have been obtained automatically from automatic training of the chess position recognizer I programmed for my application, and I have not checked if all of them have been right identified, I hope so ...

Well, those are the examples.

I hope that helps for achieving the solution

  • Could you elaborate on the description of your "background" . What is that visual feature that describes the background? Based on the description maybe the problem has to be redefined. – Arun Aniyan Feb 23 '24 at 09:09
  • Well, the application for that image classifier, will be to detect, in a chess board context, whether a board box is empty or not. An empty board box, is filled with a texture, which may be a plain color, or a texture, which is not so easy to detect. The non background boxes, include a chess figurine, that would made the detection be: not background. – Francisco Javier Rojas Feb 23 '24 at 10:53
  • My idea, would be to use some kind of image feature, which would not need many examples to be calculated, and then to use some kind of error measure, and a threshold, for the decision. But I do not know if that is possible, neither which feature, nor error measure algorithms to be used. – Francisco Javier Rojas Feb 23 '24 at 10:58
  • 1
    You could try something like an edge detector (maybe canny algorithm?) If there is almost to no edge, it's backgroud, if there is some edges, if's a piece. – Adrien Nivaggioli Feb 27 '24 at 13:09
  • Thank you Adrien suggesting an idea for solving the problem. I will update the body of my question to answer it more appropiately – Francisco Javier Rojas Mar 03 '24 at 14:22
  • Can you provide examples of background and not background? – Marko Lalovic Mar 03 '24 at 17:38
  • Hi Marko, sorry for the delay, I have been very busy

    I have just zipped the examples I have (they have been obtained automatically, from some automatic training for the chess position recognizer I programmed for my application and I have not checked if all of them are valid).

    I will update the text of the question to include a link to the zip with the examples.

    – Francisco Javier Rojas Mar 17 '24 at 16:37

0 Answers0