Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Altering trained images to train neural network

I am currently trying to make a program to differentiate rotten oranges and edible oranges solely based on their external appearance. To do this, I am planning on using a Convolutional Neural Network to train with rotten oranges and normal oranges. After some searching I could only find one database of approx. 150 rotten oranges and 150 normal oranges on a black background (http://www.cofilab.com/downloads/). Obviously, a machine learning model will need at least few thousand oranges to achieve an accuracy above 90 or so percent. However, can I alter these 150 oranges in some way to produce more photos of oranges? By alter, I mean adding different shades of orange on the citrus fruit to make a "different orange." Would this be an effective method of training a neural network?

like image 807
Rehaan Ahmad Avatar asked Jan 13 '17 00:01

Rehaan Ahmad


People also ask

How many images do you need to train a neural network?

Usually around 100 images are sufficient to train a class. If the images in a class are very similar, fewer images might be sufficient. the training images are representative of the variation typically found within the class.

Why do we resize images in deep learning?

Resizing images is a critical pre-processing step in computer vision. Principally, deep learning models train faster on small images. A larger input image requires the neural network to learn from four times as many pixels, and this increase the training time for the architecture.

Which image resolution should I use for training for deep neural network?

According to research performed at Lund University by Olivier Rukundo on effects of image size on deep learning performance via semantic segmentation of magnetic resonance heart images with Unet, the optimal image size is 256x256.


1 Answers

It is a very good way to increase the number of date you have. What you'll do depends on your data. For example, if you are training on data obtained from a sensor, you may want to add some noise to the training data so that you can increase your dataset. After all, you can expect some noise coming from the sensor later on.

Assuming that you will train it on images, here is a very good github repository that provides means to use those techniques. This python library helps you with augmenting images for your machine learning projects. It converts a set of input images into a new, much larger set of slightly altered images. Link: https://github.com/aleju/imgaug

Features:

  • Most standard augmentation techniques available.

  • Techniques can be applied to both images and keypoints/landmarks on images. Define your augmentation sequence once at the start of the experiment, then apply it many times.

  • Define flexible stochastic ranges for each augmentation, e.g. "rotate each image by a value between -45 and 45 degrees" or "rotate each image by a value sampled from the normal distribution N(0, 5.0)".

  • Easily convert all stochastic ranges to deterministic values to augment different batches of images in the exactly identical way (e.g. images and their heatmaps).

enter image description here

like image 166
Dellein Avatar answered Oct 18 '22 02:10

Dellein