I am doing a project in order to recognize an apple. (I am using Emgucv with Visual Studio 2010 C#, if that's relevant). My project is a classification (is or is not an apple). I have 2000 images of apples but I need images for the second class.

I have read about classification using ANN but they have multiple classes but I need to recognize if image contain an apple or not. So what kind of images do I need for the second classes? I want to use background of apples like second class. Is that a good idea?

I only want that ANN recognize if a image contain a pen or not so I have 2 classes(pen and non-pen) My question is What kind of image can I use to the second class? For example My first class are images of pen and second class are images of non pen (pencil, apples, grapes, tables); is that correct?

  • 1
    $\begingroup$ I don't really understand the question, but the project seems ill-defined. The universe of pictures needs to be a part of the definition. "Recognize pictures of apples among pictures of individual pieces of fruit," is completely different from, "recognize pictures that contain apples among pictures of various fruit baskets," and different again from, "differentiate pictures of apples from pictures of peoples faces." $\endgroup$ Commented Apr 3, 2014 at 12:25

1 Answer 1


A standard approach is to pick a standard image bank of other images that you might run into that aren't apples, and use that as your other class. The way you figure out what kind of images you need is: figure out what kind of images your classifier might be run on, and try to make the training set as similar as possible to the kinds of images that it will be run on in production.

  • $\begingroup$ mmm for example I can use a table that can be a background of apples. is that a good idea? $\endgroup$ Commented Apr 2, 2014 at 23:59
  • 2
    $\begingroup$ @EmilySalazar: That's not what D.W. says. Basically, you have to use a large variety of images, namely anything that your system may have to distinguish. If your use case is "distinguish empty tablets from such with an apple on it" then yea, empty tablets are good counter-examples. If you want to distinguish apples from other kind of fruit, you better have other fruit in your samples. If you train only against tablets, or cars, or star constellations, apples look much like pears or tomatoes. $\endgroup$
    – Raphael
    Commented Apr 3, 2014 at 6:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.