Abstract
Adulteration in different spices is an emerging challenge in human civilization. It is commonly detected using different analytical and instrumental techniques. Despite good accuracy and precision many of such techniques are limited by their high processing time, skilled manpower requirement, expensive machinery and portability factor. Computer vision methodology driven by powerful convolutional neural network (CNN) architectures can be a possible way to address those limitations. This paper presents a CNN driven computer vision model which can detect cornstarch adulteration in turmeric powder along with the degree of adulteration. The model has been optimized using binary genetic algorithm (BGA) for improved performance and consistency. The experimentations presented in this paper were conducted with an in-house database prepared for 4 levels of adulteration and found to provide about 98% overall accuracy. The less expensive and faster detection capability of the model along with its mobility makes this proposal a promising addition to the existing spice adulteration screening methods.
Keywords
Introduction
Turmeric (Curcuma Longa) is an integral ingredient in different cuisines for its distinctive taste, aroma and versatility. Turmeric is used in many medicinal and beauty products as well. Despite its richness it is often subjected to adulteration for higher economic profit. Adulteration is one of the most important aspects of food fraud as it can be detrimental to public health [1]. The adulterations are commonly of two types i.e. increasing the volume by cheaper material and improving appearance by adding restricted colors. Flours and starches are commonly added to increase the volume compromising the food and medicinal values [2]. On the other hand colors like Metanil yellow and Sudan dye are added to improve the appearance while these substances can cause serious human health hazards on prolong consumption [3].
The reported techniques for detection of such adulterations are majorly based on spectral analysis. Different percentages of cornstarch were mixed to turmeric and subjected to FTIR spectroscopy in [4] where data analysis has been performed using one-class soft independent modeling of class analogy (OCSIMCA) and one-class SVM (OCSVM) models which resulted about 94% overall efficiency. The starch adulteration with different percentages ranging from 0–50% were subjected NIR spectroscopy to acquire reflectance spectra in 900–1700 nm range and the signals were further filtered using Savitzky-Golay (SG) filter [5] where the extra tree regressor (ETR) model provided best results with an R2 value of 0.995. A cavity perturbation technique (CPT) has been used for adulteration detection [2] which resulted into 99% accuracy using different ML algorithms. Scope of using IR spectroscopy in this problem has been reported in [6] where PLS-DA and SIMCA techniques have been used for data analysis. The technique reported about 92% precision in detecting adulteration. Application of IR has also been reported in [7] however this work reports a genetic algorithm based variable selection mechanism for PLS algorithm and shown about 99% accuracy. Investigation on using FT_NIR spectroscopy has been reported in [8] where PLSR was used as regression model and achieved
One of the major advantages of CNN is elimination of feature extraction step present in most of the conventional prediction models. With the help of numbers of filters loaded in CNN layers it can extract abstract features from the images by itself. Such features make the model sensitive to tiny changes and that in-turn provides its power to classify between different classes that are difficult to detect by human eyes and some of the conventional classifiers. On the other hand the computer vision framework where CNN is engaged has several advantages over the spectroscopic practices, for example, the non-invasive nature of operation, less expensive implementation, faster decision with higher accuracy, higher portability and higher possibility towards IoT integration. Optimization of CNN hyperparameters for a specific purpose is also important for robust performance. Hence, a binary genetic algorithm (BGA) [15] driven optimization approach has as well been reported.
The major contribution is development of a light and optimized CNN model from scratch towards faster training and decision making along with an experimented confirmation on performance potential with small dataset (
Experimental
Sample preparation
Dry rhizomes of turmeric were procured from local market. After cleaning those were boiled at 70∘C for 10 min. The boiled rhizomes were subjected to drying. Dried rhizomes were ground using mixer to make powder. The prepared turmeric powder was divided into 5 portions. One was remained unadulterated and labeled ‘pure’. Rest 4 portions were mixed with adulterants in 10%, 20%, 30% and 40% weight-to-weight ratios and labeled as ‘90t10s’, ‘80t20s’, ‘70t30s’ and ‘60t40s’, respectively. The samples were preserved in air-tight containers till those were used for imaging.
Image database preparation
Illumination is one of the most important imaging criteria which significantly changes the inherent image features. In this work an indigenous imaging chamber as shown in Fig. 1a has been used to capture the images of the prepared samples. The labeled samples were taken in the holder which could contain upto 10 gm of powder. The surface facing the imaging camera was leveled manually so that lesser textural irregularities are captured. To capture the images camera of 5 different mobile phones resolution ranging from 48Mpixel to 64MPixel were used and a fixed distance of 1ft from the sample holder was maintained. No camera filters or external light sources (like flash light) were used during imaging. The chamber was illuminated using LED light strips having wattage of 15 W/m mounted at the four corners. The walls of the imaging chamber were covered with diffusing sheets to achieve soft and uniform distribution of light in the chamber. Considering the possibilities for real-life implementation the images were saved in .jpg format.
a) the imaging chamber and b) samples of cropped images.
Once captured the images were cropped into 300
CNN models comprises of three fundamental layers; convolution (conv_2d), pooling and fully connected (FC) layers [16]. The combination of conv_2d and pooling performs the feature extraction task from the images while fully FC layer is similar to conventional artificial neural network (ANN) architecture made of input, hidden and output layers. The filters specified in the convolution layers transform the image as per mathematical dynamics of the filters while pooling layer commonly extracts either of mean and max values from the filtered images. Numbers of conv_2d and pooling layer combinations can be used in sequence depending on the nature of input images.
In this work initially 2 conv_2d and max_pooling layer combinations were taken. It can be noted here that a shallow architecture of CNN has been adopted where dimension of each conv_2d layer will be half of its previous conv_2d layer. The adam optimizer [17] was used as it can automatically modulate the learning rate. The activation function was ReLU for all the layers other than output, which is expressed as Eq. (1).
softmax activation function as expressed in Eq. (2) [18] was used for output layer where
The loss function for optimizing the model was categorical cross-entropy and the initial model parameter setting is consolidated in Table 1.
Initial model parameter settings
Binary code representations of optimization parameters
Schematic representation of BGA process.
Hyperparameter settings optimization is frequently performed to enhance CNN performance in terms of accuracy and consistency. It also helps in avoiding over and under-fitting problems that are often experienced in CNN implementations. In this work a simple binary genetic algorithm (BGA) based approach was adopted. The choice of BGA was due to its simplicity and proven efficiency. As the model architecture does not include many layers hence a simple mathematical optimization can be computationally less expensive to realize. Like other heuristics, BGA also starts with random solutions and reach to the final optimized solutions through iterative evaluation and generation of solutions against the defined fitness function. Crossover and mutation are two nature inspired operations in BGA that results in generation of superior offspring compared to the parents. Based on the literature reviews on GA applications the crossover probability was initially set at 0.5 and with iterations reduced to 0.1, the mutation probability was set at 0.05 and started with 20 initial randomly generated binary solutions. A single-point crossover operation was adopted where the crossover point was randomly generated within the length of solution. The fitness function used in this work is presented in Eq. (3) [19]. The ranges of different model parameters as were taken for initiation of the BGA algorithm have been mentioned in Table 2 Each solution was represented as a binary string of length of 9 bit where the bits were decoded as shown in Fig. 2.
where,
The realization of CNN was accomplished in python platform using Spyder IDE and standard libraries like keras [20] and scikitlearn [21] in Windows environment. The convergence plot for the CNN parameter optimization is shown in Fig. 3 which shows that at the end of 50 iterations the accuracy of 99% is obtained by the model with the parameter settings provided in Table 3. All the results presented in the paper were obtained with CNN model with these parameter settings. The entire dataset was also divided into training:validation:testing sets using 60:20:20 ratios. The generalization potential of the model was verified against accuracy and loss values as shown in Fig. 4.
Convergence plot for BGA optimization.
Optimized parameter settings
Figure 4 shows that the model has considerable generalization potential since the training and validation plots are not showing much visible gap at the ends. This reflects that the model performance is towards better conformance to the desired low bias and high variance nature. These show that the model has balanced performance capability avoiding the chances of over- and under-fitting. It can also be notes the loss is considerably low in the order of 10 - 2 while the accuracy is in the tune of 98%. The model consistency was tested against 10-fold cross validation method. The accuracy and loss values for different folds are presented in Table 4.
Result of 10-fold cross validation
Comparative evaluation of classification performance
Model validation plots using (a) loss and (b) accuracy.
Confusion matrix for CNN performance on testing set.
ROC-AUC plot for classification results in different classes.
The confusion matrix for the model performance with testing data has been shown in Fig. 5 and the associated metric values i.e. accuracy, precision, recall, F-score [22] and Cohen Kappa [23] score are shown in Table 5. This table also includes the results of some the existing pre-trained models to evaluate the competitiveness of the presented model. Figure 5 shows that for all the classes the proposed model provide 100% accuracy except for 80t20s and 90t10s, nevertheless in these case too none of the adulterated samples have been identified as pure. In these two cases also the accuracy is in the tune of 95% and on an average about 7% wrong classification has occurred.
Similarly in Table 5 it can be clearly seen that the proposed model performance is competitive and in some cases better than some of the reported pre-trained CNN models. However, as far as architectures and tunable parameters are considered the proposed model is lighter and faster as can be seen in less training time requirement in this table. In terms of precision apart from our modell only Resnet50 provides value of 1 while in terms of accuracy also except Resnet50 all others have performed poorly. One main reason of such poor performance by established techniques is lack of generalization which is again evident from high recall and low accuracy values of in most of the models. It may be noted here that the established models could have performed much better if the hyperparaters were optimized for our test images but that wouldn’t have challenged the lesser number of layers and tunable parameters of the proposed model. The Cohen Kappa is also conveying the promising potential of the proposed model. A high value of the Cohen Kappa statistics reflects that the raters i.e. actual and predicted results are highly similar for case of ResNet50 and proposed model where the values are in the interpretation category of ‘near perfect agreement’. The rest of the models could not show favorable result against this metric. Finally in this table the training time requirement is also less in the presented model compared all other models under consideration.
The results were further evaluated against AUC-ROC [28] metric. The plots for AUC-ROC presented in Fig. 6 shows that the presented model is potential across all the classes of adulterations considered in this study. Although for few classes the AUC is not 1 but it is in the tune of 0.99 which indicates about 99% correct classification in those classes. It is also important to note that the model performs about 100% prediction accuracy for pure and highest degree of adulteration (60t40s) in this work which in turns confirms that the possibility of classifying unadulterated sample as adulterated and highly adulterate samples as unadulterated or pure is very small.
A computer vision based detection of starch adulteration in turmeric powder has been proposed in this paper. The CNN model has been optimized using BGA and experimentations have been performed using indigenous database prepared with pure and 4 degrees of adulterated turmeric samples. The results have shown the promising potential of the presented method which could provide upto 98% accuracy. Some of the major research avenues where the work can be further extended include more degrees of adulteration, realization of an handheld hardware which can perform detection on the spot and integration to IoT. Considering such future scopes the presented method can be considered as a potential step towards computer vision based detection of turmeric adulterations which is easy, inexpensive and faster compared to the existing spectral and analytical methods.
Footnotes
Statements and declarations
This work involves no potential sources of conflict of interest.
No funding was received for conducting this study.
