Artificial intelligence applied to merchandise diagnosis

In .Consumer Products & Retail, .Data & applied AI, .Logistics & Transportation, Blogfest-en, Uncategorized by Baufest

At Baufest, we explore how applied artificial intelligence (AI) can increase human capabilities.

Wednesday 2 - June - 2021
Inteligencia Artificial en Mercadería

For that purpose, we not only appeal to theory, but make progress based on specific cases. Recently, for example, we carried out a concept test through AI about the classification of the ripening stage and diseases in fruit. It was a very rapid test for an insurance company; the idea was that, starting from image classification, the level of damage to fruit shipments can be measured considering two different dimensions: the ripening stage and the eventual presence of mechanical damages or diseases.

The case arose from the need of the mentioned company, which insures international cargo. When a claim is presented before them, this company needs to see the damage that was inflicted to evaluate if a refund applies, and the amount in question.

This way, the IA focus application has to do with the diagnosis of the state of the fruit. Now, in reality, all artificial intelligence systems are data-based (from which the model learns to recognize patterns), and precisely the facts of obtaining, elaborating and handling them implies the major workload, as data has to be cleaned (eliminating altered data, and keeping that which is representative for the problem we need to solve), labelled, scaled, and the training data made to look like the data that will be used in production, among other tasks. Then, there is a cycle when algorithms are trained with machine learning  models.

It is expected that these algorhythms have a level of precision close to that of an expert. With this concept test, the team at Baufest started with a reliability of 80%. Logically, with a dedicated project, with more time and a larger volume of information, we could improve that percentage.

Automatized Report

In this opportunity, the business requirement was the automatization of reports of damage in fruits, in order to determine the level of damage and the cause. To solve this requirement, we proposed a simple solution architecture, in Python language, which would allow us from the beginning to take pictures of real inspections of bananas in fruit transportation.

With these photos, we built two models of artificial intelligence: one for the classification of the ripening stage; the other one, for the classification of the damages themselves. With the results these two models delivered, combined with more generic information, we built an automatized report which can be exported to a typical Excel and pdf file.

Data and the model

The original set of data with which the ripening model was going to be trained in order for it to learn to recognise the different categories or states of the bananas, was composed of 273 images taken in a uniform manner. Then, we expanded that set of data with data augmentation techniques: specifically, we created a new set of takes for each of the images making certain alterations, such as zooming, cuts, rotations, vertical and horizontal inversions. This added more variability and allowed us to have a final set of three thousand images, that we divided into four categories according to the ripening stage (green, yellow, half-ripe and over-ripe).

Once we had these data available, we had to pick a model to train. To create it, we opted for a Google tool called  Google Teachable Machine, because in this first instance of the concept test, we wanted to have something functional, as fast as possible, and without having to write code lines.

Once we uploaded all the images, we moved on to the instance of model preparation. It is true that training time was under two minutes, and it returned a very high level of precision: 99% in the training set, and 93% in validation. That is to say, in a very short time, we could obtain a model that recognises damage categories and maturity of bananas with considerable precision.

Enabling technologies

In this concept test, we could generate a quite thorough report where it is possible to determine the amount of fruit that us lost due to advanced ripeness level or due to damage. This was achieved in a lapse of 7 to 10 days. During this period, we were able to obtain the data set, extend it with data augmentation, train the model, download it, make the report and generate it.

This experience proves that we can develop a functional product in a short period of time and with considerably high precision, considering the reduced data set we manage, and the little time.

The conclusion is that, with a low level of investment, the feasibility of this type of artificial intelligence projects can be seen quickly: if they can be done, with which scope, if they are viable for the business and if they offer the expected value.

At Baufest, we see artificial intelligence as an enabler of technological solutions. The main goal is not the creation of models themselves, but to develop applications that use those models to solve problems. These projects still require important investments, and therefore, must be applied to something that is of main importance to companies, and really adds value.