Object Detection and Regression Based Visible Spectrophotometric Analysis: A Demonstration Using Methylene Blue Solution

  • Ersin Aytaç
    Department of Environmental Engineering, Zonguldak Bülent Ecevit University, 67100, Zonguldak, TÜRKİYE ersin.aytac[at]beun.edu.tr


This study investigates the estimation of the concentration of methylene blue solutions to understand if visible spectrophotometry could be performed using a smartphone and machine learning. The presented procedure consists of taking photos, detecting test tubes and sampling region of interest (ROI) with YOLOv5, finding the hue, saturation, value (HSV) code of the dominant color in the ROI, and regression. 257 photos were taken for the procedure. The YOLOv5 object detection architecture was trained on 928 images and the highest mAP@05 values were detected as 0.915 in 300 epochs. For automatic ROI sampling, the YOLOv5 detect.py file was edited. The trained YOLOv5 detected 254 out of 257 test tubes and extracted ROIs. The HSV code of the dominant color in the exported ROI images was determined and stored in a csv file together with the concentration values. Subsequently, 25 different regression algorithms were applied to the generated data set. The extra trees regressor was the most generalizing model with 99.5% training and 99.4% validation R2 values. A hyperparameter tuning process was performed on the extra trees regressor and a mixed model was created using the best 3 regression algorithms to improve the R2 value. Finally, all three models were tested on unseen data and the lowest MSE value was found in the untuned extra trees regressor and blended model with values of 0.10564 and 0.16586, respectively. These results prove that visible spectrophotometric analysis can be performed using the presented procedure and that a mobile application can be developed for this purpose.
  • Referencias
  • Cómo citar
  • Del mismo autor
  • Métricas
Ali, M., 2020. PyCaret: An open source, low-code machine learning library in Python. https://www.pycaret.org

Arabzadeh, V., Sohrabi, M. R., Goudarzi, N., & Davallo, M. (2019). Using artificial neural network and multivariate calibration methods for simultaneous spectrophotometric analysis of Emtricitabine and Tenofovir alafenamide fumarate in pharmaceutical formulation of HIV drug. Spectrochimica Acta Part A: Molecular And Biomolecular Spectroscopy, 215, 266-275. https://doi.org/10.1016/j.saa.2019.02.077

Aragaw, T. A., & Angerasa, F. T. (2020). Synthesis and characterization of Ethiopian kaolin for the removal of basic yellow (BY 28) dye from aqueous solution as a potential adsorbent. Heliyon, 6(9), e04975. https://doi.org/10.1016/j.heliyon.2020.e04975

Ariaeenejad, S., Motamedi, E., & Salekdeh, G. H. (2021). Application of the immobilized enzyme on magnetic graphene oxide nano-carrier as a versatile bi-functional tool for efficient removal of dye from water. Bioresource Technology, 319, 124228. https://doi.org/10.1016/j.biortech.2020.124228

Arpaia P., Azzopardi, G., Blanc, F., Bregliozzi, G., Buffat, X., Coyle, L., Fol, E., Giordano, F., Giovannozzi, M., Pieloni, T., Prevete, R., Redaelli, S., Salvachua, B., Salvant, B., Schenk, M., Camillocci, M. S., Tomás, R., Valentino, G., Van Der Veken, F. F., & Wenninger, J. (2021). Machine learning for beam dynamics studies at the CERN Large Hadron Collider. Nuclear Instruments And Methods In Physics Research Section A: Accelerators, Spectrometers, Detectors And Associated Equipment, 985, 164652. https://doi.org/10.1016/j.nima.2020.164652

Ayman, A., Zeid, A. M., Wahba, M. E. K., & El-Shabrawy, Y. (2020). Analysis of clozapine in its tablets using two novel spectrophotometric reactions targeting its tertiary amino group. Spectrochimica Acta Part A: Molecular And Biomolecular Spectroscopy, 238, 118447. https://doi.org/10.1016/j.saa.2020.118447

Aytaç, E. (2020). Unsupervised learning approach in defining the similarity of catchments: Hydrological response unit based k-means clustering, a demonstration on Western Black Sea Region of Turkey. International Soil And Water Conservation Research, 8(3), 321-331. https://doi.org/10.1016/j.iswcr.2020.05.002

Aytaç, E. (2021a). Forecasting Turkey’s Hazelnut Export Quantities with Facebook’s Prophet Algorithm and Box-Cox Transformation. Advances In Distributed Computing And Artificial Intelligence Journal, 10(1), 33-47. https://doi.org/10.14201/adcaij20211013347

Aytaç, E. (2021b). Havzaların benzerliklerini tanımlamada alternatif bir yaklaşım: hiyerarşik kümeleme yöntemi uygulaması. Fen Ve Mühendislik Bilimleri Dergisi, 21(4), 958-970. https://doi.org/10.35414/akufemubid.870649

Aytaç, E. (2022a). Exploring Electrocoagulation Through Data Analysis and Text Mining Perspectives. Environmental Engineering And Management Journal, 21(4), 317-331.

Aytaç E. (2022b). Modeling Future Impacts on Land Cover of Rapid Expansion of Hazelnut Orchards: A Case Study on Samsun, Turkey. European Journal Of Sustainable Development Research, 6(4), em0193. https://doi.org/10.21601/ejosdr/12167

Aytaç, E., Fombona‐Pascual, A., Lado, J. J., García-Quismondo, E., Palma, J., & Khayet, M. (2023d). Faradaic deionization technology: Insights from bibliometric, data mining and machine learning approaches. Desalination, 563, 116715. https://doi.org/10.1016/j.desal.2023.116715

Aytaç, E., & Khayet, M., (2023a). Machine Learning Applications on Membrane Distillation. Fourteen International Conference on Thermal Engineering: Theory and Applications, May 25-27, Yalova, Türkiye.

Aytaç, E., & Khayet, M. (2023b). A deep dive into membrane distillation literature with data analysis, bibliometric methods, and machine learning. Desalination, 553, 116482. https://doi.org/10.1016/j.desal.2023.116482

Aytaç E., & Khayet, M. (2023c). A Topic Modeling Approach to Discover the Global and Local Subjects in Membrane Distillation Separation Process. Separations, 10(9), 482. https://doi.org/10.3390/separations10090482

Azimi, M., & Pacut, A. (2020). Investigation into the reliability of facial recognition systems under the simultaneous influences of mood variation and makeup. Computers & Electrical Engineering, 85, 106662. https://doi.org/10.1016/j.compeleceng.2020.106662

Bengfort, B., Bilbro, R., McIntyre, K., Gray, L., Roman, P., Morris, A., & Danielsen, N. (2018). Yellowbrick.

Bora, D. J., Gupta, A. K., & Khan, F. A. (2015). Comparing the Performance of L*A*B* and HSV Color Spaces with Respect to Color Image Segmentation. Paper presented at the International Journal of Emerging Technology and Advanced Engineering.

Bunnag, N., Kasri, B., Setwong, W., Sirisurawong, E., Chotsawat, M., Chirawatkul, P., & Saiyasombat, C. (2020). Study of Fe ions in aquamarine and the effect of dichroism as seen using UV–Vis, NIR and x-ray. Radiation Physics And Chemistry, 177, 109107. https://doi.org/10.1016/j.radphyschem.2020.109107

Cardani, D. (2001). Adventures in HSV Space. http://robotlab.itk.ppke.hu/~rakadam/hsvspace.pdf

Chen, S. J., Karabucak, B., Steffen, J. J., Yu, Y., & Kohli, M. R. (2020). Spectrophotometric Analysis of Coronal Tooth Discoloration Induced by Tricalcium Silicate Cements in the Presence of Blood. Journal Of Endodontics, 46(12), 1913-1919. https://doi.org/10.1016/j.joen.2020.09.009

Chen, Y., & Miao, D. (2020). Granular regression with a gradient descent method. Information Sciences, 537, 246-260. https://doi.org/10.1016/j.ins.2020.05.101

Cheng, H., Li, H., Dia, Q., and Yang, J., 2023. A deep reinforcement learning method to control chaos synchronization between two identical chaotic systems. Chaos, Solitons & Fractals, 174: 113809. doi: https://doi.org/10.1016/j.chaos.2023.113809

Chung, S., Park, Y. W., & Cheong, T. (2020). A mathematical programming approach for integrated multiple linear regression subset selection and validation. Pattern Recognition, 108, 107565. https://doi.org/10.1016/j.patcog.2020.107565

Claudino, D., Ricci, W. A., Honório, H., Machry, R. V., Valandro, L. F., Da Rosa, R. A., & Pereira, J. R. (2021). Spectrophotometric analysis of dental bleaching after bonding and debonding of orthodontic brackets. The Saudi Dental Journal, 33(7), 650-655. https://doi.org/10.1016/j.sdentj.2020.05.003

Danchana, K., De Souza, C. T., Palacio, E., & Cerdà, V. (2019). Multisyringe flow injection analysis for the spectrophotometric determination of uranium (VI) with 2-(5-bromo-2-pyridylazo)-5-diethylaminophenol. Microchemical Journal, 150, 104148. https://doi.org/10.1016/j.microc.2019.104148

De Carvalho, F. d. A. T., Lima Neto, E. d. A., & Da Silva, K. C. F. (2021). A clusterwise nonlinear regression algorithm for interval-valued data. Information Sciences, 555, 357-385. https://doi.org/10.1016/j.ins.2020.10.054

Dogan, A., & Birant, D. (2021). Machine learning and data mining in manufacturing. Expert Systems With Applications, 166, 114060. https://doi.org/10.1016/j.eswa.2020.114060

Dumancas, G. G., Bello, G., Sevilleno, S., Subong, B. J. J., Koralege, R. H., Nuwan Perera, U. D & Goudelock, A. (2017). Spectrophotometric Analysis of Food Colorants. In Reference Module in Food Science: Elsevier. https://doi.org/10.1016/B978-0-08-100596-5.21457-1

Duysak, H., & Yigit, E. (2020). Machine learning based quantity measurement method for grain silos. Measurement, 152, 107279. https://doi.org/10.1016/j.measurement.2019.107279

Ebraheem, S. A. M., Elbashir, A. A., & Aboul‐Enein, H. Y. (2011). Spectrophotometric methods for the determination of gemifloxacin in pharmaceutical formulations. Acta Pharmaceutica Sinica B, 1(4), 248-253. https://doi.org/10.1016/j.apsb.2011.10.005

Eyring, M. B. (2003). Spectroscopy in Forensic Science. In R. A. Meyers (Ed.), Encyclopedia of Physical Science and Technology (Third Edition) (pp. 637-643). New York: Academic Press. https://doi.org/10.1016/B0-12-227410-5/00957-1

Frank, E., & Harrell, J. (2015). Regression Modeling Strategies. Switzerland: Springer, Cham. https://doi.org/10.1007/978-3-319-19425-7

García-González, A., Zavala-Arce, R. E., Ávila-Pérez, P., Jiménez‐Núñez, M. L., García-Gaitán, B., & García-Rivas, J. L. (2020). Development of standardized method for the quantification of azo dyes by UV-Vis in binary mixtures. Analytical Biochemistry, 608, 113897. https://doi.org/10.1016/j.ab.2020.113897

García-Lamont, F., Cervantes, J., López, A., & Rodríguez, L. (2018). Segmentation of images by color features: A survey. Neurocomputing, 292, 1-27. https://doi.org/10.1016/j.neucom.2018.01.091

Guha, A., Lei, R., Zhu, J., Nguyen, X., & Zhao, D. (2022). Robust unsupervised learning of temporal dynamic vehicle-to-vehicle interactions. Transportation Research Part C: Emerging Technologies, 142, 103768. https://doi.org/10.1016/j.trc.2022.103768

Hao, Z., Jin, L., Lyu, R., & Akram, H. R. (2020). Problematic mobile phone use and altruism in Chinese undergraduate students: The mediation effects of alexithymia and empathy. Children And Youth Services Review, 118, 105402. https://doi.org/10.1016/j.childyouth.2020.105402

Huong, D. T. M., Chai, W. S., Show, P. L., Lin, Y., Chiu, C., Tsai, S., & Chang, Y. (2020). Removal of cationic dye waste by nanofiber membrane immobilized with waste proteins. International Journal Of Biological Macromolecules, 164, 3873-3884. https://doi.org/10.1016/j.ijbiomac.2020.09.020

Jocher, G., Stoken, A., Borovec, J., NanoCode012, ChristopherSTAN, Changyu, L., & Yu, L. (2021). ultralytics/yolov5: v4.0 - nn.SiLU() activations, Weights \and Biases logging, PyTorch Hub integration (Version v4.0): Zenodo. https://doi.org/10.5281/zenodo.4418161

Jung, A. B. (2018). imgaug. https://github.com/aleju/imgaug

Kandi, S., & Charles, A. L. (2019). Statistical comparative study between the conventional DPPH spectrophotometric and dropping DPPH analytical method without spectrophotometer: Evaluation for the advancement of antioxidant activity analysis. Food Chemistry, 287, 338-345. https://doi.org/10.1016/j.foodchem.2019.02.110

Khayet, M., Aytaç, E., & Matsuura, T. (2022). Bibliometric and sentiment analysis with machine learning on the scientific contribution of Professor Srinivasa Sourirajan. Desalination, 543, 116095. https://doi.org/10.1016/j.desal.2022.116095

Kukielski, M., Kędzierska-Sar, A., Kuś, S., Wiecińska, P., & Szafran, M. (2019). Application of highly sensitive spectrophotometric analysis in detection of metal content in molybdenum reinforced alumina obtained by precursor infiltration of ceramic preforms. Ceramics International, 45(17), 22047-22054. https://doi.org/10.1016/j.ceramint.2019.07.221

Lian, W., Chao, H., Shuping, Z., Jinkai, L., Jianchuan, Z., Zhongwei, C., Zhen, Y., Yong, X., & Min, Z. (2023). Robust fall detection in video surveillance based on weakly supervised learning. Neural Networks, 163, 286-297. https://doi.org/10.1016/j.neunet.2023.03.042

Liu, G., Han, J., & Rong, W. (2021). Feedback-driven loss function for small object detection. Image And Vision Computing, 111, 104197. https://doi.org/10.1016/j.imavis.2021.104197

Liu, Y., Mazumdar, S., & Bath, P. A. (2023). An unsupervised learning approach to diagnosing Alzheimer’s disease using brain magnetic resonance imaging scans. International Journal Of Medical Informatics, 173, 105027. https://doi.org/10.1016/j.ijmedinf.2023.105027

Marczenko, Z., & Balcerzak, M. (2000). Separation, Preconcentration and Spectrophotometry in Inorganic Analysis. In E. Kloczko (Ed.), Analytical Spectroscopy Library (1st ed., Vol. 10, pp. 39-52): Elsevier Science.

Masawat, P., Harfield, A., & Namwong, A. (2015). An iPhone-based digital image colorimeter for detecting tetracycline in milk. Food Chemistry, 184, 23-29. https://doi.org/10.1016/j.foodchem.2015.03.089

Meek, C., Thiesson, B., & Heckerman, D. (2002). The Learning-Curve Sampling Method Applied to Model-Based Clustering. Journal of Machine Learning Research, 2, 397-418.

Mijinyawa, A. H., Mishra, A., & Durga, G. (2020). Cationic dye removal using a newer material fabricated by Taro Mucilage-g-PLA and Organobentonite clay. Materials Today: Proceedings. https://doi.org/10.1016/j.matpr.2019.12.345

Milojevic-Dupont, N., & Creutzig, F. (2021). Machine learning for geographically differentiated climate change mitigation in urban areas. Sustainable Cities And Society, 64, 102526. https://doi.org/10.1016/j.scs.2020.102526

Mokhtari, N., Afshari, M., & Dinari, M. (2020). Synthesis and characterization of a novel fluorene-based covalent triazine framework as a chemical adsorbent for highly efficient dye removal. Polymer, 195, 122430. https://doi.org/10.1016/j.polymer.2020.122430

Nguyen, T., Roy, A., & Memon, N. (2019). Kid on the phone! Toward automatic detection of children on mobile devices. Computers & Security, 84, 334-348. https://doi.org/10.1016/j.cose.2019.04.001

Osarogiagbon, A. U., Khan, F., Venkatesan, R., & Gillard, P. (2021). Review and analysis of supervised machine learning algorithms for hazardous events in drilling operations. Process Safety And Environmental Protection, 147, 367-384. https://doi.org/10.1016/j.psep.2020.09.038

Pal, P., Corpuz, A. G., Hasan, S. W., Sillanpää, M., & Banat, F. (2021). Simultaneous removal of single and mixed cationic/anionic dyes from aqueous solutions using flotation by colloidal gas aphrons. Separation and Purification Technology, 255: 117684. https://doi.org/10.1016/j.seppur.2020.117684

Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., & Duchesnay, E. (2011). Scikit-learn: Machine Learning in {P}ython. Journal of Machine Learning Research, 12(85): 2825-2830.

Pereda, M., & Estrada, E. (2019). Visualization and machine learning analysis of complex networks in hyperspherical space. Pattern Recognition, 86, 320-331. https://doi.org/10.1016/j.patcog.2018.09.018

Perroni, A. P., Bergoli, C. D., dos Santos, M. B. F., Moraes, R. R., & Boscato, N. (2017). Spectrophotometric analysis of clinical factors related to the color of ceramic restorations: A pilot study. The Journal Of Prosthetic Dentistry, 118(5): 611-616. https://doi.org/10.1016/j.prosdent.2016.12.010

Pradhan, S. S., Konwar, K., Ghosh, T. N., Mondal, B., Sarkar, S. K., & Deb, P. (2020). Multifunctional Iron oxide embedded reduced graphene oxide as a versatile adsorbent candidate for effectual arsenic and dye removal. Colloid And Interface Science Communications, 39, 100319. https://doi.org/10.1016/j.colcom.2020.100319

Priya, Sharma, A. K., Kaith, B. S., Chandel, K., Vipula, Isha, & Singh, A. (2020). Bifunctional gelatin/dextrin hybrid backbone based fluorescent chemo-sensor for the detection of tannic acid and removal of eosin yellow dye. Materials Chemistry And Physics, 254, 123304. https://doi.org/10.1016/j.matchemphys.2020.123304

Ragab, M. A. A., El Yazbi, F. A., Hassan, E. M., Khamis, E. F., & Hamdy, M. M. A. (2018). Spectrophotometric analysis of two eye preparations, vial and drops, containing ketorolac tromethamine and phenylephrine hydrochloride binary mixture and their ternary mixture with chlorphenirmaine maleate. Bulletin Of Faculty Of Pharmacy, Cairo University, 56(1), 91-100. https://doi.org/10.1016/j.bfopcu.2018.03.004

Shuang, K., Lyu, Z., Loo, J., & Zhang, W. (2021). Scale-balanced loss for object detection. Pattern Recognition, 117, 107997. https://doi.org/10.1016/j.patcog.2021.107997

Sliney, D. H. (2016). What is light? The visible spectrum and beyond. Eye, 30(2), 222-229. https://doi.org/10.1038/eye.2015.252

Solovyev, R., Wang, W., & Gabruseva, T. (2021). Weighted boxes fusion: Ensembling boxes from different object detection models. Image And Vision Computing, 107, 104117. https://doi.org/10.1016/j.imavis.2021.104117

Soni, S., Bajpai, P. K., Mittal, J., & Arora, C. (2020). Utilisation of cobalt doped Iron based MOF for enhanced removal and recovery of methylene blue dye from waste water. Journal Of Molecular Liquids, 314, 113642. https://doi.org/10.1016/j.molliq.2020.113642

Sumriddetchkajorn, S., Chaitavon, K., & Intaravanne, Y. (2013). Mobile device-based self-referencing colorimeter for monitoring chlorine concentration in water. Sensors And Actuators B: Chemical, 182, 592-597. https://doi.org/10.1016/j.snb.2013.03.080

Sun, G., Wen, Y., & Yu, L. (2022). Instance segmentation using semi-supervised learning for fire recognition. Heliyon, 8(12), e12375. https://doi.org/10.1016/j.heliyon.2022.e12375

Sural, S., Gang, Q., & Pramanik, S. (2002). Segmentation and histogram generation using the HSV color space for image retrieval. Paper presented at the Proceedings. International Conference on Image Processing.

Turchioe, M. R., Jimenez, V., Isaac, S., Alshalabi, M., Slotwiner, D., & Creber, R. M. (2020). Review of mobile applications for the detection and management of atrial fibrillation. Heart Rhythm O2, 1(1), 35-43. https://doi.org/10.1016/j.hroo.2020.02.005

Vishwakarma, R., & Vennelakanti, R. (2020). CNN Model and Tuning for Global Road Damage Detection. Paper presented at the 2020 IEEE International Conference on Big Data (Big Data), Los Alamitos, CA, USA. https://doi.org/10.1109/BigData50022.2020.9377902

Wang, R.-F., Deng, L.-G., Li, K., Fan, X.-J., Li, W., & Lu, H.-Q. (2020). Fabrication and characterization of sugarcane bagasse–calcium carbonate composite for the efficient removal of crystal violet dye from wastewater. Ceramics International, 46(17), 27484-27492. https://doi.org/10.1016/j.ceramint.2020.07.237

Yap, M. H., Hachiuma, R., Alavi, A., Brungel, R., Goyal, M., Zhu, H., & Frank, E. (2020). Deep Learning in Diabetic Foot Ulcers Detection: A Comprehensive Evaluation. ArXiv, abs/2010.03341.

Yuan, W., & Rui, X. (2023). Deep reinforcement learning-based controller for dynamic positioning of an unmanned surface vehicle. Computers & Electrical Engineering, 110, 108858. https://doi.org/10.1016/j.compeleceng.2023.108858

Zayed, M. A., Imam, N. G., Ahmed, M. A., & El Sherbiny, D. H. (2017). Spectrophotometric analysis of hematite/magnetite nanocomposites in comparison with EDX and XRF techniques. Journal Of Molecular Liquids, 231, 288-295. https://doi.org/10.1016/j.molliq.2017.02.007

Ziaei, F., & Ranjbar, M. 2023. A reinforcement learning algorithm for scheduling parallel processors with identical speedup functions. Machine Learning with Applications, 155, 100485. https://doi.org/10.1016/j.mlwa.2023.100485

Zualkernan, I., Aloul, F., Shapsough, S., Hesham, A., & El-Khorzaty, Y. (2017). Emotion recognition using mobile phones. Computers & Electrical Engineering, 60, 1-13. https://doi.org/10.1016/j.compeleceng.2017.05.004
Aytaç, E. (2023). Object Detection and Regression Based Visible Spectrophotometric Analysis: A Demonstration Using Methylene Blue Solution. ADCAIJ: Advances in Distributed Computing and Artificial Intelligence Journal, 12(1), e29120. https://doi.org/10.14201/adcaij.29120


Download data is not yet available.