Coins recognition systems have humungous applications from vending and slot machines to banking and management firms which directly translate to a high volume of research regarding the development of methods for such classifica- tion. In recent years , academic research has shifted towards a compute r vision approach for sorting coins due to the advancement in the field of deep learning. However, most of the documented work utili zes what is known as ‘Transfer Learning ’ in which we reuse a pre -trained model of a fixed architecture as a starting point f or our training. While such an approach saves us a lot of time and effort, the generic nature of the pre -trained model can often become a bottleneck for performance on a speciali zed problem such as coin classification. This study develops a convolution al neural net- work (CNN) model from scratch and tests it against a widely -used general -purpose architecture known as Googlenet. We have shown in this study by comparing the performance of our model with that of Googlenet (documented in vari- ous previous studies) t hat a more straightforward and speciali zed architecture is more optimal than a more complex general architecture for the coin classification problem. The model developed in this study is trained and tested on 720 and 180 images of Indian coins of different denominations , respectively. The final accuracy gained by the model is 91.62% on the training data , while the accuracy is 90.55% on the validation data. Keywords: Convolution al Neural Network ; Indian Coin ; Classification ; Denomination *Corresponding author Email address: Ch.yash042@gmail.com 1. Introduction Coin Classification and recognition systems have seen tremendous application in the past few years due to the surge of machine automation in our society [1]. Such systems are deployed to reduce the odds of human error and fast-track the repetitive process of counting and sorting a large number of coins. While traditionally , such systems make use of the mechanical and electro- magnetic properties [2] of the coins to classify them, it is due to the enormous development in the field of com- puter vision and artificial intelligence that new systems are coming forth that utili zes robust ne ural networks to detect, segment and classify coins based on the images of the coins processed in real -time. Although the ma- jority of the application stems from the sectors men- tioned above yet due to the increasing reliability of coin classification system s and the increasing availability of computational resources for the average person, various studies have been done aiming to develop a system that can assist visually impaired people in identifying and classifying real currency [ [3], [4]]. While a currency classification or identification system would contain both the banknote a nd coin classifier, this paper con- fines its scope towards the coin classification part of the system . Coins are smaller and usually have less color differ- ence between classes (different denominations). Also, coins are more durable than notes , and therefore they survive in the market for a more extensive period ; hence the market has more variations of coi ns currently in use than banknotes. Therefore, a coin classification system must be robust to account for the greater variation and deficiency of features in comparison to a banknote clas- sification model. In this paper, the authors have pro- posed a deep lea rning model that can reliably classify coins based on the coin’s image . For training the model , a dataset was created with 900 images of different de- nominations (one rupee, two rupees, five rupees, ten rupees, and twenty rupees) Indian coins. It includes 2 10 images of one rupee coin, 120 images of two rupee coins, 270 images of five rupee coins, 180 images of ten rupee coins, and finally , another 120 images of twenty rupee coins. Each class contains different variations of the denomination to ensure that mo del has enough for training. 2. Literature Review 2.1. Almisreb, Ali & Saleh, Mohd.A. (2019) . [5] In this study, the authors trained and tuned some of the famous deep learning architecture , namely Alexnet, Googlenet, and Vgg16 , using a transfer learning framework on an image dataset that contained 110 images in total of Bosnian banknotes , which included 11 different classes. The main characteristics identified in this study were currency texture, color, and forms. Vgg16 was the most accurate , and Googlenet was the least accurate at 88%. 2.2. Rahman, Mohammad & Poon, Bruce & Amin, Md Ashraful & Yan, Hong. (2014) . [6] The authors h ave used the Oriented FAST and Rotated BRIEF (ORB) methods developed in the lab of Open Source Computer Vision (O penCV). The dataset only contained Bangladeshi banknotes. The paper also 2 describes the method of selecting thresholds for the algorithms. The experiment included test images with white background as well as images with a complex and ‘closer to real ’ background to judge the practicality of the model. The proposed system was found to be 89.4% accurat e on the white paper background and 78.4% accurate on a complex background. 2.3. A. Chalechale (2007). [7] The author of this paper proposed a new approach for recogni zing coins in an image . The approach is cent ered around the idea of measuring the similarity between full colour multi -component coin images. The significant advantage of this approach is that image segmentation before the detection is not required , and as seg mentation is a very computationally expensive process by using this approach, we save a lot of computational time. 2.4. Ranjendra, P. & Anithaashri, T.P. (2020). [8] This paper is oriented around Indian currency . The authors followed the same structure as Rahman et al. [2], wherein they created a dataset that contains both Indian banknotes as well as coins of different denominations and three state of the art deep learning frameworks, namely Alexnet, Googlenet, and Vgg16, were trained, tuned and compared. The result showed that Googlenet (with 22 convolution layers) was the least accurate with an accuracy o f 88% , while Vgg16 (with 16 convolution layers) was the most accurate. 2.5. Abburu, Vedasamhitha & Gupta, Saumya & Rimitha, S. & Mulimani, Manjunath & Koolagudi, Shashidhar. (2017) . [9] A deep learning model was suggested in this research , which could classify both the country of origin and the denomination or value of a specified banknote. The model works only with paper notes and avoids dealing with coins altogether. The dataset in this study contains paper notes from 20 different countries a nd their denomination variants , and the model utili zes features like size, texture, color, and text in the image. The models were tuned to classify the notes with about 90% accuracy. 3. Methodology Most of the recent studies which are focused on showing how the Deep learning model can be used to classify images of currency (banknote or coins) into various classes have used transfer learning framework wherein they use one or more of the po pular CNN architectures like Googlenet, Alexnet, Vgg15 or Vgg16 [[10]; [8]]. While there is no apparent downside to using these frameworks, one can argue that such networks are not tailor -made for a specific problem . Instead, they are general in nature can be used in about any situation and the problem with that is that even by using 22 convolution layers , the Googlenet CNN can only get about 88% accuracy [8], since we cannot twe ak the architecture of Googlenet without losing all the pre -trained weights we have to settle for more epochs which in turn would result in higher computational time , or we can resort to collecting more data for more effective training. Both of the solutio ns are time -consuming and do not guarantee better accuracy. Hence it is evident that for analy zing the effective- ness of CNNs in classifying currency , a novel architec- ture is needed that must be created and trained from scratch so that we can get the most a ccurate solution with a simpler and less computationally expensive neu- ral network. For developing a new architecture , rigorous experimentation is need ed, and for benchmarking dif- ferent architectures , a baseline accuracy of 85% is cho- sen as this is the average accuracy reported by various studies that incorporated Googlenet CNN architecture. Figure 1: Methodology for CNN iterations 4. Data 4.1. Accumulation Most dataset available online does not include images of twenty rupee coins since it was recently approved by the government of India and was first minted in 2019. Hence for this study, we have created a new dataset [11] which includes images of Indian coins of all the currently circulating denominations , namely one rupee (₹1), two rupees (₹2), five rupees (₹5), ten rupees (₹10) and as well as twenty rupees (₹ 20). Since there are multiple designs for a coin of the same denomination , therefore it must be ensured that the majority of the designs are included in the training data so that we can make a robust model that can identify the denomination of the coin reg ardless of the change in design, an open access copy of the dataset is available on Kaggle with the same name. Hence, multiple design variations are included in our dataset. Some design variations included in the data are shown in Figures 2(a) and 2(b). 3 Figure 2: Variation of (a) One Rupee (₹1) & (b) Five Rupee (₹5) Indian Coin and (c) Different Viewing angles The dataset contains images of 30 different coins , consisting of 7 types of one rupee coins, four types of two rupee coins, nine types of five rupee coins, six types of ten rupee coins, and another four types of twenty rupee coins. Each coin has been imaged from five different viewing angles as shown in Figure 2(c) and in three different lighting conditions i) Artificial Light, ii) Low Light, and iii) Natural Light. Hence, there are 15 possible combinations of viewing angle and lighting condition ; furthermore , each combination has been sampled twice. Therefore, each coin has been imaged 30 times with varying light and viewing angles. The whole data set contains 900 such images , out of which 210 images are of one -rupee coins, 120 images are of two - rupee coins, 270 images are of five -rupee coins, 180 are images of ten -rupee coins , and finally, the rest 120 images are of twenty -rupee coins. 4.2. Pre-processing 4.2.1. Resize Resizing is the first and arguably the most critical step in image pre -processing for training a neural network as a larger image size will have more information and can produce better correlation inside the neurons , but at the same time, a large size means that the time taken by the neural network to train will also be significantly high. Therefore, a particular size should be selected that can retain the maximum amount of information , yet it should be small enough to have a practical training time. In their original form, all the images inside the dataset have a pixel size of 4000 x 3000 (12000000 or 12MP) ; this is a considerabl e size for an image that is not suitable for neural networks. So, after experimenting with different sizes , an image size of 320 x 240 was selected , and all the images were resized while keeping the aspect ratio intact. 4.2.2. Normali zation Normali zation is the process of rescaling the pixel intensity of an image to a predefined scale from the original scale. All images are in RGB format in the datase t, with pixel intensity ranging from 0 t o 255 for each color channel . Image n ormali zation was used to transform the pixel intensities from a scale of 0 -255 to a scale of 0 -1. 𝐼𝑛=𝐼𝑜× (1 255) (1) Where In and Io are the pixel intensity after and before normali zation , respectively . 4.3. Augmentation Training a Convolution al neural network requires a lot of data to achieve optimum accuracy . While our dataset contains a decent number of images , increasing the dataset furth er can effectively enhance the performance of the trained model. Data augmentation techniques are usually implemented to develop robust image classifiers using limited data [12] that can artificially generate images by employing various transformations such as random rotation, shift , flips, etc. Some transformations used in the study are shown in Figure 3. 5. CNN Architecture 5.1. Proposed Model The architecture of the CNN mod el proposed in this paper consists of five convolution layers and five pooling layers while decreasing the size of the image and increasing the number of feature maps. 4 Figure 3: (a) Rotation Transformation and (b) Brightness Transformation The output of the image processing part of CNN is then fed into a fully connected layer from which we get the final output decision of the model . The overall architecture and the positioning of the convolution and pooling layers are shown in Figure 4. 5.2. Convolution Layer Each Convolution layer is a 2D convolution layer followed by a Rectified Linear Unit (ReLU) activation function, which has been shown to have good convergence properties , for example , scale invariance and 1 -Lipschitz continuity [13], A ReLU function takes the incoming signal from the neuron . It passes on only if the signal is positive. This means that if the incoming signal is negative , the signal w ill no t proceed further in the neural network , and if it is positive, it will move forward to the next neuron unchanged. The ReLU Activation Function : 𝑓(𝑥)=𝑥+=max (0,𝑥) (2) Where x is the input to the neuron , the kernel size or the dimension of feature maps was fixed as 3x3x3 (3x3 map with three color channels) , and a 1x1x1 s tride was selected. Furthermore, feature maps increas ed from 16 (24) to 256 (28). 5.3. Pooling Layer Max pooling layers are used between some of the convolution layers to reduce the dimensionality of the feature maps. The stride of the Max Pooling layer was of 2 pixels that were selected , and finally , a global average pooling layer was used instead of a flattening layer at the junction of the CNN and the fully connected layer to reduce the shape of the final output tensor coming from the last convolution layer to shorten the time required to train the fully connected la yer. 5.4. Fully Connected Layer The low dimensional feature maps are fed into the fully connected layer through a global average pooling layer that reduces the parameter’s size and works as a flattening layer, converting the feature map to separate neurons that make up the fully connected input layer. The ReLU activation function also follows this layer . The last dense layer computes the final probabilities given by the model for each class. This layer utili zes the SoftMax function , also known as the normalized exponential function that normalizes the neural network’s output to a probability distribution over the prediction classes. The SoftMax Function: 𝜎(𝑧)𝑖=𝑒𝑧𝑖 ∑ 𝑒𝑧𝑖𝐾 𝑗=1 , (3) 𝑓𝑜𝑟 𝑖=1,2,…..,𝐾 𝑎𝑛𝑑 𝑧=(𝑧1,𝑧2,…..,𝑧𝐾)∈ ℝ𝐾 Using the SoftMax function in the last layer, we convert the output of the fully connected layer into an equivalent set of probabilities that belongs to each prediction clas s. 5.5. Training The model weights were updated using the Adam (Adaptive Moment Estimation) Stocha stic Gradient Descent optimi zation algorithm [14] so that the output corresponds with the given labels . At the same time, an adaptive learning rate was adopted that started with a value of 0.01 (1e -02) and would get reduced by a factor of 0.1 every time the training got hit by a learning plateau (with a patience level of 12 epochs). The Categorical cross -entropy function was selected as our model’s optimization criteria or as the loss function . Categorical cross -entropy (Loss Function) : ℓ(𝑥𝑖)= −∑1{𝑦𝑖= 𝒸𝑞}×log(𝑃(𝑦𝑖= 𝑐𝑞|𝑥𝑖))𝑄 𝑞=1 (4) Where Q represents the number of classes, 𝟏{𝒚𝒊= 𝓬𝒒} is the indicator that equates to 1 if 𝒚𝒊 belongs to the class 𝓬𝒒 and 0 otherwise. And 𝑷(𝒚𝒊= 𝒄𝒒|𝒙𝒊) is the probability predicted by the model of 𝒙𝒊 belonging to the class 𝓬𝒒. 5 Figure 4: Proposed CNN Architecture 6. Model Evaluation The model was developed and trained on the Google Collaboratory environment with a GPU backend support (NVIDIA Tesla K80). The model was trained for a total of 150 Epochs and was found to achieve an accuracy of 91.62% on the training data , while on the validation or test data , the accuracy was found to be 90.55%, The high level of agreement between the accuracy on training and test data signifies that the model is not overfitti ng. Figure 5(a) and (b) show the accuracy and loss curve over training epochs , respectively , while Figure 5(c) shows the adaptive learning rate during training. The accuracy metric is not sufficient to evaluate the performance of a multiclass classifier ; rather , the performance o f each class should be judged separately. Figure 6 shows the confusion matrix for the classifier , and it is evident from the confusion matrix that the model performed best at classifying Five rupees (₹5) and Ten Rupees (₹10) coins while it struggles the most to classify Twenty Rupee (₹20) coins, this phenomenon is confirmed by looking at the accuracy scores for each class separately shown in Table 1. Given that evaluation metrics like positive predictive value (PPV) or precision and negative predictive value (NPV) can only be used in binary classification, therefore using the ‘one vs . rest’ approach , the multiclass confusion matrix can be converted into five binary confusion matrix (one for each class). For example, considering class 1 (One rupee), all the correctly classified images will be termed as True Positives (TP), all the images that were correc tly classified as not One rupee will be termed as True Negative (TN), and all the images that were incorrectly classified as One rupee will be termed as False Positive (FP). Lastly, all incorrectly classified images as not One rupee will be termed False Ne gative (FN). Using this approach, TP, TN, FP , and FN can be calculated for each class, which will be used to calculate the positive predictive value(PPV) and the negative predictive value(NPV). The calculated values for TP, TN, FP, FN, PPV, and NPV for eac h class are shown in Table 2. (a) (b) (c) Figure 5: (a) Accuracy, (b) Loss , and (c) Learning Rate 6 Table 1: Accuracy Score for each class Class Total Samples Correct Predictions Wrong Predictions Acc. (%) One 42 39 3 92.8 Two 24 20 4 83.3 Five 54 51 3 94.4 Ten 36 34 2 94.4 Twenty 24 19 5 79.1 Total 180 163 17 90.5 Figure 6: Confusion Matrix 𝑃𝑜𝑠𝑖𝑡𝑖𝑣𝑒 𝑃𝑟𝑒𝑑𝑖𝑐𝑡𝑖𝑣𝑒 𝑉𝑎𝑙𝑢𝑒 (𝑃𝑃𝑉 )=𝑇𝑃 𝑇𝑃+𝐹𝑃 (5) 𝑁𝑒𝑔𝑎𝑡𝑖𝑣𝑒 𝑃𝑟𝑒𝑑𝑖𝑐𝑡𝑖𝑣𝑒 𝑉𝑎𝑙𝑢𝑒 (𝑁𝑃𝑉 )=𝑇𝑁 𝑇𝑁+𝐹𝑁 (6) 7. Conclusion and Future Prospect In this study, we have created a new dataset of 900 images that can be used to train a machine learning model to classify Indian coins based on their denomination. Out of the 900 images , 720 images were used for training the model , and 120 images were set aside for validation. A CNN architect ure was developed from scratch that contains five convolution layers . The accuracy gained on the training and validation sets was 91.62% and 90.55%, respectively. The validation accuracy (90.55%) was greater than the average accuracy of Googlenet CNN (88%) reported by various previous studies. We also confirmed that a relatively simple (4 convolution layers) CNN architecture specifically made for a pa rticular problem (Coin Denomination Classification) was more efficient than a more complex (22 convolution layer) general -purpose architecture (Googlenet). The model developed in this study was later evaluated with both multiclass classification metrics l ike Over -All-Accuracy and Per Class Accuracy as well as binary classification metrics like Positive Prediction Value (PPV) and Negative Prediction Value (NPV)). It was observed that the model performed best at classifying Five rupee s (₹5) and Ten Rupee (₹1 0) coins while it was worst at classifying Twenty Rupee (₹20) coins . This phenomenon can be explained by the fact that the dataset contains only 120 images of twenty rupee coins while there were 270 and 180 images of five and ten rupee coins , respectively. In this study , the class imbalances in the dataset were neglected ; therefore , for future improvement of the model, applying thresholding to compensate for prior class probabilities is advised for increasing the overall accuracy of the model. Moreover, since the model’s architecture is relatively shallow with only five convolution layers adding more convolution blocks might yield more accurate results.