Kernels Counting

Hi, does anyone know how to build a pipe in Knime that counts the number of kernels of corn seed in these images?




Hello @rsalencar

Welcome to KNIME’s community where everything is possible ! Amazing question !
Do you have a dataset of images with associated “number of corn seeds” ? If so, could you upload it here or somewhere else to share it with the community? Depending on its quality, I would be happy to help you on this problem and provide a preliminary solution in a KNIME workflow based on image processing and/or Deep Learning.

Best regards,



Hi Ael,
Thank you for your feedback, ar the moment i dont have a training database with a ser of pictures and its result. But i am on mu way to collect and build a database with this information.
In your opinion what would be a reasonable number of samples? I am planning to have 3 photos from each corn sample taken from random sides.
Please could you please explain how could this be achieved (kernels counting), using line you said “deep learning”? What if you have a variety of sizes and seeds colors?
Best regards,


Hi Rafael,

Welcome back and nice to hear from you Rafael. I believe we will not need many samples to build a first “prove of concept” solution. Then obviously, the more you have, the better. Could you for instance take the photo of a dozen of corns from different reasonable angles and positions as you say? That should be enough to build up an example that you could improve later. Initially and to make the problem a bit easier, could you please make sure that the background is always of the same texture and colour (different from corn colour!) ? (Other texture and colours could be tackled later in a second stage but let’s do things easier for the time being). Please make all the images exactly of the same size too. This will help too.

Once you have uploaded here the set of images, I’ll take the problem from there. The example I could set up would be essentially based on a Keras convolutional network with augmentation, normalization and other common features.

By the way, if I had to solve this using image processing, I would:

  • Segment the corn surface from the background based on the image histogram and texture.
  • Segment different regions of interest using morphological operators.
  • Differenciate the good corn from the holes using morphological operators too.
  • Calculate “good corn” surface.
  • Calculate corn surface edge size too.
  • Compute the ratio of two which should give us a fair estimation of the number of Kernels.

This is just a “plan” but this is how I initially would tackle this problem and then I would refine it with other features. This is easy to put in place but time consuming and much more complex than a CNN if one knows how to set up one.

Now about the CNN : The nice thing of it, is that it achieves all the previous operations by “learning” if enough and good examples are provided.

Concerning corn colour, this is an added complexity. I cannot say how the CNN will behave without having seen the images first and played a bit with them.

I’ll post here a first CNN solution if you upload first the data. We can then discuss how to improve it.

Hope you get a nice dataset and we can process it quickly and efficiently using the CNN.

All the best,




First of all thank you for your kind explanation, fully understood.

We are just about to start constructing this database with some amount of real corn image samples.

Some considerations:

  • the pictures a meant to be taken by a cell phone camera, at the field, so its challenging to keep the size parameter in terms of distance. Question is: If we had a reference object, lets say, at the corn of the object frame with a static size, could we use as a image scale?

  • about the background with a different color its fine, we can have that, we are using a kind of frame as a background.

  • Whenever i said different colors, kernels are always yellow but some time “whiter”.

We expect to have those images in 2 months and then have so prove of concept.

Thank you again Ael,
Keep safe.


Hi @rsalencar

Thanks for your prompt reply and the extra information. A modern cell phone camera is fine, provided it has reasonable resolution to easily detect the kernel edge, which is important. Exact distance to corn should not be a problem (because the ratio between kernel surface and its edge should be invariant and a CNN with augmentation should be able to detect it and calibrate itself just during training) but if you add a reference object such as circle of always the same colour (say red), this should facilitate enourmously the processing.

The other details you have given are excellent news. Please get back in touch when you are ready. We will take the discussion from there. By curiosity and if you don’t mind, where is the corn growing :blush: ?

Take care Rafael too and stay safe !


1 Like

Sure, Brazil!
Any other contact information for further projects development?

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.