Peaberries are a special type of coffee bean with an oval shape. Peaberries are not considered defective, but separating peaberries is important to make the shapes of the remaining beans uniform for roasting evenly. The separation of peaberries and normal coffee beans increases the value of both peaberries and normal coffee beans in the market. However, it is difficult to sort peaberries from normal beans using existing commercial sorting machines because of their similarities. In previous studies, we have shown the availability of image processing and machine learning techniques, such as convolutional neural networks (CNNs), support vector machines (SVMs), and k-nearest-neighbors (KNNs), for the classification of peaberries and normal beans using a powerful desktop PC. As the next step, assuming the use of our system in the least developed countries, this study was performed to examine their implementation in and the limitations of Raspberry Pi 3. To improve the performance, we modified the CNN architecture from our previous studies. As a result, we found that the CNN model outperformed both linear SVM and KNN on the use of Raspberry Pi 3. For instance, the trained CNN could classify approximately 13.77 coffee bean images per second with 98.19% accuracy of the classification with 64×64 pixel color images on Raspberry Pi 3. There were limitations of Raspberry Pi 3 for linear SVM and KNN on the use of large image sizes because of the system's small RAM size. Generally, the linear SVM and KNN were faster than the CNN with small image sizes, but we could not obtain better results with both the linear SVM and KNN than the CNN in terms of the classification accuracy. Our results suggest that the combination of the CNN and Raspberry Pi 3 holds the promise of inexpensive peaberries and a normal bean sorting system for the least developed countries.
Citation: Hira Lal Gope, Hidekazu Fukai. Peaberry and normal coffee bean classification using CNN, SVM, and KNN: Their implementation in and the limitations of Raspberry Pi 3[J]. AIMS Agriculture and Food, 2022, 7(1): 149-167. doi: 10.3934/agrfood.2022010
[1] | Satoshi Kumabe, Tianyu Song, Tôn Việt Tạ . Stochastic forest transition model dynamics and parameter estimation via deep learning. Mathematical Biosciences and Engineering, 2025, 22(5): 1243-1262. doi: 10.3934/mbe.2025046 |
[2] | Sebastien Motsch, Mehdi Moussaïd, Elsa G. Guillot, Mathieu Moreau, Julien Pettré, Guy Theraulaz, Cécile Appert-Rolland, Pierre Degond . Modeling crowd dynamics through coarse-grained data analysis. Mathematical Biosciences and Engineering, 2018, 15(6): 1271-1290. doi: 10.3934/mbe.2018059 |
[3] | Manal M. Yousef, Rehab Alsultan, Said G. Nassr . Parametric inference on partially accelerated life testing for the inverted Kumaraswamy distribution based on Type-II progressive censoring data. Mathematical Biosciences and Engineering, 2023, 20(2): 1674-1694. doi: 10.3934/mbe.2023076 |
[4] | Walid Emam, Khalaf S. Sultan . Bayesian and maximum likelihood estimations of the Dagum parameters under combined-unified hybrid censoring. Mathematical Biosciences and Engineering, 2021, 18(3): 2930-2951. doi: 10.3934/mbe.2021148 |
[5] | Katrine O. Bangsgaard, Morten Andersen, James G. Heaf, Johnny T. Ottesen . Bayesian parameter estimation for phosphate dynamics during hemodialysis. Mathematical Biosciences and Engineering, 2023, 20(3): 4455-4492. doi: 10.3934/mbe.2023207 |
[6] | Miguel Ángel Rodríguez-Parra, Cruz Vargas-De-León, Flaviano Godinez-Jaimes, Celia Martinez-Lázaro . Bayesian estimation of parameters in viral dynamics models with antiviral effect of interferons in a cell culture. Mathematical Biosciences and Engineering, 2023, 20(6): 11033-11062. doi: 10.3934/mbe.2023488 |
[7] | Gianni Gilioli, Sara Pasquali, Fabrizio Ruggeri . Nonlinear functional response parameter estimation in a stochastic predator-prey model. Mathematical Biosciences and Engineering, 2012, 9(1): 75-96. doi: 10.3934/mbe.2012.9.75 |
[8] | Azmy S. Ackleh, Jeremy J. Thibodeaux . Parameter estimation in a structured erythropoiesis model. Mathematical Biosciences and Engineering, 2008, 5(4): 601-616. doi: 10.3934/mbe.2008.5.601 |
[9] | Alex Capaldi, Samuel Behrend, Benjamin Berman, Jason Smith, Justin Wright, Alun L. Lloyd . Parameter estimation and uncertainty quantification for an epidemic model. Mathematical Biosciences and Engineering, 2012, 9(3): 553-576. doi: 10.3934/mbe.2012.9.553 |
[10] | Blaise Faugeras, Olivier Maury . An advection-diffusion-reaction size-structured fish population dynamics model combined with a statistical parameter estimation procedure: Application to the Indian Ocean skipjack tuna fishery. Mathematical Biosciences and Engineering, 2005, 2(4): 719-741. doi: 10.3934/mbe.2005.2.719 |
Peaberries are a special type of coffee bean with an oval shape. Peaberries are not considered defective, but separating peaberries is important to make the shapes of the remaining beans uniform for roasting evenly. The separation of peaberries and normal coffee beans increases the value of both peaberries and normal coffee beans in the market. However, it is difficult to sort peaberries from normal beans using existing commercial sorting machines because of their similarities. In previous studies, we have shown the availability of image processing and machine learning techniques, such as convolutional neural networks (CNNs), support vector machines (SVMs), and k-nearest-neighbors (KNNs), for the classification of peaberries and normal beans using a powerful desktop PC. As the next step, assuming the use of our system in the least developed countries, this study was performed to examine their implementation in and the limitations of Raspberry Pi 3. To improve the performance, we modified the CNN architecture from our previous studies. As a result, we found that the CNN model outperformed both linear SVM and KNN on the use of Raspberry Pi 3. For instance, the trained CNN could classify approximately 13.77 coffee bean images per second with 98.19% accuracy of the classification with 64×64 pixel color images on Raspberry Pi 3. There were limitations of Raspberry Pi 3 for linear SVM and KNN on the use of large image sizes because of the system's small RAM size. Generally, the linear SVM and KNN were faster than the CNN with small image sizes, but we could not obtain better results with both the linear SVM and KNN than the CNN in terms of the classification accuracy. Our results suggest that the combination of the CNN and Raspberry Pi 3 holds the promise of inexpensive peaberries and a normal bean sorting system for the least developed countries.
[1] |
Bhumiratana N, Adhikari K, Chambers-Ⅳ E (2011) Evolution of sensory aroma attributes from coffee beans to brewed coffee. LWT-Food Sci Technol 44: 2185–2192. https://doi.org/10.1016/j.lwt.2011.07.001 doi: 10.1016/j.lwt.2011.07.001
![]() |
[2] |
Giacalone D, Degn TK, Yang N, et al. (2019) Common roasting defects in coffee: Aroma composition, sensory characterization and consumer perception. Food Qual Preference 71: 463–474. https://doi.org/10.1016/j.foodqual.2018.03.009 doi: 10.1016/j.foodqual.2018.03.009
![]() |
[3] |
Suhandy D, Yulia M (2017) Peaberry coffee discrimination using UV-visible spectroscopy combined with SIMCA and PLS-DA. Int J Food Prop 20: S331–S339. https://doi.org/10.1080/10942912.2017.1296861 doi: 10.1080/10942912.2017.1296861
![]() |
[4] |
Duarte SMDS, Abreu CMPD, Menezes HCD, et al. (2005) Effect of processing and roasting on the antioxidant activity of coffee brews. Food Sci Technol 25: 387–393. https://doi.org/10.1590/s0101-20612005000200035 doi: 10.1590/s0101-20612005000200035
![]() |
[5] | Peaberry seed (2020) Available from: https://coffeebrat.com/peaberry-coffee. |
[6] | Evolution (2019) Available from: http://blogs.rochester.edu/EEB/?m=geneazyt&paged=42. |
[7] | Suhandy D, Yulia M, Kusumiyati (2018) Chemometric quantification of peaberry coffee in blends using UV–visible spectroscopy and partial least squares regression. In: AIP Conference Proceedings, AIP Publishing LLC, 060010. https://doi.org/10.1063/1.5062774 |
[8] | Peaberry coffee (2020) Available from: https://coffee-brewing-methods.com/coffee-beans-review/peaberry-coffee. |
[9] | Fukai H, Furukawa J, Katsuragawa H, et al. (2018) Classification of green coffee beans by convolutional neural network and its implementation on raspberry Pi and Camera Module. Timorese Acad J Sci Technol 1: 10. http://fect.untl.edu.tl/file_tajst/Classification of Green Coffee Beans by Convolutional Neural Network and its Implemnentation on Rasperry and Camera Module.pdf |
[10] |
Rangarajan AK, Purushothaman R, Ramesh A (2018) Tomato crop disease classification using pre-trained deep learning algorithm. Procedia Comput Sci 133: 1040–1047. https://doi.org/10.1016/j.procs.2018.07.070 doi: 10.1016/j.procs.2018.07.070
![]() |
[11] |
Jahanbakhshi A, Kheiralipour K (2020) Evaluation of image processing technique and discriminant analysis methods in postharvest processing of carrot fruit. Food Sci Nutr 8: 3346–3352. https://doi.org/10.1002/fsn3.1614 doi: 10.1002/fsn3.1614
![]() |
[12] |
Peña JM, Gutiérrez PA, Hervás-Martínez C, et al. (2014) Object-based image classification of summer crops with machine learning methods. Remote Sens 6: 5019–5041. https://doi.org/10.3390/rs6065019 doi: 10.3390/rs6065019
![]() |
[13] | Pinto C, Furukawa J, Fukai H, et al. (2017) Classification of Green coffee bean images basec on defect types using convolutional neural network (CNN). In: 2017 International Conference on Advanced Informatics, Concepts, Theory, and Applications (ICAICTA), 1–5. https://doi.org/10.1109/ICAICTA.2017.8090980 |
[14] | Gope HL, Fukai H (2020) Normal and peaberry coffee beans classification from green coffee bean images using convolutional neural networks and support vector machine. Int J Comput Inf Eng 14: 189–196. https://publications.waset.org/10011255/pdf |
[15] | Peaberry bean (2019) Available from: http://www.zecuppa.com/coffeeterms-bean-defects.htm. |
[16] | Peaberry (2020) Available from: https://gamblebaycoffee.com/peaberry-coffee-beans-better-regular. |
[17] |
LeCun Y, Bottou L, Bengio Y, et al. (1998) Gradient-based learning applied to document recognition. Proc IEEE 86: 2278–2324. https://doi.org/10.1109/5.726791 doi: 10.1109/5.726791
![]() |
[18] |
LeCun Y, Bengio Y, Hinton G (2015) Deep learning. Nature 521: 436–444. https://doi.org/10.1038/nature14539 doi: 10.1038/nature14539
![]() |
[19] | Deep learning (2020) Available from: https://mila.quebec/en/publication/deep-learning. |
[20] |
Sameen MI, Pradhan B (2017) Severity prediction of traffic accidents with recurrent neural networks. Appl Sci 7: 476. https://doi.org/10.3390/app7060476 doi: 10.3390/app7060476
![]() |
[21] |
Butt MA, Khattak AM, Shafique S, et al. (2021) Convolutional neural network based vehicle classification in adverse illuminous conditions for intelligent transportation systems. Complexity 2021: 6644861. https://doi.org/10.1155/2021/6644861 doi: 10.1155/2021/6644861
![]() |
[22] | Srivastava N, Hinton G, Krizhevsky A, et al. (2014) Dropout: A simple way to prevent neural networks from overfitting. J Mach Learn Res 15: 1929–1958. https://jmlr.org/papers/volume15/srivastava14a/srivastava14a.pdf |
[23] | Karen S, Andrew Z (2015) Very deep convolutional networks for large-scale image recognition. Published as a conference paper at ICLR 2015. https://arXiv.org/pdf/1409.1556.pdf%E3%80%82 |
[24] | Igual L, Seguí S (2017) Introduction to Data Science: A Python Approach to Concepts, Techniques and Applications, Springer, 1–218. https://www.springer.com/gp/book/9783319500164 |
[25] | Schölkopf B, Smola AJ, Bach F (2001) Learning with kernels: Support vector machines, regularization, optimization, and beyond, MIT press. https://ieeexplore.ieee.org/book/6267332 |
[26] | Mucherino A, Papajorgji PJ, Pardalos PM (2009) K-nearest neighbor classification. In: Data mining in agriculture, 83–106. https://link.springer.com/chapter/10.1007/978-0-387-88615-2_4 |
[27] | Danil M, Efendi S, Sembiring RW (2019) The analysis of attribution reduction of K-Nearest Neighbor (KNN) algorithm by using Chi-Square. In: Journal of Physics: Conference Series, IOP Publishing, 012004. https://doi.org/10.1088/1742-6596/1424/1/012004 |
[28] | Gauswami MH, Trivedi KR (2018) Implementation of machine learning for gender detection using CNN on raspberry Pi platform. In: 2018 2nd International Conference on Inventive Systems and Control (ICISC), IEEE, 608613. https://doi.org/10.1109/ICISC.2018.8398872 |
[29] | Raspberry Pi (2020) Available from: https://www.raspberrypi.org. |
[30] | Raspberry Pi 3 Model B (2020) Available from: https://github.com/ianburkeixiv/Raspberry-Pi-Gesture-App. |
[31] | Son TT, Lee C, Le-Minh H, et al. (2020) An evaluation of image-based malware classification using machine learning. In: Hernes M, Wojtkiewicz K, Szczerbicki E, (Eds.) ICCCI 2020: Advances in Computational Collective Intelligence, Communications in Computer and Information Science 1287: 125–138. https://doi.org/10.1007/978-3-030-63119-2_11 |
[32] |
Susanibar G, Ramirez J, Sanchez J, et al. (2021) Development of an automated machine for green coffee beans classification by size and defects. J Adv Agric Technol 8: 17–24. https://doi.org/10.18178/joaat.8.1.17-24 doi: 10.18178/joaat.8.1.17-24
![]() |
1. | Mohamad Baydoun, Damian Campo, Divya Kanapram, Lucio Marcenaro, Carlo S. Regazzoni, 2019, Prediction of Multi-target Dynamics Using Discrete Descriptors: an Interactive Approach, 978-1-4799-8131-1, 3342, 10.1109/ICASSP.2019.8682272 | |
2. | N. Bellomo, D. Clarke, L. Gibelli, P. Townsend, B.J. Vreugdenhil, Human behaviours in evacuation crowd dynamics: From modelling to “big data” toward crisis management, 2016, 18, 15710645, 1, 10.1016/j.plrev.2016.05.014 | |
3. | Antoine Tordeux, Gregor Lämmel, Flurin S. Hänseler, Bernhard Steffen, A mesoscopic model for large-scale simulation of pedestrian dynamics, 2018, 93, 0968090X, 128, 10.1016/j.trc.2018.05.021 | |
4. | Luca Bruno, Alessandro Corbetta, Andrea Tosin, From individual behaviour to an evaluation of the collective evolution of crowds along footbridges, 2016, 101, 0022-0833, 153, 10.1007/s10665-016-9852-z | |
5. | Alessandro Corbetta, Andrea Tosin, Comparing First-Order Microscopic and Macroscopic Crowd Models for an Increasing Number of Massive Agents, 2016, 2016, 1687-9120, 1, 10.1155/2016/6902086 | |
6. | Bouchra Aylaj, Nicola Bellomo, Livio Gibelli, Damián Knopoff, Crowd Dynamics by Kinetic Theory Modeling: Complexity, Modeling,, 2020, 12, 1938-1743, 1, 10.2200/S01055ED1V01Y202009MAS036 | |
7. | Qipin Chen, Wenrui Hao, A homotopy training algorithm for fully connected neural networks, 2019, 475, 1364-5021, 20190662, 10.1098/rspa.2019.0662 | |
8. | G. Albi, N. Bellomo, L. Fermo, S.-Y. Ha, J. Kim, L. Pareschi, D. Poyato, J. Soler, Vehicular traffic, crowds, and swarms: From kinetic theory and multiscale methods to applications and research perspectives, 2019, 29, 0218-2025, 1901, 10.1142/S0218202519500374 | |
9. | Simone Göttlich, Stephan Knapp, 2020, Chapter 2, 978-3-030-50449-6, 11, 10.1007/978-3-030-50450-2_2 | |
10. | Nicola Bellomo, Livio Gibelli, Damian Knopoff, 2020, Chapter 1, 978-3-030-50449-6, 1, 10.1007/978-3-030-50450-2_1 | |
11. | Bouchra Aylaj, Nicola Bellomo, Livio Gibelli, Alessandro Reali, A unified multiscale vision of behavioral crowds, 2020, 30, 0218-2025, 1, 10.1142/S0218202520500013 | |
12. | Francesc Valls, Ernest Redondo, David Fonseca, Pilar Garcia-Almirall, Jordi Subirós, 2016, Chapter 41, 978-3-319-39512-8, 436, 10.1007/978-3-319-39513-5_41 | |
13. | Milad Haghani, Majid Sarvi, Simulating pedestrian flow through narrow exits, 2019, 383, 03759601, 110, 10.1016/j.physleta.2018.10.029 | |
14. | Fiammetta Venuti, Vitomir Racic, Alessandro Corbetta, Modelling framework for dynamic interaction between multiple pedestrians and vertical vibrations of footbridges, 2016, 379, 0022460X, 245, 10.1016/j.jsv.2016.05.047 | |
15. | Alessandro Corbetta, Chung-Min Lee, Adrian Muntean, Federico Toschi, 2016, Chapter 7, 978-3-319-33481-3, 49, 10.1007/978-3-319-33482-0_7 | |
16. | Alessandro Corbetta, Chung-min Lee, Roberto Benzi, Adrian Muntean, Federico Toschi, Fluctuations around mean walking behaviors in diluted pedestrian flows, 2017, 95, 2470-0045, 10.1103/PhysRevE.95.032316 | |
17. | Zhiqiang Wan, Xuemin Hu, Haibo He, Yi Guo, 2017, A learning based approach for social force model parameter estimation, 978-1-5090-6182-2, 4058, 10.1109/IJCNN.2017.7966368 | |
18. | Marion Gödel, Rainer Fischer, Gerta Köster, 2020, Chapter 12, 978-3-030-55972-4, 93, 10.1007/978-3-030-55973-1_12 | |
19. | I.M. Sticco, G.A. Frank, C.O. Dorso, Social Force Model parameter testing and optimization using a high stress real-life situation, 2021, 561, 03784371, 125299, 10.1016/j.physa.2020.125299 | |
20. | Simon Rahn, Marion Gödel, Rainer Fischer, Gerta Köster, Dynamics of a Simulated Demonstration March: An Efficient Sensitivity Analysis, 2021, 13, 2071-1050, 3455, 10.3390/su13063455 | |
21. | Ahmed Elaiw, Yusuf Al-Turki, Mohamed Alghamdi, A Critical Analysis of Behavioural Crowd Dynamics—From a Modelling Strategy to Kinetic Theory Methods, 2019, 11, 2073-8994, 851, 10.3390/sym11070851 | |
22. | Alessandro Corbetta, Jasper A. Meeusen, Chung-min Lee, Roberto Benzi, Federico Toschi, Physics-based modeling and data representation of pairwise interactions among pedestrians, 2018, 98, 2470-0045, 10.1103/PhysRevE.98.062310 | |
23. | Nicola Bellomo, Livio Gibelli, 2018, Chapter 1, 978-3-030-05128-0, 1, 10.1007/978-3-030-05129-7_1 | |
24. | Bouchra Aylaj, Nicola Bellomo, Livio Gibelli, Damián Knopoff, 2021, Chapter 2, 978-3-031-01300-3, 17, 10.1007/978-3-031-02428-3_2 | |
25. | Bouchra Aylaj, Nicola Bellomo, Livio Gibelli, Damián Knopoff, 2021, Chapter 1, 978-3-031-01300-3, 1, 10.1007/978-3-031-02428-3_1 | |
26. | Siyuan Ma, Yongqing Guo, Fulu Wei, Qingyin Li, Zhenyu Wang, An Improved Social Force Model of Pedestrian Twice–Crossing Based on Spatial–Temporal Trajectory Characteristics, 2022, 14, 2071-1050, 16615, 10.3390/su142416615 | |
27. | Marion Gödel, Nikolai Bode, Gerta Köster, Hans-Joachim Bungartz, Bayesian inference methods to calibrate crowd dynamics models for safety applications, 2022, 147, 09257535, 105586, 10.1016/j.ssci.2021.105586 | |
28. | Raphael Korbmacher, Antoine Tordeux, Review of Pedestrian Trajectory Prediction Methods: Comparing Deep Learning and Knowledge-Based Approaches, 2022, 23, 1524-9050, 24126, 10.1109/TITS.2022.3205676 | |
29. | Nicola Bellomo, Livio Gibelli, 2021, Chapter 1, 978-3-030-91645-9, 1, 10.1007/978-3-030-91646-6_1 | |
30. | 2021, 978-3-031-01300-3, 10.1007/978-3-031-02428-3 | |
31. | Bouchra Aylaj, Nicola Bellomo, Livio Gibelli, Damián Knopoff, 2021, Chapter 5, 978-3-031-01300-3, 71, 10.1007/978-3-031-02428-3_5 | |
32. | Simone Göttlich, Claudia Totzeck, Parameter calibration with stochastic gradient descent for interacting particle systems driven by neural networks, 2022, 34, 0932-4194, 185, 10.1007/s00498-021-00309-8 | |
33. | Alexandra Würth, Mickaël Binois, Paola Goatin, Simone Göttlich, Data-driven uncertainty quantification in macroscopic traffic flow models, 2022, 48, 1019-7168, 10.1007/s10444-022-09989-5 | |
34. | Bin Li, Muhammad Shahzad, Hafiz Mudassir Munir, Asif Nawaz, Nabeel Abdelhadi Mohamed Fahal, Muhammad Yousaf Ali Khan, Sheeraz Ahmed, Probabilistic Analysis To Analyze Uncertainty Incorporating Copula Theory, 2022, 17, 1975-0102, 61, 10.1007/s42835-021-00863-w | |
35. | Nicola Bellomo, Livio Gibelli, Annalisa Quaini, Alessandro Reali, Towards a mathematical theory of behavioral human crowds, 2022, 32, 0218-2025, 321, 10.1142/S0218202522500087 | |
36. | Bouchra Aylaj, Nicola Bellomo, Livio Gibelli, Damián Knopoff, 2021, Chapter 4, 978-3-031-01300-3, 51, 10.1007/978-3-031-02428-3_4 | |
37. | Diletta Burini, Nadia Chouhad, Nicola Bellomo, Waiting for a Mathematical Theory of Living Systems from a Critical Review to Research Perspectives, 2023, 15, 2073-8994, 351, 10.3390/sym15020351 | |
38. | Nicola Bellomo, Jie Liao, Annalisa Quaini, Lucia Russo, Constantinos Siettos, Human behavioral crowds review, critical analysis and research perspectives, 2023, 33, 0218-2025, 1611, 10.1142/S0218202523500379 | |
39. | Milad Haghani, Majid Sarvi, Crowd model calibration at strategic, tactical, and operational levels: Full-spectrum sensitivity analyses show bottleneck parameters are most critical, followed by exit-choice-changing parameters, 2023, 1942-7867, 1, 10.1080/19427867.2023.2195729 | |
40. | Fabio Parisi, Claudio Feliciani, Ruggiero Lovreglio, What do we head for while exiting a room? a novel parametric distance map for pedestrian dynamic simulations, 2023, 156, 0968090X, 104335, 10.1016/j.trc.2023.104335 | |
41. | Chen Cheng, Linjie Wen, Jinglai Li, Parameter estimation from aggregate observations: a Wasserstein distance-based sequential Monte Carlo sampler, 2023, 10, 2054-5703, 10.1098/rsos.230275 | |
42. | F. Al Reda, S. Faure, B. Maury, E. Pinsard, Faster is Slower effect for evacuation processes: a granular standpoint, 2024, 00219991, 112861, 10.1016/j.jcp.2024.112861 | |
43. | Nicola Bellomo, Livio Gibelli, 2023, Chapter 1, 978-3-031-46358-7, 1, 10.1007/978-3-031-46359-4_1 |