-1

I want to train a model to infer the colour of a car from a car image. Let's say that for the colour classification I will use the k-nearest neighbours algorithm.

Let's also suppose that:

1) I have 1000 labelled images

2) I have 100 images for testing

However, let's suppose that I managed to write a source code which can detect a car in a car image and retrieve its colour.

Will this source code be in any way useful to the training model or since I have (manually) labelled the training images then it cannot be used in any essential way?

Outcast
  • 4,967
  • 5
  • 44
  • 99
  • What do you mean by writing a source code which can detect a car in a car image? Is the source code being used for creating the training set? – janu777 Jan 17 '18 at 05:46
  • Yes, the source code is used also for creating training set but I could even do it manually for 1000 images. In this respect my question can be rephrased in the following way: what is the purpose of training a model to classify cars according to their colour since I can retrieve the colour of every car with simple image processing? – Outcast Jan 17 '18 at 09:20
  • In other words, in general, since in order to create the training dataset in many cases you must write a source code that classifies/labels images then why not to simply use this source code than training a model. What the training model adds to my initial source code classification/labelling? – Outcast Jan 17 '18 at 09:23

1 Answers1

0

The way I understand your question is, why do we need to create a machine learning model when we can solve the problem using image processing techniques itself?

  • So It is always recommended to use image processing libraries if the objective is too simple like to find the color of some object in an image, find some template in an image invariant to rotation and scaling, edge detection etc.

  • But when your objective becomes complex like to identify various objects in an image, localize the object, pixel-based segmentation, video segmentation etc. You will need to go for deep learning models.

In your case, You will need to detect the car and find its color.

Let's break this down into two parts:

1) Car detection and localization:

  • For Detecting an object(car), you will need to look out for the following challenges:

    • Viewpoint variation
    • Scale variation
    • Deformation
    • Occlusion
    • Illumination conditions
    • Background Clutter
    • Intra-class variation

If your test cases don't face these challenges then you can very well use image processing libraries. Else it becomes a complex process. So only way to solve this issue will be training a model with different such images.

2) Color detection

  • For this, it is better to use image processing methods itself. Since for training you will need to have a significant number of images in every color you are more likely to get.

Hope this helps!

janu777
  • 1,940
  • 11
  • 26
  • Very nice, this was exactly my question! Perhaps an additional question of mine would be the following: If I have an image processing algorithm which detects & localises the car in 80% of the cases then can I use on top of this a machine learning algorithm to increase this to e.g. 90% or essentially I would start from scratch with the machine learning algorithm without using at all my image processing algorithm? – Outcast Jan 17 '18 at 09:59
  • In other words, can image processing and machine learning algorithms be combined for the same exactly purpose (e.g. detection and localisation of the car....and not simply the machine learning algorithm for the detection and localisation while the image processing algorithm for the colour detection )? – Outcast Jan 17 '18 at 10:01
  • Yes, Of course you can combine. You must create a training set with the labels: X_start, Y_start, width, height, color. – janu777 Jan 17 '18 at 10:04
  • Make sure to have significant number of training samples in every color. Ex: If Red, gree, blue are the colors then you must have good number of training images containing cars belonging to all three colors – janu777 Jan 17 '18 at 10:06
  • Ok, cool. So if I understand right, I will specify some (pretty accurate-e.g. 80%) values for X_start, Y_start, width, height, colour with my image processing techniques and then I will use a machine learning algorithm to get even closer to my desired output for these values (e.g. 90%). – Outcast Jan 17 '18 at 10:34