Detecting Ripeness In Fruit And Vegetables Via Neural Networks

Humans have an innate knack for identifying food that is fit to eat. There’s a reason you instinctively enjoy fresh fruit and vegetables, but find maggot-infested rotting flesh offputting, for example. However, we like to automate as much of the food production process as possible so we can do other things, so it’s necessary to have machines sort the ripe and ready produce from the rest at times. [kutluhan_aktar] has found a way to do just that, using the power of neural networks.

The project’s goal is a straightforward one, aiming to detect ripeness in fruit and vegetables by monitoring pigment changes. Rather than use a camera, the project relies on data from an AS7341 visible light sensor, which is better suited to capturing accurate spectral data. This allows a better read of the actual light reflected by the fruit, as determined by the pigments in the skin which are directly related to ripeness.

Sample readings were taken from a series of fruit and vegetables over a period of several days, which allowed a database to be built up of the produce at various stages of ripeness. This was then used to create a TensorFlow model which can determine the ripeness of fruit held under the sensor with a reasonable degree of certainty.

The build is a great example of the use of advanced sensing in combination with neural networks. We suspect the results are far more accurate than could have reasonably be determined with a cheap webcam, though we’d love to see an in-depth comparison as such.

Believe it or not, it’s not the only fruit spectrometer we’ve featured in these hallowed pages. Video after the break.

11 thoughts on “Detecting Ripeness In Fruit And Vegetables Via Neural Networks

    1. How do you know, can your eyes see at 9 different wavelengths including infrared ? Can you point to a paper that shows that there is no correlation between sucrose/glucose/fructose content and wavelengths absorbed by different fruits.

      1. That’s a weird shifting of the burden of proof, even though Ghent is making a claim to knowledge. I had the same question/concern as Ghent, but I’ll phrase it differently: what demonstrates the correlation between ripeness and light absorption of fruits?

    2. @Ghent The Slicer said: “But the color is not a good indicator for ripeness.”

      Sometimes yes, sometimes no. For example, ripeness in mangoes is strongly tied to color – but many pear types, nope.

      Roughly half of all common fruits are climacteric [1]. With climacteric fruits ripeness is strongly linked to the emission of ethylene gas[2]. Excerpting [1]: “Apples, bananas, melons, apricots, and tomatoes, among others, are climacteric fruits; citrus, grapes, and strawberries are not climacteric…”

      So in many cases, when it comes to the question of ripeness you are far better off sniffing (and even controlling) ethylene gas concentration rather than messing around with a brilliant camera. Reference [3] is a lovely web page that discusses how different fruits mature and ripen.

      Ripeness is only half the story though. Maturity is the other half and depending on the fruit, the two are very different things. Again, Reference [3] discusses this in more detail.

      Is throwing visual AI/ML at testing for fruit ripeness a good idea? IMO probably yes for some fruits – probably no for most fruits. It’s worth investigating though.

      Keep in-mind, today the ripening process in the whole farm-to-table supply chain is carefully controlled and timed. In most cases, knowing when a piece of produce will be at peak ripeness is already highly predictable. The brilliant camera is not needed.

      However, for some outliers like mangoes and certain varieties of avocados for example, the product may go through peak ripeness on the grocery shelf. In those cases I can imagine an AI/ML-empowered smart phone camera app that will try to tell you which pieces to buy. But then again, evolution has already turned humans into very capable ripe-fruit pickers all by themselves. We pick it up, look at it, smell it, squeeze it, thump it, etcetera. We’re already pretty good at picking the winners.

      * References:

      1. Climacteric (botany)

      https://en.wikipedia.org/wiki/Climacteric_(botany)

      2. Ethylene and Role of Ethylene in Fruit Ripening

      http://www.agrilearner.com/ethylene-role-ethylene-fruit-ripening/

      3. 25 Fruits That Ripen After Picking

      https://empressofdirt.net/fruits-ripen-after-picking/

    1. It seems like analysis of the reflection of an ultrasound ‘ping’ would reveal a better indication of ripeness.
      In fact, I think I may have seen a product that works this way. Perhaps someone has more info on that?

  1. Wouldn’t having both the spectral data *and* a webcam image (ideally with the IR filter removed one webcam) be even better at detecting ripeness accurately?

    Oh, you could even have a wheel of filters that you rotate in front of the webcam, so you can take a dozen or more pictures of the fruit with different filters (letting pass through and stopping different wavelengths for each filter, giving you rich spectral data, more than the sensor they are using here ). Wait I guess I just re-invented the wheel/spectrometer here

Leave a Reply to Paul LeBlancCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.