An Efficient Scheme For Automatic Pill Recognition Using Neural Networks
An Efficient Scheme For Automatic Pill Recognition Using Neural Networks
An Efficient Scheme For Automatic Pill Recognition Using Neural Networks
net/publication/334130284
CITATIONS READS
0 1,526
4 authors:
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Furqan Shaukat on 01 July 2019.
42
R. Chughtai et al. / The Nucleus 56, No. 1 (2019) 42-48
machine learning algorithm to train their database for 2116 real drug pill images. Belongie et al. [21] introduced the
detection. Their proposed system shows a precision and recall weighted shape context technique, in which, the similarity
rate of 0.95 and 0.97, respectively. Wong et al. [11] used Deep between two shapes is measured and used for object
Convolutional Network (DCN) for automatic pill recognition.
identification and verification. After the application of
In this paper, an efficient scheme for automatic pill
Geometric transformation, Saliency-driven pill detection is
recognition system using Neural Networks (NN) is proposed.
performed, followed by Deep model training to develop DCN.
In our method, an imprint of the pill is detected by first
They used a database of 400 commonly used tablets and
applying the Modified Stroke Width Transform (MSWT) [22]
capsules. The reported mean accuracy rate of DCN at Top-1
which is a combination of switch function, accumulated
return was 95.35%. Hart [12] proposed object segmentation
gradient and Stroke Width Transform (SWT). Then, Two-step
based mobile computer vision system. Estimators can deliver
Sampling Descriptor Set (TSDS) is utilized to refine the
the parameters (color, shape and size of the pill) of the
imprint section. Thresholding technique is applied for
unknown input pill image, which are used in recognizing the
extracting information related to the shape and size of the pill.
input image by matching these parameters with the database.
Color information is extracted by using a pill mask image and
Nguyen and Huynh [13] worked on tablet imprint recognition.
averaging three color channels of the image. At the end, a
They used polar transform technique and NN to train their
neural network is used for shape and imprint recognition.
system for specific imprint and then recognized the tablet
using a trained network. Hu [14] employed edge localization 2. Proposed Methodology
method and the invariant moment technique for imprint The proposed method consists of a series of steps which
extraction. Chen and Kamata [15] technique is based on start with the analysis of pill image dataset (available on the
finding the measurement of similarity between two shapes. US National library of medicine website [3]). Along with the
The correspondence between two different shape points is pill images, the information about the disease for which the
found and then an aligning transform is evaluated using the pill is prescribed is also available. Information of four pill
correspondence. The technique shows promising results on features, i.e., size, shape, color and imprint, is extracted
different variety of images including handwritten digits, through our devised technique by exploiting the prior
trademarks, silhouettes and the coil data, etc. knowledge about the format of the available pill images in the
Caban et al. [16] introduced a classification technique dataset. A database of acquired features of each pill is created
which automatically identifies the prescription of the tablet in the MATLAB. After the database creation, automatic
using the pill’s image. They used a modified shape feature extraction of any input query pill image (acquired
distribution method and created an invariant descriptor for according to the format and constraints implied in the pill
imprint extraction. Grigorescu and Petkov [17] presented a image dataset acquisition) is performed by our proposed
novel rich local descriptor named distance set which can be system and then compared with the database for matching and
found by using an image feature point. Two-dimensional identifying the pill. Comparison is done by utilizing distance
images are used as a distance set where the distance set metric which computes the distance between the extracted
contains the feature points of the image. By doing so, they feature value of the query pill image and already available
resolved object segmentation and shape matching problem by feature values of the pills present in the dataset. If the distance
finding the difference between distance set and dissimilarity is within the threshold value, the search region for the query
between sets of distance sets. The use of shape image in the database will be reduced. The same procedure is
matching/filtering is very useful in traffic sign detection and performed for all four feature values. Finally, the proposed
recognition of handwritten character. Suntronsuk and system gives the resultant pill image and conveys the
Ratanotayanon [18] presented an algorithm for an automatic information regarding the class of query image along with its
pill recognition system based on the text of the imprint of the location in the database.
pill. Edge-based connected component technique and edge The information about the class and instant (at which the
masking technique is utilized to extract the text from the resultant pill image is present in the database) is utilized to
imprint. Then, an optical recognition system (OCR) is applied find out the disease for which query pill can be used.
to different extracted binary imprint area to recognize the pill. However, if the distance between the query pill image features
Osada et al. [19] illustrated a method to discriminate 3D value and the database pill image features value is not within
shapes. They find a shape measuring function based on the the threshold, the database search range will not be reduced.
signature of an object as a sampled shape distribution, which This will lead to the result that the pill is not present in the
defines the global geometric properties of the object. The database. In our proposed pill recognition system, 2500 pills
discrimination method eventually was used as a pre-classifier images are used as a database. Overview of the proposed
for a recognition or similarity retrieval system. Experimental system is shown in Fig. 1 and detailed description of the steps
results show a 60.9% system accuracy. Lee et al. [20] involved in the devised technique is presented next.
proposed an automatic pill recognition system based on an
imprint of the pill. Feature vector based on edge localization
and invariant moments of the tablet was extracted.
Experimental results showed 93.02% matching accuracy over
43
R. Chughtai et al. / The Nucleus 56, No. 1 (2019) 42-48
44
R. Chughtai et al. / The Nucleus 56, No. 1 (2019) 42-48
45
R. Chughtai et al. / The Nucleus 56, No. 1 (2019) 42-48
methodology section and then tends to match these extracted 𝑁𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑓𝑎𝑙𝑠𝑒 𝑟𝑒𝑗𝑒𝑐𝑡𝑖𝑜𝑛 2
𝐹𝑅𝑅 = = = 2% (1)
𝑇𝑜𝑡𝑎𝑙 𝑖𝑑𝑒𝑛𝑡𝑖𝑓𝑖𝑐𝑎𝑡𝑖𝑜𝑛 𝑎𝑡𝑡𝑒𝑚𝑝𝑡𝑠 100
features value with the created pill database in MATLAB. If
a match is found, a resultant matched image is displayed as
shown in Fig. 12b. The system will also present the class and For false images (which does not exist in the dataset), the
instance of the input image in the form of text message such proposed system shows 98 true rejections and 2 false
as “The pill is present in DB. Class =3 and Instance =5. The acceptances.
pill is used for cold and fever”. On the other hand, if the input 𝑁𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑓𝑎𝑙𝑠𝑒 𝑎𝑐𝑐𝑒𝑝𝑡𝑎𝑛𝑐𝑒 2
𝐹𝐴𝑅 = = = 2% (2)
query pill image is not present in the database or no match of 𝑇𝑜𝑡𝑎𝑙 𝑖𝑑𝑒𝑛𝑡𝑖𝑓𝑖𝑐𝑎𝑡𝑖𝑜𝑛 𝑎𝑡𝑡𝑒𝑚𝑝𝑡𝑠 100
the input query image is found, a text message “The pill is not Table 2: Accuracy comparison with other existing systems.
present in the image” will be shown.
Image Image Pixel Size Total No.
Method Accuracy
Database Complexity of Images of Images
Osada Available
High - 133 60.9%
et al.[19] online
Belongie Available
Medium 416x448 1400 94.2%
et al. [21] online
Fig. 12: (a) Test image [3], (b) Resulting matched image.
Yu and Own
Low 200x200 2500 97.1%
Chen [7] Database
The accuracy of the system can be checked by computing
FRR (False Rejection Rate) and FAR (False Acceptance Proposed Available
High 768x1024 2500 98%
Method online
Rate). To compute the FAR and FRR, a threshold must be
defined first. During retrieval, when a pill query image is
given as an input for recognition, then our proposed method Total error of proposed pill recognition system is:
checks the query image with the existing database and gives 𝑇𝑜𝑡𝑎𝑙 𝐸𝑟𝑟𝑜𝑟 = 𝐹𝑅𝑅 + 𝐹𝐴𝑅 = 4% (3)
the output result in the form of probability, i.e., how much
percentage the query image is matched with the existing
Where, total error is 4% for 200 tested images. The accuracy
database. For example, if an image is matched with 90% of the proposed system is calculated as:
accuracy and a threshold value for the system is equal to 85%,
𝑇𝑜𝑡𝑎𝑙 𝐸𝑟𝑟𝑜𝑟
then the system will recognize it. On the other hand, if an 𝐴𝑐𝑐𝑢𝑟𝑎𝑐𝑦 = 100% −
𝑇𝑜𝑡𝑎𝑙 𝑁𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑎𝑡𝑡𝑒𝑚𝑝𝑡𝑠
image match is 80%, the system will discard the image and
will not recognize it (this falls in the FRR category). If the 4
= 100% − = 98% (4)
threshold value is set high, then FRR will increase and if the 200
threshold is set too low then FAR will increase. The threshold Pill recognition results of our system in comparison with
of the proposed system is set to EER (Equal Error Rate) by hit other systems are shown in Table 2. It can be observed that
and trial method. EER is the point where FAR is equal to FRR our proposed system and devised techniques for feature
as shown in Fig. 13 [24]. extraction are more accurate and reliable. This can be seen as
our system has the highest accuracy of 98 % in comparison to
the other similar methods. Further, our pill recognition system
is also more accurate than Yu and Chen method [7] who have
utilized the same dataset as ours.
4. Conclusions
An automatic pill recognition system is proposed which
can be used in the pharmaceutical factories as a quality
inspection where mass production of the pills is happening.
Four pill features are extracted automatically and then
Fig. 13: FAR-FRR Rate [24].
compared with the database for classification and recognition
of the pill. The proposed system achieves high accuracy of
To check the accuracy of the proposed pill recognition 98% showing its potential for marking unlabeled pills. In
system, 200 query pill images are tested. Of these tested future work, the pill recognition system will be tested on a
images, 100 images exist in the dataset referred to as true very large pill dataset. Further, an effort will be made to build
images. The rest 100 images are false images, which do not the proposed system as an online system by developing its
exist in the dataset. The proposed system gives 98 true App, so that the user can interact with the system easily.
acceptances and 2 false rejections for true images.
47
R. Chughtai et al. / The Nucleus 56, No. 1 (2019) 42-48
References [13] T.H. Huynh and T.S. Nguyen, “A new imprinted tablet recognition
algorithm using polar transform and neural networks”, Int. Conf. on
[1] CFR- Code of Federal Regulations Title 21, “US food and drug
Advanced Technologies for Communications (ATC), pp. 38-43, 2015.
administration homepage”, Available: http:// www.accessdata.fda.
gov/scripts/cdrh/cfdocs/cfcfr/CFRSearch.cfm?CFRPart=211, 2015 [14] M.K. Hu, “Visual pattern recognition by moment invariants”, IRE
Trans. Inf. Theory, pp. 179-187, 1962.
[2] WebMD Pill Identification Tool, “Pill identification homepage”,
Available: http://www.webmd.com/pill-identification/ [Accessed: [15] Z. Chen and S.I. Kamata, “A new accurate pill recognition system using
2018]. imprint information”, Sixth Int. Conf. Machine Vision, London, UK,
pp. 906711, Dec. 2013.
[3] National Library of Medicine, National Institutes of Health, United
States, “Pillbox homepage”, Available: http://pillbox.nlm.nih.gov/ [16] J.J. Caban, A. Rosebrock and T.S. Yoo, “Automatic identification of
developer.html [Accessed: 2018]. prescription drugs using shape distribution models”, IEEE 19th Int.
Conf. Image Process., pp. 1005-1008, 2012.
[4] RxList Pill Identification Tool, “Pill-identification-tool homepage”,
available at http://www.rxlist.com/pill-identification-tool/article.htm [17] C. Grigorescu and N. Petkov, “Distance sets for shape filters and shape
[Accessed: 2018]. recognition”, IEEE Trans. Image Process., vol. 12, no. 10, pp. 1274-
1286, 2003.
[5] Pill Identification Tool, “Pill identification homepage”, Available:
https://www.drugs.com/pill_identification.html [Accessed: 2018] [18] S. Siroratt and R. Sukanya, “Pill image binarization for detecting text
imprints”, 13th Int. Conf. Computer Science and Software Engineering
[6] Healthline Pill Identifier, “Pill-identifier homepage”, Available:
(CSSE), pp. 978-983, 2016.
http://www.healthline.com/pill-identifier [Accessed: 2018].
[19] R. Osada, T. Funkhouser, B. Chazelle and D. Dobkin, “Shape
[7] J. Yu and Z. Chen, “Accurate system for automatic pill recognition
distributions”, ACM Trans. Graphics, vol. 4, pp. 807–832, 2002
using imprint information”, IET Image Process., vol. 9, no. 12,
pp. 1039-1047, 2015. [20] Y.B. Lee, U. Park and A.K. Jain, “Pill-ID: Matching and retrieval of
drug pill imprint images”, IEEE Proc. 20th Int. Conf. Pattern
[8] M.A.V. Neto, J.W.M. de Souza, P.P. Reboucas Filho and W.D.O.
Recognition, pp. 2632-2635, August, 2010.
Antonio, "CoforDes: An invariant feature extractor for the drug pill
identification", IEEE 31st Int. Symp. on Computer-Based Medical [21] S. Belongie, J. Malik and J. Puzicha, “Shape matching and object
Systems (CBMS), Karlstad, pp. 30-35, 2018. recognition using shape contexts”, IEEE Trans. on Pattern Analysis and
Machine Intelligence, vol. 24, no. 4, pp. 509-522, 2002.
[9] J.S. Wang, A. Ambikapathi, Y. Han, S.L. Chung, H.W. Ting and C.F.
Chen, "Highlighted deep learning based identification of [22] B. Epshtein, E. Ofek and Y. Wexler, “Detecting text in natural scenes
pharmaceutical blister packages”, IEEE 23rd Int. Conf. on Emerging with stroke width transform”, IEEE Computer Society Conf. on
Technologies and Factory Automation (ETFA), Turin, pp. 638-645, Computer Vision and Pattern Recognition , pp. 2963-2970, 2010.
2018. [23] H. Chen, S.S. Tsai, G. Schroth, D.M. Chen, R. Grzeszczuk and
[10] R. Palenychka, A. Lakhssassi and M. Palenychka, "Verification of B. Girod, “Robust text detection in natural images with edge-enhanced
medication dispensing using the attentive computer vision approach", maximally stable extremal regions”, IEEE 18th Int. Conf. on Image
IEEE Intl. Symp. on Circuits and Systems (ISCAS), Florence, pp. 1-4, Process., pp. 2609-2612, 2011.
2018. [24] M.A. Rahman, R.A. Kabir, Z. Begum and M.M. Haque, "A study of
[11] Y.F. Wong, H.T. Ng, K.Y. Leung, K.Y. Chan, S.Y. Chan and C.C. human recognition using inner joining lines of fingers,"5th Int. Conf.
Loy,” Development of fine-grained pill identification algorithm using on Computer Sciences and Convergence Information Technology,
deep convolutional network”, Journal of Biomedical Informatics, Seoul, pp. 186-191, 2010.
vol. 74, pp. 130-136, 2017.
[12] A. Hartl, “Computer-vision based pharmaceutical pill recognition on
mobile phones”, Proc. 14th Central European Seminar on Computer
Graphics, pp. 5, 2010.
48