Method for detecting coin type
By combining the dual classification model with strategy and data preprocessing technology, the problem of insufficient training samples and uneven distribution in coin currency detection is solved, and the recognition accuracy is improved, especially for currencies with a small number of categories and uneven distribution.
Patent Information
- Application Number
- CN202311160347.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-08
- Publication Date
- 2024-08-30
AI Technical Summary
It is difficult to effectively detect the currency type of coins with existing technology, especially when the number of training samples is insufficient and the distribution is uneven, resulting in low recognition accuracy.
Using a dual classification model combination strategy, a comprehensive classification model is formed through random sampling and pseudo-label iterative training of labeled and unlabeled image sets, combined with data preprocessing technologies such as background removal, front and back image splicing, and circular image rectangular expansion.
The recognition accuracy of coin currency detection is improved, especially for a small number of categories and currencies with uneven distribution. It improves the recognition accuracy of tail categories while maintaining high accuracy of head categories.
Smart Images

Figure CN118570515A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a method for detecting coin denominations and a method for training a classification model for detecting coin denominations. Background Art
[0002] With the popularity of applications using artificial intelligence technology, more and more application requirements have emerged, such as detecting the attributes of a coin by inputting a coin image into an application installed in a client device. The attributes of a coin may include, for example, the currency attribute of the coin. In this article, the currency may include the country information of the coin, for example, the currency may be a US coin. In some cases, the currency may also include coin category information, including but not limited to one or more of the denomination, version, minting year, etc. of the coin, for example, the currency may be a Washington Head 25-cent coin minted in 1985. Summary of the invention
[0003] One of the objectives of the present disclosure is to provide a method for detecting coin denominations and a method for training a classification model for detecting coin denominations.
[0004] According to a first aspect of the present disclosure, a method for detecting denominations of coins is provided, comprising: receiving an image of a coin to be detected to form an input image; and inputting the input image into a trained classification model to obtain the denominations of the coins to be detected, wherein the classification model comprises a first classification model trained based on a first training sample set and a second classification model trained based on a second training sample set, the first training sample set is obtained by performing a first random sampling on an image set containing collected images of each denomination, and the second training sample set is obtained by performing a second random sampling on the image set, wherein the first random sampling has the same sampling probability for each image in the image set, and the second random sampling has the same sampling probability for each denomination in the image set, wherein obtaining the denominations of the coins to be detected comprises: obtaining the denominations of the coins to be detected based on the outputs of both the first classification model and the second classification model.
[0005] According to a second aspect of the present disclosure, a method for detecting the denomination of coins is provided, comprising: receiving an image of a coin to be detected; performing a rectangular expansion on a circular image area corresponding to a coin part in the image of the coin to be detected to obtain a rectangular expansion image corresponding to the coin part; forming an input image based on the rectangular expansion image; and inputting the input image into a trained classification model to obtain the denomination of the coin to be detected.
[0006] According to a third aspect of the present disclosure, there is provided a method for training a classification model for detecting coin denominations, comprising: establishing an image set of coin images involving multiple denominations; performing a first random sampling on the image set to obtain a first training sample set, wherein the first random sampling has the same sampling probability for each image in the image set; performing a second random sampling on the image set to obtain a second training sample set, wherein the second random sampling has the same sampling probability for each denomination in the image set; training a first classification model for detecting coin denominations based on the first training sample set, and training a second classification model for detecting coin denominations based on the second training sample set; and obtaining the classification model by combining the first classification model and the second classification model.
[0007] According to a fourth aspect of the present disclosure, a method for training a classification model for detecting coin denominations is provided, comprising: collecting coin images involving multiple denominations; performing rectangular expansion on the circular image area corresponding to the coin part in the coin image to obtain a rectangular expansion image corresponding to the coin part, and establishing an image set based on the rectangular expansion image; and training a classification model for detecting coin denominations based on the image set.
[0008] According to a fifth aspect of the present disclosure, there is provided a method for training a classification model for detecting coin denominations, comprising: establishing a labeled image set of coin images involving multiple coin denominations, wherein each coin image is labeled with currency information; establishing an unlabeled image set comprising multiple coin images, wherein each coin image is not labeled with currency information, wherein the number of coin images in the unlabeled image set is greater than the number of coin images in the labeled image set; and training a neural network based on both the labeled image set and the unlabeled image set to obtain a classification model for detecting coin denominations.
[0009] According to a sixth aspect of the present disclosure, a non-temporary computer-readable storage medium is provided, on which a series of computer-executable instructions are stored. When the series of computer-executable instructions are executed by one or more computing devices, the one or more computing devices perform the method as described above.
[0010] Other features and advantages of the present disclosure will become apparent from the following detailed description of exemplary embodiments of the present disclosure with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The accompanying drawings, which constitute a part of the specification, illustrate embodiments of the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0012] The present disclosure may be more clearly understood from the following detailed description with reference to the accompanying drawings, in which:
[0013] Figure 1 and Figure 2 The present invention is a schematic flowchart of a method for detecting coin denomination according to an embodiment of the present invention.
[0014] Figure 3A and Figure 3B is a schematic diagram of a received coin image according to an embodiment of the present disclosure.
[0015] Figure 4A and Figure 4B Respectively Figure 3A and Figure 3B Schematic diagram after background subtraction.
[0016] Figure 5 and Figure 6 It is a schematic diagram of splicing coin images according to an embodiment of the present disclosure.
[0017] Figure 7 It is a schematic diagram of coordinate transformation when a coin image is expanded into a rectangle according to an embodiment of the present disclosure.
[0018] Fig. 8A and Figure 8B It is a schematic diagram of rectangular expansion of a coin image according to an embodiment of the present disclosure.
[0019] 9A to 9C It is a schematic diagram of splicing rectangular expansion images according to an embodiment of the present disclosure.
[0020] Fig.10 The present invention is a structural diagram of at least a part of a system capable of implementing the method for detecting coin denomination according to an embodiment of the present disclosure.
[0021] Fig.11 The present invention is a structural diagram of at least a part of a system capable of implementing the method for detecting coin denomination according to an embodiment of the present disclosure.
[0022] Fig.12 is an exemplary block diagram of a general hardware system that may be applied according to one or more exemplary embodiments of the present disclosure.
[0023] Note that in the embodiments described below, sometimes the same reference numerals are used in common between different drawings to represent the same parts or parts with the same functions, and their repeated descriptions are omitted. In some cases, similar numbers and letters are used to represent similar items, so once an item is defined in one drawing, it does not need to be further discussed in subsequent drawings. DETAILED DESCRIPTION
[0024] The present disclosure will be described below with reference to the accompanying drawings, wherein the accompanying drawings illustrate several embodiments of the present disclosure. However, it should be understood that the present disclosure can be presented in a variety of different ways and is not limited to the embodiments described below; in fact, the embodiments described below are intended to make the disclosure of the present disclosure more complete and fully illustrate the scope of protection of the present disclosure to those skilled in the art. It should also be understood that the embodiments of the present disclosure can be combined in various ways to provide more additional embodiments.
[0025] It should be understood that the terms in this disclosure are only used to describe specific embodiments and are not intended to limit the present disclosure. All terms (including technical terms and scientific terms) used in this disclosure have the meanings commonly understood by those skilled in the art unless otherwise defined. For the sake of simplicity and / or clarity, well-known functions or structures may not be described in detail.
[0026] In the present disclosure, the term "A or B" includes "A and B" and "A or B" rather than exclusively including only "A" or only "B", unless specifically stated otherwise.
[0027] In the present disclosure, references to "one embodiment" or "some embodiments" mean that features, structures, or characteristics described in conjunction with the embodiment are included in at least one embodiment, at least some embodiments, of the present disclosure. Therefore, the appearance of the phrases "in one embodiment" or "in some embodiments" in various places of the present disclosure does not necessarily refer to the same embodiment or embodiments. In addition, in one or more embodiments, features, structures, or characteristics may be combined in any suitable combination and / or sub-combination.
[0028] In this disclosure, the word "exemplary" means "used as an example, instance or illustration" rather than as a "model" to be exactly copied. Any implementation described as an example herein is not necessarily to be construed as preferred or advantageous over other implementations. Moreover, this disclosure is not limited by any expressed or implied theory given in the above technical field, background technology, summary of the invention or detailed description.
[0029] In addition, "first", "second" and the like terms may also be used in the present disclosure for reference purposes only, and thus are not intended to be limiting. For example, the words "first", "second" and other such numerical terms referring to structures or elements do not imply a sequence or order unless the context clearly indicates otherwise.
[0030] It should also be understood that when the term “include / comprises” is used in the present disclosure, it indicates the presence of the specified features, integers, steps, operations, units and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, units and / or components and / or their combinations.
[0031] In this disclosure, the terms "component" and "system" are intended to refer to a computer-related entity, or hardware, a combination of hardware and software, software, or software in execution. For example, a component can be, but is not limited to, a process, object, executable state, execution thread, and / or program running on a processor. By way of example, both an application running on a server and the server can be a component. One or more components can exist inside an executed process and / or thread, and a component can be located on a computer and / or distributed between two or more computers.
[0032] As described above, the user can detect the currency type of the coin by inputting the coin image to the application (e.g., installed in the client device). The currency type may include the country information of the coin, and one or more of the denomination, version, minting year, etc. of the coin. Figure 1 and Figure 2 Schematic flow charts of the method for detecting the currency type of coins are shown respectively. Figure 1 In the example shown, the application performs data preprocessing on the received coin front and back images, and then uses the first sub-model (e.g. Figure 1 The "country identification engine" shown in the figure first detects the country information of the coin, and then uses the second sub-model (e.g. Figure 1 The "ddd country" in the "country-specific currency identification engine" shown in the figure detects other currency information of the coin to obtain the identification result. It should be understood that Figure 1 The country-specific currency recognition engine is connected to the output of the country recognition engine, which includes a plurality of second sub-models for detecting the coin categories of the corresponding countries, for example Figure 1 The "001 country", ... "ddd country" shown in the figure. Figure 2 In the example shown, the application passes the preprocessed input image through a single model for detecting the country of the coin and the coin category (e.g. Figure 2 The "National Currency Recognition Engine" shown in the figure detects the currency information of the coin to obtain the recognition result.
[0033] Figure 1 The example shown simplifies the coin currency recognition problem and recognizes coins from different countries separately, so that the recognition accuracy of each country is basically guaranteed and the lower limit of the recognition accuracy is relatively high. Figure 2 The example shown is full-category recognition, with a simple architecture, and with improved data preprocessing technology and recognition technology, it can achieve a high recognition accuracy rate, for example, close to 100%. It should be understood that Figure 1 and Figure 2Each deep learning model or sub-model (such as the country recognition engine, the currency recognition engine for each country in the country-specific currency recognition engine, and the national currency recognition engine) can be a model built based on a convolutional neural network.
[0034] Data preprocessing
[0035] The data preprocessing process referred to in this article includes the process of forming the input image of the classification model from the received image of the coin to be detected. The received image of the coin to be detected includes the front image and the back image of the coin. The coin image input by the user often contains the background, for example, Figure 3A and Figure 3B As shown. When training the model, in order to simplify the learning process of the model, a standard coin image without background can be used for training. Therefore, in this case, in order to make the morphology of the input image during recognition as close as possible to the sample image used during training, the preprocessing process may include background removal processing on the received image of the coin to be detected. Figure 3A and Figure 3B The coin images shown in the figure can be processed by removing the background of the coin image. Figure 4A and Figure 4B shown.
[0036] The currency information of some coins must be determined by the images of both the front and back sides of the coins. Therefore, the input image input to the classification model needs to be formed by splicing the front and back images of the coin to be detected. Figure 5 An example of left-right splicing of the front and back images of a coin is shown. Figure 6 An example of stitching the front and back images of a coin in a four-grid format is shown. It should be understood that in addition to left-right stitching and four-grid stitching, there may be other stitching forms, such as top-bottom stitching, diagonal stitching, etc. It should be noted that before the stitching process is performed, the size of the front and / or back images of the coin needs to be adjusted so that the sizes of the circular image areas corresponding to the coin parts are substantially the same. If the size adjustment is performed on the image with the background removed, the sizes of the front and back images are substantially the same.
[0037] Convolutional neural networks need to perform moderate center cropping on the input image during recognition. For left-right spliced input images, for example Figure 5 The input image shown in the figure may be 224*448 in size after resizing. After center cropping, the image of the middle area is 224*224, which may lack some information. Figure 6The input image shown may have a size of 224*224 after resizing, and a 224*224 regional image of the middle region is obtained after center cropping, which is equivalent to no cropping, so all the information in the input image can be retained.
[0038] Since convolutional neural networks are more suitable for modeling the correlation of rectangular areas, and the characteristics of coins are based on the circular area as a whole, in one example, the circular image area corresponding to the coin part in the image of the coin to be detected is rectangularly expanded to obtain a rectangular expansion diagram corresponding to the coin part, and the input image is formed according to the rectangular expansion diagram. In one example, the coin image after background removal is rectangularly expanded. In order to simplify the explanation, the preprocessing process described below is based on the coin image after background removal. By expanding the entire coin into a rectangular image (mapping the polar coordinate system to the Cartesian coordinate system, such as Figure 7 The features on the coin image can be transformed from circular to rectangular, making the features in the input image more suitable for convolutional neural network modeling. The input image is formed according to the rectangular expansion of the coin, so that the classification model (for example Figure 2 The upper limit of classification of the national currency recognition engine shown in FIG. 1 can be expanded from the thousand level to the hundred thousand level.
[0039] Next, we describe the operation of rectangular expansion of the coin image. The pixel coordinates of the coin image are expressed in a polar coordinate system, where the center of the coin is the center of the polar coordinate system, such as Figure 7 As shown. Any point (such as a pixel) on the coin image can be represented by a radius r and an angle θ. The real coordinates of the point on the image are calculated according to the following formula, and the pixel value of the point is copied to the corresponding position of the rectangular expansion image.
[0040] x=rcosθ,y=rsinθ,
[0041] x 2 +y 2 =r 2 ,
[0042] The traversal can be started from each point on the outermost circle of the coin to generate a rectangular expansion diagram. In the rectangular expansion diagram, the perimeter of the circular coin is the length and the radius is the height. The front image and the back image of the coin to be detected are respectively rectangularly expanded to obtain a front rectangular expansion diagram corresponding to the front part of the coin and a back rectangular expansion diagram corresponding to the back part of the coin. Fig. 8A The front rectangular expansion image (right) of the circular coin after the front image (left) is rectangularly expanded is shown. Figure 8BThe reverse side rectangular expansion image (right part) of the round coin is shown after the reverse side image (left part) is rectangularly expanded. It should be noted that for the sake of clarity, 8A to 9C The images shown are all processed by black-and-white binaryization, but it should be understood that in practical applications, in order to retain as much information on the coin image as possible, the images input to the classification model may not be processed by black-and-white binaryization.
[0043] After the rectangular expansion is performed, the front rectangular expansion image and the back rectangular expansion image are spliced to form an input image. There are many ways to splice. Fig. 9A In the example shown, the long sides of the front rectangular expansion image and the long sides of the back rectangular expansion image are spliced relative to each other to form an input image. In other examples, before splicing, at least one of the front rectangular expansion image and the back rectangular expansion image may be horizontally mirrored, vertically mirrored, or both horizontally mirrored and vertically mirrored. In other words, Fig. 9A In the spliced image shown, the upper front rectangular expanded image can be replaced by a horizontal mirror image, a vertical mirror image, or a horizontal plus vertical mirror image of the front rectangular expanded image, and / or the lower reverse rectangular expanded image can be replaced by a horizontal mirror image, a vertical mirror image, or a horizontal plus vertical mirror image of the reverse rectangular expanded image. It should be understood that in other examples, the reverse expanded image or its mirror image can be at the upper part of the spliced input image, and the front expanded image or its mirror image can be at the lower part of the spliced input image.
[0044] exist Fig. 9B In the example shown, the long side of the front rectangular expansion image, the long side of the back rectangular expansion image, the long side of the horizontal mirror image of the front rectangular expansion image, and the long side of the horizontal mirror image of the back rectangular expansion image are relatively spliced to form an input image. Fig. 9B In the spliced image shown, from top to bottom are the front rectangular expansion image, the back rectangular expansion image, the horizontal mirror image of the front rectangular expansion image, and the horizontal mirror image of the back rectangular expansion image. Figure 6 The four-square splicing described above makes the input image closer to a square, and the two mirror images are equivalent to backing up both the front and back features of the coin. If the convolutional neural network performs a center crop on the input image, the information in the input image can be lost as little as possible. In other examples, Fig. 9B The horizontal mirror image of the front rectangular expansion image in the illustrated mosaic image can be replaced by the front rectangular expansion image itself, or by the vertical mirror image of the front rectangular expansion image, or by the horizontal plus vertical mirror image; and / or the horizontal mirror image of the reverse rectangular expansion image can be replaced by the reverse rectangular expansion image itself, or by the vertical mirror image of the reverse rectangular expansion image, or by the horizontal plus vertical mirror image. In addition, Fig. 9BThe front rectangular expansion image and the back rectangular expansion image in the mosaic image can also be replaced by their corresponding mirror images. It should be understood that the mosaic order of the rectangular expansion images in the mosaic image can be changed. For example Fig. 9B The top-down splicing order shown can be briefly described as "positive-negative-positive mirror-negative mirror". In other examples, the top-down splicing order can be "positive mirror-negative mirror-positive-negative", "positive-negative-negative mirror-positive mirror", "negative-positive-positive mirror-negative mirror", etc.
[0045] exist Fig. 9C In the example shown, Fig. 9B Based on the stitching method shown in FIG. 1 , the input image is also expanded in the direction of the long side of the rectangle. For example, the short side of the front rectangular unfolded image and itself ( Fig. 9C The example shown) or its mirror image (other examples not shown) is spliced, and the short side of the reverse rectangular expansion image and itself ( Fig. 9C The input image is formed by splicing the short sides of the coin (the example shown) or its mirror image (other examples not shown). The mirror image can be a vertical mirror image or a horizontal plus vertical mirror image of the expanded image. In this way, if the convolutional neural network randomly crops the input image during recognition, the complete information of the coin can be obtained each time it is cropped.
[0046] Model Training
[0047] The difficulty in training the classification model for detecting coin currencies (including the aforementioned country recognition engine, the currency recognition engine for each country in the country currency recognition engine, or the national currency recognition engine) is that the number of images that can be collected for each classification is not large, for example, there are only about 4 images per category on average. In addition, some countries have relatively complete coin-related websites, and can collect more training images (for example, for American coins, each category can have up to 100-10,000 images); while some other countries may not have any coin-related websites at all, or the website construction is not complete, so it is impossible to collect more training images for these countries. This results in the distribution of training images for each category of the classification model to be extremely uneven.
[0048] In one example, a method for training a classification model for detecting coin currencies may include: establishing a labeled image set of coin images involving multiple currencies, each of which is labeled with currency information; establishing an unlabeled image set containing multiple coin images, each of which is not labeled with currency information, wherein the number of coin images in the unlabeled image set is greater than the number of coin images in the labeled image set; and training a neural network based on both the labeled image set and the unlabeled image set to obtain a classification model for detecting coin currencies. Images can be collected from coin-related websites in various countries. The coin images on these websites usually carry their currency information, so a labeled image set can be established based on this. Images containing coins (such as image search results obtained by searching with "coins" as keywords) can be searched from search websites (such as general search engines). These images usually do not carry their currency information, so an unlabeled image set can be established based on this. The number of images in the unlabeled image set that can be obtained is usually greater than the number of images in the labeled image set that can be obtained.
[0049] In one example, the unlabeled image set can be used in a self-training manner, so that the neural network can be trained based on both the labeled image set and the unlabeled image set. For example, the neural network can be trained based on the labeled image set D1 to obtain a starting model. In the labeled image set D1, each classification can have only a few (for example, no more than 5) training sample images. The coin images in the unlabeled image set S are detected by the starting model to obtain the first pseudo-label of each coin image in the unlabeled image set, thereby obtaining a coin image set D2 with the first pseudo-label. The coin image set D2 (or part thereof) with the first pseudo-label and all or part of the labeled image set D1 (for example, 20% of the images randomly selected therefrom) form a new training sample set D3, and the starting model is trained using D3 to obtain an intermediate model. In this process, it is also possible not to form a new training sample set D3 for training, but to use the coin image set D2 with the first pseudo-label to train the starting model, and then fine-tune the model on the labeled image set D1 to obtain an intermediate model. Next, the intermediate model is used to detect the currency type of the coin images in the unlabeled image set S to obtain the second pseudo-label of each coin image in the unlabeled image set, thereby obtaining the coin image set D4 with the second pseudo-label. The intermediate model is trained using a combination of at least a portion of the unlabeled image set D4 with the second pseudo-label and at least a portion of the labeled image set D1 to obtain a trained classification model. It should be understood that after the intermediate model is trained using a combination of D4 and D1, the process can be repeated once or multiple times, that is: the unlabeled image set S is detected using the intermediate model to obtain a coin image set D5 with a new pseudo-label, and the intermediate model is trained again using a combination of D5 and D1 until the number of training times reaches a predetermined number of times, or the accuracy of the model's recognition result meets a predetermined condition, thereby obtaining a trained classification model.
[0050] In one example, a neural network can be pre-trained using a self-supervised method based on an unlabeled image set, and then the pre-trained neural network can be fine-tuned based on a labeled image set to obtain a classification model for detecting coin denominations. Pre-training a neural network using a self-supervised method can use, for example, a contrastive distillation self-supervised strategy. A teacher network and a student network with the same network structure can be established, and two different transformations can be performed on the image sample x in the unlabeled image set to obtain two different image samples x1 and x2 (for example, one transformation can be a global image augmentation such as rotating the image, color / brightness transformation, and the other transformation can be a local image augmentation such as randomly cutting off a local area of the image). The two different image samples x1 and x2 are input to the teacher network and the student network respectively, and each network outputs its own features. The cross entropy loss function is used to measure the similarity of the features output by the two networks to reduce the difference between the outputs of the teacher network and the student network. For example, a stop-gradient (sg) operator can be applied to the teacher network to propagate the gradient only through the student network, and the parameters of the teacher network are updated using the exponential moving average (ema) of the parameters of the student network, thereby performing contrastive distillation self-supervised pre-training. For a pre-trained neural network (which can be any of the aforementioned teacher network and student network), the training process can be fine-tuned based on the labeled image set.
[0051] The fine-tuning training process may include fine-tuning the pre-trained neural network using two different strategies, and then fusing the outputs of the two models obtained by the two different strategies to obtain the final model output. The labeled image set may be subjected to a first random sampling to obtain a first training sample set, wherein the first random sampling has the same sampling probability for each image in the labeled image set. The pre-trained neural network is trained based on the first training sample set to obtain a first classification model for detecting coin denominations. The first classification model trained in this way obeys the distribution of the training samples in the first training set, that is, the more categories of training samples, the more fully the training is, and the higher the recognition accuracy is. The advantage is that the recognition accuracy of common currencies is high and can meet most test scenarios. The disadvantage is that the accuracy of the categories in the middle and tail is low, and the upper limit of the overall recognition rate is not high. The labeled image set may also be subjected to a second random sampling to obtain a second training sample set, wherein the second random sampling has the same sampling probability for each currency in the labeled image set. The pre-trained neural network is trained based on the second training sample set to obtain a second classification model for detecting coin denominations. For example, a threshold value can be set, such as 20. In each round of training, each category is randomly sampled up to 20 times. This ensures that the head category does not occupy too much weight. The advantage is that the accuracy of currency recognition in the middle and tail is significantly improved (for example, the accuracy can be increased from 20% to 75%), and the disadvantage is that the accuracy of the head currency is reduced (for example, the accuracy can be reduced from 95% to 90%).
[0052] The final classification model for detecting coin currencies is obtained by combining the first classification model and the second classification model. For example, in the process of running an application to detect coin currencies, the scores of each currency output by the first classification model and the scores of the corresponding currencies output by the second classification model can be averaged (may include weighted average) to obtain a comprehensive score for each currency, and the output of the final classification model is determined based on the comprehensive score of each currency as the recognition result of the coin currency by the application. By fusing the outputs of the first classification model and the second classification model, the recognition accuracy of the head currency can be kept almost unchanged (for example, maintaining an accuracy of 95%), while the recognition accuracy of the tail currency can also be improved to a higher level (for example, 74% accuracy), which allows the recognition accuracy of coins in countries such as Europe and Asia to have a higher lower limit, from the previous 10%-20% to 80-95%.
[0053] According to the scheme of the embodiment of the present disclosure, by using a large amount of unlabeled data for pre-training and combining the scheme of fusing the output results of the model after different fine-tuning training strategies, the problem of few and unevenly distributed training samples in the field of coin denomination detection is effectively solved; in conjunction with data preprocessing processes such as background removal, front and back image stitching and / or rectangular expansion of circular coin images, the classification space of the classification model used to detect coin denominations is improved, and the recognition accuracy of each classification is improved.
[0054] Fig.10 4 is a structural diagram of at least a portion of a system 400 capable of implementing a method for detecting coin denominations according to an embodiment of the present disclosure. It will be appreciated by those skilled in the art that system 400 is merely an example and should not be viewed as limiting the scope of the present disclosure or the features described in the present disclosure. In this example, system 400 may include one or more storage devices 410, one or more electronic devices 420, and one or more computing devices 430, which may be communicatively connected to each other via a network or bus 440. One or more storage devices 410 provide storage services for one or more electronic devices 420, and one or more computing devices 430. Although one or more storage devices 410 are shown in system 400 as separate boxes independent of one or more electronic devices 420, and one or more computing devices 430, it should be appreciated that one or more storage devices 410 may actually be stored on any of the other entities 420, 430 included in system 400. Each of one or more electronic devices 420 and one or more computing devices 430 may be located at a different node of a network or bus 440, and may be able to communicate directly or indirectly with other nodes of the network or bus 440. It will be appreciated by those skilled in the art that system 400 may also include Fig.10 Other devices not shown, each of which may be located at a different node of the network or bus 440 .
[0055] One or more storage devices 410 may be configured to store any data described above, including but not limited to: coin images, neural network models, detection results, and application files. One or more computing devices 430 may be configured to execute one or more of the above methods 100, and / or one or more steps / operations in one or more methods 100. One or more electronic devices 420 may be configured to provide services to users, which may output detection results, etc. to users. One or more electronic devices 420 may also be configured to execute one or more steps in method 100.
[0056] The network or bus 440 can be any wired or wireless network, and can also include cables. The network or bus 440 can be part of the Internet, the World Wide Web, a specific intranet, a wide area network, or a local area network. The network or bus 440 can utilize standard communication protocols such as Ethernet, WiFi, and HTTP, proprietary protocols for one or more companies, and various combinations of the aforementioned protocols. The network or bus 440 can also include, but is not limited to, an industrial standard architecture (ISA) bus, a microchannel architecture (MCA) bus, an enhanced ISA (EISA) bus, a video electronics standard association (VESA) local bus, and a peripheral component interconnect (PCI) bus.
[0057] Each of the one or more electronic devices 420 and the one or more computing devices 430 may be configured to communicate with Fig.11 The system 500 shown is similar, that is, it has one or more processors 510, one or more memories 520, and instructions and data. One or more electronic devices 420 can be configured to perform the method of detecting coin currency according to the embodiment of the present disclosure. One or more computing devices 430 can be configured to perform the method of training a classification model for detecting coin currency according to the embodiment of the present disclosure. Each of the one or more electronic devices 420 and the one or more computing devices 430 can be a personal computing device intended for use by a user or a commercial computer device used by an enterprise, and has all components commonly used in conjunction with a personal computing device or a commercial computer device, such as a central processing unit (CPU), a memory (e.g., RAM and an internal hard drive) for storing data and instructions, one or more I / O devices such as a display (e.g., a monitor with a screen, a touch screen, a projector, a television, or other devices operable to display information), a mouse, a keyboard, a touch screen, a microphone, a speaker, and / or a network interface device.
[0058] One or more electronic devices 420 may also include one or more cameras for capturing still images or recording video streams, and all components for connecting these elements to each other. Although one or more electronic devices 420 may each include a full-size personal computing device, they may optionally include a mobile computing device that can wirelessly exchange data with a server through a network such as the Internet. For example, one or more electronic devices 420 may be a mobile phone, or a device such as a PDA with wireless support, a tablet PC, or a netbook that can obtain information via the Internet. In another example, one or more electronic devices 420 may be a wearable computing system.
[0059] Fig.111 is a block diagram of at least a portion of a system 500 capable of implementing a method for detecting a mint mark of a coin according to an embodiment of the present disclosure. The system 500 includes one or more processors 510, one or more memories 520, and other components (not shown) that are typically present in a computer or the like. Each of the one or more memories 520 can store content that can be accessed by the one or more processors 510, including instructions 521 that can be executed by the one or more processors 510, and data 522 that can be retrieved, manipulated, or stored by the one or more processors 510.
[0060] Instructions 521 may be any set of instructions to be executed directly by one or more processors 510, such as machine code, or any set of instructions to be executed indirectly, such as a script. The terms "instructions," "application," "process," "step," and "program" in this disclosure may be used interchangeably in this disclosure. Instructions 521 may be stored in an object code format for direct processing by one or more processors 510, or as a script or collection of independent source code modules in any other computer language, including those interpreted on demand or compiled in advance. Instructions 521 may include instructions that cause one or more processors 510, such as to act as the various neural networks in this disclosure. Other portions of this disclosure explain the functions, methods, and routines of instructions 521 in more detail.
[0061] The one or more memories 520 may be any temporary or non-temporary computer-readable storage medium capable of storing content accessible by the one or more processors 510, such as a hard drive, a memory card, a ROM, a RAM, a DVD, a CD, a USB memory, a writable memory, and a read-only memory, etc. One or more of the one or more memories 520 may include a distributed storage system, in which instructions 521 and / or data 522 may be stored on a plurality of different storage devices that may be physically located at the same or different geographical locations. One or more of the one or more memories 520 may be connected to the one or more first devices 510 via a network, and / or may be directly connected to or incorporated into any one of the one or more processors 510.
[0062] One or more processors 510 can retrieve, store or modify data 522 according to instructions 521. The data 522 stored in one or more memories 520 may include at least part of one or more of the items stored in one or more storage devices 410 described above. For example, although the subject matter described in the present disclosure is not limited by any specific data structure, the data 522 may also be stored in a computer register (not shown), as a table or XML document with many different fields and records, stored in a relational database. The data 522 can be formatted into any computing device readable format, such as but not limited to binary values, ASCII or Unicode. In addition, the data 522 may include any information sufficient to identify relevant information, such as numbering, descriptive text, proprietary code, pointer, reference to data stored in other memories such as other network locations, or information used by functions to calculate relevant data.
[0063] The one or more processors 510 may be any conventional processor, such as a commercially available central processing unit (CPU), a graphics processing unit (GPU), etc. Alternatively, the one or more processors 510 may also be a dedicated component, such as an application specific integrated circuit (ASIC) or other hardware-based processor. Although not required, the one or more processors 510 may include specialized hardware components to perform specific computing processes faster or more efficiently.
[0064] Although Fig.11 Schematically, one or more processors 510 and one or more memories 520 are shown in the same box, but the system 500 may actually include multiple processors or memories that may exist in the same physical housing or in different physical housings. For example, one of the one or more memories 520 may be a hard drive or other storage medium located in a housing different from the housing of each of the one or more computing devices 430 described above. Therefore, references to processors, computers, computing devices, or memories should be understood to include references to a collection of processors, computers, computing devices, or memories that may or may not operate in parallel.
[0065] Fig.12 is an exemplary block diagram of a general hardware system 600 that may be applied according to one or more exemplary embodiments of the present disclosure. Fig.12Describe system 600, which is an example of a hardware device that can be applied to various aspects of the present disclosure. Any of the systems 400, 500 in the above embodiments may include all or part of the system 600. The system 600 may be any machine configured to perform processing and / or computing, and may be, but is not limited to, a workstation, a server, a desktop computer, a laptop computer, a tablet computer, a personal data assistant, a smart phone, a car computer, or any combination thereof.
[0066] The system 600 may include elements that may be connected to or communicate with the bus 602 via one or more interfaces. For example, the system 600 may include the bus 602, as well as one or more processors 604, one or more input devices 606, and one or more output devices 608. The one or more processors 604 may be any type of processor, and may include but is not limited to one or more general-purpose processors and / or one or more special-purpose processors (e.g., special processing chips). Each operation and / or step in the method described above may be implemented by executing instructions by one or more processors 604.
[0067] Input device 606 may be any type of device that can input information to a computing device, and may include, but is not limited to, a mouse, a keyboard, a touch screen, a microphone, and / or a remote controller. Output device 608 may be any type of device that can present information, and may include, but is not limited to, a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer.
[0068] The system 600 may also include or be connected to a non-transitory storage device 610. The non-transitory storage device 610 may be any storage device that is non-transitory and can implement data storage, and may include but is not limited to a disk drive, an optical storage device, a solid-state memory, a floppy disk, a hard disk, a tape or any other magnetic medium, an optical disk or any other optical medium, a ROM (read-only memory), a RAM (random access memory), a cache memory, and / or any other memory chip / chipset, and / or any other medium from which a computer can read data, instructions, and / or code. The non-transitory storage device 610 may be detachable from the interface. The non-transitory storage device 610 may have data / instructions / code for implementing the above methods, operations, steps, and processes.
[0069] The system 600 may also include a communication device 612. The communication device 612 may be any type of device or system capable of communicating with an external device and / or with a network, and may include, but is not limited to, a modem, a network card, an infrared communication device, a wireless communication device, and / or a chipset, such as a Bluetooth device, an 802.11 device, a WiFi device, a WiMax device, a cellular communication device, a satellite communication device, and / or the like.
[0070] The bus 602 may include, but is not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MCA) bus, an Enhanced ISA (EISA) bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus. In particular, for vehicle-mounted devices, the bus 602 may also include a Controller Area Network (CAN) bus or other architectures designed for use in vehicles.
[0071] The system 600 may also include a working memory 614 , which may be any type of working memory that may store instructions and / or data useful for the operation of the processor 604 , and may include, but is not limited to, random access memory and / or read-only storage devices.
[0072] Software elements may be located in the working memory 614, including but not limited to an operating system 616, one or more application programs 618, drivers, and / or other data and code. Instructions for performing the above methods, operations, and steps may be included in one or more application programs 618. The executable code or source code of the instructions of the software elements may be stored in a non-transitory computer-readable storage medium, such as the storage device 610 described above, and may be read into the working memory 614 by compilation and / or installation. The executable code or source code of the instructions of the software elements may also be downloaded from a remote location.
[0073] It should also be understood that changes can be made according to specific requirements. For example, custom hardware can also be used, and / or specific elements can be implemented with hardware, software, firmware, middleware, microcode, hardware description language or any combination thereof. In addition, connections with other computing devices such as network input / output devices can be adopted. For example, some or all of the methods or devices according to the embodiments of the present disclosure can be implemented by using programming hardware (for example, including a field programmable gate array (FPGA) and / or a programmable logic array (PLA)) in assembly language or hardware programming language (such as VERILOG, VHDL, C++) according to the logic and algorithm of the present disclosure.
[0074] It should also be understood that the components of system 600 can be distributed over a network. For example, some processing can be performed using one processor, while other processing can be performed by another processor remote from the one processor. Other components of system 600 can also be similarly distributed. In this way, system 600 can be interpreted as a distributed computing system that performs processing at multiple locations.
[0075] In addition, the embodiments of the present disclosure may also include the following examples:
[0076] 1. A method for detecting the currency type of a coin, comprising:
[0077] receiving an image of a coin to be inspected to form an input image; and
[0078] Input the input image into the trained classification model to obtain the currency type of the coin to be detected.
[0079] The classification model includes a first classification model trained based on a first training sample set and a second classification model trained based on a second training sample set. The first training sample set is obtained by performing a first random sampling on an image set containing collected images of various currencies, and the second training sample set is obtained by performing a second random sampling on the image set. The first random sampling has the same sampling probability for each image in the image set, and the second random sampling has the same sampling probability for each currency in the image set.
[0080] Wherein, obtaining the currency type of the coin to be detected includes: obtaining the currency type of the coin to be detected based on outputs of both the first classification model and the second classification model.
[0081] 2. According to the method described in 1, the currency type of the coins to be tested is obtained based on the outputs of both the first classification model and the second classification model, including: averaging the scores of each currency type output by the first classification model with the scores of the corresponding currency type output by the second classification model to obtain a comprehensive score for each currency type, and determining the currency type of the coins to be tested based on the comprehensive scores for each currency type.
[0082] 3. The method according to item 1, further comprising:
[0083] The front side image and the back side image of the coin to be detected are spliced to form the input image.
[0084] 4. The method according to 3, wherein the splicing includes left-right splicing or four-grid splicing.
[0085] 5. The method according to item 1, further comprising:
[0086] The circular image area corresponding to the coin part in the image of the coin to be detected is rectangularly expanded to obtain a rectangular expansion image corresponding to the coin part, and the input image is formed according to the rectangular expansion image.
[0087] 6. The method according to 5, further comprising:
[0088] Respectively performing the rectangular expansion on the front side image and the back side image of the coin to be detected to obtain a front side rectangular expansion image corresponding to the front side portion of the coin and a back side rectangular expansion image corresponding to the back side portion of the coin; and
[0089] The front rectangular unfolded image and the back rectangular unfolded image are spliced to form the input image.
[0090] 7. The method according to 6, wherein the splicing comprises:
[0091] The long sides of the front rectangular unfolded image and the long sides of the back rectangular unfolded image are spliced oppositely to form the input image.
[0092] 8. The method according to item 6, further comprising: before the splicing, horizontally mirroring and / or vertically mirroring at least one of the front rectangular unfolded image and the back rectangular unfolded image.
[0093] 9. The method according to claim 6, wherein the splicing comprises:
[0094] The long sides of the front rectangular unfolded image, the long sides of the back rectangular unfolded image, the long sides of the horizontal mirror image and / or the vertical mirror image of the front rectangular unfolded image, and the long sides of the horizontal mirror image and / or the vertical mirror image of the back rectangular unfolded image are relatively spliced to form the input image.
[0095] 10. The method according to 6, wherein the splicing is a first splicing, and the method further comprises:
[0096] The front rectangular development image is secondly spliced with itself or its mirror image, and the reverse rectangular development image is secondly spliced with itself or its mirror image to form the input image.
[0097] 11. The method according to 10, wherein the second splicing comprises:
[0098] Join the short side of the unfolded image to the short side of itself or its mirror image opposite to each other.
[0099] 12. The method according to item 1, further comprising:
[0100] The received image of the coin to be detected is subjected to background removal processing to form the input image.
[0101] 13. The method according to item 1, wherein the first classification model or the second classification model comprises:
[0102] A first sub-model for detecting the country of coins, and a plurality of second sub-models connected to the output of the first sub-model for detecting the types of coins of respective countries respectively; or
[0103] A single model for detecting the country of a coin and the type of coin.
[0104] 14. A method for detecting the denomination of a coin, comprising:
[0105] receiving an image of a coin to be inspected;
[0106] Expanding the circular image area corresponding to the coin part in the image of the coin to be detected into a rectangular shape to obtain a rectangular expansion image corresponding to the coin part;
[0107] forming an input image according to the rectangular development image; and
[0108] The input image is input into the trained classification model to obtain the currency type of the coin to be detected.
[0109] 15. The method according to 14, further comprising:
[0110] Respectively performing the rectangular expansion on the front side image and the back side image of the coin to be detected to obtain a front side rectangular expansion image corresponding to the front side portion of the coin and a back side rectangular expansion image corresponding to the back side portion of the coin; and
[0111] The front rectangular unfolded image and the back rectangular unfolded image are spliced to form the input image.
[0112] 16. The method according to 15, wherein the splicing comprises:
[0113] The long sides of the front rectangular unfolded image and the long sides of the back rectangular unfolded image are spliced oppositely to form the input image.
[0114] 17. The method according to 15 further includes: before the splicing, horizontally mirroring and / or vertically mirroring at least one of the front rectangular unfolded image and the back rectangular unfolded image.
[0115] 18. The method according to 15, wherein the splicing comprises:
[0116] The long sides of the front rectangular unfolded image, the long sides of the back rectangular unfolded image, the long sides of the horizontal mirror image and / or the vertical mirror image of the front rectangular unfolded image, and the long sides of the horizontal mirror image and / or the vertical mirror image of the back rectangular unfolded image are relatively spliced to form the input image.
[0117] 19. The method according to 15, wherein the splicing is a first splicing, and the method further comprises:
[0118] The front rectangular development image is secondly spliced with itself or its mirror image, and the reverse rectangular development image is secondly spliced with itself or its mirror image to form the input image.
[0119] 20. The method according to 19, wherein the second splicing comprises:
[0120] Join the short side of the unfolded image to the short side of itself or its mirror image opposite to each other.
[0121] 21. The method according to 14, wherein:
[0122] The classification model includes a first classification model trained based on a first training sample set and a second classification model trained based on a second training sample set, wherein the first training sample set is obtained by performing a first random sampling on an image set containing collected images of various currencies, and the second training sample set is obtained by performing a second random sampling on the image set, wherein the first random sampling has the same sampling probability for each image in the image set, and the second random sampling has the same sampling probability for each currency in the image set.
[0123] Obtaining the currency type of the coin to be detected includes: obtaining the currency type of the coin to be detected based on outputs of both the first classification model and the second classification model.
[0124] 22. The method according to 21, wherein obtaining the currency type of the coins to be tested based on the outputs of both the first classification model and the second classification model includes: averaging the scores of each currency type output by the first classification model with the scores of the corresponding currency type output by the second classification model to obtain a comprehensive score for each currency type, and determining the currency type of the coins to be tested based on the comprehensive scores for each currency type.
[0125] 23. The method according to 14, further comprising:
[0126] The received image of the coin to be detected is subjected to background removal processing to form the input image.
[0127] 24. The method according to 14, wherein the classification model comprises:
[0128] A first sub-model for detecting the country of coins, and a plurality of second sub-models connected to the output of the first sub-model for detecting the types of coins of respective countries respectively; or
[0129] A single model for detecting the country of a coin and the type of coin.
[0130] 25. A method for training a classification model for detecting coin denominations, comprising:
[0131] Creating an image set involving coin images of multiple currencies;
[0132] Performing a first random sampling on the image set to obtain a first training sample set, wherein the first random sampling has the same sampling probability for each image in the image set;
[0133] Performing a second random sampling on the image set to obtain a second training sample set, wherein the sampling probability of the second random sampling for each currency type in the image set is the same;
[0134] A first classification model for detecting coin denominations is obtained by training based on the first training sample set, and a second classification model for detecting coin denominations is obtained by training based on the second training sample set; and
[0135] The classification model is obtained by combining the first classification model and the second classification model.
[0136] 26. The method according to 25, wherein the classification model obtained by combining the first classification model and the second classification model includes: averaging the score of each currency output by the first classification model with the score of the corresponding currency output by the second classification model to obtain a comprehensive score of each currency, and determining the output of the classification model based on the comprehensive score of each currency.
[0137] 27. The method according to 25, further comprising:
[0138] Create a pre-training set containing unlabeled coin images;
[0139] Pre-training the neural network using the pre-training set; and
[0140] The pre-trained neural network is trained based on a first training sample set to obtain a first classification model, and the pre-trained neural network is trained based on a second training sample set to obtain a second classification model.
[0141] 28. The method of 27, wherein the pre-training uses a self-supervised approach.
[0142] 29. The method according to 25, wherein establishing the image set comprises:
[0143] The obverse image and the reverse image of the coin are stitched together to form an image in the image set.
[0144] 30. The method according to 29, wherein the splicing includes left-right splicing or four-grid splicing.
[0145] 31. The method according to 25, wherein establishing the image set comprises:
[0146] The circular image area corresponding to the coin part in the coin image is expanded into a rectangle to obtain a rectangular expansion image corresponding to the coin part, and the image in the image set is formed according to the rectangular expansion image.
[0147] 32. The method according to 31, wherein establishing the image set further comprises:
[0148] Performing the rectangular expansion on the front side image and the back side image of the coin respectively, so as to obtain a front side rectangular expansion image corresponding to the front side portion of the coin and a back side rectangular expansion image corresponding to the back side portion of the coin respectively; and
[0149] The front rectangular unfolded image and the back rectangular unfolded image are spliced together to form an image in the image set.
[0150] 33. The method according to 32, wherein the splicing comprises:
[0151] The long sides of the front rectangular development image and the long sides of the back rectangular development image are relatively spliced to form the image in the image set.
[0152] 34. The method according to 32 further comprises: before the splicing, horizontally mirroring and / or vertically mirroring at least one of the front rectangular unfolded image and the back rectangular unfolded image.
[0153] 35. The method according to 32, wherein the splicing comprises:
[0154] The long sides of the front rectangular unfolded image, the long sides of the back rectangular unfolded image, the long sides of the horizontal mirror image and / or the vertical mirror image of the front rectangular unfolded image, and the long sides of the horizontal mirror image and / or the vertical mirror image of the back rectangular unfolded image are relatively spliced to form images in the image set.
[0155] 36. The method according to 32, wherein the splicing is a first splicing, and the method further comprises:
[0156] The front rectangular development image is secondly spliced with itself or its mirror image, and the reverse rectangular development image is secondly spliced with itself or its mirror image to form an image in the image set.
[0157] 37. The method according to 36, wherein the second splicing comprises:
[0158] Join the short side of the unfolded image to the short side of itself or its mirror image opposite to each other.
[0159] 38. The method according to 25, wherein establishing the image set comprises:
[0160] The coin images are subjected to background subtraction processing to form images in the image set.
[0161] 39. A method for training a classification model for detecting coin denominations, comprising:
[0162] Collect coin images involving multiple currencies;
[0163] Expanding the circular image area corresponding to the coin part in the coin image into a rectangle to obtain a rectangular expansion image corresponding to the coin part, and establishing an image set according to the rectangular expansion image; and
[0164] A classification model for detecting coin denominations is obtained through training based on the image set.
[0165] 40. The method according to 39, wherein establishing an image set according to the rectangular unfolded image comprises:
[0166] Performing the rectangular expansion on the front side image and the back side image of the coin respectively, so as to obtain a front side rectangular expansion image corresponding to the front side portion of the coin and a back side rectangular expansion image corresponding to the back side portion of the coin respectively; and
[0167] The front rectangular unfolded image and the back rectangular unfolded image are spliced together to form an image in the image set.
[0168] 41. The method according to 40, wherein the splicing comprises:
[0169] The long sides of the front rectangular development image and the long sides of the back rectangular development image are relatively spliced to form the image in the image set.
[0170] 42. The method according to 40, wherein establishing an image set based on the rectangular unfolded image further comprises: before the stitching, horizontally mirroring and / or vertically mirroring at least one of the front rectangular unfolded image and the back rectangular unfolded image.
[0171] 43. The method according to 40, wherein the splicing comprises:
[0172] The long sides of the front rectangular unfolded image, the long sides of the back rectangular unfolded image, the long sides of the horizontal mirror image and / or the vertical mirror image of the front rectangular unfolded image, and the long sides of the horizontal mirror image and / or the vertical mirror image of the back rectangular unfolded image are relatively spliced to form images in the image set.
[0173] 44. The method according to 40, wherein the stitching is a first stitching, and establishing an image set according to the rectangular expansion image further comprises:
[0174] The front rectangular development image is secondly spliced with itself or its mirror image, and the reverse rectangular development image is secondly spliced with itself or its mirror image to form an image in the image set.
[0175] 45. The method according to 44, wherein the second splicing comprises:
[0176] Join the short side of the unfolded image to the short side of itself or its mirror image opposite to each other.
[0177] 46. The method according to 39, wherein the classification model is obtained based on the image set training, comprising:
[0178] Performing a first random sampling on the image set to obtain a first training sample set, wherein the first random sampling has the same sampling probability for each image in the image set;
[0179] Performing a second random sampling on the image set to obtain a second training sample set, wherein the sampling probability of the second random sampling for each currency type in the image set is the same;
[0180] A first classification model for detecting coin denominations is obtained by training based on the first training sample set, and a second classification model for detecting coin denominations is obtained by training based on the second training sample set; and
[0181] The classification model is obtained by combining the first classification model and the second classification model.
[0182] 47. The method according to 46, wherein the classification model obtained by combining the first classification model and the second classification model includes: averaging the score of each currency output by the first classification model with the score of the corresponding currency output by the second classification model to obtain a comprehensive score of each currency, and determining the output of the classification model based on the comprehensive score of each currency.
[0183] 48. The method according to 39, further comprising:
[0184] Create a pre-training set containing unlabeled coin images;
[0185] Pre-training the neural network using the pre-training set; and
[0186] The pre-trained neural network is trained based on the image set to obtain the classification model.
[0187] 49. A method according to 48, wherein the pre-training uses a self-supervised approach.
[0188] 50. The method according to 39, further comprising:
[0189] Before the rectangle is expanded, the coin image is subjected to background subtraction.
[0190] 51. The method according to claim 39, wherein the classification model comprises:
[0191] A first sub-model for detecting the country of coins, and a plurality of second sub-models connected to the output of the first sub-model for detecting the types of coins of respective countries respectively; or
[0192] A single model for detecting the country of a coin and the type of coin.
[0193] 52. A method for training a classification model for detecting coin denominations, comprising:
[0194] Establishing a labeled image set of coin images involving multiple currencies, wherein each coin image is labeled with currency information;
[0195] Establishing an unlabeled image set including a plurality of coin images, wherein each coin image is not labeled with currency information, wherein the number of coin images in the unlabeled image set is greater than the number of coin images in the labeled image set; and
[0196] A neural network is trained based on both the labeled image set and the unlabeled image set to obtain a classification model for detecting coin denominations.
[0197] 53. The method according to 52, wherein training the neural network based on both the labeled image set and the unlabeled image set comprises:
[0198] Training the neural network based on the labeled image set to obtain a starting model;
[0199] Using the starting model to perform currency detection on the coin images in the unlabeled image set to obtain a first pseudo label for the coin images in the unlabeled image set;
[0200] Training the starting model using a combination of at least a portion of the unlabeled image set with the first pseudo label and at least a portion of the labeled image set to obtain an intermediate model;
[0201] Using the intermediate model to perform currency type detection on the coin images in the unlabeled image set to obtain second pseudo labels for the coin images in the unlabeled image set; and
[0202] The intermediate model is trained using a combination of at least a portion of the unlabeled image set with a second pseudo label and at least a portion of the labeled image set to obtain the classification model.
[0203] 54. The method according to 52, wherein training the neural network based on both the labeled image set and the unlabeled image set comprises:
[0204] Pre-training the neural network using a self-supervised approach based on a set of unlabeled images; and
[0205] The pre-trained neural network is fine-tuned based on the labeled image set to obtain a classification model for detecting coin denominations.
[0206] 55. A non-temporary computer-readable storage medium, wherein a series of computer-executable instructions are stored on the non-temporary computer-readable storage medium, and when the series of computer-executable instructions are executed by one or more computing devices, the one or more computing devices perform a method as described in any one of 1-24.
[0207] Although various aspects of the present disclosure have been described so far with reference to the accompanying drawings, the above-described methods, systems, and devices are merely illustrative examples, and the scope of the present disclosure is not limited by these aspects, but only by the following aspects: the attached claims and their equivalents. Various elements may be omitted or replaced with equivalent elements. In addition, the steps may be performed in an order different from the order described in the present disclosure. In addition, various elements may be combined in various ways. It is also important to note that as technology develops, many of the elements described may be replaced by equivalent elements that appear after the present disclosure.
Claims
1. A method for detecting the currency type of a coin, comprising: receiving an image of a coin to be detected to form an input image; as well as Input the input image into the trained classification model to obtain the currency type of the coin to be detected. The classification model includes a first classification model trained based on a first training sample set and a second classification model trained based on a second training sample set. The first training sample set is obtained by performing a first random sampling on an image set containing collected images of various currencies, and the second training sample set is obtained by performing a second random sampling on the image set. The first random sampling has the same sampling probability for each image in the image set, and the second random sampling has the same sampling probability for each currency in the image set. Wherein, obtaining the currency type of the coin to be detected includes: obtaining the currency type of the coin to be detected based on outputs of both the first classification model and the second classification model.
2. The method according to claim 1, wherein: Obtaining the currency type of the coin to be detected based on the outputs of both the first classification model and the second classification model includes: averaging the score of each currency type output by the first classification model with the score of the corresponding currency type output by the second classification model to obtain a comprehensive score of each currency type, and determining the currency type of the coin to be detected based on the comprehensive score of each currency type.
3. The method according to claim 1, further comprising: The front side image and the back side image of the coin to be detected are spliced to form the input image.
4. The method according to claim 3, wherein: The splicing includes left-right splicing or four-grid splicing.
5. The method according to claim 1, further comprising: The circular image area corresponding to the coin part in the image of the coin to be detected is rectangularly expanded to obtain a rectangular expansion image corresponding to the coin part, and the input image is formed according to the rectangular expansion image.
6. The method according to claim 5, further comprising: Respectively performing the rectangular expansion on the front side image and the back side image of the coin to be detected to obtain a front side rectangular expansion image corresponding to the front side portion of the coin and a back side rectangular expansion image corresponding to the back side portion of the coin; and The front rectangular unfolded image and the back rectangular unfolded image are spliced to form the input image.
7. A method for detecting the currency type of a coin, comprising: receiving an image of a coin to be inspected; Expanding the circular image area corresponding to the coin part in the image of the coin to be detected into a rectangular shape to obtain a rectangular expansion image corresponding to the coin part; forming an input image according to the rectangular expansion image; as well as The input image is input into the trained classification model to obtain the currency type of the coin to be detected.
8. A method for training a classification model for detecting coin denominations, comprising: Creating an image set involving coin images of multiple currencies; Performing a first random sampling on the image set to obtain a first training sample set, wherein the first random sampling has the same sampling probability for each image in the image set; Performing a second random sampling on the image set to obtain a second training sample set, wherein the sampling probability of the second random sampling for each currency type in the image set is the same; A first classification model for detecting coin denominations is obtained by training based on the first training sample set, and a second classification model for detecting coin denominations is obtained by training based on the second training sample set; and The classification model is obtained by combining the first classification model and the second classification model.
9. A method for training a classification model for detecting coin denominations, comprising: Collect coin images involving multiple currencies; Expanding the circular image area corresponding to the coin part in the coin image into a rectangle to obtain a rectangular expansion image corresponding to the coin part, and establishing an image set according to the rectangular expansion image; as well as A classification model for detecting coin denominations is obtained through training based on the image set.
10. A method for training a classification model for detecting coin denominations, comprising: Establishing a labeled image set of coin images involving multiple currencies, wherein each coin image is labeled with currency information; Establishing an unlabeled image set including a plurality of coin images, wherein each coin image is not labeled with currency information, wherein the number of coin images in the unlabeled image set is greater than the number of coin images in the labeled image set; as well as A neural network is trained based on both the labeled image set and the unlabeled image set to obtain a classification model for detecting coin denominations.
