Training: Advanced Options

avatar
Libor Vanek
3. November 2020

Results of machine learning models are strongly dependent both on the quality and quantity of your training data. Unfortunately, getting more reliable data is often quite expensive. There are however a couple of techniques designed to deal specifically with this problem. Using Ximilar App, anyone can train their own recognition and detection models and  Ximilar has recently introduced new options for this process.

What We Do for You

From our end to reduce work for you, we use models pre-trained on huge amounts of data, which can already recognize the basic elements on your images. Sometimes those might be already quite high level concepts like an individual. Other times, they could be lines, edges and so forth. The training just refines the model for your specific data.

How Can You Help Us

Then, there are some options which are much more dependent on the given task you are trying to solve. You can artificially change your training images and generate additional data “for free”. Some operations are typically “safe” and we turn them on by default – image quality, mild color changes, left-right flip or small crop of an image.

Others are more disruptive and can potentially destroy the important pieces of information in your image. Therefore it is up to you to turn them on. This is something we strongly encourage you to do for as many of them as possible within your task.

Default Advanced Options

Choosing Correct Options

Do not be afraid of growing number of options. The main rule for deciding which one to enable is very simple. Could the particular operation change the image in such way that you will be no longer able to recognize it? If not, you can allow it. Sometimes, you might ask a second question – could an image modified by this operation be sent to my service? Do I want to recognize it?

In one of our earlier articles, we described how to train a custom image classifier. We will take an example from the same domain (cats vs dogs) to walk you through the different options.

Flip And Rotate

The most basic operations are rotation and flip. Below, you will find an original image on the left side and then pictures with the following operations: flip vertical, flip horizontal, rotate 90, rotate max (20).

As you see, the dog is recognizable in all pictures. Horizontal flip should be turn on without any hesitation. Vertical flip and rotate 90 depends on the data you are expecting to recognize. Will those all be professional photos? Then those options will probably not help you. Will users all around the world be using your service to upload pictures from their phones? Well, sometimes the image might be rotated the wrong way.

In addition, a small arbitrary rotation (rotate max) might be useful to introduce some deformations which will make the model even more robust.

Let’s Do Some More

Now, we can continue to more advanced image augmentations. Again, we have an original image on the left. And then we apply: color (light, medium and aggressive), quality, crop and erase augmentations.

Changes of the colors are a very natural operation. We provide you with for options:

  • Keep original colors.
  • Light changes – slightly modify brightness and contrast.
  • Medium changes – modify brightness and contrast a bit more, modify hue and saturation.
  • Aggressive changes – drop one of the color channels, swap channels, convert image to black and white.

Other operations are more straightforward. They can be either on or off. Quality simulates various JPEG compressions, noise etc. Crop will cut of a small part of an image on each side. And finally, erase will remove small rectangular patches from the image.

In our task, all operations made the dog recognizable, with possible exception of the last one – erase. If the object or its defining part on the image is too small, it might be removed by this operation. Therefore use erase carefully.

Final Tips

Do not be afraid to experiment. You can train multiple models with different settings and compare the results. However, always be careful, how you do the evaluation. The best way is to set your independent test dataset. Read more in this blog post.

For every trained model, your settings are saved and you can inspect them at your will.

If you have any question about this or any other functionality, please do not hesitate to contact us. We would be glad to discuss your problem and help you.

Related Articles