CN111767819A - Image identification method and device, electronic equipment and computer readable medium - Google Patents
Image identification method and device, electronic equipment and computer readable medium Download PDFInfo
- Publication number
- CN111767819A CN111767819A CN202010582656.4A CN202010582656A CN111767819A CN 111767819 A CN111767819 A CN 111767819A CN 202010582656 A CN202010582656 A CN 202010582656A CN 111767819 A CN111767819 A CN 111767819A
- Authority
- CN
- China
- Prior art keywords
- determining
- image
- pixel
- target image
- target
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 56
- 238000004891 communication Methods 0.000 claims description 19
- 238000012795 verification Methods 0.000 claims description 16
- 238000004590 computer program Methods 0.000 claims description 10
- 210000003462 vein Anatomy 0.000 description 9
- 230000008569 process Effects 0.000 description 7
- 238000010586 diagram Methods 0.000 description 6
- 230000009471 action Effects 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 238000004422 calculation algorithm Methods 0.000 description 2
- 238000000605 extraction Methods 0.000 description 2
- 238000001914 filtration Methods 0.000 description 2
- 230000003044 adaptive effect Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000005286 illumination Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
- G06V20/40—Scenes; Scene-specific elements in video content
- G06V20/41—Higher-level, semantic clustering, classification or understanding of video scenes, e.g. detection, labelling or Markovian modelling of sport events or news items
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
- G06V20/40—Scenes; Scene-specific elements in video content
- G06V20/46—Extracting features or characteristics from the video content, e.g. video fingerprints, representative shots or key frames
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Theoretical Computer Science (AREA)
- Computational Linguistics (AREA)
- Software Systems (AREA)
- Image Analysis (AREA)
Abstract
The application provides an image recognition method, an image recognition device, an electronic device and a computer readable medium, wherein the method comprises the following steps: acquiring a target image and an acquisition scene of the target image; determining a target sliding window corresponding to the acquisition scene of the target image according to the corresponding relation between a preset acquisition scene and the sliding window; selecting a coding unit from the target image through the target sliding window, determining pixel points contained in the coding unit, and determining binary codes of the coding unit according to the pixel points; determining target image characteristics through binary coding of each coding unit contained in the target image; and determining a target recognition object according to the target image characteristics. The image recognition is more accurate.
Description
Technical Field
The present application relates to the field of image recognition technologies, and in particular, to an image recognition method, an image recognition apparatus, an electronic device, and a computer-readable medium.
Background
With the development of computer technology, image recognition technology is developing more and more rapidly. The texture features and the noise features are also the essential features of the image, and the texture performance and the noise of the image can be correspondingly changed along with different acquisition scenes of the image, such as different resolutions of an acquisition device or different illumination brightness.
At present, image features can be generated by adopting an LBP (Local Binary Patterns) algorithm in image recognition, and the specific extraction process is as follows: calculating a 3 x 3 pixel sliding window in the image, and then binarizing the pixels in the surrounding 8 neighborhoods by taking the pixel in the center of the window as a threshold value to obtain a binary code corresponding to a local area of the image. However, only the pixels around 8 threshold are considered, and for larger texture features, the sliding window loses part of information when extracting features, so that the result of extracting image features is not accurate, and the image identification is also not accurate.
Disclosure of Invention
An object of the embodiments of the present application is to provide an image recognition method, an image recognition apparatus, an electronic device, and a computer-readable medium, so as to solve the problem of inaccurate image recognition. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present application provides an image recognition method, where the method includes:
acquiring a target image and an acquisition scene of the target image;
determining a target sliding window corresponding to the acquisition scene of the target image according to the corresponding relation between a preset acquisition scene and the sliding window;
selecting a coding unit from the target image through the target sliding window, determining pixel points contained in the coding unit, and determining binary codes of the coding unit according to the pixel points;
determining target image characteristics through binary coding of each coding unit contained in the target image;
and determining a target recognition object according to the target image characteristics.
Optionally, before determining the target sliding window corresponding to the acquisition scene of the target image according to the preset corresponding relationship between the acquisition scene and the sliding window, the method further includes:
acquiring a verification image set, an input image set and sliding windows with different sizes under a preset acquisition scene;
aiming at each sliding window, acquiring a plurality of image characteristics of the input image set through the sliding window, and constructing a binary tree model according to the image characteristics;
acquiring first image features of the verification data set, determining second image features matched with the first image features in the binary tree model, and taking identification objects corresponding to the second image features as first identification objects corresponding to the first image features;
determining the recognition rate of the sliding window according to the matching result of the first recognition object and a preset recognition object of the first image characteristic;
and in the plurality of sliding windows, taking the sliding window with the highest recognition rate as the sliding window corresponding to the preset acquisition scene.
Optionally, the coding unit is divided into a plurality of pixel blocks;
the determining the binary code of the coding unit according to the pixel point comprises:
determining pixel points contained in each pixel block;
calculating the pixel value of each pixel block through the pixel points contained in each pixel block;
from each of the pixel values, a binary encoding of the coding unit is calculated.
Optionally, the calculating the binary code of the coding unit by each of the pixel values includes:
calculating the average pixel value of each pixel block in the coding unit;
calculating the difference value of the pixel values of the pixel blocks with central symmetry and the difference value of the pixel value of the central pixel block and the average pixel value;
and determining binary code values corresponding to the difference values, and forming the determined binary code values into binary codes of the coding units.
Optionally, the calculation formula of the binary code value is:
where x is each of the differences, and s (x) transforms each of the differences into a corresponding binary coded value.
Optionally, the calculating a pixel value of each pixel block through a pixel point included in each pixel block includes:
acquiring a pixel point value of each pixel point in the pixel block;
and calculating the average value of all the pixel point values in the pixel block, and taking the average value as the pixel value of the pixel block.
Optionally, determining the target recognition object according to the target image feature includes:
inputting the target image characteristics into a preset binary tree model, wherein child nodes contained in the binary tree model represent preset image characteristics, and each leaf node of the binary tree model corresponds to one identification object;
comparing the target image characteristics with two child nodes under the same father node in the binary tree model according to the sequence from the root node to the leaf node, and determining the child node with the nearest distance until the leaf node with the nearest distance is determined;
and determining a target recognition object corresponding to the target image characteristic according to the corresponding relation between the leaf nodes and the recognition object.
Optionally, the target image feature is an image array, and two child nodes under the same father node in the binary tree model are a first array and a second array respectively;
comparing the target image features with two child nodes under the same father node in the binary tree model according to the sequence from the root node to the leaf nodes, and determining the child node closest to the root node comprises:
respectively calculating the distance values between the image array and the first array and the second array;
comparing the two distance values and determining a minimum distance value;
and taking the array corresponding to the minimum distance value as the nearest child node.
Optionally, the determining the target image feature through binary coding of each coding unit included in the target image includes:
acquiring binary codes of coding units contained in the image;
determining the frequency value of binary codes with the same code value;
and connecting all the frequency order values to form an array, and taking the array as a target image feature.
In a second aspect, an embodiment of the present application provides an image recognition apparatus, including:
the acquisition module is used for acquiring a target image and an acquisition scene of the target image;
the first determining module is used for determining a target sliding window corresponding to the acquisition scene of the target image according to the corresponding relation between a preset acquisition scene and the sliding window;
the selection module is used for selecting a coding unit from the target image through the target sliding window, determining pixel points contained in the coding unit and determining binary codes of the coding unit according to the pixel points;
the second determining module is used for determining the characteristics of the target image through the binary coding of each coding unit contained in the target image;
and the third determining module is used for determining the target recognition object according to the target image characteristics.
In a third aspect, an electronic device in an embodiment of the present application includes a processor, a communication interface, a memory, and a communication bus, where the processor and the communication interface complete communication between the memory and the processor through the communication bus;
a memory for storing a computer program;
a processor for implementing any of the method steps described herein when executing the program stored in the memory.
In a fourth aspect, the present application is embodied in a computer-readable storage medium having a computer program stored therein, which when executed by a processor implements any of the method steps described herein.
The embodiment of the application has the following beneficial effects:
the embodiment of the application provides an image identification method, which comprises the steps of electronically acquiring a target image and a target image acquisition scene, then determining a target sliding window corresponding to the target image acquisition scene, selecting a coding unit in the target image through the target sliding window, determining pixel points contained in the coding unit, determining binary codes of the coding unit according to the pixel points, determining target image characteristics through the binary codes of the coding units contained in the target image, and finally determining a target identification object according to the target image characteristics. According to the method and the device, the size of the target sliding window can be determined according to the texture corresponding to the acquisition scene by selecting the target sliding window corresponding to the acquisition scene of the target image, so that a wider range or more accurate texture characteristic can be determined through the target sliding window, and the image identification is more accurate.
Of course, not all of the above advantages need be achieved in the practice of any one product or method of the present application.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art to obtain other drawings without inventive exercise.
Fig. 1 is a flowchart of an image recognition method according to an embodiment of the present disclosure;
FIG. 2 is a flowchart of a method for determining a target sliding window according to an embodiment of the present disclosure;
fig. 3 is a flowchart of a method for determining binary codes of coding units according to an embodiment of the present disclosure;
FIG. 4 is a flowchart of a method for calculating binary codes of coding units according to an embodiment of the present disclosure;
FIG. 5-a is a schematic view of a sliding window provided in accordance with an embodiment of the present application;
FIG. 5-b is a detailed schematic view of a sliding window according to an embodiment of the present application;
FIG. 5-c is a binary code graph according to an embodiment of the present application;
fig. 6 is a schematic diagram of extracting features of a target image according to an embodiment of the present application;
FIG. 7 is a schematic diagram illustrating determination of a target recognition object according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an image recognition apparatus according to an embodiment of the present disclosure;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the application provides an image recognition method which can be applied to an electronic device and used for recognizing a target recognition object of a target image. The corresponding target sliding window is selected according to the acquisition scene, so that the target sliding window is more adaptive to the acquisition scene and is suitable for different image textures, the target image feature extraction is more accurate, and the image identification is more accurate.
An image recognition method provided in the embodiments of the present application will be described in detail below with reference to specific embodiments, as shown in fig. 1, the specific steps are as follows:
step 101: and acquiring a target image and an acquisition scene of the target image.
The electronic device obtains a target image, where the target image may be an image capable of identifying an identification object to which the target image belongs, for example, if the target image is a finger vein image, the identification object is an ID of a finger to which the finger vein image belongs, and if the target image is a face, the identification object is a name or an identification number of a person to which the face belongs. The electronic equipment acquires a collecting scene of the target image, wherein the collecting scene comprises the resolution of a camera, the brightness of the environment where the target image is located and the like, and the texture and the noise of the target image are different when the collecting scene is different.
Step 102: and determining a target sliding window corresponding to the acquisition scene of the target image according to the corresponding relation between the preset acquisition scene and the sliding window.
The electronic equipment determines a target sliding window corresponding to the acquisition scene of the target image according to the corresponding relation between the preset acquisition scene and the sliding window, specifically, determines a target sliding window of a corresponding size corresponding to the acquisition scene of the target image. The target sliding window is divided into N multiplied by N identical pixel blocks, each pixel block comprises a pixel points, a is a positive integer, and N is a positive odd number larger than 1. The larger the value of a is, the more pixel points are contained in each pixel block, and the larger the target sliding window is.
In the embodiment of the present application, the target sliding window is divided into 3 × 3 identical pixel blocks, and each pixel block includes a pixel points.
Optionally, as shown in fig. 2, before determining a target sliding window corresponding to the acquisition scene of the target image according to a corresponding relationship between a preset acquisition scene and the sliding window, the method further includes:
step 201: and acquiring a verification image set, an input image set and sliding windows with different sizes under a preset acquisition scene.
The electronic equipment determines a preset acquisition scene, and acquires a verification image set, an input image set and sliding windows with different sizes under the preset acquisition scene. The electronic device randomly divides an image dataset into a logging dataset and a verification dataset, the image dataset including images of a plurality of objects and an ID number corresponding to the image of each object, the image of each object being divided into different sub-images, the sub-images having different noise between them, or the positions of the objects on the sub-images being different.
For example, the image dataset comprises a plurality of images, the plurality of images being images of finger veins of different fingers. Each finger may have a plurality of different images of the finger veins, specifically different positions of the finger in the images, or different noise between the images.
Step 202: and aiming at each sliding window, acquiring a plurality of image characteristics of the input image set through the sliding window, and constructing a binary tree model according to the image characteristics.
And for each sliding window, the electronic equipment acquires the image characteristics of a plurality of images recorded into the image set through the sliding window, and constructs a binary tree model according to the image characteristics.
Step 203: and acquiring first image features of the verification data set, determining second image features matched with the first image features in the binary tree model, and taking identification objects corresponding to the second image features as first identification objects corresponding to the first image features.
The electronic device obtains a first image feature of the verification data set through the sliding window, and determines a second image feature matching the first image feature in the binary tree model, where a specific matching process is described below. And taking the recognition object corresponding to the second image characteristic as a first recognition object corresponding to the first image characteristic.
For example, if the first image feature of the verification data set matches the image feature of a leaf node in the binary tree, the image feature of the leaf node corresponding to the ID number of the finger is AA, then AA is used as the ID number of the finger corresponding to the first image feature.
Step 204: and determining the recognition rate of the sliding window according to the matching result of the first recognition object and a preset recognition object of the first image characteristic.
The electronic equipment judges whether the first identification object is the same as a preset identification object of the first image characteristic, and if so, the image identification is correct.
According to the method, all verification images in the verification data set can be matched with the input data set, and the image recognition rate under the sliding window is obtained, wherein the image recognition rate is the ratio of the number of the verification images which are correctly recognized to all the verification images.
By adopting the same method, the image recognition rates under the second sliding window and the third sliding window can be respectively obtained, and the sliding window with the highest image recognition rate is taken as the target sliding window.
Step 205: and in the plurality of sliding windows, taking the sliding window with the highest recognition rate as the sliding window corresponding to the preset acquisition scene.
And determining the respective image recognition rates of other sliding windows by adopting the same method, and taking the sliding window with the highest recognition rate as the sliding window corresponding to the preset acquisition scene by the electronic equipment. And selecting a proper sliding window according to the recognition rate for the preset acquisition scene, and establishing a corresponding relation between the preset acquisition scene and the sliding window, so that the sliding window can be conveniently selected after the acquisition scene of the target image which is the same as or similar to the preset acquisition scene is acquired. And a proper sliding window is selected, so that the noise of the image is reduced, the texture of the target image is better met, and the image identification is more accurate.
Step 103: and selecting a coding unit in the target image through the target sliding window, determining pixel points contained in the coding unit, and determining the binary coding of the coding unit according to the pixel points.
The electronic equipment selects a coding unit in the target image, the size of the coding unit is the same as that of the target sliding window, and the position of the coding unit in the target image is also the same.
The coding units with different sizes comprise different pixel points, after the electronic equipment determines the coding units, the pixel points included in the coding units can be determined, the coding units are divided into a plurality of pixel blocks, each pixel block comprises one or more pixel points, the electronic equipment calculates the pixel value of each pixel block according to the pixel points, and the binary coding of the coding units is calculated through each pixel value.
Optionally, as shown in fig. 3, the dividing of the coding unit into a plurality of pixel blocks, and determining the binary code of the coding unit according to the pixel points includes:
step 301: and determining pixel points contained in each pixel block.
After the electronic device determines the pixel points included in the coding unit, since the coding unit is square, the coding unit is divided into 9 identical pixel blocks, that is, into 3 × 3 pixel blocks, and therefore the pixel points included in each pixel block can be determined according to the pixel points included in the coding unit.
Step 302: and calculating the pixel value of each pixel block through the pixel points contained in each pixel block.
The electronic equipment determines pixel points contained in each pixel block, and then calculates the pixel value of the pixel block according to the pixel point value corresponding to each pixel point.
Optionally, calculating a pixel value of each pixel block by using a pixel point included in each pixel block includes: acquiring a pixel point value of each pixel point in a pixel block; and calculating the average value of all pixel point values in the pixel block, and taking the average value as the pixel value of the pixel block.
In the embodiment of the application, the electronic device determines the pixel points included in each pixel block, obtains the pixel point value of each pixel point in the pixel block, calculates the average value of all the pixel point values in the pixel block, and takes the average value as the pixel value of the pixel block. The pixel values of each pixel block may be the same or different, and are specifically determined according to the pixel points included in the pixel block and the pixel point values of the pixel points. The electronic device may reduce the effect of noise in the image by taking the average of the pixel point values in the pixel block as the pixel value of the pixel block.
Step 303: from each pixel value, a binary code of the coding unit is calculated.
In the embodiment of the present application, calculating the binary code of the coding unit includes two ways:
the first method is as follows: calculating a 3 x 3 pixel sliding window in the image, and then binarizing the pixels in the surrounding 8 neighborhoods by taking the pixel in the center of the window as a threshold value to obtain a binary code corresponding to a local area of the image.
The second method comprises the following steps: calculating the difference between the pixel values of the central symmetric pixel blocks and the difference between the pixel value of the central pixel block and the average pixel value, and calculating the binary code of the coding unit according to the difference, wherein the process of calculating the binary code is described in detail below.
Step 104: the target image features are determined by binary coding of each coding unit contained in the target image.
In this embodiment, after acquiring the binary codes of the coding units, the electronic device may acquire the binary codes of other coding units by using the same method, so as to obtain the binary codes of all the coding units included in the entire target image. The electronic equipment acquires frequency values of binary codes with the same code values, connects all the frequency values to form an array, and takes the array as the target image characteristic.
Optionally, determining the target image feature by binary coding of each coding unit included in the target image includes: acquiring binary codes of coding units contained in an image; determining the frequency value of binary codes with the same code value; and (4) connecting all frequency values to form an array, and taking the array as the target image characteristic.
The electronic equipment acquires the binary codes of all the coding units contained in the image, and because the code values of the binary codes of some coding units are the same, the electronic equipment determines the frequency values of the binary codes with the same code values, combines all the frequency values to form a one-dimensional array, and takes the one-dimensional array as the target image characteristic.
Specifically, the electronic device may obtain the binary codes of all the coding units included in the image, convert the binary codes into corresponding decimal codes, then obtain the frequency values of the decimal codes with the same coding value, join all the frequency values to form an array, and use the array as the target image feature.
The electronic device may further divide the image into a plurality of regions, each region including a plurality of coding units, acquire the decimal codes of all the coding units of each region, acquire the frequency values of the decimal codes having the same coding value, and then join the frequency values of the plurality of regions to form an array, and take the array as the target image feature. Because the pixel point has the position information, the decimal code of the coding unit of each region is obtained, actually the binary code of the coding unit of the position of the region is obtained, the decimal code comparison of the coding units at the same position is facilitated, and the situation that two images with the same image content but different position distribution obtain the same or similar target image characteristics is avoided.
Step 105: and determining a target recognition object according to the target image characteristics.
The target image features and each preset image feature in the database can be compared respectively, the preset image features with the closest comparison result are determined, and the identification object corresponding to the preset image features is used as the target identification object, but the efficiency of the comparison process is low, so that a binary tree model is constructed by using a KD (K-dimension tree) tree algorithm, the target image features and the image features of partial subnodes in the binary tree model are compared, and the comparison efficiency is improved.
Optionally, as shown in fig. 4, calculating the binary code of the coding unit by each pixel value includes:
step 401: an average pixel value of each pixel block in the coding unit is calculated.
The electronic device calculates an average pixel value of each pixel block after acquiring the pixel value of each pixel block in the encoding unit. The encoding unit has nine pixel blocks, and thus the average pixel value is the average of the pixel values of the nine pixel blocks.
Step 402: the difference of the pixel values of the centrosymmetric pixel blocks and the difference of the pixel value of the central pixel block and the average pixel value are calculated.
Since the coding unit has nine pixel blocks, the coding unitComprising four pairs of pixel blocks centered on a centrally symmetric pixel block. As shown in FIG. 5, FIG. 5-a is a schematic view of a sliding window, comprising nine pixel blocks, g1And g5Is two pixel blocks of central symmetry, g2And g6Is two pixel blocks of central symmetry, g3And g7Is two pixel blocks of central symmetry, g4And g8Are two pixel blocks with central symmetry.
The method calculates the difference value of the pixel values of the centrosymmetric pixel blocks, namely calculating g1-g5,g2-g6,g3-g7,g4-g8Calculating the difference between the pixel value of the central pixel block and the average pixel value, i.e. calculatingWherein, gcIs the pixel value of the central pixel block,is the average of the pixel values of the respective pixel blocks.
Step 403: and determining binary code values corresponding to the difference values, and forming the determined binary code values into binary codes of the coding units.
And the electronic equipment brings the difference values into a preset formula and calculates binary coding values corresponding to the difference values.
The calculation formula of the binary code value is as follows:
where x is each difference, and s (x) is used to transform each difference into a corresponding binary coded value.
After calculating each binary code value, the electronic device connects the binary code values according to a preset sequence, specifically, the electronic device can connect the binary code values clockwise in sequence to form a binary code of the coding unit.
Fig. 5-b is a detailed schematic diagram of a sliding window, which includes nine pixel blocks, each pixel block includes 3 × 3 pixel points, and each pixel block is 18,125,79,53,86,113,31,235, 1.
The electronic device calculates the difference, i.e. g, of the centrosymmetric pixel blocks1-g5=18-1=17,g2-g6=125-235=-110,g3-g7=79-31=48,g4-g8=113=53=60。
The electronic device calculates the difference between the pixel value of the central pixel block and the average pixel value, gc=86,
Substituting the calculated difference values into a formulaThe results are obtained and written in the corresponding pixel blocks, respectively, as shown in fig. 5-c, the resulting binary code is 10111.
FIG. 5-c is a binary code map. It can be seen that the binary code is 10111.
By calculating the difference value of the pixel values of the pixel blocks with central symmetry and the difference value of the pixel value of the central pixel block and the average pixel value, the obtained binary code can be a 5-bit binary number, and the coding mode is 32, compared with the prior art that the binary code is an 8-bit binary number and the coding mode is 256, the coding mode is reduced, and the target characteristic quantity is also reduced.
As shown in fig. 6, fig. 6 is a schematic diagram of extracting features of a target image. The method comprises the steps of firstly obtaining an image containing fingers, intercepting the image containing the finger area from the image to be used as a target image, then carrying out image preprocessing, specifically, carrying out denoising on the target image through Gaussian filtering and median filtering, increasing the contrast of the target image, then dividing the target image into areas, and calculating binary codes of the areas.
Optionally, as shown in fig. 7, determining the target recognition object according to the target image feature includes:
step 701: inputting the target image characteristics into a preset binary tree model, wherein child nodes contained in the binary tree model represent the preset image characteristics, and each leaf node of the binary tree model corresponds to one identification object.
The electronic equipment is provided with a preset binary tree model, wherein the binary tree model comprises a plurality of child nodes, each child node represents different preset image characteristics, and each leaf node of the binary tree model corresponds to one identification object.
For example, the preset image features are finger vein image features, each sub-node represents different finger vein image features, and different sub-nodes may represent finger vein image features of different fingers or different finger vein image features of the same finger. Each leaf node corresponds to an identification object of the finger vein image characteristics, and the identification object can be an identification code of a finger.
Step 702: and comparing the target image characteristics with two child nodes under the same father node in the binary tree model according to the sequence from the root node to the leaf node, and determining the child node closest to the target image characteristics until the leaf node closest to the target image characteristics is determined.
The electronic equipment compares the target image characteristics with two child nodes under the same father node in the binary tree model according to the sequence from the root node to the leaf node, determines the child node with the closest distance, then compares the target image characteristics with the two child nodes under the child node, and sequentially compares the target image characteristics with the leaf node until the leaf node with the closest distance is determined.
Optionally, the target image feature is an image array, and two child nodes under the same father node in the binary tree model are a first array and a second array respectively;
comparing the target image characteristics with two child nodes under the same father node in the binary tree model according to the sequence from the root node to the leaf node, and determining the child node closest to the root node comprises: respectively calculating the distance values between the image array and the first array and the second array; comparing the two distance values and determining a minimum distance value; and taking the array corresponding to the minimum distance value as the nearest child node.
The target image is characterized by being an image array, two child nodes under the same father node in the binary tree model are respectively a first array and a second array, the electronic equipment respectively calculates the distance values between the image array and the first array and the second array, determines the minimum distance value, determines the array corresponding to the minimum distance value as the child node with the closest distance, then respectively compares the image array and the values of the two child nodes under the child node, determines the minimum distance value, sequentially compares the minimum distance value until the array with the closest distance is determined, and determines the leaf node.
Step 703: and determining a target recognition object corresponding to the target image characteristics according to the corresponding relation between the leaf nodes and the recognition objects.
The leaf nodes and the recognition objects have corresponding relations, and the electronic equipment determines the target recognition objects corresponding to the target image features according to the corresponding relations of the leaf nodes and the recognition objects.
An image recognition apparatus according to an embodiment of the present application, as shown in fig. 8, includes:
a first obtaining module 801, configured to obtain a target image and a collection scene of the target image;
a first determining module 802, configured to determine, according to a correspondence between a preset acquisition scene and a sliding window, a target sliding window corresponding to an acquisition scene of a target image;
a selecting module 803, configured to select a coding unit from the target image through the target sliding window, determine a pixel point included in the coding unit, and determine a binary code of the coding unit according to the pixel point;
a second determining module 804, configured to determine a target image feature through binary coding of each coding unit included in the target image;
a third determining module 805, configured to determine the target recognition object according to the target image feature.
Optionally, the apparatus further comprises:
the second acquisition module is used for acquiring a verification image set, an input image set and sliding windows with different sizes in a preset acquisition scene;
the building module is used for obtaining a plurality of image characteristics of the input image set through each sliding window and building a binary tree model according to the image characteristics;
the first corresponding module is used for acquiring first image features of the verification data set, determining second image features matched with the first image features in the binary tree model, and taking identification objects corresponding to the second image features as first identification objects corresponding to the first image features;
the fourth determining module is used for determining the recognition rate of the sliding window according to the matching result of the first recognition object and a preset recognition object of the first image characteristic;
and the second corresponding module is used for taking the sliding window with the highest recognition rate as the sliding window corresponding to the preset acquisition scene in the plurality of sliding windows.
Optionally, the coding unit is divided into a plurality of pixel blocks;
the selecting module 803 is specifically configured to:
determining pixel points contained in each pixel block;
calculating the pixel value of each pixel block through the pixel points contained in each pixel block;
from each pixel value, a binary code of the coding unit is calculated.
Optionally, the selecting module 803 is specifically configured to:
calculating the average pixel value of each pixel block in the coding unit;
calculating the difference value of the pixel values of the pixel blocks with central symmetry and the difference value of the pixel value of the central pixel block and the average pixel value;
and determining binary code values corresponding to the difference values, and forming the determined binary code values into binary codes of the coding units.
Optionally, the calculation formula of the binary code value is:
where x is each difference, and s (x) transforms each difference into a corresponding binary coded value.
Optionally, the selecting module 803 is specifically configured to:
acquiring a pixel point value of each pixel point in a pixel block;
and calculating the average value of all pixel point values in the pixel block, and taking the average value as the pixel value of the pixel block.
Optionally, the third determining module 805 is specifically configured to:
inputting the target image characteristics into a preset binary tree model, wherein child nodes contained in the binary tree model represent preset image characteristics, and each leaf node of the binary tree model corresponds to one identification object;
comparing the target image characteristics with two child nodes under the same father node in the binary tree model according to the sequence from the root node to the leaf node, and determining the child node closest to the target image characteristics until the leaf node closest to the target image characteristics is determined;
and determining a target recognition object corresponding to the target image characteristics according to the corresponding relation between the leaf nodes and the recognition objects.
Optionally, the target image feature is an image array, and two child nodes under the same father node in the binary tree model are a first array and a second array respectively;
the third determining module 805 is specifically configured to:
respectively calculating the distance values between the image array and the first array and the second array;
comparing the two distance values and determining a minimum distance value;
and taking the array corresponding to the minimum distance value as the nearest child node.
Optionally, the second determining module 804 is specifically configured to:
acquiring binary codes of coding units contained in an image;
determining the frequency value of binary codes with the same code value;
and (4) connecting all frequency values to form an array, and taking the array as the target image characteristic.
The embodiment of the application provides an image identification method, which comprises the steps of electronically acquiring a target image and a target image acquisition scene, then determining a target sliding window corresponding to the target image acquisition scene, selecting a coding unit in the target image through the target sliding window, determining pixel points contained in the coding unit, determining binary codes of the coding unit according to the pixel points, determining target image characteristics through the binary codes of the coding units contained in the target image, and finally determining a target identification object according to the target image characteristics. According to the method and the device, the size of the target sliding window can be determined according to the texture corresponding to the acquisition scene by selecting the target sliding window corresponding to the acquisition scene of the target image, so that a wider range or more accurate texture characteristic can be determined through the target sliding window, and the image identification is more accurate.
Based on the same technical concept, an embodiment of the present invention further provides an electronic device, as shown in fig. 9, including a processor 901, a communication interface 902, a memory 903 and a communication bus 904, where the processor 901, the communication interface 902, and the memory 903 complete mutual communication through the communication bus 904,
a memory 903 for storing computer programs;
the processor 901 is configured to implement the above steps when executing the program stored in the memory 903.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
In a further embodiment provided by the present invention, there is also provided a computer readable storage medium having stored therein a computer program which, when executed by a processor, implements the steps of any of the methods described above.
In a further embodiment provided by the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the methods of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above description is merely exemplary of the present application and is presented to enable those skilled in the art to understand and practice the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (12)
1. An image recognition method, characterized in that the method comprises:
acquiring a target image and an acquisition scene of the target image;
determining a target sliding window corresponding to the acquisition scene of the target image according to the corresponding relation between a preset acquisition scene and the sliding window;
selecting a coding unit from the target image through the target sliding window, determining pixel points contained in the coding unit, and determining binary codes of the coding unit according to the pixel points;
determining target image characteristics through binary coding of each coding unit contained in the target image;
and determining a target recognition object according to the target image characteristics.
2. The method according to claim 1, wherein before determining a target sliding window corresponding to the acquisition scene of the target image according to a preset corresponding relationship between the acquisition scene and the sliding window, the method further comprises:
acquiring a verification image set, an input image set and sliding windows with different sizes under a preset acquisition scene;
aiming at each sliding window, acquiring a plurality of image characteristics of the input image set through the sliding window, and constructing a binary tree model according to the image characteristics;
acquiring first image features of the verification data set, determining second image features matched with the first image features in the binary tree model, and taking identification objects corresponding to the second image features as first identification objects corresponding to the first image features;
determining the recognition rate of the sliding window according to the matching result of the first recognition object and a preset recognition object of the first image characteristic;
and in the plurality of sliding windows, taking the sliding window with the highest recognition rate as the sliding window corresponding to the preset acquisition scene.
3. The method of claim 1, wherein the coding unit is divided into a plurality of pixel blocks;
the determining the binary code of the coding unit according to the pixel point comprises:
determining pixel points contained in each pixel block;
calculating the pixel value of each pixel block through the pixel points contained in each pixel block;
from each of the pixel values, a binary encoding of the coding unit is calculated.
4. The method of claim 3, wherein said calculating a binary encoding of said coding unit from each of said pixel values comprises:
calculating the average pixel value of each pixel block in the coding unit;
calculating the difference value of the pixel values of the pixel blocks with central symmetry and the difference value of the pixel value of the central pixel block and the average pixel value;
and determining binary code values corresponding to the difference values, and forming the determined binary code values into binary codes of the coding units.
6. The method of claim 3, wherein said calculating a pixel value of each of said pixel blocks from said pixel points included in each of said pixel blocks comprises:
acquiring a pixel point value of each pixel point in the pixel block;
and calculating the average value of all the pixel point values in the pixel block, and taking the average value as the pixel value of the pixel block.
7. The method of claim 1, wherein determining a target recognition object based on the target image features comprises:
inputting the target image characteristics into a preset binary tree model, wherein child nodes contained in the binary tree model represent preset image characteristics, and each leaf node of the binary tree model corresponds to one identification object;
comparing the target image characteristics with two child nodes under the same father node in the binary tree model according to the sequence from the root node to the leaf node, and determining the child node with the nearest distance until the leaf node with the nearest distance is determined;
and determining a target recognition object corresponding to the target image characteristic according to the corresponding relation between the leaf nodes and the recognition object.
8. The method of claim 7, wherein the target image feature is an image array, and two child nodes under the same parent node in the binary tree model are a first array and a second array, respectively;
comparing the target image features with two child nodes under the same father node in the binary tree model according to the sequence from the root node to the leaf nodes, and determining the child node closest to the root node comprises:
respectively calculating the distance values between the image array and the first array and the second array;
comparing the two distance values and determining a minimum distance value;
and taking the array corresponding to the minimum distance value as the nearest child node.
9. The method according to claim 1, wherein the determining the target image characteristics through binary coding of each coding unit included in the target image comprises:
acquiring binary codes of coding units contained in the image;
determining the frequency value of binary codes with the same code value;
and connecting all the frequency order values to form an array, and taking the array as a target image feature.
10. An image recognition apparatus, characterized in that the apparatus comprises:
the acquisition module is used for acquiring a target image and an acquisition scene of the target image;
the first determining module is used for determining a target sliding window corresponding to the acquisition scene of the target image according to the corresponding relation between a preset acquisition scene and the sliding window;
the selection module is used for selecting a coding unit from the target image through the target sliding window, determining pixel points contained in the coding unit and determining binary codes of the coding unit according to the pixel points;
the second determining module is used for determining the characteristics of the target image through the binary coding of each coding unit contained in the target image;
and the third determining module is used for determining the target recognition object according to the target image characteristics.
11. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1-9 when executing a program stored in the memory.
12. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of the claims 1-9.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010582656.4A CN111767819B (en) | 2020-06-23 | 2020-06-23 | Image recognition method, device, electronic equipment and computer readable medium |
PCT/CN2020/140647 WO2021258699A1 (en) | 2020-06-23 | 2020-12-29 | Image identification method and apparatus, and electronic device and computer-readable medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010582656.4A CN111767819B (en) | 2020-06-23 | 2020-06-23 | Image recognition method, device, electronic equipment and computer readable medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111767819A true CN111767819A (en) | 2020-10-13 |
CN111767819B CN111767819B (en) | 2024-09-06 |
Family
ID=72722788
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010582656.4A Active CN111767819B (en) | 2020-06-23 | 2020-06-23 | Image recognition method, device, electronic equipment and computer readable medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN111767819B (en) |
WO (1) | WO2021258699A1 (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2021258699A1 (en) * | 2020-06-23 | 2021-12-30 | 珠海格力电器股份有限公司 | Image identification method and apparatus, and electronic device and computer-readable medium |
CN114217758A (en) * | 2021-12-01 | 2022-03-22 | 深圳Tcl新技术有限公司 | Image display method, image display device, electronic equipment and computer readable storage medium |
CN114549597A (en) * | 2021-12-24 | 2022-05-27 | 北京旷视科技有限公司 | Method, device, storage medium and program product for matching target object in image |
CN114638774A (en) * | 2020-12-01 | 2022-06-17 | 珠海碳云智能科技有限公司 | Image data processing method and device, and nonvolatile storage medium |
CN115861050A (en) * | 2022-08-29 | 2023-03-28 | 如你所视(北京)科技有限公司 | Method, apparatus, device and storage medium for generating panoramic image |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114494967A (en) * | 2022-01-27 | 2022-05-13 | 广东欧域科技有限公司 | Fruit tree identification method, system, equipment and medium based on edge calculation |
CN115879076B (en) * | 2022-12-09 | 2023-05-26 | 山东和同信息科技股份有限公司 | Intelligent heat supply management system based on cloud computing |
CN116385414B (en) * | 2023-04-10 | 2023-11-07 | 哈尔滨耐是智能科技有限公司 | Component multi-scale defect feature extraction method, computing device and storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103661102A (en) * | 2012-08-31 | 2014-03-26 | 北京旅行者科技有限公司 | Method and device for reminding passersby around vehicles in real time |
US20140266803A1 (en) * | 2013-03-15 | 2014-09-18 | Xerox Corporation | Two-dimensional and three-dimensional sliding window-based methods and systems for detecting vehicles |
WO2016012655A1 (en) * | 2014-07-25 | 2016-01-28 | Nokia Corporation | Method, apparatus and electronic device for detecting object in an image |
CN107016366A (en) * | 2017-03-29 | 2017-08-04 | 浙江师范大学 | A kind of guideboard detection method based on Adaptive windowing mouthful and convolutional neural networks |
US20180165552A1 (en) * | 2016-12-12 | 2018-06-14 | National Chung Shan Institute Of Science And Technology | All-weather thermal-image pedestrian detection method |
CN109815844A (en) * | 2018-12-29 | 2019-05-28 | 西安天和防务技术股份有限公司 | Object detection method and device, electronic equipment and storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111767819B (en) * | 2020-06-23 | 2024-09-06 | 珠海格力电器股份有限公司 | Image recognition method, device, electronic equipment and computer readable medium |
-
2020
- 2020-06-23 CN CN202010582656.4A patent/CN111767819B/en active Active
- 2020-12-29 WO PCT/CN2020/140647 patent/WO2021258699A1/en active Application Filing
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103661102A (en) * | 2012-08-31 | 2014-03-26 | 北京旅行者科技有限公司 | Method and device for reminding passersby around vehicles in real time |
US20140266803A1 (en) * | 2013-03-15 | 2014-09-18 | Xerox Corporation | Two-dimensional and three-dimensional sliding window-based methods and systems for detecting vehicles |
WO2016012655A1 (en) * | 2014-07-25 | 2016-01-28 | Nokia Corporation | Method, apparatus and electronic device for detecting object in an image |
US20180165552A1 (en) * | 2016-12-12 | 2018-06-14 | National Chung Shan Institute Of Science And Technology | All-weather thermal-image pedestrian detection method |
CN107016366A (en) * | 2017-03-29 | 2017-08-04 | 浙江师范大学 | A kind of guideboard detection method based on Adaptive windowing mouthful and convolutional neural networks |
CN109815844A (en) * | 2018-12-29 | 2019-05-28 | 西安天和防务技术股份有限公司 | Object detection method and device, electronic equipment and storage medium |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2021258699A1 (en) * | 2020-06-23 | 2021-12-30 | 珠海格力电器股份有限公司 | Image identification method and apparatus, and electronic device and computer-readable medium |
CN114638774A (en) * | 2020-12-01 | 2022-06-17 | 珠海碳云智能科技有限公司 | Image data processing method and device, and nonvolatile storage medium |
CN114638774B (en) * | 2020-12-01 | 2024-02-02 | 珠海碳云智能科技有限公司 | Image data processing method and device and nonvolatile storage medium |
CN114217758A (en) * | 2021-12-01 | 2022-03-22 | 深圳Tcl新技术有限公司 | Image display method, image display device, electronic equipment and computer readable storage medium |
CN114549597A (en) * | 2021-12-24 | 2022-05-27 | 北京旷视科技有限公司 | Method, device, storage medium and program product for matching target object in image |
CN115861050A (en) * | 2022-08-29 | 2023-03-28 | 如你所视(北京)科技有限公司 | Method, apparatus, device and storage medium for generating panoramic image |
Also Published As
Publication number | Publication date |
---|---|
WO2021258699A1 (en) | 2021-12-30 |
CN111767819B (en) | 2024-09-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111767819B (en) | Image recognition method, device, electronic equipment and computer readable medium | |
KR101183391B1 (en) | Image comparison by metric embeddings | |
CN110688524B (en) | Video retrieval method and device, electronic equipment and storage medium | |
CN113095370B (en) | Image recognition method, device, electronic equipment and storage medium | |
CN110766708B (en) | Image comparison method based on contour similarity | |
CN110084238B (en) | Finger vein image segmentation method and device based on LadderNet network and storage medium | |
CN108960280B (en) | Picture similarity detection method and system | |
CN111104941B (en) | Image direction correction method and device and electronic equipment | |
Xie et al. | Bag-of-words feature representation for blind image quality assessment with local quantized pattern | |
CN115631112B (en) | Building contour correction method and device based on deep learning | |
CN111414803A (en) | Face recognition method and device and electronic equipment | |
CN111242925A (en) | Target detection method and device for CT image data and electronic equipment | |
CN107578011A (en) | The decision method and device of key frame of video | |
Kong et al. | Local Stereo Matching Using Adaptive Cross‐Region‐Based Guided Image Filtering with Orthogonal Weights | |
CN111488810A (en) | Face recognition method and device, terminal equipment and computer readable medium | |
CN111353325A (en) | Key point detection model training method and device | |
CN111353514A (en) | Model training method, image recognition method, device and terminal equipment | |
CN109840529B (en) | Image matching method based on local sensitivity confidence evaluation | |
CN116630367B (en) | Target tracking method, device, electronic equipment and storage medium | |
CN112257689A (en) | Training and recognition method of face recognition model, storage medium and related equipment | |
CN113128278A (en) | Image identification method and device | |
CN113920147B (en) | Remote sensing image building extraction method and device based on deep learning | |
CN116229098A (en) | Image recognition method based on mask contour tracking and related products | |
CN113051901B (en) | Identification card text recognition method, system, medium and electronic terminal | |
CN115270841A (en) | Bar code detection method and device, storage medium and computer equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |