I am starting a project, in which I plan to run a neural-network regression using images. These are simple images of particles in a field with low contrast. The shape of the particles changes in response to a given chemical. I plan to trach the system to predict the concentration of the chemical, using my image data (a few hundreds of images, with >20 particles/image on average). I'd like to get your expert opinion, wether i should segment the images before feeding them into the model (keras/tensorflow), or just give it the raw images? Due to the low contrast, the segmentation isn't perfect (it segments correctly ~85% of the particles, snd the rest get missed or interconnected), so segmentation will create a bias. On the other hand, in msny images, most of the image is background and not particles, which may make harder to find the right features. So, what do you think? Thanks in advance, JT2
I presume you wish the Keras model to classify the image, i.e. if particles in an image have a particular shape in response to addition of a chemical (e.g. for argument's sake, let's say a square shape), then let's give the image a value of 1. Otherwise, the image has a value of 0.
In this instance, you would need to segment for the simple reason that the CNN (convolutional neural network) needs to know the criteria for distinguishing between each image in order to classify correctly.
As an example (and this is purely hypothetical), let's say that one chemical induces circular particles, while another induces square particles. You would then partition training and test data in separate folders as follows:
- Training data (80% circular images).
- Training data (80% square images).
- Test data (20% circular images).
- Test data (20% square images).
Of course, this is assuming that you are able to distinguish among the images in the first instance and classify them manually.
Then, you are building the neural network in order to train on this data, and then correctly classify an unseen image (i.e. one not already included in either the training or test data as a 0 or a 1).
If it helps, you can see an example of how a CNN can be used to distinguish between an image of a car and a plane in this example: http://www.michaeljgrogan.com/image-recognition-with-keras-convolutional-neural-networks/
Essentially, your steps using Keras are to:
- Segment the data as described above
- Construct the CNN
- Train the model over a certain number of epochs until such point that the training and validation accuracy is maximised
- Classify an unseen image based on the trained model
Hope this helps.