Image processing method and device
By extracting the characteristic information of the object to be identified in the target image and performing Euclidean distance matching, the problem of high computational complexity in the existing technology when adding new identified objects is solved, achieving rapid identification and reducing the amount of calculation, and is suitable for self-service vending, etc. scene.
Patent Information
- Application Number
- CN201910030346.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-01-14
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2039-01-14
AI Technical Summary
In the existing technology, the recognition/detection model needs to be re-established when a new recognition object is added, which leads to an increase in computational complexity and calculation amount, and a long calculation time.
By extracting the feature information of the object to be identified in the target image and matching it with the stored feature information of the identified object by Euclidean distance, the category of the object to be identified is determined, the amount of calculation and complexity are reduced, and the calculation time is shortened.
It achieves rapid identification of objects to be identified, reduces the amount of calculation and computational complexity, and eliminates the need to re-establish models. It is suitable for new product identification in areas such as self-service vending.
Smart Images

Figure CN111435424B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to image processing technology, and in particular to an image processing method and device. Background Art
[0002] In image processing technology, the recognition of the identification object in the image is achieved through the recognition / detection algorithm. The specific implementation process of the current general recognition / detection algorithm mainly includes two aspects: model establishment and model application: based on multiple images collected in advance, a recognition / detection model is first established, and then the recognition object is recognized (model application) for the randomly collected images including a certain identification object according to the established recognition / detection model. When adding a new identification object, still using the above method will undoubtedly increase the computational complexity and calculation amount. Summary of the invention
[0003] In order to solve the existing technical problems, the embodiments of the present application provide an image processing method and device, which can at least reduce the amount of calculation and operation complexity and shorten the calculation time.
[0004] The technical solution of the embodiment of the present application is implemented as follows:
[0005] The present application provides an image processing method, the method comprising:
[0006] Obtaining a collected image;
[0007] Obtaining a target image in the captured image, wherein the target image at least includes an object to be identified;
[0008] Based on the target image, characteristic information of the object to be identified is obtained;
[0009] Based on the feature information, the object to be identified is determined.
[0010] In the above solution, determining the object to be identified based on the feature information includes:
[0011] Obtaining stored feature information of each identified object;
[0012] The feature information of the object to be identified is matched with the feature information of each identified object obtained to determine the object to be identified.
[0013] In the above solution, matching the feature information of the object to be identified with the obtained feature information of each identified object to determine the object to be identified includes:
[0014] Determine the Euclidean distance between the feature information of the object to be identified and the feature information of each identified object;
[0015] Determine, among the various recognition objects, the recognition object having the shortest Euclidean distance to the feature information of the object to be recognized;
[0016] It is determined that the identification object having the shortest Euclidean distance with the feature information of the object to be identified is in the same category.
[0017] In the above solution, obtaining the target image in the acquired image includes:
[0018] Performing convolution processing on each collected image through at least two convolution layers to obtain a feature image of each collected image in at least part of the convolution layers;
[0019] Based on at least part of the feature image of the convolution layer, obtaining recognition results of positions of multiple objects to be recognized in the collected image;
[0020] Based on the multiple recognition results, obtaining position information of the object to be recognized in the captured image;
[0021] Based on the position information of the object to be identified in the acquired image, a target image is determined.
[0022] In the above solution, before storing the feature information of each identified object, the method further includes:
[0023] Obtain and store feature information of each identified object;
[0024] The step of obtaining feature information of each identified object includes:
[0025] For one of the identification objects, collecting multiple images of the identification object;
[0026] Calculate the Euclidean distance between two images;
[0027] Based on the Euclidean distance, the feature information of the identified object is calculated.
[0028] An embodiment of the present application provides an image processing device, the device comprising a processor and a storage medium; wherein the storage medium is used to store a computer program;
[0029] The processor is configured to perform at least the following steps when executing the computer program stored in the storage medium:
[0030] Obtaining a collected image;
[0031] Obtaining a target image in the captured image, wherein the target image at least includes an object to be identified;
[0032] Based on the target image, characteristic information of the object to be identified is obtained;
[0033] Based on the feature information, the object to be identified is determined.
[0034] In the above solution, the processor is further used to perform the following steps:
[0035] Obtaining stored feature information of each identified object;
[0036] The feature information of the object to be identified is matched with the feature information of each identified object obtained to determine the object to be identified.
[0037] In the above solution, the processor is further used to perform the following steps:
[0038] Determine the Euclidean distance between the feature information of the object to be identified and the feature information of each identified object;
[0039] Determine, among the various recognition objects, the recognition object having the shortest Euclidean distance to the feature information of the object to be recognized;
[0040] It is determined that the identification object having the shortest Euclidean distance with the feature information of the object to be identified is in the same category.
[0041] In the above solution, the processor is further used to perform the following steps:
[0042] Performing convolution processing on each collected image through at least two convolution layers to obtain a feature image of each collected image in at least part of the convolution layers;
[0043] Based on at least part of the feature image of the convolution layer, obtaining recognition results of positions of multiple objects to be recognized in the collected image;
[0044] Based on the multiple recognition results, obtaining position information of the object to be recognized in the captured image;
[0045] Based on the position information of the object to be identified in the acquired image, a target image is determined.
[0046] In the above solution, the processor is further used to perform the following steps:
[0047] Obtain and store feature information of each identified object;
[0048] The step of obtaining feature information of each identified object includes:
[0049] For one of the identification objects, collecting multiple images of the identification object;
[0050] Calculate the Euclidean distance between two images;
[0051] Based on the Euclidean distance, the feature information of the identified object is calculated.
[0052] The image processing method and device of the embodiment of the present application obtains the target image in the captured image, and recognizes the object to be recognized based on the target image, which will greatly reduce the amount of calculation and the complexity of operation compared with the recognition of the object to be recognized based on the entire captured image. In addition, based on the target image, the feature information of the object to be recognized is obtained, and the object to be recognized is recognized based on the feature information. The object to be recognized can be determined based on the feature information alone, which can also reduce the amount of calculation and the complexity of operation, shorten the calculation time, and thus quickly recognize the object to be recognized. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0054] Figure 1 The following is a schematic diagram of the implementation process of the image processing method of the present application embodiment. Figure 1 ;
[0055] Figure 2 The following is a schematic diagram of the implementation process of the image processing method of the present application embodiment. Figure 2 ;
[0056] Figure 3 A schematic diagram of the framework of image processing in an embodiment of the present application;
[0057] Figure 4 The structure of the image processing device in the embodiment of the present application is shown in FIG. Figure 1 ;
[0058] Figure 5 The structure of the image processing device in the embodiment of the present application is shown in FIG. Figure 2 . DETAILED DESCRIPTION
[0059] In order to make the purpose, technical scheme and advantages of the present application clearer, the technical scheme in the embodiment of the present application will be clearly and completely described below in conjunction with the drawings in the embodiment of the present application. Obviously, the described embodiment is only a part of the embodiment of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. In the absence of conflict, the embodiments in the present application and the features in the embodiments can be combined with each other arbitrarily. The steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions. In addition, although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that here.
[0060] The technical problems existing in the aforementioned related technical solutions can be understood as follows:
[0061] In the related art, the process of establishing a recognition / detection model is: collecting multiple images including the object to be recognized, pre-labeling the recognition object (identifying what kind of object the recognition object is), that is, establishing a model of the recognition object based on the known recognition object.
[0062] In some application areas, such as the field of self-service commodity sales, if new commodities are added to the commodities sold, the recognition / detection model needs to be re-established, so that the re-established model can be used to identify whether the commodities sold are new commodities; if the model is not re-established, when the commodities bought by the consumer are new commodities, it is impossible to detect whether the commodities sold are new commodities. It can be seen that in the related art, the need to re-establish the recognition / detection model for each new commodity added undoubtedly increases the computational complexity, greatly increases the amount of calculation, and takes a long time to calculate.
[0063] It can be understood that the object to be identified or the identified object can be any object that can be identified, such as a person, commodity, animal or plant in an image or video stream.
[0064] Compared with the method of using recognition / detection models to identify objects in the related art, the use of this solution can at least greatly reduce the amount of calculation and computational complexity and shorten the calculation time.
[0065] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0066] The present application embodiment provides an image processing method, such as Figure 1 As shown, the method includes:
[0067] Step 101: obtaining a captured image;
[0068] In this step, an image acquisition device such as a camera is used to acquire images. In the field of self-service vending, a camera is set inside the self-service vending machine to acquire images and / or videos of consumers purchasing goods in the self-service vending machine and taking them away or merchants replenishing goods.
[0069] Step 102: obtaining a target image in the captured image, wherein the target image at least includes an object to be identified;
[0070] Because the image captured in step 101 includes not only the object to be identified and the hand, but also other background images, such as the internal environment image of the vending machine (such as the display layer for placing goods and / or the door of the vending machine), this step is to separate the image portion including the object to be identified and / or the hand from the captured image, and remove the image portion including the internal environment.
[0071] Step 103: Based on the target image, obtain feature information of the object to be identified;
[0072] In this step, the Lemb layer added in the image recognition network of this scheme is used to obtain the feature information of the object to be recognized from the target image.
[0073] Step 104: Determine the object to be identified based on the feature information.
[0074] In this step, the object to be identified is determined based on the feature information of the object to be identified.
[0075] The entity executing steps 101 to 104 is the same image processing device.
[0076] In the above scheme, for the captured image, the target image in the captured image is first obtained, that is, the background part in the captured image is first deleted and the part with the object to be identified is retained. Compared with the method of identifying the object to be identified based on the target image and the method of identifying the object to be identified based on the entire captured image, the amount of calculation and the complexity of operation will be greatly reduced. Based on the target image, the feature information of the object to be identified is obtained and the object to be identified is identified based on the feature information. Compared with the method of re-establishing a model for each additional object to be identified in the related art, there is no need to re-establish the model in this scheme. The object to be identified can be determined only based on the feature information, which can also reduce the amount of calculation and the complexity of operation, shorten the calculation time, and thus quickly identify the object to be identified.
[0077] In an alternative solution, Figure 2 As shown, the step 104: determining the object to be identified based on the feature information includes:
[0078] Step 104a: Obtaining stored feature information of each identified object;
[0079] In this step, feature information of each possible identified object is obtained at least through a subsequent training process.
[0080] Step 104b: Match the feature information of the object to be identified with the obtained feature information of each identification object to determine the object to be identified.
[0081] In an optional embodiment, the above step 104b: matching the feature information of the object to be identified with the obtained feature information of each identified object to determine the object to be identified includes:
[0082] Determine the Euclidean distance between the feature information of the object to be identified and the feature information of each identified object;
[0083] Determine, among the various recognition objects, the recognition object having the shortest Euclidean distance to the feature information of the object to be recognized;
[0084] It is determined that the identification object having the shortest Euclidean distance with the feature information of the object to be identified is in the same category, and objects in the same category can be regarded as the same identification object.
[0085] In the above scheme, the object to be identified is determined by matching feature information. Compared with the method of identifying the object to be identified by detecting / identifying the model in the related art, this method of determining the object to be identified by matching feature information, specifically by Euclidean distance, can reduce the amount of calculation and computational complexity, shorten the calculation time, and thus quickly identify the object to be identified.
[0086] In an optional embodiment, before storing the feature information of each identified object, the method further includes:
[0087] Obtain and store feature information of each identified object;
[0088] The step of obtaining feature information of each identified object includes:
[0089] For one of the identification objects, multiple images of the identification object are collected; the Euclidean distance between each two images is calculated; and based on the Euclidean distance, feature information of the identification object is calculated.
[0090] In the above scheme, the characteristic information of each identified object is calculated and stored based on the subsequent training process. This process can provide a certain basis for quickly identifying the object to be identified.
[0091] In an optional solution, obtaining the target image in the acquired image includes:
[0092] Performing convolution processing on each collected image through at least two convolution layers to obtain a feature image of each collected image in at least part of the convolution layers;
[0093] Based on at least part of the feature image of the convolution layer, obtaining recognition results of positions of multiple objects to be recognized in the collected image;
[0094] Based on the multiple recognition results, obtaining position information of the object to be recognized in the captured image;
[0095] Based on the position information of the object to be identified in the acquired image, a target image is determined.
[0096] The above scheme can refer to the subsequent target image extraction process. This process can be regarded as deleting the background part of the acquired image and retaining the part with the object to be identified. The identification of the object to be identified based on the target image and the identification of the object to be identified based on the entire acquired image will definitely greatly reduce the amount of calculation and computational complexity.
[0097] Combine the following Figure 3 The block diagram shown further illustrates this solution.
[0098] Taking the implementation of this solution in a self-service vending machine as an example, it can be understood that when adding a new product for self-service vending in the self-service vending machine, the new product needs to be registered in the list of salable products of the self-service vending machine. Only after the registration is completed can the self-service vending machine sell the new product and identify the new product when a consumer purchases it.
[0099] The framework of this solution includes three parts: model training (establishment), new product registration and product sales application (application level). It can be understood that model training (establishment) can be considered as extracting feature information of self-service products through pre-collected data (image data), and the model can be applied after training with pre-collected image data. Registration of new products can be considered as registering new products to the list of salable products to facilitate subsequent sales. The product sales application can be considered as using the trained model to identify the type of products being sold, such as cola, Sprite or orange juice.
[0100] Those skilled in the art can understand that, considering that in the process of selling goods, for one selling process, an image captured by the camera of the self-service vending machine includes at least an image of the hand-held goods and a background image. Before performing any of the three major schemes mentioned above, in order to reduce the amount of calculation, the image captured by the camera can be separated into two major image parts, namely, the image part of the hand-held goods and the background image part, by the following target image extraction method. Then, the separated image of the hand-held goods is used as the input of the above three major parts for processing each part, as described below.
[0101] (I) The method for extracting the target image is as follows:
[0102] Considering that this scheme is to extract the effective image part - the target image (the image part of the hand holding the commodity) in the captured image, and in the application scenario of commodity sales, the position of the operating body - the hand in the captured image in the effective image part can be regarded as the position of the hand holding the commodity in the captured image, so the position of the hand in the captured image can be regarded as the position of the hand holding the commodity in the captured image. It can be understood that the following extraction process can also be regarded as the process of determining the position of the hand in the captured image. The extraction process is mainly divided into two major processes: the process of determining the feature image of the captured image and the process of distinguishing the hand from the background.
[0103] The network architecture of the extraction process is mainly based on a neural network, specifically a target detection algorithm based on a neural network (SSD) or an algorithm such as Faster R-CNN (Fast-CNN-based region detection).
[0104] Take the case where a camera captures an image (the captured image includes an image of a hand-held product and a background image) as an example for explanation:
[0105] (1) Determine the feature image:
[0106] The target image is represented as a floating point matrix of (H, W, 3), where H and W are the height and width of the captured image respectively, and 3 represents the three channels of red, green and blue (RGB).
[0107] The neural network includes at least two convolutional layers. Those skilled in the art should know that the convolutional layers are connected layer by layer, that is, the output of the previous convolutional layer serves as the input of the next convolutional layer.
[0108] The collected image is input into each convolution layer in turn, and after the convolution operation of each convolution layer, the output of different convolution layers is obtained. The output is the feature image obtained by the convolution operation of the corresponding convolution layer.
[0109] It can be understood that a pooling layer (max pooling layer) can be added between convolutional layers to reduce the dimension and make the calculation faster. A normalization layer (batch normalization) can also be added to normalize the image to reduce the dimension and speed up the calculation.
[0110] For the above description, please refer to the relevant technical understanding and will not be repeated here.
[0111] (ii) Distinguishing hands from background:
[0112] Those skilled in the art should know that the SSD algorithm involves the concept of a bounding box (window), which is used to circle the position of an object such as a hand or a product in the captured image. This process can be used to identify whether the object circled in the bounding box is a hand or a background.
[0113] It can be understood that in the SSD algorithm, the shape of the binding box (window) can be a rectangle, a cube, a hexagon, etc. The shape and size of the binding box are related to the aspect ratio and the scaling ratio of the binding box. In this solution, binding boxes of different shapes and sizes can be predefined. For example, a binding box with a rectangular shape and an area of 1 can circle the hand. A binding box with a square shape and an area of 12 can also circle the hand. The following technical solution is to calculate the shape and size of the binding box.
[0114] Predefine the aspect ratios of all the binding boxes that may be used in this solution. For example, predefine M (M is a positive integer, which can be flexibly set according to the specific situation) aspect ratios of the binding boxes, select at least some of the convolutional layers from all the convolutional layers, and assign a scaling ratio (between 0 and 1) to each selected convolutional layer. j , after the processing of the jth convolutional layer mentioned above, the feature image is Z j , the scaling ratio assigned to the jth convolutional layer is scale, and the i-th length-width ratio is set as ratio_i. The following operations are performed on ratio_i and the selected jth convolutional layer:
[0115] First, the output of the jth convolutional layer is subjected to multiple convolutions, for example, N = (Nclass + 1) + 4 convolution operations, and the output is the first matrix C with a shape of (h, w, N). Where N is a positive integer greater than or equal to 5, and Nclass is a positive integer greater than or equal to 1.
[0116] Among them, in the N convolution operations, the elements of C such as C[x][y][1]~C[x][y][Nclass+1] obtained by the first (Nclass+1) convolution operations represent the probability that the pixel at position C[x][y] on the feature image is the background or the object. For example, taking Nclass=1 as an example, 6 convolution operations are required on the output of the jth convolution layer to obtain the first matrix C, whose shape is (h, w, 6); among them, the element C[1][5][1] represents the probability of whether the pixel at position (1, 5) is the background or the hand. The elements C[x][y][Nclass+2]~C[x][y][N] in C obtained by the last 4 convolution operations are used to calculate the bounding box in the original image-captured image I j The position in.
[0117] Secondly, according to the height and width (h, w) of the first matrix C and the original image-collected image I j The size of C (H, W) is calculated by the following formulas (2) and (3) to calculate the position of an element in C (C[n_h][n_w]) corresponding to the original image (img_h, img_w):
[0118] img_h=H / h*n_h+C[n_h][n_w][Nclass+2]*H*scale (2);
[0119] img_w=H / h*n_w+C[n_h][n_w][Nclass+3]*W*scale (3);
[0120] Next, substitute the scale and ratio_i formulas into formula (4) and formula (5) to calculate the length and width of the bounding box corresponding to an element in C (C[n_h][n_w]):
[0121] box_H=H*scale*ratio_i+C[n_h][n_w][Nclass+4]*H*scale (4);
[0122] box_W=W*scale / ratio_i+C[n_h][n_w][Nclass+5]*W*scale (5);
[0123] Finally, according to (img_h, img_w) as well as box_H and box_W, the coordinates (position) of the binding box in the original image are calculated:
[0124] The bounding box is a quadrilateral, and the positions of the upper left corner and lower right corner of the quadrilateral shape in the original image are:
[0125] The y-axis coordinate of the upper left corner: img_h-box_H / 2;
[0126] The x-axis coordinate of the upper left corner: img_w-box_W / 2;
[0127] The y-axis coordinate of the lower right corner: img_h+box_H / 2;
[0128] The x-axis coordinate of the lower right corner: img_w+box_W / 2;
[0129] Based on the position of the binding box in the original image, the shape and size of the binding box in the original image can be obtained. The first matrix C represents the probability that the object circled by the binding box in the original image is the background or the hand. It can be understood that the recognition result is the recognition result obtained for the output of the j-th convolutional layer when the aspect ratio of the binding box is one of the aspect ratios. For the output of the j-th convolutional layer, it is necessary to traverse other (M-1) aspect ratios one by one, and use this to calculate different binding boxes, and determine the probability that different bound and circled objects are the background or the hand.
[0130] Each selected convolutional layer is processed as described above.
[0131] The recognition results generated by all selected convolutional layers are processed by the non-maximum suppression algorithm (NMS), and the hand in the collected image I can be obtained. j The position information in the image I j The image part including the hand (i.e., the hand holding the product) is extracted and used as the input part of the subsequent solution.
[0132] (II) Model training (building) process:
[0133] A plurality of images / photos including commodities are collected by the camera, and the categories of commodities in the images / photos are marked. The category of the commodity is used to identify the specific commodity, such as cola, Sprite or orange juice. Based on the aforementioned method for extracting the image part of the hand-held commodity, the effective image part in each image is separated, and the separated effective image is used as the input data of the training (establishment) process of the model, and the following scheme is continued.
[0134] The model training in this solution uses an image recognition network, such as a residual image recognition network (ResNet). This solution is based on improving the existing ResNet and training based on the improved ResNet. The specific improvements are as follows:
[0135] Those skilled in the art should understand that ResNet includes at least two convolutional layers for performing convolution operations to obtain feature information of the image. In this solution, the existing ResNet is improved. Specifically, the second to last convolutional layer of ResNet is denoted as Lftr, and the last convolutional layer is denoted as Lcls. A Lemb layer is added to Lftr and Lcls, and a softmax layer is connected after Lcls. Cross entropy is used as the loss function in the softmax layer. A loss function is also added to the Lemb layer, which is related to the Euclidean distance:
[0136] Assuming that the number of images collected is N, for each separated valid image, calculate the Euclidean distance between the two images in the N valid images. If the Euclidean distance between image i and image j is recorded as D_ij, it can be understood that the smaller D_ij is, the closer the categories of the products in the two images are, such as both Sprite or both Coke.
[0137] For each combination of image i and image j:
[0138] Because the categories of the goods in the collected images are marked in advance, based on the marking, it can be known whether the categories of the goods in image i and image j are the same category, and the following processing is performed based on the result of whether they are the same category:
[0139] If the products in image i and image j are of the same category and D_ij is less than the first preset threshold Tmin, then minimize D_ij;
[0140] If the products in image i and image j are of the same category and D_ij is greater than the second preset threshold Tmin, then D_ij is intermediated;
[0141] If images i and j are not of the same class and D_ij is less than the preset threshold Tmax, D_ij is maximized.
[0142] Among them, minimization, medianization and maximization of D_ij are flexibly set according to specific situations, and its purpose is to obtain a comparison result of whether the goods in image i and image j are the same goods. In practical applications, medianization is such as 0.5*D_ij, maximization D_ij is such as 1*D_ij, and minimization is 0.1*D_ij. Tmin is less than Tmax, and the specific values of the two are flexibly set according to the application situation.
[0143] According to the above method, combined with the principle of minimizing the loss function of the softmax layer and the Lemb layer, ResNet is trained to complete the training (establishment) of the model. Among them, the improved part can be regarded as the obtained embedding network.
[0144] Those skilled in the art should know that if the N input images are images of Sprite, then after the above process, feature information about the Sprite image is obtained. If the N input images are images of Coke, then after the above process, feature information about the Coke image is obtained. Storing feature information about Coke images, feature information about Sprite images, and feature information about any other conceivable commodity is considered as storing feature information about each object to be identified.
[0145] The aforementioned processing process based on the Euclidean distance of the image can at least make the trained model more robust and less susceptible to interference.
[0146] (III) Registration process for new products:
[0147] Rotate the new product at multiple angles, take images of the new product at different rotation angles, and obtain images of the new product in different postures; for each image, first separate the effective image part in each image based on the aforementioned method of extracting the image part of the hand-held product, and input the separated effective image into the embedding network, record the output value of the Lemb layer as the embedding value, which can be understood as the characteristic information of the product. Perform hard clustering operation (K-Means) on all recorded embedding values to obtain the typical embedding value of the new product and store it.
[0148] Here, hard clustering operation is performed because the recognition of feature information of each piece of the same new product will inevitably generate redundancy of feature information of the same new product. In order to reduce unnecessary storage, hard clustering operation is performed.
[0149] In this solution, the feature information of the new product and the feature information of other objects to be identified, such as Coke and Sprite, are stored in the embedding database. While storing the feature information of different objects to be identified, the category information of different objects to be identified is also associated and stored for subsequent use.
[0150] Those skilled in the art should understand that in the related art, each time a new product is added, the recognition / detection model needs to be re-established. However, in the embodiment of the present application, for the newly added product, there is no need to re-establish it. It is only necessary to perform the aforementioned registration process, and the feature information of the new product can be identified by inputting the valid image of the new product into the embedding network. The use of this solution can at least greatly reduce the amount of calculation and the complexity of the operation, and shorten the calculation time. The aforementioned registration process is relatively simple and easy, more suitable for promotion in practical applications, and has good portability.
[0151] (IV) Product sales application: This process can be regarded as the process of identifying the products being sold during the sales process, which belongs to the application level solution;
[0152] The camera collects images during a commodity sales process; first, the effective image part in the collected image is separated based on the aforementioned method for extracting the hand-held commodity image part, and the separated effective image is input into the embedding network, and the output value of the Lemb layer is recorded as the embedding value of the commodity being sold. In the embedding database, the embedding value with the shortest (closest) Euclidean distance to this embedding value is searched, and the category of the commodity corresponding to the embedding with the shortest Euclidean distance to the embedding value is determined, and it is confirmed that the category of the commodity being sold is the same as the category of the commodity corresponding to the embedding. For example, if the output value of the Lemb layer during the sales process is A, in the embedding database, the embedding value with the shortest Euclidean distance to the embedding value with the value of A is A', and the commodity corresponding to the embedding value A' is cola, then the commodity being sold this time is cola.
[0153] In the above scheme, the category of the goods being sold is determined based on the match between the embedding value of the goods being sold and the stored embeddings of each object to be identified. Compared with the method of identifying the object to be identified through detection / identification models in the related art, the amount of calculation and computational complexity can be reduced, and the calculation time can be shortened, so that the object to be identified can be quickly identified.
[0154] The present application also provides an image processing device, such as Figure 4 As shown, the device includes a processor 701 and a storage medium 702; wherein the storage medium 702 is used to store computer programs;
[0155] The processor 701 is configured to perform at least the following steps when executing the computer program stored in the storage medium 702:
[0156] Obtaining a collected image;
[0157] Obtaining a target image in the captured image, wherein the target image at least includes an image of an object to be identified;
[0158] Based on the target image, characteristic information of the object to be identified is obtained;
[0159] Based on the feature information, the object to be identified is determined.
[0160] In the above solution, the processor 701 is further configured to perform the following steps:
[0161] Obtaining stored feature information of each identified object;
[0162] The feature information of the object to be identified is matched with the feature information of each identified object obtained to determine the object to be identified.
[0163] In the above solution, the processor 701 is further configured to perform the following steps:
[0164] Determine the Euclidean distance between the feature information of the object to be identified and the feature information of each identified object;
[0165] Determine, among the various recognition objects, the recognition object having the shortest Euclidean distance to the feature information of the object to be recognized;
[0166] It is determined that the identification object having the shortest Euclidean distance with the feature information of the object to be identified is in the same category.
[0167] In the above solution, the processor 701 is further configured to perform the following steps:
[0168] Performing convolution processing on each collected image through at least two convolution layers to obtain a feature image of each collected image in at least part of the convolution layers;
[0169] Based on at least part of the feature image of the convolution layer, obtaining recognition results of positions of multiple objects to be recognized in the collected image;
[0170] Based on the multiple recognition results, obtaining position information of the object to be recognized in the captured image;
[0171] Based on the position information of the object to be identified in the acquired image, a target image is determined.
[0172] In the above solution, the processor 701 is further configured to perform the following steps:
[0173] Obtain and store feature information of each identified object;
[0174] The step of obtaining feature information of each identified object includes:
[0175] For one of the identification objects, collecting multiple images of the identification object;
[0176] Calculate the Euclidean distance between two images;
[0177] Based on the Euclidean distance, the feature information of the identified object is calculated.
[0178] The image processing device of the embodiment of the present application can also be Figure 5As shown, the image processing device 700 includes: at least one processor 701, a storage medium 702, at least one network interface 704 and a user interface 703. The various components in the image processing device 700 are coupled together through a bus system 705. It can be understood that the bus system 705 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 705 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 705 is not shown in FIG. Figure 5 Various buses are labeled as bus system 705.
[0179] The user interface 703 may include a display, a keyboard, a mouse, a trackball, a click wheel, keys, buttons, a touch pad or a touch screen.
[0180] It can be understood that the storage medium 702 can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM, SyncLink Dynamic Random Access Memory), and direct RAM bus random access memory (DRRAM, Direct Rambus Random Access Memory).The storage medium 702 described in the embodiments of the present application is intended to include, but is not limited to, these and any other suitable types of memory.
[0181] The storage medium 702 in the embodiment of the present application is used to store various types of data to support the operation of the image processing device 700. Examples of these data include: any computer program for operating on the image processing device 700, such as an operating system 7021 and an application 7022. Among them, the operating system 7021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks. The application 7022 can include various applications, such as a media player (Media Player), a browser (Browser), etc., for implementing various application services. The program that implements the method of the embodiment of the present application can be included in the application 7022.
[0182] The method disclosed in the above embodiment of the present application can be applied to the processor 701, or implemented by the processor 701. The processor 701 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 701. The above processor 701 may be a general processor, a digital signal processor (DSP, Digital Signal Processor), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 701 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general processor may be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiment of the present application, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in the storage medium 702, and the processor 701 reads the information in the storage medium 702, and completes the steps of the above method in combination with its hardware.
[0183] The present application also provides a storage medium, which can be Figure 4 and 5 The storage medium 702 is used to store a computer program, which performs the aforementioned image processing method when executed.
[0184] It should be noted that the image processing device provided in the embodiment of the present application, since the principle of solving the problem by the image processing device is similar to that of the aforementioned image processing method, the implementation process and implementation principle of the image processing device can be referred to the description of the implementation process and implementation principle of the aforementioned image processing method, and the repeated parts will not be repeated.
[0185] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0186] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.
[0187] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0188] A person skilled in the art can understand that: all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), disks or optical disks, etc. Various media that can store program codes.
[0189] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can be essentially or partly reflected in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
[0190] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. An image processing method, characterized in that: The method comprises: Obtaining a collected image; Obtaining a target image in the collected image, wherein the target image is an image portion separated from the collected image and including an object to be identified; Based on the target image, characteristic information of the object to be identified is obtained; wherein the characteristic information is obtained by processing the target image through an embedding network; the embedding network is obtained by training an image recognition network to which a Lemb layer having a loss function is added; the Lemb layer is located between the second to last convolution layer and the last convolution layer of the image recognition network; Based on the feature information, the object to be identified is determined.
2. The method according to claim 1, characterized in that The step of determining the object to be identified based on the feature information includes: Obtaining stored feature information of each identified object; The feature information of the object to be identified is matched with the feature information of each identified object obtained to determine the object to be identified.
3. The method according to claim 2, characterized in that The step of matching the feature information of the object to be identified with the feature information of each identified object to determine the object to be identified includes: Determine the Euclidean distance between the feature information of the object to be identified and the feature information of each identified object; Determine, among the various recognition objects, the recognition object having the shortest Euclidean distance to the feature information of the object to be recognized; It is determined that the identification object having the shortest Euclidean distance with the feature information of the object to be identified is in the same category.
4. The method according to claim 1, characterized in that The step of obtaining a target image from a captured image comprises: Performing convolution processing on each collected image through at least two convolution layers to obtain a feature image of each collected image in at least part of the convolution layers; Based on at least part of the feature image of the convolution layer, obtaining recognition results of positions of multiple objects to be recognized in the collected image; Based on the multiple recognition results, obtaining the position information of the object to be recognized in the captured image; Based on the position information of the object to be identified in the acquired image, a target image is determined.
5. The method according to claim 2 or 3, characterized in that: Before storing the feature information of each identified object, the method further includes: Obtain and store feature information of each identified object; The step of obtaining feature information of each identified object includes: For one of the identification objects, collecting multiple images of the identification object; Calculate the Euclidean distance between two images; Based on the Euclidean distance, the feature information of the identified object is calculated.
6. An image processing device, characterized in that: The device comprises a processor and a storage medium; wherein the storage medium is used to store a computer program; The processor is configured to perform at least the following steps when executing the computer program stored in the storage medium: Obtaining a collected image; Obtaining a target image in the collected image, wherein the target image is an image portion separated from the collected image and including at least an object to be identified; Based on the target image, characteristic information of the object to be identified is obtained; wherein the characteristic information is obtained by processing the target image through an embedding network; the embedding network is obtained by training an image recognition network to which a Lemb layer having a loss function is added; the Lemb layer is located between the second to last convolution layer and the last convolution layer of the image recognition network; Based on the feature information, the object to be identified is determined.
7. The device according to claim 6, characterized in that The processor is further configured to perform the following steps: Obtaining stored feature information of each identified object; The feature information of the object to be identified is matched with the feature information of each identified object obtained to determine the object to be identified.
8. The device according to claim 7, characterized in that The processor is further configured to perform the following steps: Determine the Euclidean distance between the feature information of the object to be identified and the feature information of each identified object; Determine, among the various recognition objects, the recognition object having the shortest Euclidean distance to the feature information of the object to be recognized; It is determined that the identification object having the shortest Euclidean distance with the feature information of the object to be identified is in the same category.
9. The device according to claim 6, characterized in that The processor is further configured to perform the following steps: Performing convolution processing on each collected image through at least two convolution layers to obtain a feature image of each collected image in at least part of the convolution layers; Based on at least part of the feature image of the convolution layer, obtaining recognition results of positions of multiple objects to be recognized in the collected image; Based on the multiple recognition results, obtaining the position information of the object to be recognized in the captured image; Based on the position information of the object to be identified in the acquired image, a target image is determined.
10. The device according to claim 7 or 8, characterized in that The processor is further configured to perform the following steps: Obtain and store feature information of each identified object; The step of obtaining feature information of each identified object includes: For one of the identification objects, collecting multiple images of the identification object; Calculate the Euclidean distance between two images; Based on the Euclidean distance, the feature information of the identified object is calculated.
