A method for automatically identifying and locating human body parts for imaging
By intelligently analyzing video frames through the camera, the camera position and clarity are automatically adjusted, solving the problem of low efficiency in adjusting shooting angle and distance in face recognition, and realizing efficient automatic shooting of human body parts.
Patent Information
- Application Number
- CN202511539067.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-27
- Publication Date
- 2026-05-26
- Estimated Expiration
- 2045-10-27
Smart Images

Figure CN121415309B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image recognition technology, and more specifically to a method for automatically identifying, locating, and photographing human body parts. Background Technology
[0002] Image recognition refers to the technology of using computers to process, analyze, and understand images in order to identify targets and objects of various patterns. It is a practical application of deep learning algorithms. Currently, image recognition technology is generally divided into facial recognition and product recognition. Facial recognition is mainly used in security checks, identity verification, and mobile payments; product recognition is mainly used in the process of commodity circulation, especially in unmanned retail fields such as unmanned shelves and smart retail cabinets.
[0003] The traditional image recognition process consists of four steps: image acquisition → image preprocessing → feature extraction → image recognition.
[0004] As the first step in face recognition, face detection is the task of detecting faces from the background of an image. Face detection is a complex research subject due to factors such as image background, brightness variations, and head posture.
[0005] Current mainstream image recognition algorithms require the subject to adjust the shooting angle and distance themselves, and they only analyze the already taken photos, without processing the images before they were taken. This necessitates the subject adjusting their position and angle multiple times to meet the pre-shooting requirements for positioning and image proportion before providing a satisfactory photo. Summary of the Invention
[0006] In view of this, the purpose of the present invention is to provide a method for automatically identifying, locating and photographing human body parts, so as to overcome the problems existing in the prior art.
[0007] The camera first performs intelligent analysis based on video frames to identify the outline, angle, proportion, and image clarity of human body parts. Based on the results of the intelligent analysis, it provides mechanical structure adjustment parameters to drive the mechanical structure to automatically adjust the camera position. Then, it performs human body part recognition and finally takes a photo that meets the requirements of angle, proportion, and clarity indicators for specific human body parts.
[0008] To achieve the above objectives, the present invention adopts the following technical solution:
[0009] This application provides a method for automatically identifying, locating, and photographing human body parts, including:
[0010] Acquire the video stream after the camera is turned on, and extract frames from the video stream to determine the target image;
[0011] By using a pre-established human body part recognition model, human body parts in the target image are identified, and the proportion of human body parts in the target image and the current shooting angle of the camera are determined.
[0012] When the proportion of human body parts in the target image is less than the proportion threshold, the coordinate position of the detection box is determined and compared with the absolute position of the target image to determine the position of the detection box in the target image;
[0013] The camera's movement direction and distance are determined based on the relative direction and distance between the position of the detection box in the target image and the center position of the target image.
[0014] According to the control protocol of the camera motor, a corresponding pulse signal is generated to drive the driver of the camera motor, control the rotation direction and speed of the camera motor, and adjust the position of the camera so that the proportion of human body parts in the target image reaches the proportion threshold.
[0015] Based on the human body parts identified by the human body part recognition model, the corresponding shooting angle is determined;
[0016] Based on the current shooting angle and the corresponding photo angle, determine the horizontal movement angle of the camera, and move the camera according to the horizontal movement angle;
[0017] The sharpness of the target image is calculated based on the gradient information and high-frequency components of the target image;
[0018] When the sharpness of the target image is lower than a preset sharpness threshold, the initial position of the camera is determined and the movement step size of the camera is initialized.
[0019] The camera is moved one camera step distance relative to the target image relative to its initial position, and the sharpness of the target image at the current position is determined as the first test sharpness.
[0020] The camera is returned to its initial position, and the camera is moved away from the target by one camera movement step relative to its initial position. The sharpness of the target image at the current position is then determined as a second test sharpness.
[0021] The first test sharpness and the second test sharpness are compared with the sharpness of the target image when the camera is in its initial position, and the movement direction corresponding to the test sharpness that is greater than the sharpness of the target image when the camera is in its initial position is determined as the target direction of the camera.
[0022] The camera is moved gradually toward the target direction by adjusting the camera movement step size;
[0023] Each time the camera moves by one movement step, the sharpness of the target image at the current position is determined, and the difference between the sharpness of the target image at the previous camera movement step is calculated to determine the sharpness difference.
[0024] When the sharpness difference is negative, the camera's movement direction is reversed, and the camera's movement step size is halved until the absolute value of the sharpness difference is less than a preset sharpness difference threshold. Then, the movement stops, the object distance of the camera is adjusted, and the camera is used to take a picture.
[0025] Furthermore, the method described above, before acquiring the video stream after the camera is turned on and performing frame extraction on the video stream to determine the target image, further includes:
[0026] Construct a human body part recognition model;
[0027] Obtain a training dataset of human body part images;
[0028] The human body part recognition model is trained using the human body part image training dataset.
[0029] Furthermore, the method described above, wherein identifying human body parts in the target image using a pre-established human body part recognition model and determining the proportion of human body parts in the target image, includes:
[0030] Adjust the target image to a preset size and perform pixel normalization on the target image;
[0031] The target image is subjected to multi-level feature extraction through the backbone network and feature fusion through the neck network, outputting feature maps of three different scales.
[0032] The feature map at each scale is divided into a grid, and three anchor boxes are predicted in each grid. For each anchor box, a location parameter, a confidence parameter, and a class parameter are output.
[0033] Convert the position parameters output by the anchor frame into actual coordinates;
[0034] Remove anchor frames whose confidence parameters are lower than a first preset threshold;
[0035] Based on the category parameters, the anchor boxes are sorted according to confidence level in each category, and the anchor box with the highest confidence level is determined in each category;
[0036] In each category, calculate the overlap between the remaining anchor frames and the anchor frame with the highest confidence, and delete the anchor frames whose overlap exceeds a second preset threshold;
[0037] Based on the anchor boxes retained for each category, human body parts identified by detection box markers in the initial target image are determined, and the proportion of human body parts in the target image is determined.
[0038] Furthermore, the methods described above also include:
[0039] The images of the human body parts and the recognition results of the human body parts are encrypted and stored on a server and a local storage device, respectively.
[0040] Furthermore, the method described above, wherein encrypting the image of the human body part and the recognition result of the human body part, and storing them on a server and a local storage device respectively, includes:
[0041] Obtain the public key of an asymmetric encryption algorithm;
[0042] The human body part image and the recognition result of the human body part are divided into blocks of fixed size, and each block is encrypted using the public key;
[0043] The encrypted data block stream is stored on the server, and the private key of the asymmetric encryption algorithm is securely stored.
[0044] Obtain the encryption key;
[0045] The encryption key is used to perform block encryption or stream encryption on the human body part image and the recognition result of the human body part;
[0046] The encrypted data is stored in the local storage device.
[0047] The beneficial effects of this invention are as follows:
[0048] This application first acquires the video stream after the camera is turned on, and then extracts frames from the video stream to determine the target image. Next, using a pre-established human body part recognition model, it identifies the human body parts in the target image. Based on the proportion, position, and angle of the human body parts in the target image, the camera position is adjusted to obtain the image's sharpness information. Based on this sharpness information, the object distance of the fixed-focus camera is adjusted, and finally, the camera takes a picture. In this application, the camera provides adjustment parameters based on intelligent analysis of video frames, driving the camera to automatically adjust its position and object distance before performing human body part recognition. Attached Figure Description
[0049] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0050] Figure 1 This is a flowchart provided by an embodiment of a method for automatically identifying, locating, and photographing human body parts according to the present invention. Detailed Implementation
[0051] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be described in detail below. Obviously, the described embodiments are merely some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other implementation methods obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0052] Figure 1 This is a flowchart illustrating an embodiment of the present invention that automatically identifies, locates, and captures images of human body parts. Please refer to [link / reference]. Figure 1 This embodiment may include the following steps:
[0053] S1. Obtain the video stream after the camera is turned on, and extract frames from the video stream to determine the target image;
[0054] S2. Using a pre-established human body part recognition model, identify human body parts in the target image and determine the proportion of human body parts in the target image and the current shooting angle of the camera.
[0055] S3. When the proportion of human body parts in the target image is less than the proportion threshold, determine the coordinate position of the detection box and compare it with the absolute position of the target image to determine the position of the detection box in the target image.
[0056] S4. Determine the camera's movement direction and distance based on the relative direction and distance between the detection box's position in the target image and the center of the target image;
[0057] S5. According to the control protocol of the camera motor, generate the corresponding pulse signal to drive the driver of the camera motor, control the rotation direction and speed of the camera motor, and adjust the position of the camera so that the proportion of human body parts in the target image reaches the proportion threshold.
[0058] S6. Determine the corresponding shooting angle based on the human body parts identified by the human body part recognition model;
[0059] S7. Determine the horizontal movement angle of the camera based on the current shooting angle and the corresponding photo angle, and move the camera according to the horizontal movement angle;
[0060] S8. Calculate the sharpness of the target image based on the gradient information and high-frequency components of the target image;
[0061] S9. When the sharpness of the target image is lower than the preset sharpness threshold, determine the initial position of the camera and initialize the camera's movement step size.
[0062] S10. Move the camera one camera movement step distance relative to the initial position of the camera towards the target and determine the sharpness of the target image at the current position as the first test sharpness.
[0063] S11. Return the camera to its initial position and move the camera away from the target by one camera movement step relative to its initial position. Determine the sharpness of the target image at the current position as a second test sharpness.
[0064] S12. Compare the first test sharpness and the second test sharpness with the sharpness of the target image when the camera is in its initial position, and determine the direction of movement corresponding to the test sharpness that is greater than the sharpness of the target image when the camera is in its initial position as the target direction of the camera.
[0065] S13. Adjust the camera movement step size and gradually move the camera towards the target direction;
[0066] S14. For each camera movement step, determine the sharpness of the target image at the current position, and calculate the difference between the sharpness of the target image at the previous camera movement step and the current sharpness difference.
[0067] S15. When the sharpness difference is negative, reverse the camera's movement direction and halve the camera's movement step size until the absolute value of the sharpness difference is less than the preset sharpness difference threshold. Then stop moving, complete the adjustment of the camera's object distance, and take a picture using the camera.
[0068] Understandably, this embodiment first acquires the video stream after the camera is turned on, and then extracts frames from the video stream to determine the target image. Next, using a pre-established human body part recognition model, it identifies the human body parts in the target image. Based on the proportion, position, and angle of the human body parts in the target image, the camera position is adjusted to obtain the image's clarity information. Based on this clarity information, the object distance of the fixed-focus camera is adjusted, and finally, the camera takes a picture. In this embodiment, the camera provides adjustment parameters based on intelligent analysis of the video frames, driving the camera to automatically adjust its position and object distance before performing human body part recognition.
[0069] When adjusting the camera position, the coordinates of the target bounding box are drawn based on the human body part recognition model algorithm. The absolute position of the image is then compared with the coordinates of the target bounding box. If the target location in the image is not within the target area, the position of the target bounding box is checked. If the target bounding box is off-center, the camera should be moved upwards to gradually center the newly captured target. If the target bounding box is off-center, the camera should be moved downwards to gradually center the newly captured target.
[0070] It should be noted that the camera's horizontal movement track is circular, and the target is located at the center of the circle, with the camera lens always focusing on the center.
[0071] When adjusting the shooting angle, since different parts of the human body have different shooting angles, the corresponding shooting angle is determined based on the identified human body part. Then, based on the current shooting angle identified by the human body part recognition model, the horizontal position of the camera is adjusted so that the camera reaches the corresponding shooting angle.
[0072] The image data stream captured in real time by the camera enters the sharpness evaluation unit, which uses the image's gradient information (such as the gradient magnitude calculated by the Sobel operator) and high-frequency components (obtained through Fourier transform) to evaluate the image's sharpness. When the sharpness is lower than a set threshold, the CPU calculates the amount of change in the object distance parameter that needs to be adjusted, and then sends the object distance adjustment command to the camera through the camera control interface.
[0073] When adjusting the camera's object distance, the focal length f of a fixed-focus lens is constant, while the image distance v is determined by the lens structure (a fixed value). According to the Gaussian imaging formula: 1 / f = 1 / u + 1 / v.
[0074] Where u is the object distance (the distance from the object to the lens). When u satisfies the above formula, the object image is the clearest (at which point the sharpness a reaches its peak).
[0075] Sharpness 'a' is a unimodal function of object distance 'u' (theoretically): when 'u' is less than the optimal value, 'a' increases with increasing 'u'; beyond the optimal value, 'a' decreases with increasing 'u'. The threshold 'b' is the minimum acceptable sharpness, and it is necessary to ensure that 'a' ≥ 'b'.
[0076] First, initialize the parameters:
[0077] Initial position s0 (current camera position), initial step size step0 (e.g., 5mm, set according to the accuracy of the moving device). Direction flag dir (1 indicates moving away from the object, -1 indicates moving closer to the object, can be randomly set initially). History resolution list ahistory=[a0] (a0 is the initial resolution).
[0078] Then determine the direction of movement:
[0079] Move step0 in the initial direction dir to reach the position s1 = s0 + dir × step0, and calculate the clarity a1.
[0080] If a1 > a0: The direction is correct, keep dir unchanged, and enter the fine search.
[0081] If a1 < a0: The direction is wrong, reverse dir (dir = -dir), move to s1 = s0 + dir × step0, and recalculate a1.
[0082] Then, start moving:
[0083] When a < b and |a - b| > θ (θ is the threshold difference): Keep the step size step = step0 (rapid approximation with a large step size).
[0084] When a ≥ b or |a - b| ≤ θ: Reduce the step size to step = step0 / 2^n (n is the number of iterations, fine adjustment with a small step size).
[0085] Move to the new position sk+1 = sk + dir × step, and calculate ak+1.
[0086] If ak+1 > ak: Continue to move along dir, update sk = sk+1, and ak = ak+1.
[0087] If ak+1 < ak: It means that the peak has been passed, reverse dir, and halve the step size (step = step / 2) to avoid overshoot.
[0088] When ak ≥ b, and after two consecutive moves |ak+1 - ak| < ϵ (ϵ is the minimum clarity change amount, such as 0.1%), stop adjusting.
[0089] Preferably, before step S1, it further includes:
[0090] Construct a human body part recognition model;
[0091] Obtain a human body part image training data set;
[0092] Train the human body part recognition model with the human body part image training data set.
[0093] It can be understood that by using a single-shot object detection algorithm, preparing face and human body part annotation data, the trained deep learning detection model can detect faces, tongues, ears, and palms.
[0094] The core feature of the algorithm is "end-to-end" detection (directly outputting the target position and category from the input image), taking into account both speed and accuracy.
[0095] When training a human body part recognition model, the model first preprocesses the input image:
[0096] Resizing: Scale the input image to a fixed size (e.g., 640×640) while maintaining the aspect ratio (avoiding distortion by filling the black borders).
[0097] Data augmentation: Expanding the dataset through random scaling, cropping, flipping, mosaic enhancement, and MixUp augmentation can improve the model's generalization ability.
[0098] Normalization: Normalizes pixel values from [0,255] to [0,1] or [-0.5,0.5] to facilitate network calculations.
[0099] Then, feature extraction is performed:
[0100] Multi-level features of the image are extracted through the backbone network (low-level features correspond to edges and textures, while high-level features correspond to semantic information such as "car" and "person"):
[0101] Focus layer: Slices each 2×2 pixel block of the input image and then stitches them together (e.g., 640×640×3→320×320×12), reducing computation while preserving details.
[0102] The CSP module divides the feature map into two parts: one part is passed directly, and the other part is concatenated with the former after multiple convolutions, which enhances feature flow and reduces redundant calculations.
[0103] SPP layer: The feature map is processed with pooling kernels of different sizes (such as 1×1, 5×5, 9×9, 13×13) and then stitched together to enhance the adaptability to targets of different scales.
[0104] Then, feature fusion is performed:
[0105] Fusing features at different scales through a neck network (solving the problem of difficult detection of small targets):
[0106] FPN: Passes high-level semantic features (large target information) down to the middle and low-level features, and merges them to supplement the semantic information of small targets.
[0107] PAN: It propagates low-level detailed features (edge information of small targets) upwards and merges them with high-level features to supplement the detailed information of large targets.
[0108] The final output consists of three feature maps of different scales (e.g., 80×80, 40×40, and 20×20, corresponding to the detection of small, medium, and large targets, respectively).
[0109] Then, target detection is performed:
[0110] The feature map at each scale is divided into a grid (e.g., an 80×80 feature map → 80×80 grids). Each grid predicts 3 anchor boxes (Anchors, pre-defined based on typical target sizes obtained from training set clustering, such as [10,13], [16,30], etc.). Each anchor box outputs 5+N parameters: 4 positional parameters: the predicted anchor box offset (tx,ty,tw,th), used to calculate the actual bounding box coordinates of the target; 1 confidence parameter: representing the probability that the anchor box contains the target; and N class parameters: the probability that the target belongs to each class (N is the number of classes, such as 80 classes in the COCO dataset).
[0111] Perform bounding box coordinate calculation:
[0112] Assuming the top-left corner of the grid is (cx, cy) and the width and height of the anchor frame are (pw, ph), the formula for converting the network-predicted offset into actual coordinates is:
[0113] Center coordinates: (bx,by)=(σ(tx)+cx,σ(ty)+cy) (σ is the sigmoid function, which limits the offset to 0~1 to ensure that the center is within the grid)
[0114] Width and height: (bw, bh) = (pw × e^tw, ph × e^th) (The exponential function ensures that the width and height are positive)
[0115] Final bounding box: (x1, y1, x2, y2) = (bx - bw / 2, by - bh / 2, bx + bw / 2, by + bh / 2) (coordinates of the top left and bottom right corners).
[0116] Finally, optimize the loss function:
[0117] The difference between the predicted and actual values is measured using a loss function, and the network parameters are updated via backpropagation.
[0118] Bounding box loss: CIoU (Complete IoU) is used to calculate the overlap between the predicted box and the ground truth box, the distance between the center points, and the aspect ratio difference to ensure accurate positioning.
[0119] Confidence loss: Use BCEWithLogitsLoss to distinguish between anchor boxes with and without a target.
[0120] Category loss: Optimize category prediction with BCEWithLogitsLoss or CrossEntropyLoss.
[0121] Preferably, step S2 includes:
[0122] Adjust the target image to a preset size and perform pixel normalization on the target image;
[0123] The backbone network performs multi-level feature extraction on the target image, and the neck network performs feature fusion to output feature maps of three different scales.
[0124] The feature map at each scale is divided into a grid, and three anchor boxes are predicted in each grid. The location parameters, confidence parameters, and class parameters of each anchor box are output.
[0125] Convert the position parameters output by the anchor box into actual coordinates;
[0126] Remove anchor boxes whose confidence parameters are lower than the first preset threshold;
[0127] Based on the category parameter, the anchor boxes are sorted by confidence level in each category, and the anchor box with the highest confidence level is determined in each category;
[0128] Calculate the overlap between the remaining anchor boxes and the anchor box with the highest confidence in each category, and delete anchor boxes whose overlap exceeds a second preset threshold;
[0129] Based on the anchor boxes retained for each category, human body parts are identified in the initial target image by detecting box markers.
[0130] Understandably, after preprocessing the input image, features are extracted through the Backbone and Neck, and the Head outputs prediction results at three scales (three anchor box parameters for each grid). The network output (tx, ty, tw, th) is converted into actual bounding box coordinates (x1, y1, x2, y2) using a formula, simultaneously obtaining the confidence score and class probability of each box. Duplicate or low-confidence boxes are removed, retaining the best results: low-confidence boxes (e.g., confidence < 0.25) are filtered out. For each class, boxes are sorted by confidence score, and the highest-confidence box is used as the benchmark, deleting other boxes with an overlap (IoU) exceeding a threshold (e.g., 0.45). The final retained boxes are the detection results, containing the target's location (x1, y1, x2, y2), class, and confidence score.
[0131] This system achieves efficient object detection by combining grid partitioning and anchor box prediction with multi-layer feature fusion and end-to-end training. The core source of its location information is the network's prediction of anchor box offsets, which are then converted into actual bounding box coordinates using a pre-defined formula, and finally filtered by Non-Maximum Suppression (NMS) to obtain the final result. This design balances speed (single-stage) and accuracy (multi-scale features + CIoU loss), making it a mainstream framework for real-time object detection.
[0132] During detection, the image needs to be reduced to a size supported by the algorithm. After detection, the corresponding component coordinates are located on the original resolution image, and a detection bounding box can be drawn according to project requirements.
[0133] Preferred options also include:
[0134] The images of human body parts and the recognition results of human body parts are encrypted and stored on the server and local storage devices respectively.
[0135] Preferably, the images of human body parts and the recognition results of human body parts are encrypted and stored on a server and a local storage device, respectively, including:
[0136] Obtain the public key of an asymmetric encryption algorithm;
[0137] The images of human body parts and the recognition results of human body parts are divided into blocks of fixed size, and each block is encrypted using a public key.
[0138] The encrypted data block stream is stored on the server, and the private key of the asymmetric encryption algorithm is securely stored.
[0139] Obtain the encryption key;
[0140] Block encryption or stream encryption is applied to images of human body parts and the recognition results of human body parts using an encryption key;
[0141] The encrypted data is stored on a local storage device.
[0142] Understandably, the process begins with obtaining the public key for an asymmetric encryption algorithm (such as RSA) from the key management module. Then, the data is encrypted using the public key by the encryption algorithm unit, which encrypts the acquired image data and related detection information (such as location and angle). During encryption, the data is divided into fixed-size blocks, and each block is encrypted sequentially. The encrypted data block stream can then be uploaded to the backend server.
[0143] The encryption key (which can be a symmetric key, such as the AES algorithm key) is read from the local key storage unit. The collected data is then processed by the encryption algorithm unit, which uses the key to encrypt the data. The encryption method can be block encryption or stream encryption. The encrypted data is then stored in the local storage device.
[0144] For asymmetric encryption algorithms (such as RSA), a public and private key pair is generated. The public key is provided to the data encryption submodule for data encryption, while the private key is securely stored for decryption by the backend server. For local storage encryption, a symmetric encryption key is generated and managed.
[0145] It is understood that the same or similar parts in the above embodiments can be referred to each other, and the contents not described in detail in some embodiments can be referred to the same or similar contents in other embodiments.
[0146] It should be noted that in the description of this invention, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this invention, unless otherwise stated, "a plurality of" means at least two.
[0147] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process, and the scope of the preferred embodiments of the invention includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as will be understood by those skilled in the art to which embodiments of the invention pertain.
[0148] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0149] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
[0150] Furthermore, the functional units in the various embodiments of the present invention can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0151] The storage media mentioned above can be read-only memory, disk, or optical disk, etc.
[0152] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0153] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A method for automatically identifying, locating, and photographing human body parts, characterized in that, include: Acquire the video stream after the camera is turned on, and extract frames from the video stream to determine the target image; By using a pre-established human body part recognition model, human body parts in the target image are identified, and the proportion of human body parts in the target image and the current shooting angle of the camera are determined. When the proportion of human body parts in the target image is less than the proportion threshold, the coordinate position of the detection box is determined and compared with the absolute position of the target image to determine the position of the detection box in the target image; The camera's movement direction and distance are determined based on the relative direction and distance between the position of the detection box in the target image and the center position of the target image. According to the control protocol of the camera motor, a corresponding pulse signal is generated to drive the driver of the camera motor, control the rotation direction and speed of the camera motor, and adjust the position of the camera so that the proportion of human body parts in the target image reaches the proportion threshold. Based on the human body parts identified by the human body part recognition model, the corresponding shooting angle is determined; Based on the current shooting angle and the corresponding photo angle, determine the horizontal movement angle of the camera, and move the camera according to the horizontal movement angle; The sharpness of the target image is calculated based on the gradient information and high-frequency components of the target image; When the sharpness of the target image is lower than a preset sharpness threshold, the initial position of the camera is determined and the movement step size of the camera is initialized. The camera is moved one camera step distance relative to the target image relative to its initial position, and the sharpness of the target image at the current position is determined as the first test sharpness. The camera is returned to its initial position, and the camera is moved away from the target by one camera movement step relative to its initial position. The sharpness of the target image at the current position is then determined as a second test sharpness. The first test sharpness and the second test sharpness are compared with the sharpness of the target image when the camera is in its initial position, and the movement direction corresponding to the test sharpness that is greater than the sharpness of the target image when the camera is in its initial position is determined as the target direction of the camera. The camera is moved gradually toward the target direction by adjusting the camera movement step size; Each time the camera moves by one movement step, the sharpness of the target image at the current position is determined, and the difference between the sharpness of the target image at the previous camera movement step is calculated to determine the sharpness difference. When the sharpness difference is negative, the camera's movement direction is reversed, and the camera's movement step size is halved until the absolute value of the sharpness difference is less than a preset sharpness difference threshold. Then, the movement stops, the object distance of the camera is adjusted, and the camera is used to take a picture.
2. The method according to claim 1, characterized in that, Before acquiring the video stream after the camera is turned on, and extracting frames from the video stream to determine the target image, the method further includes: Construct a human body part recognition model; Obtain a training dataset of human body part images; The human body part recognition model is trained using the human body part image training dataset.
3. The method according to claim 2, characterized in that, The step of identifying human body parts in the target image using a pre-established human body part recognition model and determining the proportion of human body parts in the target image includes: Adjust the target image to a preset size and perform pixel normalization on the target image; The target image is subjected to multi-level feature extraction through the backbone network and feature fusion through the neck network, outputting feature maps of three different scales. The feature map at each scale is divided into a grid, and three anchor boxes are predicted in each grid. For each anchor box, a location parameter, a confidence parameter, and a class parameter are output. Convert the position parameters output by the anchor frame into actual coordinates; Remove anchor frames whose confidence parameters are lower than a first preset threshold; Based on the category parameters, the anchor boxes are sorted according to confidence level in each category, and the anchor box with the highest confidence level is determined in each category; In each category, calculate the overlap between the remaining anchor frames and the anchor frame with the highest confidence, and delete the anchor frames whose overlap exceeds a second preset threshold; Based on the anchor boxes retained for each category, human body parts identified by detection box markers in the initial target image are determined, and the proportion of human body parts in the target image is determined.
4. The method according to claim 3, characterized in that, Also includes: The images of the human body parts and the recognition results of the human body parts are encrypted and stored on a server and a local storage device, respectively.
5. The method according to claim 4, characterized in that, The step of encrypting the image of the human body part and the recognition result of the human body part, and storing them on a server and a local storage device respectively, includes: Obtain the public key of an asymmetric encryption algorithm; The human body part image and the recognition result of the human body part are divided into blocks of fixed size, and each block is encrypted using the public key; The encrypted data block stream is stored on the server, and the private key of the asymmetric encryption algorithm is securely stored. Obtain the encryption key; The encryption key is used to perform block encryption or stream encryption on the human body part image and the recognition result of the human body part; The encrypted data is stored in the local storage device.
Citation Information
Patent Citations
Intelligent patrol point position correction device based on AI front-end algorithm
CN117579926A
Image processing device and program
JP2018073385A