{"id":2095,"date":"2026-04-02T18:37:10","date_gmt":"2026-04-02T10:37:10","guid":{"rendered":"https:\/\/iweb20wp-b205b.url.tku.edu.tw\/jase\/?post_type=tkuisotope&#038;p=2095"},"modified":"2026-05-11T22:19:50","modified_gmt":"2026-05-11T14:19:50","slug":"pill-counting-method-for-strip-plate-slots-based-on-yolov12","status":"publish","type":"tkuisotope","link":"\/jase\/?tkuisotope=pill-counting-method-for-strip-plate-slots-based-on-yolov12","title":{"rendered":"Pill Counting Method for Strip Plate Slots Based on YOLOv12"},"content":{"rendered":"\n<div class=\"wp-block-tkuwpbs5-bs5-row row article-info\">\n<div class=\"wp-block-tkuwpbs5-bs5-column col-md-3 align-self-start\">\n<p><i class=\"fa fa-folder\" aria-hidden=\"true\"><\/i>&nbsp;<a href=\"\/jase\/?page_id=807\" data-type=\"page\" data-id=\"807\">2026<\/a><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-tkuwpbs5-bs5-column col-md-3 align-self-start\">\n<p><i class=\"fa fa-folder-open\" aria-hidden=\"true\"><\/i>&nbsp;<a href=\"\/jase\/?page_id=2035\" data-type=\"page\" data-id=\"1055\">Volume 29, Issue 6<\/a><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-tkuwpbs5-bs5-column col-md-6 align-self-start\">\n<div class=\"wp-block-tkuwpbs5-bs5-div dv_publish\" data-aos=\"normal\"><div class=\"wp-block-post-date\"><time datetime=\"2026-04-02T18:37:10+08:00\">2026-04-02<\/time><\/div><\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-tkuwpbs5-bs5-row row\">\n<div class=\"wp-block-tkuwpbs5-bs5-column col-md-5 align-self-start\">\n<div class=\"wp-block-tkuwpbs5-bs5-div au-ol\" data-aos=\"normal\">\n<p>Qingwu Shi, Maotong Qin, Xu Du<a href=\"mailto:13351649107@163.com\"><i class=\"fa fa-envelope\"><\/i><\/a>, and Huaqi Zhaoa<a href=\"mailto:zhaohuaqi@126.com\"><i class=\"fa fa-envelope\"><\/i><\/a><\/p>\n\n\n\n<p style=\"font-size:14px\">School of Information and Electronic Engineering, Jiamusi University, Jiamusi 154007, China<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-tkuwpbs5-bs5-div\" style=\"margin-top:var(--wp--preset--spacing--40)\" data-aos=\"normal\">\n<p>Received:&nbsp;August 14, 2025<br>Accepted:&nbsp;September 30, 2025<br>Publication Date:&nbsp;April 2, 2026<\/p>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-tkuwpbs5-bs5-column col-md-7 align-self-start clk=\u5716\u7247\"><img decoding=\"async\" src=\"\/jase\/wp-content\/uploads\/2026\/04\/29_06_10.jpg\" class=\"img-fluid img-fluid mx-auto d-block\" alt=\"\u4e0a\u50b3\u5716\u7247\">\n\n\n<p class=\"has-text-align-center img_caption\">Variation of Model Evaluation Metrics<\/p>\n<\/div>\n<\/div>\n\n\n\n<p class=\"has-small-font-size\"><i class=\"fab fa-creative-commons\"><\/i>&nbsp;<strong>Copyright&nbsp;<\/strong>The Author(s). This is an open access article distributed under the terms of the&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/creativecommons.org\/licenses\/by\/4.0\/\" target=\"_blank\">Creative Commons Attribution&nbsp;License (CC BY 4.0)<\/a>, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are cited.<\/p>\n\n\n\n<p>Download Citation:\u00a0 <a href=\"\/jase\/wp-content\/uploads\/2026\/05\/V296.0010.bib\" data-type=\"attachment\" data-id=\"6699\" target=\"_blank\" rel=\"noreferrer noopener\">BibTeX <\/a>| <a rel=\"noreferrer noopener\" href=\"https:\/\/doi.org\/10.6180\/jase.202606_29(6).0010\" target=\"_blank\">https:\/\/doi.org\/10.6180\/jase.202606_29(6).0010<\/a>\u00a0\u00a0<\/p>\n\n\n\n<p class=\"btn btn-primary article-btn\"><a href=\"\/jase\/wp-content\/uploads\/2026\/04\/10_2025_1089_V29i6.pdf\" data-type=\"attachment\" data-id=\"2062\" target=\"_blank\" rel=\"noreferrer noopener\">Download PDF<\/a><\/p>\n\n\n\n<div style=\"height:24px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>In the modern pharmaceutical industry, automated pill counting is a critical step in the production process. However, traditional methods often fail to meet the demands of high-speed and real-time detection in terms of accuracy and efficiency. This paper, motivated by the application of strip-type pill counting machines in pharmaceutical manufacturing, proposes a pill counting and missing pill detection method within elongated strip plate holes using the YOLOv12 model. The method is capable of identifying three pill states-missing pill, single pill, and two pills vertically overlapped within a single slot-and then determines the pill quantity based on the corresponding identified states. In this study, a custom dataset was constructed, and the collected images were manually annotated. The CBAM (Convolutional Block Attention Module) attention mechanism was integrated into the YOLOv12 model to enhance its focus on small pill targets and critical regions. Additionally, negative samples were incorporated into the dataset to improve the model\u2019s ability to distinguish between background and missing pill states. With a parameter size of 2.6 M and a computational complexity of<br>6.4 GFLOPs, the model maintains low computational cost and lightweight characteristics while achieving high-precision detection of pill quantities and missing pill states<\/p>\n\n\n\n<p><em>Keywords:&nbsp;YOLOv12;Strip-type pill counting; CBAM; Object detection; Small object detection<\/em><\/p>\n\n\n\n<div style=\"height:2rem\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-tkuwpbs5-bs5-div ref_ol\" data-aos=\"normal\">\n<div class=\"container\">\n<div id=\"model-response-message-contentr_5c778fd0db7dad80\" class=\"markdown markdown-main-panel stronger enable-updated-hr-color\" dir=\"ltr\" aria-live=\"polite\" aria-busy=\"false\">\n<ol>\n<li data-path-to-node=\"1\">[1] X. Yao, (2021) \u201cCurrent Situation and Development Prospects of Traditional Chinese Medicine Industry\u201d Chinese Traditional and Herbal Drugs 52(17): 5115\u20135119. DOI: CNKI:SUN:ZCYO.0.2021-17-001.<\/li>\n<li data-path-to-node=\"1\">[2] Z. Fan, (2022) \u201cDesign of an Automatic Pill Counting System Based on a Single-Chip Microcomputer\u201d Plant Maintenance Engineering (09): 113\u2013114. DOI: 10.16621\/j.cnki.issn1001-0599.2022.05.49.<\/li>\n<li data-path-to-node=\"1\">[3] Y. Ruidong. \u201cResearch on High-Precision Pill Counting Machine Control System Based on ARM\u201d. (mathesis). Shandong University, 2015.<\/li>\n<li data-path-to-node=\"1\">[4] J. Yang, C. Dou, L. Xin, W. Liu, and X. Zhou, (2018) \u201cResearch on tablet granule counting algorithm based on visual matching technology\u201d Packaging Engineering 39(19): 175\u2013180. DOI: 10.19554\/j.cnki.1001-3563.2018.19.031.<\/li>\n<li data-path-to-node=\"1\">[5] G. Liu. \u201cDesign of Counting Machine Control System Based on DSP and PLC\u201d. (mathesis). Nanchang Hangkong University, 2013.<\/li>\n<li data-path-to-node=\"1\">[6] Z. Wang, J. Chen, and R. Ai, (2017) \u201cDevelopment Trend and Application Prospect of Photoelectric Detection Technology\u201d Sichuan Cement (03): 152. DOI: CNKI:SUN:SCSA.0.2017-03-149.<\/li>\n<li data-path-to-node=\"1\">[7] Q. Sun and J. Cai, (2020) \u201cDetection System of Flat Plate Counting Machine Based on FPGA\u201d Light Industry Machinery 38(03): 69\u201373. DOI: CNKI:SUN:QGJX.0.2020-03-014.<\/li>\n<li data-path-to-node=\"1\">[8] C. Phromlikhit, F. Cheevasuvit, and S. Yimman. \u201cTablet counting machine base on image processing\u201d. In: The 5th 2012 Biomedical Engineering International Conference. 2012, 1\u20135. DOI: 10.1109\/BMEiCon.2012.6465508.<\/li>\n<li data-path-to-node=\"1\">[9] J. Moon, S. Lim, H. Lee, S. Yu, and K.-B. Lee, (2022) \u201cSmart Count System Based on Object Detection Using Deep Learning\u201d Remote Sensing 14(15): 3761. DOI: 10.3390\/rs14153761.<\/li>\n<li data-path-to-node=\"1\">[10] A. D. Nguyen, H. H. Pham, H. T. Trung, Q. V. H. Nguyen, T. N. Truong, and P. L. Nguyen, (2023) \u201cHigh accurate and explainable multi-pill detection framework with graph neural network-assisted multimodal data fusion\u201d Plos One 18(9): e0291865. DOI: 10.48550\/arXiv.2303.09782.<\/li>\n<li data-path-to-node=\"1\">[11] Y. Yao, J. Cai, and Q. Liu, (2018) \u201cDetection method of flat plate counting machine based on machine vision\u201d Optical Instruments 40(04): 9\u201314. DOI: CNKI:SUN:GXYQ.0.2018-04-002.<\/li>\n<li data-path-to-node=\"1\">[12] M. Hao, K. Sun, T. Liu, and G. Wang, (2023) \u201cDesign of high-speed online pill counting and packaging system based on machine vision\u201d Techniques of Automation and Applications 42(06): 38\u201340. DOI: 10.20033\/j.1003-7241.(2023)06-0038-03.<\/li>\n<li data-path-to-node=\"1\">[13] J. Zhang and W. Zhu, (2018) \u201cCounting of circular overlapping particles based on depth image processing technology\u201d Information Technology (06): 71\u201375+80. DOI: 10.13274\/j.cnki.hdzj.2018.06.015.<\/li>\n<li data-path-to-node=\"1\">[14] A. Hu and Z. Li, (2018) \u201cCounting machine system based on improved Faster R-CNN\u201d Packaging Engineering 39(09): 141\u2013145. DOI: 10.19554\/j.cnki.1001-3563.2018.09.025.<\/li>\n<li data-path-to-node=\"1\">[15] H.-J. Kwon, H.-G. Kim, and S.-H. Lee, (2022) \u201cPill Detection Model for Medicine Inspection Based on Deep Learning\u201d Chemosensors 10(1): DOI: 10.3390\/chemosensors10010004.<\/li>\n<li data-path-to-node=\"1\">[16] R. Girshick, J. Donahue, T. Darrell, and J. Malik. \u201cRich Feature Hierarchies for Accurate Object Detection and Semantic Segmentation\u201d. In: 2014 IEEE Conference on Computer Vision and Pattern Recognition. 2014, 580\u2013587. DOI: 10.1109\/CVPR.2014.81.<\/li>\n<li data-path-to-node=\"1\">[17] J. Redmon, S. Divvala, R. Girshick, and A. Farhadi. \u201cYou Only Look Once: Unified, Real-Time Object Detection\u201d. In: 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR). 2016, 779\u2013788. DOI: 10.1109\/CVPR.2016.91.<\/li>\n<li data-path-to-node=\"1\">[18] J. Ma, Y. Zhou, Z. Zhou, Y. Zhang, and L. He, (2025) \u201cToward smart ocean monitoring: Real-time detection of marine litter using YOLOv12 in support of pollution mitigation\u201d Marine Pollution Bulletin 217: 118136. DOI: <a class=\"ng-star-inserted\" href=\"https:\/\/doi.org\/10.1016\/j.marpolbul.2025.118136\" target=\"_blank\" rel=\"noopener\">https:\/\/doi.org\/10.1016\/j.marpolbul.2025.118136<\/a>.<\/li>\n<li data-path-to-node=\"1\">[19] J. Bu. \u201cResearch on PCB surface defect detection method based on improved YOLOX\u201d. (mathesis). Liaoning University of Science and Technology, 2023. DOI: 10.26923\/d.cnki.gasgc.2023.000088.<\/li>\n<li data-path-to-node=\"1\">[20] R. Khanam and M. Hussain, (2025) \u201cA Review of YOLOv12: Attention-Based Enhancements vs. Previous Versions\u201d arXiv arXiv:2504.11995: DOI: <a class=\"ng-star-inserted\" href=\"https:\/\/doi.org\/10.48550\/arXiv.2504.11995\" target=\"_blank\" rel=\"noopener\">https:\/\/doi.org\/10.48550\/arXiv.2504.11995<\/a>.<\/li>\n<li data-path-to-node=\"1\">[21] H. W. Ting, S. L. Chung, C. F. Chen, et al., (2020) \u201cA Drug Identification Model Developed Using Deep Learning Technologies: Experience of a Medical Center in Taiwan\u201d BMC Health Services Research 20: 312. DOI: 10.1186\/s12913-020-05166-w.<\/li>\n<li data-path-to-node=\"1\">[22] J. Chen and X. Wang, (2024) \u201cDense small object detection algorithm for UAV aerial images based on improved YOLOv5\u201d Computer Engineering and Applications 60(03): 100\u2013108.<\/li>\n<li data-path-to-node=\"1\">[23] R. Sapkota, M. Flores-Calero, R. Qureshi, et al., (2025) \u201cYOLO advances to its genesis: a decadal and comprehensive review of the You Only Look Once (YOLO) series\u201d Artificial Intelligence Review 58: 274. DOI: 10.1007\/s10462-025-11253-3.<\/li>\n<li data-path-to-node=\"1\">[24] S. Yin, L. Wang, M. Shafiq, L. Teng, A. A. Laghari, and M. F. Khan, (2023) \u201cG2Grad-CAMRL: An Object Detection and Interpretation Model Based on Gradient-Weighted Class Activation Mapping and Reinforcement Learning in Remote Sensing Images\u201d IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing 16: 3583\u20133598. DOI: 10.1109\/JSTARS.2023.3241405.<\/li>\n<li data-path-to-node=\"1\">[25] S. Woo, J. Park, J.-Y. Lee, and I. S. Kweon. \u201cCBAM: Convolutional Block Attention Module\u201d. In: Computer Vision \u2013 ECCV 2018: 15th European Conference, Munich, Germany, September 8\u201314, 2018, Proceedings, Part VII. 2018, 3\u201319. DOI: 10.1007\/978-3-030-01234-2_1.<\/li>\n<li data-path-to-node=\"1\">[26] Q. Shi, S. Yin, K. Wang, et al., (2022) \u201cMultichannel convolutional neural network-based fuzzy active contour model for medical image segmentation\u201d Evolving Systems 13: 535\u2013549. DOI: 10.1007\/s12530-021-09392-3.<\/li>\n<li data-path-to-node=\"1\">[27] C. Zhang. \u201cResearch on rotated object detection method based on convolutional neural networks\u201d. (mathesis). University of Electronic Science and Technology of China, 2023. DOI: 10.27005 \/ d.cnki.gdzku.2023.002432.<\/li>\n<li data-path-to-node=\"1\">[28] Y. Pan. \u201cResearch on FPGA acceleration technology of feature extraction in visual inspection\u201d. (phdthesis). Hefei University of Technology, 2021. DOI: 10.27101\/d.cnki.ghfgu.2021.000005.<\/li>\n<li data-path-to-node=\"1\">[29] X. Liang. \u201cResearch on pill coating defect detection technology based on machine vision\u201d. (mathesis). Chongqing University of Science and Technology, 2023. DOI: 10.27854\/d.cnki.gcqkj.2023.000357.<\/li>\n<li data-path-to-node=\"1\">[30] Z. Wu. \u201cResearch and application of online pill defect detection system based on machine vision\u201d. (mathesis). Tianjin Polytechnic University, 2023. DOI: 10.27357\/d.cnki.gtgyu.2023.001211.<\/li>\n<li data-path-to-node=\"1\">[31] L. Liang. \u201cResearch on particle counting and defect detection system based on visual tracking\u201d. (mathesis). South China University of Technology, 2014.<\/li>\n<li data-path-to-node=\"1\">[32] W. Zhou, B. Sun, L. Shi, and S. Yang, (2025) \u201cResearch on potato leaf disease detection method based on YOLO model\u201d Automation Instrumentation 40(05): 71\u201375. DOI: 10.19557\/j.cnki.1001-9944.2025.05.014.<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n<p><\/p>\n","protected":false},"author":3,"template":"wp-custom-template-detail-4-aricles","meta":{"_uag_custom_page_level_css":""},"categories":[12,15,6,121],"tags":[248],"acf":[],"uagb_featured_image_src":[],"uagb_author_info":{"display_name":"\u6797\u923a\u6db5","author_link":"\/jase\/?author=3"},"uagb_comment_info":0,"uagb_excerpt":"&nbsp;Copyright&nbsp;The Author(s). This is an open access article distributed under the terms of the&nbsp;Creative Commons Attribution&nbsp;License (CC BY 4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are cited. Download Citation:\u00a0 BibTeX | https:\/\/doi.org\/10.6180\/jase.202606_29(6).0010\u00a0\u00a0 Download PDF In the modern pharmaceutical industry, automated pill counting is a critical&hellip;","_links":{"self":[{"href":"\/jase\/index.php?rest_route=\/wp\/v2\/tkuisotope\/2095"}],"collection":[{"href":"\/jase\/index.php?rest_route=\/wp\/v2\/tkuisotope"}],"about":[{"href":"\/jase\/index.php?rest_route=\/wp\/v2\/types\/tkuisotope"}],"author":[{"embeddable":true,"href":"\/jase\/index.php?rest_route=\/wp\/v2\/users\/3"}],"wp:attachment":[{"href":"\/jase\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2095"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/jase\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2095"},{"taxonomy":"post_tag","embeddable":true,"href":"\/jase\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}