Method for detecting coin attributes based on neural network model
By receiving and comparing two photographed images of the coin, using a neural network model to detect whether the coin is flipped over, and combining the training sample set of front and back images, it solves the problems of inaccurate coin attribute detection and difficulty in same-side detection in the existing technology. Implemented more accurate coin attribute detection.
Patent Information
- Application Number
- CN202310342876.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-27
- Publication Date
- 2024-09-27
AI Technical Summary
The existing technology is difficult to combine the information on the front and the back of the coin when detecting coin attributes, resulting in inaccurate detection results, and it is difficult to distinguish whether the two input photos are of the same side, affecting the detection accuracy.
By receiving the first coin image and prompting the user to flip it over and taking another photo, it receives the second coin image, uses the trained neural network model to detect whether the two images are the same side, and decides whether to perform coin attribute detection based on the detection results. When training the neural network model, the front and back images of the coin are combined as samples, labeled as unturned or turned over, and a sample set is constructed to improve the model's recognition ability.
The accuracy and precision of coin detection are improved, ensuring that coin attributes can be accurately detected and output when the two photos input by the user are of different sides, and the recognition ability of the model is enhanced.
Smart Images

Figure CN118711033A
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 attributes based on a neural network model and a method for training a neural network model. Background Art
[0002] As applications using artificial intelligence technologies become more popular, there are more and more application demands, such as detecting coin properties, such as coin appearance, by inputting coin images into applications installed in client devices. Summary of the invention
[0003] One of the purposes of the present disclosure is to provide a method for detecting coin attributes based on a neural network model and a method for training a neural network model.
[0004] According to a first aspect of the present disclosure, a method for detecting coin attributes based on a neural network model is provided, comprising: receiving a first coin image; outputting information to prompt a user to turn the coin over and take a photo again, and receiving a second coin image; inputting both the first coin image and the second coin image into a trained first neural network model to detect whether the second coin image is not turned over relative to the first coin image; in response to the detection result indicating that the second coin image is not turned over relative to the first coin image, outputting information again to prompt the user to turn the coin over and take a photo again; and in response to the detection result indicating that the second coin image is turned over relative to the first coin image, inputting both the first coin image and the second coin image into a trained second neural network model to detect coin attributes, and outputting the detected coin attributes.
[0005] According to a second aspect of the present disclosure, a method for training a neural network model is provided, wherein the neural network model is used to detect whether two coin images inputted are of the same side, wherein the method comprises a first process for constructing a sample set, wherein the first process comprises: collecting a front image and a back image of each coin in a plurality of coins to form an original image set, wherein the plurality of coins comprises N kinds of coins, wherein the lth coin in the N kinds of coins comprises K l coins, of which N and K lare all positive integers, l=1, 2, ... N; select the front image and the back image of the first coin among the multiple coins and the front image and the back image of the second coin among the multiple coins from the original image set; put the combination of the front image of the first coin and itself, the combination of the back image of the first coin and itself, the combination of the front image of the second coin and itself, and the combination of the back image of the second coin and itself as corresponding image samples into the first sample subset; and put the combination of the front image of the first coin and the back image of the first coin, the combination of the front image of the first coin and the back image of the second coin, the combination of the front image of the second coin and the back image of the second coin, and the combination of the front image of the second coin and the back image of the first coin as corresponding image samples into the second sample subset; in response to the first coin and the second coin attributes For coins of the same kind, a combination of the obverse image of the first coin and the obverse image of the second coin, and a combination of the reverse image of the first coin and the reverse image of the second coin are put into a first sample subset as corresponding image samples; and in response to the first coin and the second coin belonging to different kinds of coins, a combination of the obverse image of the first coin and the obverse image of the second coin, and a combination of the reverse image of the first coin and the reverse image of the second coin are put into a second sample subset as corresponding image samples, wherein the image samples in the first sample subset are all annotated with a first value to indicate that the first image of the two images of the corresponding image sample has not been turned over relative to the second image, and the image samples in the second sample subset are all annotated with a second value to indicate that the first image of the two images of the corresponding image sample has been turned over relative to the second image, and the first sample subset and the second sample subset constitute the sample set.
[0006] According to a third aspect of the present disclosure, a method for training a neural network model is provided, wherein the neural network model is used to detect whether two coin images inputted are of the same side, wherein the method comprises a first process for constructing a sample set, wherein the first process comprises: collecting a front image and a back image of each coin in a plurality of coins to form an original image set, wherein the plurality of coins comprises N kinds of coins, wherein the lth coin in the N kinds of coins comprises K l coins, of which N and K lare all positive integers, l=1,2,…N; the front image of each coin and its combination, the back image of each coin and its combination, the front image of each coin and the front images of other individual coins of the same kind, and the back image of each coin and the back images of other individual coins of the same kind are taken as image samples in the first sample subset; the front image of each coin and the back image of the coin, the front image of each coin and the back images of other individual coins of the same kind, the back image of each coin and the front images of other individual coins of the same kind, and the combination of any two images of coins of different kinds are taken as image samples in the second sample subset, wherein the image samples in the first sample subset are all marked with a first value to indicate that the first image of the two images of the corresponding image sample has not been turned over relative to the second image, and the image samples in the second sample subset are all marked with a second value to indicate that the first image of the two images of the corresponding image sample has been turned over relative to the second image, and the first sample subset and the second sample subset constitute the sample set.
[0007] According to a fourth aspect of the present disclosure, a non-temporary computer-readable storage medium is provided, characterized in that 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 the method as described above.
[0008] 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
[0009] 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.
[0010] The present disclosure may be more clearly understood from the following detailed description with reference to the accompanying drawings, in which:
[0011] Figure 1 The figure is an exemplary flow chart of a method for detecting coin attributes based on a neural network model according to an embodiment of the present disclosure.
[0012] FIG. 2A to FIG. 2C Schematic diagram of a method for training a neural network model according to an embodiment of the present disclosure.
[0013] FIG. 3A to FIG. 3D Schematic diagram of a method for training a neural network model according to an embodiment of the present disclosure.
[0014] Figure 4 Schematic diagram of a method for training a neural network model according to an embodiment of the present disclosure.
[0015] Figure 5 Schematic diagram of the front and back images of a coin in an embodiment of the present disclosure.
[0016] Figure 6 The present invention is a structural diagram of at least a part of a system for detecting coin attributes based on a neural network model according to an embodiment of the present disclosure.
[0017] Figure 7 The present invention is a structural diagram of at least a part of a system for detecting coin attributes based on a neural network model according to an embodiment of the present disclosure.
[0018] Figure 8 The present invention is a structural diagram of at least a part of a system for detecting coin attributes based on a neural network model according to an embodiment of the present disclosure.
[0019] Fig. 9 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.
[0020] 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
[0021] 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.
[0022] 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.
[0023] 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.
[0024] 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.
[0025] 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.
[0026] 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.
[0027] 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.
[0028] 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.
[0029] The inventor of the present application has found that when detecting the attributes of a coin, it is necessary to combine the information of both the front and back sides of the coin to give a more accurate detection result. Therefore, it is proposed that after the user inputs the first coin image, the user is prompted to turn the coin over and take another photo. In addition, in order to prevent the user from inputting two photos that are actually the same side of the coin, the two input coin images are also tested to see if they are the same side. Figure 1FIG. 1 is an exemplary flow chart of a method 100 for detecting coin attributes based on a neural network model according to an embodiment of the present disclosure. The method 100 may include the following steps.
[0030] In step 110, the application receives a first coin image; in step 120, the application outputs information to prompt the user to turn the coin over and take a photo again, and receives a second coin image in step 130. In step 140, both the first coin image and the second coin image are input into a trained first neural network model (also referred to herein as a "coin flip detection model") to detect whether the second coin image is not flipped relative to the first coin image. If the detection result indicates that the second coin image is not flipped relative to the first coin image, the application again outputs information to prompt the user to turn the coin over and take a photo again (step 150), and may, for example, return to step 130 to receive the second coin image again. If the detection result indicates that the second coin image is flipped relative to the first coin image, both the first coin image and the second coin image are input into a trained second neural network model (also referred to herein as a "coin attribute detection model") to perform coin attribute detection (step 160), and output the detected coin attribute (step 170). The first neural network model is trained based on the method described below.
[0031] In some embodiments, the coin flip detection model can output a binary result. For example, an output of 1 can indicate that one of the two input images is not flipped over relative to the other; an output of 0 can indicate that one of the two input images is flipped over relative to the other. In some embodiments, the coin flip detection model can output the similarity of the two input images, for example, the output similarity can be a value mapped to the interval [0,1]. A similarity threshold can be set. When the similarity indicated by the output result of the coin flip detection model is greater than the threshold, it can be considered that one of the two input images is not flipped over relative to the other; when the similarity indicated by the output result of the coin flip detection model is not greater than the threshold, it can be considered that one of the two input images is flipped over relative to the other.
[0032] Figure 6The structure diagram of at least a part of the system 300 for detecting coin attributes based on a neural network model according to an embodiment of the present disclosure. The system 300 can be used to execute the method 100 described above. The system 300 includes an input device 310, a computing device 320, and an output device 330. The input device 310 is configured to receive the first and second coin images, for example, from a memory or a camera. The computing device 320 is configured to: input both the first coin image and the second coin image into the trained first neural network model to detect whether the second coin image is not turned over relative to the first coin image; in response to the detection result indicating that the second coin image is not turned over relative to the first coin image, output information again through the output device 330 to prompt the user to turn the coin over and take a photo again; and in response to the detection result indicating that the second coin image is turned over relative to the first coin image, input both the first coin image and the second coin image into the trained second neural network model to detect coin attributes. The output device 330 is configured to output information to prompt the user to turn the coin over and take a photo again, and output the detected coin attributes.
[0033] In some embodiments, the above-mentioned first and second neural network models, i.e., the coin flip detection model and the coin attribute detection model, can both be deployed in a server device. In these embodiments, the input device 310 and the output device 330 can be included in the client device, and the computing device 320 can be included in the server device. After the client device acquires the first and second coin images, the first and second coin images are transmitted to the server device to complete the flip detection or coin attribute detection on the server device. After the server device completes the detection, the detection result is transmitted to the client device so that the client device outputs the corresponding information.
[0034] In some embodiments, at least one of the coin flip detection model and the coin attribute detection model can be deployed in a client device. In these embodiments, the input device 310 and the output device 330 can be included in the client device, and at least part of the computing device 320 can also be included in the client device. The client device can include an electronic device such as a computer, a tablet computer, a mobile phone, etc. The electronic device can be used as a client device for executing the method 100 by installing a client version for executing an application.
[0035] It should be understood that any model can be deployed in both the client device and the server device. For example, a large model with a large number of parameters can be deployed in the server device, and a small model with a smaller number of parameters that performs the same function as the large model can be deployed in the client device. In this way, when the client device cannot connect to the server, such as when the network is unavailable, the model can be used for detection on the client side; and when the server can be connected, the model can be used for detection on the server side.
[0036] Any one of the coin flipping detection model and the coin attribute detection model may be an integration of multiple models. Any suitable method may be used for model integration, for example, voting method, averaging method, stacking method, non-cross stacking method, etc.
[0037] The inventor of the present application also found that in the training of the coin flip detection model, if the samples of the front image marked as the front of the coin and the samples of the back image marked as the back of the coin are used to train the coin flip detection model, so that it can respectively identify the front or back of the coin in the two images, and then judge whether the two images have been flipped relative to each other based on the recognition result, the detection effect of the coin flip detection model is not ideal. Therefore, the inventor also proposed a training method for the coin flip detection model to be described below. That is, the combination of the two images is used as a sample for overall annotation. If the two images are the same side of the same coin, they are marked as not flipped; if the two images are different sides of the same coin or are from different types of coins, they are marked as not flipped. It has been verified that the coin flip detection model trained by the method for training the neural network model according to the embodiment of the present disclosure to be described below has a high recognition accuracy and good detection effect.
[0038] FIG. 2A to FIG. 2C It is a schematic diagram of a method for training a neural network model according to an embodiment of the present disclosure. The method is applicable to training the first neural network model described above, also referred to herein as a "coin flip detection model." The model is used to detect whether one of the two input coin images has been flipped relative to the other. The coin flip detection model M includes a basic network structure and an output layer connected to the basic network structure. The basic network structure can be selected based on actual computing resources. For example, it can be a general convolutional neural network, including but not limited to the ResNet series, EfficientNet series, ConvNext series, or a Transformer network, including but not limited to the ViT series, etc., or an independently designed neural network structure. The input layer in the basic network structure needs to be modified to be able to simultaneously receive two images as inputs to the basic network structure. The output layer is constructed to be able to output two feature vectors corresponding to the two input images, such as Figure 4 shown.
[0039] The training of the coin flipping detection model M first includes the process of constructing a sample set. In this process, images need to be collected to form Figure 2AThe original image set shown. Specifically, the front image and the back image of each coin in the plurality of coins are collected to form the original image set. It should be noted that the "front" or "back" of a coin referred to in this article does not distinguish the actual front and back of the coin, but only refers to one side of the coin and the other side opposite thereto (for the sake of language simplicity). Figure 5 Take the two images of a coin shown in Figure 1 as an example. Usually, the side with the left image (the side with the person) is called the front side of the coin, and the side with the right image (the side with the building) is called the back side of the coin. Figure 5 The image on the left is called the front image of the coin, and the image on the right is called the back image of the coin; the image on the left can also be called the back image of the coin, and the image on the right is called the front image of the coin.
[0040] The plurality of coins include N kinds of coins, where N is a positive integer. In this article, the same kind of coins refers to coins with the same pattern template on the coin surface. Correspondingly, different kinds of coins refer to coins with different pattern templates on the coin surface. As for coins of the same version but produced in different years, they can be classified as different kinds of coins (because the "year" part of the pattern on the coin surface is different), or they can be classified as the same kind of coins (because most of the patterns on the coin surface are the same). Each of the N kinds of coins (for example, the lth kind, l = 1, 2, ... N) includes K l coins, of which K l is a positive integer. That is, in the original image set, each coin may include one or more coin individuals, and the number of coin individuals contained in any two coins may be the same or different. In the case where an image of a coin contains multiple coin individual images, it may be images containing individuals with different appearance grades (for example, different degrees of wear), or it may be images containing individuals with the same or similar appearance grades but different image clarity, color temperature, light conditions for taking pictures, etc.
[0041] After the original image set is formed, the sample set can be constructed. It should be noted that the samples in the constructed sample set can be used for model training or for testing the accuracy of model output. As described above, each image sample in the sample set for the coin flip detection model M includes two images (each of which represents one side of a coin) and includes a label representing the annotation value of the image sample. In some embodiments, the label can be a binary label, such as 1 or 0, to respectively indicate that the two images are on the same side (not flipped) or different sides (turned). Therefore, for the sake of simplicity of description, the image sample marked as 1 (not flipped) is called a positive sample, and the image sample marked as 0 (turned) is called a negative sample. In this way, the sample set can include a set of positive samples (also referred to as the "first sample subset" herein) and a set of negative samples (also referred to as the "second sample subset" herein). The image samples in the first sample subset are all marked with a first value, such as a label of 1, to indicate that the first image of the two images of the corresponding image sample is not flipped relative to the second image, so that the positive sample is used to train the model M to recognize that the two images are not flipped. The image samples in the second sample subset are all labeled with a second value, such as a label of 0, to indicate that the first image of the two images of the corresponding image sample has been flipped relative to the second image, so that the negative samples are used to train the model M to recognize that the two images have been flipped relative to each other.
[0042] In some embodiments, the Figure 2B The method 200 shown forms a first sample subset and a second sample subset. From all the multiple coins included in the original image set, two coins are selected (e.g., arbitrarily selected), namely, the first coin and the second coin described below. It should be noted that in order to make full use of the coins collected in the original image set, it is best to select all the coins in the original image set, that is, to achieve a combination of every two coins in all H coins included in the original image set. The first coin selected has a front image and a back image, and the second coin also has a front image and a back image. Figure 2B As shown, the combinations of these images are placed into corresponding sample subsets in the manner described below.
[0043] The following image combinations are put into the first sample subset as corresponding image samples as positive samples for training the coin flipping detection model M:
[0044] A combination of the obverse image of the first coin and itself;
[0045] A combination of an image of the reverse side of the first coin and itself;
[0046] a combination of the obverse image of the second coin and itself; and
[0047] A combination of the reverse image of the second coin and itself.
[0048] In addition, if the first coin and the second coin belong to the same type of coins, the following image combination is also put into the first sample subset as a positive sample:
[0049] a combination of an obverse image of a first coin and an obverse image of a second coin; and
[0050] A combination of an image of the reverse side of a first coin and an image of the reverse side of a second coin.
[0051] The following image combinations are put into the second sample subset as corresponding image samples as negative samples for training the coin flipping detection model M:
[0052] a combination of an obverse image of a first coin and a reverse image of the first coin;
[0053] a combination of an obverse image of a first coin and a reverse image of a second coin;
[0054] a combination of an obverse image of a second coin and a reverse image of the second coin; and
[0055] A combination of the obverse image of the second coin and the reverse image of the first coin.
[0056] In addition, if the first coin and the second coin belong to different types of coins, the following image combination is also put into the second sample subset as a negative sample:
[0057] a combination of an obverse image of a first coin and an obverse image of a second coin; and
[0058] A combination of an image of the reverse side of a first coin and an image of the reverse side of a second coin.
[0059] Reference below FIG. 3A to FIG. 3D , a specific example is used to explain in detail the method for constructing a sample set according to the above embodiment. In this specific example, the total H coins collected include 3 coins, and the N types of coins are 2 in total, of which the first type of coins includes 2 K1 coins, and the second type of coins includes 1 K2 coin. The front image and the back image of each coin form the following Figure 3A The original image set shown. Each image in the original image set is represented by x ima , where the subscript i represents the type of coin, i.e. the i-th coin, and i∈[1,...,N]; the subscript m represents the number of the coin in each coin, i.e. the m-th coin of the i-th coin, and m∈[1,...,K i ]; the subscript a indicates whether the image is the front or back of the coin, a∈[front, back].
[0060] If the first coin and the second coin selected from the original image set are the first coin and the second coin of the first type of coin, that is, the first coin and the second coin are the same type of coins, then Figure 3B According to the above rules, the following image combinations are added as positive samples to the first sample subset: the combination of the front image of the first coin and itself (x 11正 , x 11正 ), the reverse image of the first coin and its combination (x 11反 , x 11反 ), the front image of the second coin and its combination (x 12正 , x 12正 ), the reverse image of the second coin and its combination (x 12反 , x 12反 ), a combination of the obverse image of the first coin and the obverse image of the second coin (x 11正 , x 12正 ), and a combination of the reverse image of the first coin and the reverse image of the second coin (x 11反 , x 12反 ). The following image combination is added as a negative sample to the second sample subset: the combination of the front image of the first coin and the back image of the first coin (x 11正 , x 11反 ), a combination of the front image of the first coin and the back image of the second coin (x 11正 , x 12反 ), a combination of the front image of the second coin and the back image of the second coin (x 12正 , x 12反 ), and a combination of the obverse image of the second coin and the reverse image of the first coin (x 12正 , x 11反 ).
[0061] If the first coin and the second coin selected from the original image set are the first coin of the first type of coin and the first coin of the second type of coin, respectively, that is, the first coin and the second coin are coins of different types, then Figure 3C According to the above rules, the following image combinations are added as positive samples to the first sample subset: the combination of the front image of the first coin and itself (x 11正 , x 11正 ), the reverse image of the first coin and its combination (x 11反 , x 11反 ), the front image of the second coin and its combination (x 21正 , x 21正 ), and the combination of the reverse image of the second coin and itself (x 21反 , x 21反). The following image combination is added as a negative sample to the second sample subset: the combination of the front image of the first coin and the back image of the first coin (x 11正 , x 11反 ), a combination of the front image of the first coin and the back image of the second coin (x 11正 , x 21反 ), a combination of the front image of the second coin and the back image of the second coin (x 21正 , x 21反 ), a combination of the obverse image of the second coin and the reverse image of the first coin (x 21正 , x 11反 ), a combination of the obverse image of the first coin and the obverse image of the second coin (x 11正 , x 21正 ), a combination of the reverse image of the first coin and the reverse image of the second coin (x 11反 , x 21反 ).
[0062] If the first coin and the second coin selected from the original image set are the second coin of the first coin and the first coin of the second coin, respectively, then the first coin and the second coin are different coins, which is equivalent to Figure 3C The front and back images of the first coin of the first type in the example are replaced by the front and back images of the second coin of the first type, respectively. This will not be described in detail here.
[0063] Thus, after selecting every combination of two coins from all three coins included in the original image set, After that, the first sample subset and the second sample subset are formed as follows: Figure 3D shown.
[0064] In some embodiments, the Figure 2C In the illustrated method 200', various combinations of images in the original image set are placed into corresponding sample subsets.
[0065] The following image combinations are put into the first sample subset as corresponding image samples as positive samples for training the coin flipping detection model M:
[0066] The combination of the front image of each coin and itself (x 11正 , x 11正 )、(x 12正 , x 12正 )、(x 21正 , x 21正 );
[0067] The combination of each coin's reverse image and itself (x 11反 , x 11反 )、(x12反 , x 12反 )、(x 21反 , x 21反 );
[0068] The front image of each coin and the combination of the front images of other individual coins of the same type (x 11正 , x 12正 );as well as
[0069] The reverse image of each coin and the combination of the reverse images of other individual coins of the same type (x 11反 , x 12反 ).
[0070] The following image combinations are put into the second sample subset as corresponding image samples as negative samples for training the coin flipping detection model M:
[0071] The combination of the front image of each coin and the back image of the coin (x 11正 , x 11反 )、(x 12正 , x 12反 )、(x 21正 , x 21反 );
[0072] The combination of the obverse image of each coin and the reverse images of other individual coins of the same type (x 11正 , x 12反 )、(x 12正 , x 11反 );
[0073] A combination of the reverse image of each coin and the obverse images of other individual coins of the same type (repeated with the image sample corresponding to the previous rule); and
[0074] The combination of any two images of different coins (x 11正 , x 21正 )、(x 11正 , x 21反 )、(x 11反 , x 21正 )、(x 11反 , x 21反 )、(x 12正 , x 21正 )、(x 12正 , x 21反 )、(x 12反 , x 21正 )、(x 12反 , x 21反 ).
[0075] In accordance with Figure 2CAfter the method 200' shown in the figure puts various combinations of images into corresponding sample subsets, the first sample subset and the second sample subset formed are respectively as follows: Figure 3D shown.
[0076] Depend on Figure 3D It can be seen that in any combination of two images (x ima , x jnb ), if i=j and a=b, the image combination is a same-side image combination and put into the first sample subset; for other combinations (including the case where i=j and a≠b, or the case where i≠j), they are all different-side image combinations and put into the second sample subset. It can be seen that in the process of determining whether an image sample is a positive sample or a negative sample, it is only necessary to consider the type of coin and whether the image is the front and back of the coin, and there is no need to consider the number of the coin in each type (that is, the number of the coin of each type). Therefore, the representation of the image is simplified in the following description, that is, each image in the original image set can be represented as x ia , where the subscript i represents the type of coin, i∈[1,...,N]; the subscript a represents whether the image is the front or back of the coin, a∈[front,back]. Accordingly, an image sample in the sample set, or a combination of two images, can be represented as (x ia , x jb ), where i, j ∈ [1, ..., N], a, b ∈ [positive, negative].
[0077] In the formation of Figure 3D After the first sample subset and the second sample subset are shown, each image sample can be labeled, that is, each image sample (x ia , x jb )Add tags To obtain the sample set Labels of image samples in the first sample subset The value is 1, the label of the image sample in the second sample subset The value is 0, that is, the label Determined according to the following formula:
[0078]
[0079] In some embodiments, the sample data may be augmented to construct a sample set. Figure 3DAs shown, the number of image samples in the first sample subset is less than the number of image samples in the second sample subset. In order to maintain a balance between the number of positive samples and the number of negative samples to optimize the training effect of the model, the first sample subset can be augmented. In addition, since the original images that can be collected are always limited, in order to increase the overall number of samples, the samples in the entire sample set can also be augmented so that the model can see more types of data during training and improve the generalization ability of the model. One or more image samples in the first sample subset and / or the second sample subset can be locally transformed and / or globally transformed to generate one or more new image samples in the corresponding sample subset. The local transformation includes: cutting a local area of the image sample and filling the local area with a pure color, wherein the shape and size of the local area, and the position of the local area in the image sample are randomly determined, and the color of the pure color is also randomly determined. These random determinations can ensure the diversity of samples. The overall transformation includes: a rotation transformation, a mirror transformation, a translation transformation, a noise transformation, a fuzzy transformation (for example, by Gaussian blur, etc.) and a color space transformation. One or a combination of multiple transformations. It should be noted that, regardless of whether the transformation is local or global, the new image samples obtained by the transformation and the original image samples before the transformation should belong to the same sample subset, that is, the new image samples have the same labels as the original image samples. The sample set after augmentation can be used in the subsequent model training process.
[0080] Sample Set The process of training the model can be as follows Figure 4 As shown, it includes: (1) transforming the image pair (x ia ,x jb ) is input into the initialized model M to obtain two vectors Use cosine similarity (or KL divergence, Euclidean distance, etc.) to measure the similarity of two vectors as the similarity result of the two images: (2) Calculate the prediction result y ijab and tags The difference between them is measured by the loss function L, and the loss is obtained. (3) According to the back propagation algorithm and the chain rule, the gradient of the loss with respect to each node in the model is calculated and the model parameters are updated. (4) (1)-(3) are looped until a stopping condition is reached. The stopping condition may be, for example, a preset number of iterations.
[0081] In some embodiments, the coin flip detection model M needs to be deployed in the client device. The model deployed in the client device is limited by the client's capabilities and cannot have a large number of parameters. The prediction effect of a small model with a small number of parameters after training is usually not good. The knowledge distillation method can be used to train the coin flip detection model M with a small number of parameters so that the coin flip detection model M with a small number of parameters can have the same or similar performance as the model with a large number of parameters. A large model M with more parameters can be established first. L , and use the sample set For large model M L For training. L After the prediction effect meets the requirements, the large model M L To guide the training of the coin flipping detection model M with fewer parameters to be deployed on the client device, to adjust the parameters of the coin flipping detection model M. Specifically, the coin flipping detection model M is trained based on the sample set, and during the training, based on the output M(x ia ,x jb ) The predicted result y of the similarity of the two input images determined by ijab With sample labels The difference between the two, and the output M(x ia ,x jb ) and large model M L Output M L (x ia ,x jb ) to determine the loss function Where α is a hyperparameter. This training method can improve the training effect of the small model coin flipping detection model M.
[0082] The large model M used to guide the training of the small model L , can be used only for the training process, that is, not deployed; or can be deployed in the server device. It should be noted that even if the small model has been deployed in the client device, the large model M can be deployed in the server device. L In other words, even if the large model M is deployed in the server device L In this case, the small model can also be deployed in the client device. In this way, when the client device cannot connect to the server, for example, when the network is unavailable, the client can detect whether the coin is flipped; and when the server can be connected, the server can detect whether the coin is flipped. The large model M used to guide the training of the small model LIt can be an integration of multiple models. Any suitable method can be used for model integration, for example, voting method, averaging method, stacking method, non-cross stacking method, etc.
[0083] After the coin flip detection model M is trained, it will be deployed in the server device and / or the client device. After that, the model can be used to detect whether the coin is flipped. For example, two coin images are input, and the similarity of the two images is obtained after the trained coin flip detection model M. The closer the similarity is to 1, the more likely it is that the two images are the same side of the same coin. In actual use, according to the model performance and task requirements, a threshold can be set. When the similarity value of a pair of input images is higher than the threshold, a conclusion of the same side is given, prompting the user to flip the coin.
[0084] Figure 7 4 is a block diagram schematically showing at least a portion of a system 400 for detecting coin attributes based on a neural network model according to an embodiment of the present disclosure. It will be appreciated by those skilled in the art that the system 400 is only an example and should not be considered as limiting the scope of the present disclosure or the features described in the present disclosure. In this example, the 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. The one or more storage devices 410 provide storage services for the one or more electronic devices 420 and the one or more computing devices 430. Although the one or more storage devices 410 are shown in the system 400 as separate boxes independent of the one or more electronic devices 420 and the one or more computing devices 430, it should be appreciated that the one or more storage devices 410 may actually be stored on any of the other entities 420, 430 included in the system 400. Each of the one or more electronic devices 420 and the one or more computing devices 430 may be located at different nodes of the 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 the system 400 may also include Figure 7 Other devices are not shown, each of which is located at a different node of the network or bus 440.
[0085] One or more storage devices 410 may be configured to store any data described above, including but not limited to: input images, sample sets, various models, and detection results, and application files and other data. 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 to users, etc. One or more electronic devices 420 may also be configured to execute one or more steps in method 100.
[0086] 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.
[0087] Each of the one or more electronic devices 420 and the one or more computing devices 430 may be configured to communicate with Figure 8 The system 500 shown is similar, i.e., having one or more processors 510, one or more memories 520, and instructions and data. 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 a business, 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), memory (e.g., RAM and internal hard drive) to store 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 device operable to display information), a mouse, a keyboard, a touch screen, a microphone, a speaker, and / or a network interface device.
[0088] 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.
[0089] Figure 8 Schematically illustrates at least a portion of a system 500 for detecting coin attributes based on a neural network model 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 other device. 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.
[0090] 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.
[0091] 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.
[0092] 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.
[0093] 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, such as image processing of images.
[0094] Although Figure 8Schematically, 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 (not shown) 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.
[0095] Fig. 9 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. 9 Describe 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 300, 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.
[0096] 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.
[0097] 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.
[0098] 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.
[0099] 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.
[0100] 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.
[0101] 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.
[0102] 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.
[0103] 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.
[0104] 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.
[0105] In addition, the embodiments of the present disclosure may also include the following examples:
[0106] 1. A method for detecting coin attributes based on a neural network model, comprising:
[0107] receiving a first coin image;
[0108] Output information to prompt the user to turn the coin over and take another photo, and receive a second coin image;
[0109] Inputting both the first coin image and the second coin image into the trained first neural network model to detect whether the second coin image is not flipped relative to the first coin image;
[0110] In response to the detection result indicating that the second coin image is not turned over relative to the first coin image, outputting information again to prompt the user to turn the coin over and take another photo; and
[0111] In response to the detection result indicating that the second coin image has been turned over relative to the first coin image, both the first coin image and the second coin image are input into the trained second neural network model to perform coin attribute detection, and the detected coin attributes are output.
[0112] 2. The method according to 1, wherein the training process of the first neural network model includes a first process for constructing a sample set, wherein the first process includes:
[0113] The front image and the back image of each coin in a plurality of coins are collected to form an original image set, wherein the plurality of coins include N kinds of coins, and the first coin in the N kinds of coins includes Kl coins, of which N and K l are all positive integers, l = 1, 2, ... N;
[0114] selecting, from the original image set, a front side image and a back side image of a first coin of the plurality of coins and a front side image and a back side image of a second coin of the plurality of coins;
[0115] putting a combination of the obverse image of the first coin and itself, a combination of the reverse image of the first coin and itself, a combination of the obverse image of the second coin and itself, and a combination of the reverse image of the second coin and itself as corresponding image samples into a first sample subset;
[0116] putting a combination of the obverse image of the first coin and the reverse image of the first coin, a combination of the obverse image of the first coin and the reverse image of the second coin, a combination of the obverse image of the second coin and the reverse image of the second coin, and a combination of the obverse image of the second coin and the reverse image of the first coin as corresponding image samples into a second sample subset;
[0117] In response to the first coin and the second coin being of the same kind, placing a combination of the obverse image of the first coin and the obverse image of the second coin, and a combination of the reverse image of the first coin and the reverse image of the second coin as corresponding image samples into a first sample subset; and
[0118] In response to the first coin and the second coin being different coins, a combination of the front image of the first coin and the front image of the second coin, and a combination of the back image of the first coin and the back image of the second coin are put into a second sample subset as corresponding image samples, wherein:
[0119] The image samples in the first sample subset are all labeled with a first value to indicate that the first image of the two images of the corresponding image sample is not flipped relative to the second image,
[0120] The image samples in the second sample subset are all labeled with a second value to indicate that the first image of the two images of the corresponding image sample has been flipped relative to the second image.
[0121] The first sample subset and the second sample subset constitute the sample set.
[0122] 3. The method according to 1, wherein the training process of the first neural network model includes a first process for constructing a sample set, wherein the first process includes:
[0123] The front image and the back image of each coin in a plurality of coins are collected to form an original image set, wherein the plurality of coins include N kinds of coins, and the first coin in the N kinds of coins includes K l coins, of which N and Kl are all positive integers, l = 1, 2, ... N;
[0124] The front image of each coin and its combination, the back image of each coin and its combination, the front image of each coin and its combination, the front image of each coin and the front images of other individual coins of the same type, and the back image of each coin and the back images of other individual coins of the same type are used as corresponding image samples in the first sample subset;
[0125] The combination of the front image of each coin and the back image of the coin, the combination of the front image of each coin and the back images of other individual coins of the same type, the combination of the back image of each coin and the front images of other individual coins of the same type, and the combination of any two images of coins of different types are taken as corresponding image samples in the second sample subset, wherein,
[0126] The image samples in the first sample subset are all labeled with a first value to indicate that the first image of the two images of the corresponding image sample is not flipped relative to the second image,
[0127] The image samples in the second sample subset are all labeled with a second value to indicate that the first image of the two images of the corresponding image sample has been flipped relative to the second image.
[0128] The first sample subset and the second sample subset constitute the sample set.
[0129] 4. The method according to 2 or 3, wherein the first process further comprises:
[0130] One or more image samples in the first sample subset and / or the second sample subset are locally transformed and / or globally transformed to generate one or more new image samples in the corresponding sample subset, wherein:
[0131] The local transformation includes: cutting a local area of the image sample and filling the local area with a solid color, wherein the shape and size of the local area and the position of the local area in the image sample are randomly determined, and the color of the solid color is also randomly determined;
[0132] The overall transformation includes: one or a combination of rotation transformation, mirror transformation, translation transformation, noise transformation, blur transformation and color space transformation.
[0133] 5. The method according to 2 or 3, wherein the training process of the first neural network model further includes a second process for model training, wherein the second process includes:
[0134] Constructing a network structure of a first neural network model so that an input of the first neural network model includes both a first input image and a second input image, and an output of the first neural network model includes a first feature vector corresponding to the first input image and a second feature vector corresponding to the second input image;
[0135] Inputting the image samples in the sample set into the first neural network model, and using the similarity between the output first feature vector and the second feature vector as the prediction result of the first neural network model; and
[0136] The loss function is determined based on the difference between the prediction result of the first neural network model and the labeled value of the image sample.
[0137] 6. The method according to 5, wherein the similarity between the first feature vector and the second feature vector is determined based on cosine similarity, KL divergence or Euclidean distance of the first feature vector and the second feature vector.
[0138] 7. The method according to 5, wherein the first neural network model includes a training model with more parameters and a deployment model to be deployed and with fewer parameters, wherein the second process is used to train the training model, and the training process of the first neural network model further includes a third process for training the deployment model after the output accuracy of the training model meets the condition, wherein the third process includes:
[0139] Inputting the image samples in the sample set into the deployment model, and using the similarity between the output first feature vector and the second feature vector as the prediction result of the deployment model; and
[0140] The loss function is determined based on both the difference between the prediction results of the deployed model and the labeled values of the image samples and the difference between the prediction results of the deployed model and the prediction results of the trained model.
[0141] 8. The method according to 7, wherein the training model is only used to train the deployment model or is also used to be deployed in the server device, and the deployment model is used to be deployed in the client device.
[0142] 9. The method according to 1, wherein the first neural network model is an integration of multiple models.
[0143] 10. The method according to 7 or 8, wherein the training model is an integration of multiple models.
[0144] 11. A method for training a neural network model, the neural network model being used to detect whether two coin images input are of the same side, the method comprising a first process for constructing a sample set, wherein the first process comprises:
[0145] The front image and the back image of each coin in a plurality of coins are collected to form an original image set, wherein the plurality of coins include N kinds of coins, and the first coin in the N kinds of coins includes K l coins, of which N and K l are all positive integers, l = 1, 2, ... N;
[0146] selecting, from the original image set, a front side image and a back side image of a first coin of the plurality of coins and a front side image and a back side image of a second coin of the plurality of coins;
[0147] putting a combination of the obverse image of the first coin and itself, a combination of the reverse image of the first coin and itself, a combination of the obverse image of the second coin and itself, and a combination of the reverse image of the second coin and itself as corresponding image samples into the first sample subset; and
[0148] putting a combination of the obverse image of the first coin and the reverse image of the first coin, a combination of the obverse image of the first coin and the reverse image of the second coin, a combination of the obverse image of the second coin and the reverse image of the second coin, and a combination of the obverse image of the second coin and the reverse image of the first coin as corresponding image samples into a second sample subset;
[0149] In response to the first coin and the second coin being of the same kind, placing a combination of the obverse image of the first coin and the obverse image of the second coin, and a combination of the reverse image of the first coin and the reverse image of the second coin as corresponding image samples into a first sample subset; and
[0150] In response to the first coin and the second coin being different coins, a combination of the front image of the first coin and the front image of the second coin, and a combination of the back image of the first coin and the back image of the second coin are put into a second sample subset as corresponding image samples, wherein:
[0151] The image samples in the first sample subset are all labeled with a first value to indicate that the first image of the two images of the corresponding image sample is not flipped relative to the second image,
[0152] The image samples in the second sample subset are all labeled with a second value to indicate that the first image of the two images of the corresponding image sample has been flipped relative to the second image.
[0153] The first sample subset and the second sample subset constitute the sample set.
[0154] 12. The method according to 11, wherein the first process further comprises:
[0155] One or more image samples in the first sample subset and / or the second sample subset are locally transformed and / or globally transformed to generate one or more new image samples in the corresponding sample subset, wherein:
[0156] The local transformation includes: cutting a local area of the image sample and filling the local area with a solid color, wherein the shape and size of the local area and the position of the local area in the image sample are randomly determined, and the color of the solid color is also randomly determined;
[0157] The overall transformation includes: one or a combination of rotation transformation, mirror transformation, translation transformation, noise transformation, blur transformation and color space transformation.
[0158] 13. The method according to 11, wherein the training process of the first neural network model further includes a second process for model training, wherein the second process includes:
[0159] Constructing a network structure of a first neural network model so that an input of the first neural network model includes both a first input image and a second input image, and an output of the first neural network model includes a first feature vector corresponding to the first input image and a second feature vector corresponding to the second input image;
[0160] Inputting the image samples in the sample set into the first neural network model, and using the similarity between the output first feature vector and the second feature vector as the prediction result of the first neural network model; and
[0161] The loss function is determined based on the difference between the prediction result of the first neural network model and the labeled value of the image sample.
[0162] 14. The method according to 13, wherein the similarity between the first feature vector and the second feature vector is determined based on cosine similarity, KL divergence or Euclidean distance between the first feature vector and the second feature vector.
[0163] 15. The method according to 13, wherein the first neural network model includes a training model with more parameters and a deployment model to be deployed and with fewer parameters, wherein the second process is used to train the training model, and the training process of the first neural network model further includes a third process for training the deployment model after the output accuracy of the training model meets the condition, wherein the third process includes:
[0164] Inputting the image samples in the sample set into the deployment model, and using the similarity between the output first feature vector and the second feature vector as the prediction result of the deployment model; and
[0165] The loss function is determined based on both the difference between the prediction results of the deployed model and the labeled values of the image samples and the difference between the prediction results of the deployed model and the prediction results of the trained model.
[0166] 16. The method according to 15, wherein the training model is only used to train the deployment model or is also used to be deployed in the server device, and the deployment model is used to be deployed in the client device.
[0167] 17. The method according to 11, wherein the neural network model is an integration of multiple models.
[0168] 18. The method according to 15, wherein the training model is an integration of multiple models.
[0169] 19. A method for training a neural network model, the neural network model being used to detect whether two coin images input are of the same side, the method comprising a first process for constructing a sample set, wherein the first process comprises:
[0170] The front image and the back image of each coin in a plurality of coins are collected to form an original image set, wherein the plurality of coins include N kinds of coins, and the first coin in the N kinds of coins includes K l coins, of which N and K l are all positive integers, l = 1, 2, ... N;
[0171] The front image of each coin and its combination, the back image of each coin and its combination, the front image of each coin and its combination, the front image of each coin and the front images of other individual coins of the same type, and the back image of each coin and the back images of other individual coins of the same type are used as image samples in the first sample subset;
[0172] The combination of the front image of each coin and the back image of the coin, the combination of the front image of each coin and the back images of other individual coins of the same type, the combination of the back image of each coin and the front images of other individual coins of the same type, and the combination of any two images of coins of different types are taken as image samples in the second sample subset, wherein,
[0173] The image samples in the first sample subset are all labeled with a first value to indicate that the first image of the two images of the corresponding image sample is not flipped relative to the second image,
[0174] The image samples in the second sample subset are all labeled with a second value to indicate that the first image of the two images of the corresponding image sample has been flipped relative to the second image.
[0175] The first sample subset and the second sample subset constitute the sample set.
[0176] 20. A non-temporary computer-readable storage medium, characterized in that 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 the method described in any one of 1-10.
[0177] 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 coin attributes based on a neural network model, comprising: receiving a first coin image; Output information to prompt the user to turn the coin over and take another photo, and receive a second coin image; Inputting both the first coin image and the second coin image into the trained first neural network model to detect whether the second coin image is not flipped relative to the first coin image; In response to the detection result indicating that the second coin image is not turned over relative to the first coin image, outputting information again to prompt the user to turn the coin over and take another photo; as well as In response to the detection result indicating that the second coin image has been turned over relative to the first coin image, both the first coin image and the second coin image are input into the trained second neural network model to perform coin attribute detection, and the detected coin attributes are output.
2. The method according to claim 1, wherein: The training process of the first neural network model includes a first process for constructing a sample set, wherein the first process includes: The front image and the back image of each coin in a plurality of coins are collected to form an original image set, wherein the plurality of coins include N kinds of coins, and the first coin in the N kinds of coins includes K l coins, of which N and K l are all positive integers, l = 1, 2, ... N; selecting, from the original image set, a front side image and a back side image of a first coin of the plurality of coins and a front side image and a back side image of a second coin of the plurality of coins; putting a combination of the obverse image of the first coin and itself, a combination of the reverse image of the first coin and itself, a combination of the obverse image of the second coin and itself, and a combination of the reverse image of the second coin and itself as corresponding image samples into a first sample subset; putting a combination of the obverse image of the first coin and the reverse image of the first coin, a combination of the obverse image of the first coin and the reverse image of the second coin, a combination of the obverse image of the second coin and the reverse image of the second coin, and a combination of the obverse image of the second coin and the reverse image of the first coin as corresponding image samples into a second sample subset; In response to the first coin and the second coin being of the same kind, placing a combination of the obverse image of the first coin and the obverse image of the second coin, and a combination of the reverse image of the first coin and the reverse image of the second coin as corresponding image samples into a first sample subset; and In response to the first coin and the second coin being different coins, a combination of the front image of the first coin and the front image of the second coin, and a combination of the back image of the first coin and the back image of the second coin are put into a second sample subset as corresponding image samples, wherein: The image samples in the first sample subset are all labeled with a first value to indicate that the first image of the two images of the corresponding image sample is not flipped relative to the second image, The image samples in the second sample subset are all labeled with a second value to indicate that the first image of the two images of the corresponding image sample has been flipped relative to the second image. The first sample subset and the second sample subset constitute the sample set.
3. The method according to claim 1, wherein: The training process of the first neural network model includes a first process for constructing a sample set, wherein the first process includes: The front image and the back image of each coin in a plurality of coins are collected to form an original image set, wherein the plurality of coins include N kinds of coins, and the first coin in the N kinds of coins includes K l coins, of which N and K l are all positive integers, l = 1, 2, ... N; The front image of each coin and its combination, the back image of each coin and its combination, the front image of each coin and its combination, the front image of each coin and the front images of other individual coins of the same type, and the back image of each coin and the back images of other individual coins of the same type are used as corresponding image samples in the first sample subset; The combination of the front image of each coin and the back image of the coin, the combination of the front image of each coin and the back images of other individual coins of the same type, the combination of the back image of each coin and the front images of other individual coins of the same type, and the combination of any two images of coins of different types are taken as corresponding image samples in the second sample subset, wherein, The image samples in the first sample subset are all labeled with a first value to indicate that the first image of the two images of the corresponding image sample is not flipped relative to the second image, The image samples in the second sample subset are all labeled with a second value to indicate that the first image of the two images of the corresponding image sample has been flipped relative to the second image. The first sample subset and the second sample subset constitute the sample set.
4. The method according to claim 2 or 3, wherein: The first process also includes: One or more image samples in the first sample subset and / or the second sample subset are locally transformed and / or globally transformed to generate one or more new image samples in the corresponding sample subset, wherein: The local transformation includes: cutting a local area of the image sample and filling the local area with a solid color, wherein the shape and size of the local area and the position of the local area in the image sample are randomly determined, and the color of the solid color is also randomly determined; The overall transformation includes: one or a combination of rotation transformation, mirror transformation, translation transformation, noise transformation, blur transformation and color space transformation.
5. The method according to claim 2 or 3, wherein: The training process of the first neural network model also includes a second process for model training, wherein the second process includes: Constructing a network structure of a first neural network model so that an input of the first neural network model includes both a first input image and a second input image, and an output of the first neural network model includes a first feature vector corresponding to the first input image and a second feature vector corresponding to the second input image; Inputting the image samples in the sample set into the first neural network model, and using the similarity between the output first feature vector and the second feature vector as the prediction result of the first neural network model; and The loss function is determined based on the difference between the prediction result of the first neural network model and the labeled value of the image sample.
6. The method according to claim 5, wherein: The similarity between the first feature vector and the second feature vector is determined based on cosine similarity, KL divergence, or Euclidean distance of the first feature vector and the second feature vector.
7. The method according to claim 5, wherein: The first neural network model includes a training model with more parameters and a deployment model to be deployed and with fewer parameters, wherein the second process is used to train the training model, and the training process of the first neural network model also includes a third process for training the deployment model after the output accuracy of the training model meets the condition, wherein the third process includes: Inputting the image samples in the sample set into the deployment model, and using the similarity between the output first feature vector and the second feature vector as the prediction result of the deployment model; and The loss function is determined based on both the difference between the prediction results of the deployed model and the labeled values of the image samples and the difference between the prediction results of the deployed model and the prediction results of the trained model.
8. The method according to claim 7, wherein: The training model is only used to train the deployment model or is also used to be deployed in the server device, and the deployment model is used to be deployed in the client device.
9. The method according to claim 1, wherein: The first neural network model is an integration of multiple models.
10. The method according to claim 7 or 8, wherein: The training model is an integration of multiple models.
Citation Information
Patent Citations
Folded banknote identification method
CN108320372A
Coin recognition method and processing terminal based on depth learning convolution neural network
CN109389615A
Image based coin detection-identification method and system and storage medium
CN110415425A
Cited By
AI-driven ancient coin identification method and system
CN120510620A
AI-driven ancient coin identification method and system
CN120510620B
