Image identification methods, electronic devices and computer-readable media

Through pre-trained detection and classification models, the image target area is automatically obtained and identification results are generated, which solves the problems of complexity and low accuracy of traditional image recognition methods, and achieves high-accuracy and automated image identification.

CN111881944BActive Publication Date: 2024-09-17MOUTAI INST
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202010651813.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-08
Publication Date
2024-09-17
Estimated Expiration
2040-07-08

AI Technical Summary

Technical Problem

Traditional image recognition methods require manual design and extraction of features. The process is complex and difficult to generalize. The recognition accuracy is low and there is a lack of automation.

Method used

Use pre-trained detection models and classification models to generate feature maps through convolutional layers, region proposal layers, matching layers, fully convolutional layers and output layers, automatically obtain image target areas, and use residual networks to classify and generate identification results. Collection to determine image categories.

Benefits of technology

It improves the automation and convenience of the image identification process, achieves high-accuracy identification of multi-category images, and can be extended to other categories of applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111881944B
    Figure CN111881944B
Patent Text Reader

Abstract

The embodiments of the present disclosure disclose a method, an electronic device, and a computer-readable medium for image identification. A specific implementation of the method includes: acquiring a first target image; inputting the first target image into a pre-trained detection model to generate a second target image; inputting the second target image into a pre-trained classification model to generate a set of identification results for the second target image; and determining the category of the first target image based on the set of identification results. This method uses a pre-trained detection model to generate second target features, and automatically acquires valid image target areas without manual intervention. The pre-trained classification model is used to automatically generate an identification result set, and the category of the first target image is automatically determined based on the identification result set, thereby improving the automation and convenience of the image identification process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to the field of artificial intelligence, and in particular to an image recognition method, an electronic device, and a computer-readable medium. Background Art

[0002] Image recognition is an important field of artificial intelligence. It refers to the technology of using computers to process, analyze and understand images to identify targets and objects of various different patterns. Unlike the methods of identification through biochemical components and identification based on near-infrared hyperspectral images, the image recognition method is convenient and fast and does not require the assistance of professional equipment. Traditional image recognition methods require manual methods to design and extract features from images. The feature extraction process is complicated and difficult to generalize to other images, and the recognition accuracy is also low. The application of deep learning algorithms in the field of image recognition can integrate feature extraction and classification into a whole, without the need for manual feature design, so that the identification of multiple categories of images can achieve a high accuracy rate, and can also be easily generalized to the identification of other categories of images. Summary of the invention

[0003] The embodiment of the present disclosure proposes a method for image identification.

[0004] In a first aspect, an embodiment of the present disclosure provides a method for image identification, the method comprising: acquiring a first target image; inputting the first target image into a pre-trained detection model to generate a second target image; inputting the second target image into a pre-trained classification model to generate an identification result set for the second target image; and determining the category of the first target image based on the identification result set.

[0005] In some embodiments, the method further includes: sending the category of the first target image to a device that supports display, and controlling the device to display the category.

[0006] In some embodiments, inputting the first target image into a pre-trained detection model to generate a second target image includes: inputting the first target image into a pre-trained detection model to generate a process image; and cutting the process image to generate the second target image.

[0007] In some embodiments, a pre-trained detection model includes a convolutional layer, a region proposal layer, a matching layer, a full convolutional layer and an output layer; and inputting the first target image into the pre-trained detection model to generate a process image includes: inputting the first target image into the convolutional layer to generate a first feature map; inputting the first feature map into the region proposal layer to generate a candidate region map; inputting the first feature map and the candidate region map into the matching layer to generate a second feature map; inputting the second feature map into the full convolutional layer to generate a third feature map; and inputting the third feature map into the output layer to generate a process image.

[0008] In some embodiments, the pre-trained classification model includes a first number of pre-trained neural networks, wherein the pre-trained neural network is a residual network, and the residual network is composed of a second number of residual modules, and the residual module generates an output using the following formula: y = F(x, {W i})+x, where x is the input of the residual module, y is the output of the residual module, F() is the residual function, W is the weight matrix, i is the layer count in the residual module, and W i represents the weight matrix of the i-th layer, {W i} represents the set of weight matrices of all layers in the residual module.

[0009] In some embodiments, the first number of pre-trained neural networks corresponds to a first number of predetermined categories.

[0010] In some embodiments, the pre-trained neural network is obtained by the following steps: determining the network structure of the initial neural network and initializing the network parameters of the initial neural network; obtaining a training sample set, wherein the training sample includes a sample image and a sample category corresponding to the sample image; selecting a sample from the sample set, and performing the following training steps: inputting the sample image of the selected sample into the initial neural network to obtain the category of the selected sample; comparing the category of the selected sample with the corresponding sample category; determining whether the initial neural network has achieved a preset optimization goal based on the comparison result; in response to determining that the initial neural network has achieved the optimization goal, treating the initial neural network as a pre-trained neural network that has completed training; in response to determining that the initial neural network has not completed training, adjusting relevant parameters in the initial neural network, and re-selecting samples from the sample set, using the adjusted initial neural network as the initial neural network, and performing the training steps again.

[0011] In some embodiments, the second target image is input into a pre-trained classification model to generate a set of identification results for the second target image, including: inputting the second target image into a pre-trained classification model to obtain an output result set; determining the output result set of the pre-trained classification model as the identification result set for the second target image, wherein the output result set of the pre-trained classification model is a set of output results of a first number of pre-trained neural networks, the identification result is the output result of the pre-trained neural network, and the identification result set includes the first number of identification results.

[0012] In some embodiments, based on the identification result set, determining the category of the first target image includes: in response to all values ​​in the identification result set being negative values, determining that the category of the first target image is empty; in response to not all values ​​in the identification result set being negative values, determining the category corresponding to the maximum value in the identification result set as the category of the first target image.

[0013] In a second aspect, an embodiment of the present disclosure provides a terminal device, which includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any implementation method in the first aspect.

[0014] The disclosed embodiments provide a method, electronic device and computer-readable medium for image identification. A specific implementation of the method includes: acquiring a first target image; inputting the first target image into a pre-trained detection model to generate a second target image; inputting the second target image into a pre-trained classification model to generate an identification result set of the second target image; and determining the category of the first target image based on the identification result set.

[0015] One of the above-mentioned embodiments of the present disclosure has the following beneficial effects: based on the first target image, the second target image is automatically acquired using a pre-trained detection model, without the need to manually determine the key target area in the first target image. The second target image is classified using a pre-trained classification model to obtain a set of identification results for the second target image. Based on the identification set, the category of the first target image is automatically generated. The embodiment of the present disclosure generates the second target feature using a pre-trained detection model, and automatically acquires the effective image target area without manual intervention. The identification result set is automatically generated using a pre-trained classification model, and the category of the first target image is automatically determined based on the identification result set, thereby improving the automation and convenience of the image identification process. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Other features, objects and advantages of the present disclosure will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0017] Figure 1 is an architectural diagram of an exemplary system in which some embodiments of the present disclosure may be applied;

[0018] Figure 2 is a flow chart of some embodiments of the method for image identification according to the present disclosure;

[0019] Figure 3 is a flow chart of training steps for training a neural network according to the present disclosure;

[0020] Figure 4 It is a structural diagram of a terminal device suitable for implementing some embodiments of the present disclosure. DETAILED DESCRIPTION

[0021] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0022] It should also be noted that, for ease of description, only the parts related to the invention are shown in the drawings. In the absence of conflict, the embodiments and features in the embodiments of the present disclosure can be combined with each other.

[0023] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0024] The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.

[0025] Figure 1 An exemplary system architecture 100 is shown to which an embodiment of the method of image authentication of the present disclosure may be applied.

[0026] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0027] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as image recognition applications, data analysis applications, natural language processing applications, etc.

[0028] The terminal devices 101, 102, 103 can be hardware or software. When the terminal devices 101, 102, 103 are hardware, they can be various terminal devices with display screens, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, etc. When the terminal devices 101, 102, 103 are software, they can be installed in the terminal devices listed above. They can be implemented as multiple software or software modules (for example, to provide image input, text input, etc.), or they can be implemented as a single software or software module. No specific limitation is made here.

[0029] The server 105 may be a server that provides various services, such as a server that performs recognition and other processing on images input by the terminal devices 101, 102, and 103. The server may perform recognition and other processing on the received images, and feed back the processing results (such as recognition results) to the terminal devices.

[0030] It should be noted that the image identification method provided in the embodiment of the present disclosure is generally executed by the server 105 , and accordingly, the device for display is generally set in the server 105 .

[0031] It should be noted that the server 105 may also directly store images locally, and the server 105 may directly extract local images and obtain recognition results through recognition methods. In this case, the exemplary system architecture 100 may not include the terminal devices 101, 102, 103 and the network 104.

[0032] It should also be noted that the terminal devices 101, 102, 103 may also be installed with image recognition applications, and in this case, the image identification method may also be executed by the terminal devices 101, 102, 103. In this case, the exemplary system architecture 100 may also not include the server 105 and the network 104.

[0033] It should be noted that the server 105 can be hardware or software. When the server 105 is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server is software, it can be implemented as multiple software or software modules (for example, for providing image identification services), or it can be implemented as a single software or software module. No specific limitation is made here.

[0034] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0035] Continue to refer Figure 2 , shows a process 200 of some embodiments of the method for image identification according to the present disclosure. The method for image identification comprises the following steps:

[0036] Step 201: Acquire a first target image.

[0037] In some embodiments, the image identification method is performed by a subject (eg Figure 1 The terminal device shown in the figure can obtain the first target image. Among them, the image is a similar and vivid description or portrait of an objective object, and is the most commonly used information carrier in human social activities. The image is all pictures with visual effects. Specifically, the first target image can be an image of an apple.

[0038] Step 202: Input the first target image into a pre-trained detection model to generate a second target image.

[0039] In some embodiments, the execution subject inputs the first target image into a pre-trained detection model to generate a process image. The pre-trained detection model includes a convolution layer, a region proposal layer, a matching layer, a full convolution layer and an output layer.

[0040] In some optional implementations of some embodiments, the execution subject inputs the first target image into a pre-trained detection model, and the output of the pre-trained detection model is used as the process image. The process of the pre-trained detection model generating the process image may include the following steps:

[0041] In the first step, the first target image is input into the convolution layer to generate the first feature map.

[0042] In the second step, the first feature map is input into the region proposal layer to generate a candidate region map.

[0043] Specifically, the region proposal layer slides the window in the first feature map through windows or anchors with different multiples and aspect ratios to generate a candidate region map. Specifically, three windows can be defined. The size of the first window can be 16 pixels, including three windows with aspect ratios of 1:1, 1:2, and 2:1 respectively. The size of the second window can be 8 pixels, including three windows with aspect ratios of 1:1, 1:2, and 2:1 respectively. The size of the third window can be 32 pixels, including three windows with aspect ratios of 1:1, 1:2, and 2:1 respectively. The region proposal layer uses these three windows to slide the first feature map, and calculates the intersection-over-union ratio using the following formulas:

[0044]

[0045] Among them, IoU represents the intersection over union ratio, A represents the window generated by the region proposal layer, B represents the correct window in the sample database used for pre-training, S represents the area, and S A∩B represents the overlapping area of ​​A and B, S A∪B Represents the union area of ​​A and B. In response to the IoU value being greater than "0.5", the region A is included in the candidate region to obtain a candidate region map.

[0046] In the third step, the first feature map and the candidate region map are input into the matching layer to generate the second feature map.

[0047] Specifically, the matching layer implements pooling of the candidate region map, thereby pooling candidate region maps of different sizes to obtain a second feature map of a fixed size. Optionally, the pooling operation can use a bilinear interpolation algorithm to obtain an interpolated second feature map. The portion of the second feature map that is not interpolated is marked as a candidate region.

[0048] The fourth step is to input the second feature map into the full convolution layer to generate the third feature map.

[0049] The fifth step is to input the third feature map into the output layer to generate a process image.

[0050] In some optional implementations of some embodiments, the above-mentioned execution body cuts the process image to generate a second target image. In the process image, the outermost edges of the marked candidate area form a bounding box. The outermost edges can be defined according to the minimum and maximum values ​​of the horizontal coordinates and the minimum and maximum values ​​of the vertical coordinates of all pixels inside the marked candidate area. The outermost edges form a rectangle. According to the rectangular frame, the candidate area is cut out from the process image using a toolkit for image processing. The width of the rectangular frame is set to a uniform pixel size. Specifically, the width can be 300 pixels. The height of the rectangular frame is transformed accordingly according to the aspect ratio of the candidate area image to generate the second target image.

[0051] Step 203: input the second target image into a pre-trained classification model to generate a set of identification results of the second target image.

[0052] In some embodiments, the execution subject inputs the second target image into a pre-trained classification model. Optionally, the pre-trained classification model includes a first number of pre-trained neural networks. The first number of pre-trained neural networks corresponds to a first number of predetermined image categories.

[0053] Optionally, the pre-trained neural network is a residual network. The residual network is composed of a second number of residual modules. Each residual module generates an output using the following formula:

[0054] y=F(x,{W i})+x,

[0055] Wherein, x is the input of the residual module, y is the output of the residual module, F() is the residual function, W is the weight matrix, i is the layer count in the residual module, and W i represents the weight matrix of the i-th layer, {W i} represents the set of weight matrices of all layers in the residual module. Specifically, the residual function F() is expressed as follows:

[0056] F(x)=W2σ(W1x),

[0057] Wherein, x is the input of the residual module, W is the weight matrix, W1 represents the weight matrix of the first layer, W2 represents the weight matrix of the second layer, and σ represents the activation function. Specifically, the activation function can be a function running on the neurons of the artificial neural network, responsible for mapping the input of the neuron to the output. Specifically, the activation function can be a ReLu function, which is expressed as:

[0058] σ(x)=max(0,x)

[0059] Among them, σ represents the activation function, x represents any integer input, and max() is the maximum value processing.

[0060] In some optional implementations of some embodiments, the execution subject inputs the second target image into a pre-trained classification model to obtain an output result set. The pre-trained classification model includes a first number of pre-trained neural networks. The execution subject inputs the second target image into a first number of pre-trained neural networks to obtain a first number of output results. The output result set includes the first number of output results. The output result set of the pre-trained classification model is determined as the identification result set of the second target image. Among them, the output result set of the pre-trained classification model is a set of output results of the first number of pre-trained neural networks. The identification result is the output result of the pre-trained neural network, and the identification result set includes the first number of identification results.

[0061] Step 204 : determining the category of the first target image based on the identification result set.

[0062] In some embodiments, the execution entity determines the category of the first target image based on the identification result set.

[0063] In response to all the values ​​in the identification result set being negative values, determining that the category of the first target image is empty. Specifically, the category of the first target image does not belong to a predetermined image category. In response to not all the values ​​in the identification result set being negative values, determining the category corresponding to the maximum value in the identification result set as the category of the first target image.

[0064] Optionally, the execution subject sends the category of the first target image to a device that supports display, and controls the device to display the category. The device that supports display may be a device that is communicatively connected to the execution subject, and may display the image category based on the received information. For example, the category information displayed by the device is "first category apples", where the first category may indicate that the apples are produced in "Shandong Province". For another example, the category information displayed by the device is "second category apples", where the second category may indicate that the apples are produced in "Hebei Province". This automatic display method emphasizes the display of the category of the first target image, which is conducive to improving the accuracy and convenience of users making judgments and decisions regarding the first target image.

[0065] Figure 2 An embodiment provided has the following beneficial effects: based on the first target image, the second target image is automatically acquired using a pre-trained detection model, without the need to manually determine the key target area in the first target image. The second target image is classified using a pre-trained classification model to obtain a set of identification results for the second target image. Based on the identification set, the category of the first target image is automatically generated. The embodiment of the present disclosure generates second target features using a pre-trained detection model, and automatically acquires valid image target areas without manual intervention. The identification result set is automatically generated using a pre-trained classification model, and the category of the first target image is automatically determined based on the identification result set, thereby improving the automation and convenience of the image identification process.

[0066] Continue to refer Figure 3 , shows a process 300 of an embodiment of a training step of a pre-trained neural network according to the present disclosure. The training step may include the following steps:

[0067] Step 301, determining the network structure of the initial neural network and initializing the network parameters of the initial neural network.

[0068] In this embodiment, the execution subject of the training step can be the same as the execution subject of the image identification method (for example Figure 1 The terminal device shown in the figure is the same or different. If they are the same, the execution subject of the training step can store the trained network structure information and the parameter values ​​of the network parameters locally after the neural network is trained. If they are different, the execution subject of the training step can send the trained network structure information and the parameter values ​​of the network parameters to the execution subject of the image identification method after the neural network is trained.

[0069] In this embodiment, the execution subject of the training step may first determine the network structure of the initial neural network. For example, it is necessary to determine which layers the initial neural network includes, the connection order relationship between the layers, which neurons each layer includes, the weight and bias corresponding to each neuron, the activation function of each layer, etc. Optionally, the neural network may include a second number of residual modules.

[0070] Then, the execution subject of the training step can initialize the network parameters of the initial neural network. In practice, the various network parameters of the initial neural network (for example, weight parameters and bias parameters) can be initialized with some different small random numbers. "Small random numbers" are used to ensure that the network will not enter a saturated state due to excessive weights, thereby causing training failure, and "different" is used to ensure that the network can learn normally.

[0071] Step 302: Obtain a training sample set.

[0072] In this embodiment, the execution subject of the training step can obtain the training sample set locally or remotely from other terminal devices connected to the execution subject through a network. The training samples include sample images and sample categories corresponding to the sample images.

[0073] Step 303: Select a sample from the sample set, take the sample image included in the sample as input, take the corresponding pre-obtained sample category corresponding to the sample image as the expected output, and train the neural network.

[0074] In this embodiment, the execution subject of the training step can execute step 1 to train the neural network.

[0075] Step 1: Neural network training process.

[0076] First, the sample images included in the training samples in the selected training sample set are input into the initial neural network to obtain the categories of the selected samples.

[0077] Second, the category of the selected sample is compared with the corresponding sample category. Specifically, the difference between the category of the selected sample and the corresponding sample category can be calculated using a preset loss function. For example, the difference between the category of the selected sample and the corresponding sample category can be calculated using a cross entropy loss function, and the use of a sigmoid function in the cross entropy loss function can avoid the problem of reduced machine learning rate when the gradient is descended.

[0078] Third, in response to determining that the initial neural network has reached the optimization goal, the initial neural network is used as a pre-trained neural network that has completed training, and the training ends. Specifically, the preset optimization goal here may include but is not limited to at least one of the following: the training time exceeds the preset time; the number of training times exceeds the preset number of times; the calculated difference is less than the preset difference threshold.

[0079] Step 304, in response to determining that the initial neural network has not been trained, adjusting relevant parameters in the initial neural network, reselecting samples from the sample set, using the adjusted initial neural network as the initial neural network, and performing the training step again.

[0080] In this embodiment, the execution subject of the training step responds to determining that the initial neural network has not been trained. Specifically, it can be in response to the initial neural network not reaching the optimization target, adjusting the relevant parameters in the initial neural network. Specifically, various implementation methods can be used to adjust the network parameters of the initial neural network based on the difference between the category of the selected sample and the corresponding sample category. For example, the Adam, BP (Back Propagation) algorithm or SGD (Stochastic Gradient Descent) algorithm can be used to adjust the network parameters of the initial neural network.

[0081] Optionally, the execution subject reselects a sample from the sample set, takes the sample image included in the sample as input, takes the corresponding pre-obtained sample category corresponding to the sample image as the expected output, uses the adjusted initial neural network as the initial neural network, executes the above step 1, and trains the neural network again.

[0082] In this embodiment, the execution subject of the training step determines the initial neural network obtained through training as the pre-trained neural network.

[0083] Figure 3 An embodiment provided has the following beneficial effects: a neural network is trained based on a sample image and a sample category corresponding to the sample image. The neural network can be directly applied to determine the probability that an input image corresponds to the category. The first target image is directly input into the neural network without manual intervention or image feature extraction, and the probability that the first target image corresponds to the category can be automatically obtained.

[0084] Reference below Figure 4 , which shows a schematic diagram of the structure of a computer system 400 suitable for implementing a server of an embodiment of the present disclosure. Figure 4 The server shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0085] like Figure 4 As shown, the computer system 400 includes a central processing unit (CPU) 401, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 402 or the program loaded from the storage part 408 to the random access memory (RAM) 403. Various programs and data required for the operation of the system 400 are also stored in the RAM 403. The CPU 401, the ROM 402 and the RAM 403 are connected to each other through a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.

[0086] The following components are connected to the I / O interface 405: a storage section 406 including a hard disk, etc.; and a communication section 407 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 407 performs communication processing via a network such as the Internet. A drive 408 is also connected to the I / O interface 405 as needed. A removable medium 409, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 408 as needed, so that a computer program read therefrom is installed into the storage section 406 as needed.

[0087] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 407, and / or installed from the removable medium 409. When the computer program is executed by the central processing unit (CPU) 401, the above functions defined in the method of the present disclosure are executed. It should be noted that the computer-readable medium described in the present disclosure can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection with one or more conductors, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device, or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in combination with an instruction execution system, device, or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0088] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as C or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0089] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0090] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present disclosure is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above invention concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other.

Claims

1. A method for image identification, include: Acquire a first target image; Inputting the first target image into a pre-trained detection model to generate a second target image; Inputting the second target image into a pre-trained classification model to generate a set of identification results of the second target image; Based on the identification result set, determining the category of the first target image; The step of inputting the first target image into a pre-trained detection model to generate a second target image includes: Inputting the first target image into a pre-trained detection model to generate a process image; The pre-trained detection model includes a convolution layer, a region proposal layer, a matching layer, a full convolution layer and an output layer; and the first target image is input into the pre-trained detection model to generate a process image, including: Inputting the first target image into the convolutional layer to generate a first feature map; The first feature map is input into the region proposal layer to generate a candidate region map, wherein the region proposal layer slides the first feature map through windows or anchors with different multiples and aspect ratios to generate a candidate region map, and defines three windows. The size of the first window is 16 pixels, including three windows representing aspect ratios of 1:1, 1:2, and 2:1, respectively. The size of the second window is 8 pixels, including three windows representing aspect ratios of 1:1, 1:2, and 2:1, respectively. The size of the third window is 32 pixels, including three windows representing aspect ratios of 1:1, 1:2, and 2:1, respectively. The region proposal layer uses these three windows to slide the first feature map, and calculates the intersection-over-union ratio using the following formulas: Among them, IoU represents the intersection over union ratio, A represents the window generated by the region proposal layer, B represents the correct window in the sample database used for pre-training, S represents the area, and S A∩B represents the overlapping area of ​​A and B, S A∪B Represents the union area of ​​​​A and B. In response to the IoU value being greater than 0.5, the area corresponding to window A generated by the region proposal layer is included in the candidate region to obtain a candidate region map; Inputting the first feature map and the candidate region map into the matching layer to generate a second feature map, wherein the matching layer implements pooling of the candidate region map, pooling the candidate region maps of different sizes to obtain a second feature map of a fixed size, and marking a portion of the second feature map that has not been interpolated as a candidate region; Inputting the second feature map into the full convolutional layer to generate a third feature map; Inputting the third feature map into the output layer to generate the process image; The process image is cut to generate the second target image, wherein, in the process image, the outermost edges of the marked candidate areas form a bounding box, the outermost edges are defined according to the minimum and maximum values ​​of the horizontal coordinates and the minimum and maximum values ​​of the vertical coordinates of all pixels inside the marked candidate areas, and the outermost edges form a rectangle. According to the rectangular box, a picture processing toolkit is used to cut the candidate area from the process image, the width of the rectangular box is set to a uniform pixel size, and the height of the rectangular box is transformed accordingly according to the aspect ratio of the candidate area image to generate the second target image.

2. The method according to claim 1, in, The method further comprises: The category of the first target image is sent to a device supporting display, and the device is controlled to display the category.

3. The method according to claim 2, in, The pre-trained classification model includes a first number of pre-trained neural networks, wherein the pre-trained neural network is a residual network, and the residual network is composed of a second number of residual modules, and the residual module generates an output using the following formula: y=F(x, {W i })+x, where x is the input of the residual module, y is the output of the residual module, F() is the residual function, W is the weight matrix, i is the layer count in the residual module, and W i represents the weight matrix of the i-th layer, {W i } represents the set of weight matrices of all layers in the residual module.

4. The method according to claim 3, in, The first number of pre-trained neural networks corresponds to a first number of predetermined categories.

5. The method according to claim 4, in, The pre-trained neural network is obtained by the following steps: Determine the network structure of the initial neural network and initialize the network parameters of the initial neural network; Acquire a training sample set, wherein the training sample includes a sample image and a sample category corresponding to the sample image; Select samples from the sample set and perform the following training steps: Inputting a sample image of a selected sample into an initial neural network to obtain a category of the selected sample; Comparing the category of the selected sample with the corresponding sample category; Determining whether the initial neural network reaches a preset optimization goal according to the comparison result; In response to determining that the initial neural network achieves the optimization goal, using the initial neural network as the pre-trained neural network that has completed training; In response to determining that the initial neural network has not been trained, relevant parameters in the initial neural network are adjusted, and samples are reselected from the sample set, and the adjusted initial neural network is used as the initial neural network to perform the training step again.

6. The method according to claim 5, in, The step of inputting the second target image into a pre-trained classification model to generate a set of identification results of the second target image includes: Inputting the second target image into a pre-trained classification model to obtain an output result set; The output result set of the pre-trained classification model is determined as the identification result set of the second target image, wherein the output result set of the pre-trained classification model is a set of output results of the first number of pre-trained neural networks, the identification result is the output result of the pre-trained neural network, and the identification result set includes the first number of identification results.

7. The method according to claim 6, in, The determining the category of the first target image based on the identification result set includes: In response to all values ​​in the identification result set being negative values, determining that the category of the first target image is empty; In response to the values ​​in the identification result set not all being negative values, the category corresponding to the maximum value in the identification result set is determined as the category of the first target image.

8. A first terminal device, include: one or more processors; a storage device having one or more programs stored thereon; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Image discrimination model training method and device and readable storage medium

    CN107609598A

  • Target identification method and device and monitoring equipment

    CN109871730A

  • Target detection method, electronic equipment and storage medium

    CN110110652A

  • Image detection method and device and computer readable storage medium

    CN110378420A

  • Visual identification method and device combined with fine-grained classification and computer device

    CN110826504A