Blogs
Jun 29, 2023

Improving the accuracy of image classification model using synthetic data

Synthetic data can enhance the accuracy of your AI models. We will demonstrate how we improved the accuracy of a classification AI model trained on Kaggle's dataset using this approach.

You have most likely seen a lot of classification AI models detecting if image is of a dog or a cat. In similar way, in this classification example, the AI will detect if image is of a penguin or a turtle. If you think a bit about this two animals you will notice they are somehow similar in shape. This similarity can pose a challenge to the AI, especially if the classification must be carried out on blurry underwater images.
Improving the accuracy of image classification model using synthetic data
Kaggle's dataset "Penguins vs Turtles" consist of 572 unique images, 250 images of penguins, and 250 images of turtles, with additional 72 images that can be used for validation. Each image has exactly one instance of a turtle or a penguin.

We trained our AI classification model with Azure Custom Vision by uploading this 500 training images and labelling them "penguin" or "turtle", training images were split equality 50:50 for each label.

We tested the classification AI model, and we noticed that classification was done correctly in most cases: AI model was able to predict if there is an image of a penguin or an image of a turtle. However, in a few cases, we found that the model was not performing optimally. As you can see in the image below, the picture on the left was classified as a penguin with only 71.3% accuracy, while the image on the right was misclassified as a turtle with 78.5% accuracy.
Two penguins detected swimming by the computer vision as for the first result
We decided to improve the accuracy of our classification AI model with the use of synthetic data. We generated synthetic data with our solution syntheticAIdata Enterprise and with two realistic 3D models, one for a penguin and one for a turtle.
Image of a 3D penguin on a screen
Both 3D models are animated with head and flipper movements which creates a better variation of generated data. Synthetic data was generated for the water environment, and with dynamic lighting settings. In the examples below you can see 4 synthetic data images for penguins and 4 for turtles that were generated in the process.
synthetically generate images of penguins and turtles swimming
In total, we generated 250 images for a penguin and 250 images for a turtle. Generated synthetic data doubled our initial dataset, and we had 500 images for each label. Generating synthetic data with our solution takes only a few seconds. Our solution supports Azure Custom Vision as one of the integrations, and with a single click, we could upload our images directly to the Custom Vision project.

Retraining the classification model with additional images significantly improved the classifications. The image on the left was classified as a penguin with 99.9% accuracy, while the image on the right was correctly classified this time with an accuracy of 98.2%.
Computer vision accurately detecting two swimming penguins, aided by the use of synthetic data
Synthetic data is an inexpensive alternative for a real data and it can greatly improve accuracy of your AI models. Generating data on a large scale is quick and easy, and with our solution you can easily integrate it into existing projects. If you would like to learn more about it do not hesitate to reach out to us!