Grocer-Ease: Grain Classification, Quality Prediction and Level Monitoring System

Download Full-Text PDF Cite this Publication

Text Only Version

Grocer-Ease: Grain Classification, Quality Prediction and Level Monitoring System

Adesh Singp, Akarsh Ghosp, Aparajita Mitra1, Babu Gaurav1, Nethravathy V2 1Student, Dept. of Computer Science and Engineering, Bangalore Institute of Technology, Bengaluru, Karnataka, India

2Assistant Professor, Dept. of Computer Science and Engineering, Bangalore Institute of Technology, Bengaluru, Karnataka, India

Abstract: Keeping track of quality and availability of grains is time-taking and a burdening task. Hence, this paper proposes an architecture which will make classifying of grain, predicting quality and monitoring effortless, hence GROCER-EASE. It will help user to determine type and quality of grain, as well as notify user when level of grain becomes below some threshold value. In an overview it uses Image processing, and concepts of CNN and weighted NN-classifier.

The complete system can be divided into two major modules. The first being the Grain detection and quality prediction module and second is the Level monitoring module. In Grain detection and quality prediction module, the grain is first classified using pre-trained CNN model. Once, the type of grain is known, different features are extracted like major-axis, minor-axis, lustre, area, roundness, aspect-ratio etc which is used for classifying the grain within its class. Weighted NN- classifier is used for determining the type of rice/pulse (dal) (can be scaled to any number of grains with appropriate dataset) The quality-index is determined based on number of foreign particles present, area of lustre in grain particles, aspect ratio etc. Secondly, in Level monitoring System, a pretrained CNN model is used to determine level of grain in container (which can be placed at a distance). This module records level a defined frequency and notifies the user of the decreased level, once the level goes below a pre-defined threshold.

The system proposed can prove to be useful in public sector if installed in modular kitchen setups and can provide a complete solution for better handling of groceries.

Keywords: CNN, Grain-quality detection, Image Processing, NN- Classifier.

  1. INTRODUCTION

    As Day-to-day life becomes busy, it is of great importance for us to take good care of our health. To maintain a good health, intake of proper food is a must. Thus, it is very important for us to choose wisely what we intake. Sadly, in this busy life, most people fail to maintain a quality intake. This causes many diseases and breakdown of health in general.

    The food industry has been growing at a very fast pace to meet the needs quantitatively at a cost of lower quality. There is a need to keep a check on the quality of food one intakes. Many researches are going on from a long time to incorporate proper measures for this purpose. Food quality is an important food requirement, because food consumers are susceptible to any form of contamination that may occur during the collection and processing.

    As India is the highest producer of pulse and rice (agriculture) across the globe, many varieties of rice and pulses are produced and is very difficult to identify each variety and determine the quality of it. The quality of food is an important factor for proper nourishment and todays market should be free of adulterated food grains. These grains consist of several impurities like stones, damaged seeds, broken granules etc. The addition of impurities in food affects the composition and quality of food. There is no convenient method to identify these inferior quality grains in the market. Human perception based on visual inspection has long been recognized as a guide to quality assessment but the results are not accurate and reliable.

    When the food, especially grains available for public intake is degrading with such a high rate, keeping track of quality surely needs assistance and idea. Also, its more often than never that we lose track of the availability of food in household until we run out it. These problems are very common and a solution to this is of high interest. Having a complete household solution, which keeps track of all the availability and quality of groceries we need would ease day- to-day life.

    So, we fixating on the burning need of an assistance which can guide us about the quality of grain and can also keep track of the availability of the grains, we decided to pursue this idea as our final year project. The system which we have built has two major modules. First one is Classifying and Quality Determining Module and the second one is Level monitoring module. Level monitoring system, which would keep track of the necessary grain availability and notify before the user runs out of it. Quality determination module determines the detailed information of quality of grain. This can help the user to know the quality of grain available in the market.

    We have used Machine learning and Image processing to our dispense in making of this project, which can detect decrease in level and quality of the grain. In system we have built, the user can upload image of the grain before buying and can determine the quality. Also, with a pi cam setup along with raspberry pi, the system can keep constant track of the availability of the grain, and notify when the level goes below certain pre-decided threshold. The flow of the project consists different layers and all the layers work in sync to

    give best possible output. The system first determines the type of grain, followed by classification of type of grain and finally the quality index. Hence, giving complete knowledge about the grain. Various morphological factors are used amongst which size, roundness, lustre, foreign particles, fullness, texture are few to mention.

    We hope the project we built proves to be of some relevance and is capable of having some impact on common.

  2. RELATED WORKS

    Food quality detection has been a focus of research since long time now. Many approaches have been used to design quality detection models. Some paper [1] have used principal component analysis, canny edge and comparison for rice grain identification and quality analysis. The model was accurate but slow.[6] Some have also used the image processing technique based on principal component analysis to detect quality.

    One of the papers referred [8] worked on Image Processing Based with Bayesian Regularization Learning Algorithm for detection of quality of wheat grains. In this paper the features used were less in number, but the system gave reasonable efficiency.

    The paper [2] proposes system to monitor food grain and maintain storage system at home mainly using IoT. Another paper studied [3] classify the varieties of grain using ANN.

    The paper [4] has used back-propagation neural network for rice grain classification. [9] present the way to detect foreign bodies in grain using ANN.

    All the papers mentioned and many other gave a thorough insight for making of this paper. They gave the basic idea that using a well-trained CNN model can be used to detect grains and the morphological characters extracted by image processing techniques can be used detect the variety and quality of grains too.

  3. PROPOSED SYSTEM The system is divided into two modules:

    1. Grain detection and Quality Prediction Module

    2. Level Detection Module

    1. Grain detection and Quality Prediction Module

      This module detects the quality of grains of uploaded image. It mainly focuses on morphological features of the grain particles to detect the quality. In this module concepts of CNN, image processing an NN classifier is used.

      Steps followed in this module are-

      1. Pre-processing of image

        This sub-module processes the input image by-

        • Binarization using thresholding (Converting the image into grayscale)

        • Applying averaging filter (Used to suppress either the high frequencies in the image, i.e. smoothing the image, or the low frequencies, i.e. enhancing or detecting edges in the image)

        • Erosion (erosion removes pixels on object boundaries)

        • Dilation (Dilation adds pixels to the boundaries of objects in an image)

        • These enhances the morphological features to be extracted.

      2. Identification of grain

        This sub-module accepts the pre-processed image. Uses CNN-model to detect the grain. The model is trained using 200 images for each grain. These images are taken from distance of 10cm – 20 cm distance in varying lighting conditions.

      3. Morphological features extraction

        Once the type of grain is detected then the morphological features respective to the grain is detected. Morphological features such as length of grain particles, width of particles, total area and perimeter of one particle, lustre present or not if present area of lustre, presence of foreign body.

        All these features extracted are stored in a csv file which is further used for classification.

      4. Grain variety detection

        In this sub-module the variety of grain is determined based on the morphological features extracted. These features are grain specific and each feature is allotted weight which makes sure the participation of features in determination of grain variety is based on importance of the feature.

      5. Quality Prediction

      The quality is determined in form of an index whose value can range from 0 to 1. This index is calculated based on various features. These features are Number of foreign particles, size of foreign particle, lustre, aspect ratio, roundness, fullness etc.

    2. Level Monitoring

      1. Acquiring Input Image

        The input image is captured using pi-camera setup in an reasonable distance and lighting condition. These images were taken every 30 minutes.

      2. Processing and Determination of Level of grain

        The image input is processed and input into pre-trained CNN model which determines the level of grain.

      3. Comparison and Notification

        The level detected is compared to pre-determined threshold value. If the level is found to be below the threshold value appropriate notification is given to the user.

      4. Storage of data in Cloud and Comparison

    • Data gathered from the previous step is stored in cloud (to be done)/file (for local) which is compared to pre-set threshold

    • Notification system (to be done)

    • This submodule is triggered when data predicted satisfies threshold condition.

    • Cart Building and Ordering (to be done)

    • This sub-module is triggered along with notification system to place order.

  4. ALGORITHMS

    The following Concepts of Machine Learning are used at the proposed systems disposal-

    Weighted NN Classifier

    Weighted KNN is a modified version of k nearest neighbours. One of the many issues that affect the performance of the KNN algorithm is the choice of the hyperparameter k. If k is too small, the algorithm would be more sensitive to outliers. If k is too large, then the neighbourhood may include too many points from other classes.

    Another issue is the approach to combining the class labels. The simplest method is to take the majority vote, but this can be a problem if the nearest neighbours vary widely in their distance and the closest neighbours more reliably indicate the class of the object.

    CNN

    The algorithm applies a single neural network to the full image, and then divides the image into regions and predicts bounding boxes and probabilities for each region. These bounding boxes are weighted by the predicted probabilities. a single CNN simultaneously predicts multiple bounding boxes and class probabilities for those boxes. CNN trains on full images and directly optimizes detection performance. the entire image during training and test time so it implicitly encodes contextual information about classes as well as their appearance. It learns generalizable representations of objects so that when trained on natural images and tested on artwork, the algorithm outperforms other top detection methods. The most important feature of C-CNN is that it is very efficient and fast in Realtime.

    Fig.1: CNN Model

  5. ARCHITECTURE

    Fig. 2: System Architecture

    1. Mobile Camera

      Mobile camera is the source of image. End-User can upload image of the grain for which the result is responded as Type of grain, category of grain and quality index.

    2. User Dashboard

      User Dashboard is the User Interface in which the user can interact with the system. The option to upload image and then segment to view result can be viewed on this interface. The results consist of grain, variety of grain, and quality of grain.

    3. Notification System

      The notification system notifies customer of the alarming level of grain before it runs out.

    4. Camera

      Pi Cam which is compatible with Raspberry Pi is used, and uploads image every 30 mins. This image is sent to Raspberry pi connected to pi cam over Bluetooth.

    5. Raspberry Pi

      In this Raspberry Pi the trained model is uploaded and is processed to save the calculated data of level of grain in each container Here the level detection data is stored and computed. Any alarming level is notified through notification system.

    6. Cloud

      Cloud is used to store the data recorded in regular time interval. This data is used to compare and notify user, when needed.

    7. Containers

      These containers are placed on a shelf mounted on wall at a distance of 1.5 m from Pi-camera which takes image of this shelf from which the level of grain in each container is detected.

  6. METHODOLOGY

      1. Grain detection and Quality Prediction Module

        1. The image uploaded is pre-processed.

        2. The image is fed into pre-trained CNN model

        3. The output is then used to decide the NN classifier it is fed in

        4. The features like Major axis, Minor axis, area, perimeter and lustre is extracted using various cv2 library methods.

        5. These morphological features are used to determine in weighted KNN classifier with value of K=5. The output of this NN classifier is class of grain.

        6. These morphological features along with foreign particles, size of foreign particle and aspect ratio is used to calculate quality index.

      2. Level Monitoring Module

    1. The image uploaded is input.

    2. The input image is fed to pre trained CNN model.

    3. The output level is compared to previous levels and to pre- set threshold value.

    4. Data is stored, handled and Appropriate notification is shown to End-user.

  7. RESULT AND TESTING

    The proposed system showed the output of 90.06% for quality detection module and 96% accuracy for level detection module.

    The system is also resonably fast as it takes response time of 20 50 seconds in quality module and 7 – 15 seconds in level detection module. The system is tested under various lighting condition with variety of image quality and I sfound to perform as expected. Some of the sample cases are discussed in the Table I And Table II. The output of various pre-processing steps is illustrated in Figure 3. Various morphological features extracted is illustrated in Figure 4. The snapshots of endproduct is shown in Figure 5 and Figure 6.

    Table-I: Test scenaris and result for quality detection

    Sample No.

    Light Condition

    Grain

    Variety

    Cases

    Success

    1

    Bright

    Rice

    Short Grain

    5

    5/5

    2

    Dim

    Rice

    Short Grain

    5

    4/5

    3

    Dim

    Rice

    Long Grain

    5

    5/5

    4

    Bright

    Rice

    Long Grain

    5

    5/5

    5

    Dim

    Rice

    Med Grain

    5

    5/5

    6

    Bright

    Rice

    Med Grain

    5

    5/5

    7

    Bright

    Pulse

    Type 1

    4

    4/4

    8

    Dim

    Pulse

    Type 1

    5

    4/5

    9

    Bright

    Pulse

    Type 2

    4

    4/4

    10

    Dim

    Pulse

    Type 2

    4

    4/4

    Table-II: Test scenarios and result for level monitoring

    Sample No.

    Light Condition

    Containers in Image

    No of test cases

    Correctly Detected Level

    1

    Dim

    1

    10

    10

    2

    Bright

    1

    10

    10

    3

    Dim

    2

    10

    10

    4

    Bright

    2

    10

    10

    5

    Bright

    2(contents sticking to wall)

    10

    8

    Fig. 3: Result images after various Pre processing steps

    Fig. 4: Morphological features

    Fig. 5: Snapshot of manual level detection module

    Fig. 6: Snapshot of grain detection and quality prediction module

  8. CONCLUSION

    In this research article, we developed a system which can classify and determine quality of grain and can also monitor level of grain from time to time. In the grain detection and quality prediction module we have used CNN to detect the grain. Image processing is used to extract various relevant morphological features which is then used by NN classifier to detect the variety of the grain. Then these features along with few more is used to predict the quality index.

    In the level monitoring module, we use CNN to our disposal for detection of level. The system developed was reasonably accurate and functioned efficiently.

  9. FUTURE WORK

The accuracy can be elevated by considering various other conditions while building the dataset. The system can be trained to perform on many more grain types. A mobile application can be developed to make the end user experience better.

REFERENCES

  1. Deepika Sharma and Sharad D. Sawant Grain Quality Detection by using Image Processing for public distribution In the proceedings of 2017 International Conference on Intelligent Computing and Control Systems (ICICCS 2017)

  2. Saleem Ulla Shariff, M. G. Gurubasavanna and C. R. Byrareddy IoT- Based Smart Food Storage Monitoring and Safety System In the proceedings International Conference on Computer Networks and Communication Technologies, Lecture Notes on Data Engineering and Communications Technologies

  3. Alper Taner *, Ye¸sim Benal Öztekin, Ali Tekgüler, Hüseyin Sauk and Hüseyin Duran Classification of Varieties of Grain Species by Artificial Neural Networks Journal of Agronomy journal 2018

  4. Ksh. Robert Singh , Saurabh Chaudhury Efficient technique for rice grain classification using back-propagation neural network and wavelet decomposition Journal of The Institution of Engineering and Technology journal 2016

  5. Engr. Zahida Parveen Dr. Muhammad Anzar Alam and Engr. Hina Shakir Assessment of Quality of Rice Grain using Optical and Image

    Processing Technique In the proceedings of 2017 International Conference on Communication, Computing and Digital Systems (C- CODE)

  6. Muhammad Junaid Asif, Tayyab Shahbaz, Dr. Syed Tahir Hussain Rizvi and Sajid Iqbal Rice Grain Identification and Quality Analysis using Image Processing based on Principal Component Analysis In the proceedings of 2018 International Symposium on Recent Advances in Electrical Engineering (RAEE)

  7. Rakesh Satapathy, Srikanth Prahlad, Vijay Kaulgud Smart Shelfie Internet of Shelves, For higher on-shelf availability In the proceedings of 2015 IEEE Region 10 Symposium

  8. Ahmet Kayaba, Kadir Sabanc, Enes Yiit, Abdurrahim Tokta, Mehmet Yerlikaya and Berat Yldz Image Processing Based ANN with Bayesian Regularization Learning Algorithm for Classification of Wheat Grains In the proceedings of 2017 Research Gate Conference

  9. Harish S Gujjar, Dr.M.Siddappa Recognition and Classification of Different types of Food Grains and Detection of Foreign Bodies using Neural Networks In the proceedings of 2014 International Conference on Information and Communication Technologies (ICICT- 2014)

  10. Rosarium Pila, SaurabhRawat, Indar Prakash Singhal eZaar, The Smart Container In the proceedings of 2017 2nd International Conference on Telecommunication and Networks (TEL-NET 2017)

AUTHORS PROFILE

Akarsh Ghosh, B.E. final year student, Department of Computer Science and Engineering, Bangalore Institute of technology. He has interests in Web development, Data Science. Machine learning.

Adesh Singh, B.E. final year student, Department of Computer Science and Engineering, Bangalore Institute of technology. He has completed her primary and secondary education in West Bengal. He has interests n Data Science. Machine learning, Image processing.

Aparajita Mitra, B.E. final year student, Department of Computer Science and Engineering, Bangalore Institute of technology. She has completed her primary and secondary education in Ranchi. She is currently working as intern in OneDirect, Bangalore. She is interested in fields of Machine learning and Web development.

Babu Gaurav, B.E. final year student, Department of Computer Science and Engineering, Bangalore Institute of technology. He has completed his primary and secondary education from Ranchi and Kota respectively. His current interests are Big Data. Machine learning.

Nethravathy V working as Assistant professor at Bangalore Institute of Technology. Her areas of interest are Image processing and Natural Language processing

Leave a Reply

Your email address will not be published. Required fields are marked *