Image recognition method, device, computing equipment and medium
By obtaining the original image of the portrait, determining the bone information and target area, and using the feature extraction model to identify the wearing of the hard helmet, solving the problems of low recognition efficiency and low accuracy in traditional methods, achieving more efficient and accurate hard helmet wearing Identify.
Patent Information
- Application Number
- CN201911138131.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-11-18
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2039-11-18
AI Technical Summary
Traditional safety helmet wear recognition methods have low recognition efficiency and low accuracy during image recognition.
By obtaining the original image of the portrait, determining the bone information, determining the target area based on the bone information, and using the feature extraction model to identify whether the portrait in the target area wears a safety helmet, and comparing the feature vector with the feature vector in the feature library through the European-style distance measurement value. To judge the wearing condition.
Improve the efficiency and accuracy of image recognition, accurately determine the target area that potentially contains safety helmets, narrow the recognition range, and improve the recognition efficiency and accuracy.
Smart Images

Figure CN111767773B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and more specifically, to an image recognition method, apparatus, computing device, and medium. Background Art
[0002] Safety devices such as hard hats can protect people's heads from falling objects and other injuries, and are protective equipment that must be worn during construction work. However, many construction workers do not wear hard hats due to negligence or fluke mentality, causing unnecessary casualties in accidents. Through hard hat wearing recognition technology, construction workers who are not wearing hard hats can be found in time, thereby improving management efficiency during the construction process.
[0003] Traditional helmet wearing recognition methods generally first detect the overall outline of the human body in the image to be recognized, and then find the position of the helmet in the overall outline to determine whether the human body in the image is wearing a helmet.
[0004] In the process of implementing the concept of the present disclosure, the inventors found that the above method has at least problems of low recognition efficiency and low accuracy in the process of recognizing images. Summary of the invention
[0005] In view of this, the present disclosure provides a method, apparatus, computing device and medium for image recognition.
[0006] One aspect of the present disclosure provides a method for image recognition, including: acquiring an original image containing a human portrait; determining bone information in the original image; determining a target area from the original image based on the bone information; and identifying whether the human portrait in the target area wears a safety device in a preset manner.
[0007] According to an embodiment of the present disclosure, the above-mentioned determination of the skeleton information in the original image includes: obtaining the skeleton information by inputting the original image into a preset human skeleton key point detection model, and the skeleton information includes the coordinates of the neck position, the left ear position and the right ear position.
[0008] According to an embodiment of the present disclosure, the target area is determined from the original image based on the skeleton information, including: determining the center point according to the coordinates of the left ear position and the coordinates of the right ear position; determining a rectangular area with the center point as the center, the length of the rectangular area being the distance from the center point to the neck position, and the width of the rectangle being 1 / 2 of the length; and determining the rectangular area as the target area in the original image.
[0009] According to an embodiment of the present disclosure, the above-mentioned identification of whether a person in a target area wears a safety device in a preset manner includes: obtaining a target feature vector by inputting an image of the target area into a preset feature extraction model; obtaining a positive feature library and a negative feature library, the positive feature library including at least one first feature vector, and the negative feature library including at least one second feature vector; determining a first distance metric value and a second distance metric value by comparing the target feature vector with the first feature vector in the positive feature library and the second feature vector in the negative feature library respectively; and if the first distance metric value is less than the second distance metric value, determining that the person in the target area wears a safety helmet in the preset manner; otherwise, determining that the person in the target area does not wear a safety helmet in the preset manner.
[0010] According to an embodiment of the present disclosure, the above-mentioned method of determining the first distance measurement value and the second distance measurement value by comparing the target feature vector with the first feature vector in the positive feature library and the second feature vector in the negative feature library, respectively, includes: calculating the Euclidean distance between the target feature vector and all the first feature vectors, and determining the smallest Euclidean distance among the Euclidean distances between the target feature vector and all the first feature vectors as the first distance measurement value; and calculating the Euclidean distance between the target feature vector and all the second feature vectors, and determining the smallest Euclidean distance among the Euclidean distances between the target feature vector and all the second feature vectors as the second distance measurement value.
[0011] Another aspect of the present disclosure provides an image recognition device, including: a first acquisition module, used to acquire an original image containing a portrait; a first determination module, used to determine bone information in the original image; a second determination module, used to determine a target area from the original image based on the bone information; and an identification module, used to identify whether the portrait in the target area is wearing a safety device in a preset manner.
[0012] According to an embodiment of the present disclosure, the above-mentioned first determination module includes: a second acquisition submodule, which is used to obtain skeleton information by inputting the original image into a preset human skeleton key point detection model, and the skeleton information includes the coordinates of the neck position, left ear position and right ear position.
[0013] According to an embodiment of the present disclosure, the above-mentioned second determination module includes: a third determination submodule, used to determine the center point according to the coordinates of the left ear position and the coordinates of the right ear position; a fourth determination submodule, used to determine a rectangular area with the center point as the center, the length of the rectangular area is the distance from the center point to the neck position, and the width of the rectangle is 1 / 2 of the length; and a fifth determination submodule, used to determine the rectangular area as the target area in the original image.
[0014] According to an embodiment of the present disclosure, the above-mentioned recognition module includes: an input submodule, which is used to obtain a target feature vector by inputting an image of the target area into a preset feature extraction model; a third acquisition submodule, which is used to obtain a positive feature library and a negative feature library, the positive feature library includes at least one first feature vector, and the negative feature library includes at least one second feature vector; a comparison submodule, which is used to determine a first distance measurement value and a second distance measurement value by comparing the target feature vector with the first feature vector in the positive feature library and the second feature vector in the negative feature library respectively; and a fifth determination submodule, which is used to determine that the person in the target area wears a safety helmet in a preset manner if the first distance measurement value is less than the second distance measurement value; otherwise, it is determined that the person in the target area does not wear a safety helmet in the preset manner.
[0015] According to an embodiment of the present disclosure, the above-mentioned comparison submodule includes: a first calculation subunit, used to calculate the Euclidean distance between the target feature vector and all first feature vectors, and determine the smallest Euclidean distance among the Euclidean distances between the target feature vector and all first feature vectors as the first distance measurement value; and a second calculation subunit, used to calculate the Euclidean distance between the target feature vector and all second feature vectors, and determine the smallest Euclidean distance among the Euclidean distances between the target feature vector and all second feature vectors as the second distance measurement value.
[0016] Another aspect of the present disclosure provides a computing device, including: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method as described above.
[0017] Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the above method when executed.
[0018] Another aspect of the present disclosure provides a computer program, which includes computer executable instructions, and the instructions are used to implement the method described above when executed.
[0019] According to an embodiment of the present disclosure, the skeleton information in the original image is determined. Based on the skeleton information, the target area potentially containing the helmet can be determined more accurately, thereby narrowing the scope of subsequent image recognition, thereby achieving the technical effect of improving image recognition efficiency and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0021] Figure 1 An exemplary system architecture to which the image recognition method according to an embodiment of the present disclosure can be applied is schematically shown;
[0022] Figure 2A The flowchart of the method for image recognition according to the embodiment of the present disclosure is schematically shown;
[0023] Figure 2B A flowchart of determining a target area from an original image based on skeleton information according to another embodiment of the present disclosure is schematically shown;
[0024] Figure 2C Schematically shows a flow chart of identifying whether a person in a target area wears a safety device in a preset manner according to another embodiment of the present disclosure;
[0025] Figure 3 A schematic diagram showing key points of a human skeleton according to an embodiment of the present disclosure is shown;
[0026] Figure 4A A block diagram schematically shows an apparatus for image recognition according to an embodiment of the present disclosure;
[0027] Figure 4B Schematically shows a block diagram of another first determination module according to an embodiment of the present disclosure;
[0028] Figure 4C Schematically shows a block diagram of another second determination module according to an embodiment of the present disclosure;
[0029] Figure 4D Schematically shows a block diagram of another identification module according to an embodiment of the present disclosure;
[0030] Figure 4E A block diagram schematically shows another comparison submodule according to an embodiment of the present disclosure; and
[0031] Figure 5 The block diagram of a computer system suitable for implementing the method described above according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0032] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0033] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0034] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification, and should not be interpreted in an idealized or overly rigid manner.
[0035] In the case of using expressions such as "at least one of A, B, and C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.). In the case of using expressions such as "at least one of A, B, or C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, or C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0036] The embodiment of the present disclosure provides an image recognition method and a device capable of applying the method. The method includes acquiring an original image containing a human figure; determining skeleton information in the original image; determining a target area from the original image according to the skeleton information; and identifying whether the human figure in the target area wears a safety device in a preset manner.
[0037] Figure 1 The exemplary system architecture 100 to which the image recognition method according to the embodiment of the present disclosure can be applied is schematically shown. It should be noted that: Figure 1 What is shown is merely an example of a system architecture to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.
[0038] like Figure 1 As shown, the system architecture 100 according to this embodiment may include an image acquisition device 101 and a server 102. The image acquisition device 101 may be any electronic device having a function of acquiring image information, including but not limited to a video camera, a still camera, and a webcam.
[0039] The server 102 may analyze and process the video data, image data and other data received from the image acquisition device 101 , and output the processing results.
[0040] It should be noted that the image recognition method provided in the embodiment of the present disclosure can generally be performed by the server 102. Accordingly, the image recognition device provided in the embodiment of the present disclosure can generally be set in the server 102. The image recognition method provided in the embodiment of the present disclosure can also be performed by a server or server cluster that is different from the server 102 and can communicate with the image acquisition device 101. Accordingly, the image recognition device provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 102 and can communicate with the image acquisition device 101.
[0041] It should be understood that Figure 1 The number of image acquisition devices and servers in the embodiment is only for illustration. Any number of image acquisition devices and servers may be provided according to implementation requirements.
[0042] Figure 2A The flowchart of the image recognition method according to the embodiment of the present disclosure is schematically shown.
[0043] like Figure 2A As shown, the method includes operations S210 to S240.
[0044] In operation S210, an original image including a human portrait is acquired.
[0045] According to an embodiment of the present disclosure, operation S210 may include, for example, capturing a video stream containing a portrait through the image capture device 101 and sending it to the server 102 , and then the server 102 extracting the original image from the received video stream.
[0046] Then, in operation S220, skeleton information in the original image is determined.
[0047] According to an embodiment of the present disclosure, the skeleton information may be, for example, the coordinates of key points of the human skeleton, and the key points of the human skeleton are used to locate the positions of various parts of the human body. Figure 3 A schematic diagram of key points of human skeleton according to an embodiment of the present disclosure is shown. Figure 3 As shown, the key points of the human skeleton include: neck (1), left ear (16) and right ear (17), in addition to: nose (0), left shoulder (2), left elbow (3), left wrist (4), right shoulder (5), right elbow (6), right wrist (7), left hip (8), left knee (9), left ankle (10), right hip (11), right knee (12), right ankle (13), left eye (14) and right eye (15).
[0048] According to an embodiment of the present disclosure, a human skeleton key point detection model can be pre-trained to detect human skeleton key points in an image. After the original image is input into the human skeleton key point detection model, the human skeleton key point detection model will output each human skeleton key point and its coordinates contained in the original image.
[0049] In operation S230, a target region is determined from the original image according to the skeleton information.
[0050] According to an embodiment of the present disclosure, a smaller area containing the human head (i.e., an area potentially containing a helmet) can be determined in the original image as a target area through the neck position, left ear position, and right ear position in the skeleton information, thereby reducing the image range that needs to be recognized in subsequent recognition operations.
[0051] Figure 2B The flowchart of determining a target area from an original image based on skeleton information according to another embodiment of the present disclosure is schematically shown.
[0052] like Figure 2B As shown, operation S230 may include sub-operations S231 to S233, for example.
[0053] In sub-operation S231, a center point is determined based on the coordinates of the left ear position and the coordinates of the right ear position.
[0054] Then, in sub-operation S232, a rectangular area is determined with the center point as the center.
[0055] The length of the rectangular area is the distance from the center point to the neck position, and the width of the rectangle is 1 / 2 of the length.
[0056] In sub-operation S233, a rectangular area is determined as a target area in the original image.
[0057] According to an embodiment of the present disclosure, the coordinates of the neck key point are marked as a1(X1, Y1), and the coordinates of the left ear key point are marked as a 16 (X 16 , Y 16 ), the coordinates of the key points of the right ear are marked as a 17 (X 17 , Y 17 ), where X1, Y1, X 16 , Y 16 , X 17 , Y 17 are not 0. Then the coordinates of the center point O can be calculated according to the following formula:
[0058] O(x,y)=(0.5*(X 16 +X 17 ), 0.5*(Y16 +Y 17 )).
[0059] Next, calculate the distance d from the center point O to the key point of the neck. Then determine a rectangular area with the distance d from the center point O to the neck as the length and 0.5*d as the height. Specifically, the rectangular area can be determined by determining the two vertices on any diagonal line of the rectangular area. Take the upper left vertex Bbox TopLeft and the lower right vertex Bbox BottomRight For example, Bbox can be calculated by the following formulas TopLeft and Bbox BottomRight Coordinates:
[0060] Bbox TopLeft (x, y) = (( x -0.5*d), (O y -0.5*d)),
[0061] Bbox BottomRight (x, y) = (( x +0.5*d), O y ),
[0062] Among them, O x is the x-axis coordinate of O, O y is the y-axis coordinate of O.
[0063] In operation S240, it is identified whether the person in the target area wears the safety device in a preset manner.
[0064] According to an embodiment of the present disclosure, the safety device may be, for example, a safety helmet. Features may be extracted in advance from an image of a human head wearing a safety helmet in a preset manner, and a safety helmet feature library may be established based on these features. Then, by extracting features in the target area, the features are compared with the features in the safety helmet feature library. If the similarity between the two is higher than a threshold, it indicates that the person in the target area is wearing a safety helmet in a preset manner, otherwise it indicates that the person in the target area is not wearing a safety helmet in a preset manner (including not wearing a safety helmet, the device being worn is not a safety helmet, and the way of wearing a safety helmet is not standardized).
[0065] It is understandable that, by setting different feature libraries, the present method can also be used to identify other safety protection devices worn on the head, such as goggles, masks, earmuffs, and protective masks.
[0066] According to the embodiments of the present disclosure, by extracting features in the target area and comparing the features with the features in the helmet feature library, certain scalable functions can be realized. For example, in actual application, there may be a need to identify new styles of helmets. The features of these new styles of helmets can be added to the feature library to realize the recognition of these helmets, thereby expanding the original recognition function.
[0067] Figure 2C A flowchart for identifying whether a person in a target area wears a safety device in a preset manner according to another embodiment of the present disclosure is schematically shown.
[0068] like Figure 2C As shown, operation S240 may include sub-operations S241 to S244, for example.
[0069] In sub-operation S241, a target feature vector is obtained by inputting the image of the target area into a preset feature extraction model.
[0070] According to the embodiment of the present disclosure, the feature extraction model is a deep network model trained by triplet loss (loss function), and its backbone is SENet (Squeeze-and-Excitation Network). After the image of the intercepted target area is input into the trained feature extraction model, an n-dimensional feature vector [A1, A2, ..., A n ](n is a positive integer, A n The value range of is [-1, 1]), which is the target feature vector. This feature vector directly represents the overall characteristics of the target area that potentially contains the helmet.
[0071] In sub-operation S242, a positive example feature library and a negative example feature library are obtained.
[0072] The positive example feature library includes at least one first feature vector, and the negative example feature library includes at least one second feature vector.
[0073] According to an embodiment of the present disclosure, a number of positive example images (i.e., images of wearing a helmet in a preset manner) and a number of negative example images (i.e., images of not wearing a helmet in a preset manner) are prepared in advance. Each positive example image is input into a feature extraction model to obtain an n-dimensional first feature vector. Each negative example image is input into a feature extraction model to obtain an n-dimensional second feature vector. All positive example images and all negative example images are respectively input into the feature extraction model, and all the first feature vectors obtained constitute a positive example feature library, and all the second feature vectors obtained constitute a negative example feature library.
[0074] In sub-operation S243, a first distance metric value and a second distance metric value are determined by comparing the target feature vector with the first feature vector in the positive example feature library and the second feature vector in the negative example feature library respectively.
[0075] According to an embodiment of the present disclosure, sub-operation S243 may include, for example, calculating the Euclidean distance between the target feature vector and all first feature vectors, and determining the minimum Euclidean distance between the target feature vector and all first feature vectors as the first distance metric value. At the same time, calculating the Euclidean distance between the target feature vector and all second feature vectors, and determining the minimum Euclidean distance between the target feature vector and all second feature vectors as the second distance metric value.
[0076] For example, the target feature vector is [A1, A2, ..., A n ], the number of first eigenvectors is i, and the i-th first eigenvector is recorded as [B i1, B i2 , …, B in ], the number of second eigenvectors is j, and the jth second eigenvector is recorded as [C j1 , C j2 , …, C jn ].
[0077] Then the Euclidean distance between the target feature vector and the i-th first feature vector is:
[0078]
[0079] The Euclidean distance between the target eigenvector and the jth second eigenvector is:
[0080]
[0081] According to another embodiment of the present disclosure, after the first distance metric value and the second distance metric value are calculated, the first distance metric value and the second distance metric value may be normalized to fall within the range of 0 to 1 to facilitate subsequent data processing.
[0082] In sub-operation S244, if the first distance metric value is less than the second distance metric value, it is determined that the person in the target area wears the helmet in a preset manner; otherwise, it is determined that the person in the target area does not wear the helmet in the preset manner.
[0083] According to an embodiment of the present disclosure, sub-operation S244 may include, for example, determining whether the first distance metric value is less than the second distance metric value, and if the first distance metric value is less than the second distance metric value, setting label to a helmet to indicate that the person in the target area wears a helmet in a preset manner, and then outputting the first distance metric value and label. If the first distance metric value is greater than or equal to the second distance metric value, setting label to non-helmet to indicate that the person in the target area does not wear a helmet in a preset manner, and then outputting the second distance metric value and label.
[0084] According to another embodiment of the present disclosure, in order to improve the accuracy of recognition, a threshold T may also be set. In the case where the label is a helmet, it is further determined whether the first distance metric value is less than the threshold T. If the first distance metric value is less than the threshold T, it is determined that the person in the target area wears the helmet in a preset manner, otherwise, it is determined that the person in the target area does not wear the helmet in the preset manner.
[0085] According to an embodiment of the present disclosure, for the normalized first distance metric value, the threshold T can be any value in the range of 0.3 to 0.6. Exemplarily, in this embodiment, the threshold T is 0.5.
[0086] According to an embodiment of the present disclosure, the skeleton information in the original image is determined. Based on the skeleton information, the target area potentially containing the helmet can be determined more accurately, thereby narrowing the scope of subsequent image recognition, thereby achieving the technical effect of improving image recognition efficiency and accuracy.
[0087] Figure 4A The block diagram schematically shows a device for image recognition according to an embodiment of the present disclosure.
[0088] like Figure 4A As shown, the apparatus 400 includes a first acquisition module 410 , a first determination module 420 , a second determination module 430 and an identification module 440 .
[0089] The first acquisition module 410 is used to acquire an original image containing a portrait.
[0090] The first determination module 420 is used to determine the skeleton information in the original image.
[0091] The second determination module 430 is used to determine the target area from the original image according to the skeleton information.
[0092] The identification module 440 is used to identify whether the person in the target area is wearing a safety device in a preset manner.
[0093] According to an embodiment of the present disclosure, the skeleton information in the original image is determined. Based on the skeleton information, the target area potentially containing the helmet can be determined more accurately, thereby narrowing the scope of subsequent image recognition, thereby achieving the technical effect of improving image recognition efficiency and accuracy.
[0094] Figure 4B A block diagram of a first determination module according to another embodiment of the present disclosure is schematically shown.
[0095] like Figure 4B As shown, the first determination module 420 includes a second acquisition submodule 421, which is used to obtain skeleton information by inputting the original image into a preset human skeleton key point detection model, and the skeleton information includes the coordinates of the neck position, the left ear position and the right ear position.
[0096] Figure 4C A block diagram of a second determination module according to another embodiment of the present disclosure is schematically shown.
[0097] like Figure 4C As shown, the second determination module 430 includes a third determination submodule 431 , a fourth determination submodule 432 and a fifth determination submodule 433 .
[0098] The third determination submodule 431 is used to determine the center point according to the coordinates of the left ear position and the coordinates of the right ear position.
[0099] The fourth determination submodule 432 is used to determine a rectangular area with the center point as the center, where the length of the rectangular area is the distance from the center point to the neck position, and the width of the rectangle is 1 / 2 of the length.
[0100] The fifth determining submodule 433 is used to determine a rectangular area in the original image as a target area.
[0101] Figure 4D A block diagram of a recognition module according to another embodiment of the present disclosure is schematically shown.
[0102] like Figure 4D As shown, the identification module 440 includes an input submodule 441 , a third acquisition submodule 442 , a comparison submodule 443 and a fifth determination submodule 444 .
[0103] The input submodule 441 is used to obtain a target feature vector by inputting an image of the target area into a preset feature extraction model.
[0104] The third acquisition submodule 442 is used to acquire a positive example feature library and a negative example feature library, where the positive example feature library includes at least one first feature vector, and the negative example feature library includes at least one second feature vector.
[0105] The comparison submodule 443 is used to determine a first distance metric value and a second distance metric value by comparing the target feature vector with the first feature vector in the positive example feature library and the second feature vector in the negative example feature library respectively.
[0106] The fifth determination submodule 444 is configured to determine that the person in the target area wears the helmet in a preset manner if the first distance metric value is less than the second distance metric value; otherwise, determine that the person in the target area does not wear the helmet in the preset manner.
[0107] Figure 4E A block diagram of a comparison submodule according to another embodiment of the present disclosure is schematically shown.
[0108] like Figure 4E As shown, the comparison submodule 443 includes a first calculation subunit 4431 and a second calculation subunit 4432 .
[0109] The first calculation subunit 4431 is used to calculate the Euclidean distance between the target feature vector and all the first feature vectors, and determine the smallest Euclidean distance among the Euclidean distances between the target feature vector and all the first feature vectors as the first distance metric value.
[0110] The second calculation subunit 4432 is used to calculate the Euclidean distances between the target feature vector and all the second feature vectors, and determine the smallest Euclidean distance among the Euclidean distances between the target feature vector and all the second feature vectors as the second distance metric value.
[0111] According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits, or at least part of the functions of any one of them can be implemented in one module. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be split into multiple modules for implementation. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be at least partially implemented as hardware circuits, such as field programmable gate arrays (FPGAs), programmable logic arrays (PLAs), systems on chips, systems on substrates, systems on packages, application specific integrated circuits (ASICs), or can be implemented by hardware or firmware in any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, according to the embodiments of the present invention, one or more of the modules, submodules, units, and subunits can be at least partially implemented as computer program modules, and when the computer program modules are run, the corresponding functions can be performed.
[0112] For example, any multiple of the first acquisition module 410, the first determination module 420, the second determination module 430, and the identification module 440 can be combined in one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the first acquisition module 410, the first determination module 420, the second determination module 430, and the identification module 440 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or by any one of the three implementation methods of software, hardware, and firmware, or by a suitable combination of any of them. Alternatively, at least one of the first acquisition module 410 , the first determination module 420 , the second determination module 430 , and the identification module 440 may be at least partially implemented as a computer program module, and when the computer program module is executed, a corresponding function may be performed.
[0113] Figure 5 The block diagram of a computer system suitable for implementing the method described above according to an embodiment of the present disclosure is schematically shown. Figure 5 The computer system 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.
[0114] like Figure 5 As shown, the computer system 500 according to the embodiment of the present disclosure includes a processor 501, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 502 or the program loaded from the storage part 508 to the random access memory (RAM) 503. The processor 501 may include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (for example, an application-specific integrated circuit (ASIC)), etc. The processor 501 may also include an onboard memory for caching purposes. The processor 501 may include a single processing unit or multiple processing units for performing different actions of the method flow according to the embodiment of the present disclosure.
[0115] In RAM 503, various programs and data required for the operation of system 500 are stored. Processor 501, ROM 502 and RAM 503 are connected to each other through bus 504. Processor 501 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 502 and / or RAM 503. It should be noted that the program can also be stored in one or more memories other than ROM 502 and RAM 503. Processor 501 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.
[0116] According to an embodiment of the present disclosure, the system 500 may further include an input / output (I / O) interface 505, which is also connected to the bus 504. The system 500 may further include one or more of the following components connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.
[0117] According to an embodiment of the present disclosure, the method flow according to an embodiment of the present disclosure 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 storage medium, and the computer program contains 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 509, and / or installed from the removable medium 511. When the computer program is executed by the processor 501, the above-mentioned functions defined in the system of the embodiment of the present disclosure are executed. According to an embodiment of the present disclosure, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.
[0118] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0119] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, may include but is not limited to: 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), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present disclosure, a computer-readable storage medium may include the ROM 502 and / or RAM 503 described above and / or one or more memories other than ROM 502 and RAM 503.
[0120] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two 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 box in the block diagram or flow chart, and the combination of the boxes in the block diagram 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.
[0121] It will be appreciated by those skilled in the art that the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations and / or combinations are not explicitly described in the present disclosure. In particular, the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways without departing from the spirit and teachings of the present disclosure. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0122] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. The scope of the present disclosure is defined by the attached claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A method for image recognition, include: Get the original image containing the portrait; Determining bone information in the original image; Determine a target area from the original image according to the skeleton information; as well as Identify whether the person in the target area is wearing a safety device in a preset manner; The step of identifying whether the person in the target area wears a safety device in a preset manner includes: Obtaining a target feature vector by inputting the image of the target area into a preset feature extraction model; Acquire a positive example feature library and a negative example feature library, wherein the positive example feature library includes at least one first feature vector, and the negative example feature library includes at least one second feature vector; Determine a first distance metric value and a second distance metric value by comparing the target feature vector with a first feature vector in a positive feature library and a second feature vector in a negative feature library respectively; If the first distance metric value is less than the second distance metric value, setting the label to a hard hat; In the case where the tag is a safety helmet, if the first distance metric value is less than a threshold, it is determined that the person in the target area wears a safety device in a preset manner; otherwise, it is determined that the person in the target area does not wear a safety device in a preset manner.
2. The method according to claim 1, in, Determining the skeleton information in the original image includes: The skeleton information is obtained by inputting the original image into a preset human skeleton key point detection model, wherein the skeleton information includes the coordinates of the neck position, the left ear position and the right ear position.
3. The method according to claim 2, in, Determining the target area from the original image according to the skeleton information includes: Determine a center point according to the coordinates of the left ear position and the coordinates of the right ear position; Determine a rectangular area with the center point as the center, the length of the rectangular area is the distance from the center point to the neck position, and the width of the rectangle is 1 / 2 of the length; and In the original image, the rectangular area is determined as the target area.
4. The method according to claim 1, in, The determining of the first distance metric value and the second distance metric value by comparing the target feature vector with the first feature vector in the positive feature library and the second feature vector in the negative feature library respectively includes: Calculating the Euclidean distances between the target feature vector and all first feature vectors, and determining the smallest Euclidean distance among the Euclidean distances between the target feature vector and all first feature vectors as a first distance metric value; and The Euclidean distances between the target feature vector and all the second feature vectors are calculated, and the smallest Euclidean distance among the Euclidean distances between the target feature vector and all the second feature vectors is determined as the second distance metric value.
5. A device for image recognition, include: A first acquisition module, used to acquire an original image containing a portrait; A first determination module, used to determine the skeleton information in the original image; A second determination module, used to determine a target area from the original image according to the skeleton information; as well as A recognition module, used to recognize whether the person in the target area is wearing a safety device in a preset manner; The step of identifying whether the person in the target area wears a safety device in a preset manner includes: Obtaining a target feature vector by inputting the image of the target area into a preset feature extraction model; Acquire a positive example feature library and a negative example feature library, wherein the positive example feature library includes at least one first feature vector, and the negative example feature library includes at least one second feature vector; Determine a first distance metric value and a second distance metric value by comparing the target feature vector with a first feature vector in a positive feature library and a second feature vector in a negative feature library respectively; If the first distance metric value is less than the second distance metric value, setting the label to a hard hat; In the case where the tag is a safety helmet, if the first distance metric value is less than a threshold, it is determined that the person in the target area wears a safety device in a preset manner; otherwise, it is determined that the person in the target area does not wear a safety device in a preset manner.
6. The device according to claim 5, in, The first determining module comprises: The second acquisition submodule is used to acquire skeleton information by inputting the original image into a preset human skeleton key point detection model, wherein the skeleton information includes the coordinates of the neck position, the left ear position and the right ear position.
7. The device according to claim 6, in, The second determining module comprises: A third determination submodule, used to determine a center point according to the coordinates of the left ear position and the coordinates of the right ear position; a fourth determination submodule, configured to determine a rectangular area with the center point as the center, wherein the length of the rectangular area is the distance from the center point to the neck position, and the width of the rectangle is 1 / 2 of the length; and The fifth determination submodule is used to determine the rectangular area as the target area in the original image.
8. A computing device, include: 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 are enabled to implement the method of any one of claims 1 to 4.
9. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, causes the processor to implement the method of any one of claims 1 to 4.
Citation Information
Patent Citations
Safety cap wearing detection method and apparatus
CN107016373A
Image recognition method and device and computer readable medium
CN107798344A
A method and an apparatus for processing an image
CN108986023A
A method for detecting the position arrangement of key points of human skeleton on a multi-person image
CN109255783A
Thyroid nodule ultrasonic image classification method based on capsule network
CN110059730A
