Bone key point data processing method and device
By adjusting the coordinates of key skeletal points within the standard activity area and using the interpolation method, the problem of normalized differences and insufficient diversity in skeletal key point data processing is solved, the accuracy and data diversity of action recognition are improved, and the problem is solved Video frame filling disorder problem.
Patent Information
- Application Number
- CN202310260477.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-10
- Publication Date
- 2024-09-10
AI Technical Summary
The existing technology has problems such as large differences in normalized data of similar actions, lack of diversity in training data, and disordered filling of video frames in the processing of skeletal key point data, which affects the accuracy of action recognition.
By adjusting the coordinates of bone key points within the preset standard activity area, the action video data is normalized, and the interpolation method is used to solve the problem of video frame filling disorder and increase the diversity of data.
It improves the accuracy of skeleton point data application, ensures the accuracy and data diversity of action recognition, and solves the problem of normalized data differences caused by cameras, shooting positions and shooting parameters.
Smart Images

Figure CN118628950A
Abstract
Description
Technical Field
[0001] The invention relates to computer application technology, and in particular to a method and device for processing skeleton key point data. Background Art
[0002] At present, using the key points of the skeleton of an organism for action recognition is a widely used method.
[0003] Existing solutions have problems when processing skeleton point data: the normalized data of similar actions are quite different, the training data lacks diversity, and the video frame filling is disordered, which affects the accuracy of action recognition based on skeleton point data. Summary of the invention
[0004] In view of this, the main purpose of the present invention is to provide a method and device for enhancing the processing of skeleton key point data, which is conducive to improving the accuracy of applying the skeleton key point data.
[0005] In order to achieve the above object, the technical solution proposed in the embodiment of the present invention is:
[0006] A method for enhancing and processing skeleton key point data, comprising:
[0007] Get action video data;
[0008] Based on the action video data, for a target object in the video, within a preset standard activity area, the coordinates of the skeleton key points of the target object in the video are adjusted to obtain action video data that meets preset target conditions.
[0009] The embodiment of the present invention further provides a device for enhancing and processing skeleton key point data, comprising:
[0010] A data acquisition unit, used for acquiring action video data;
[0011] The data enhancement unit is used to adjust the coordinates of the skeleton key points of the target object in the video within a preset standard activity area based on the action video data to obtain action video data that meets the preset target conditions.
[0012] The embodiment of the present invention also provides an enhanced processing device for skeleton key point data, including a processor and a memory;
[0013] The memory stores an application program executable by the processor, which is used to enable the processor to execute the method for enhancing the skeleton key point data as described above.
[0014] The embodiment of the present invention further provides a computer-readable storage medium, in which computer-readable instructions are stored. The computer-readable instructions are used to execute the method for enhancing the skeleton key point data as described above.
[0015] The embodiment of the present invention further provides a computer program product, including a computer program / instruction, which implements the steps of the method for enhancing the skeleton key point data as described above when executed by a processor.
[0016] In summary, the skeleton key point data enhancement processing proposed in the embodiment of the present invention is to adjust the skeleton key point coordinates of the object in the video within the preset standard activity area for the target object in the action video, so as to obtain the action video data that meets the preset target condition. In this way, by adjusting the skeleton key point coordinates of the organism in the video based on the specified standard activity area, the activity area range of all actions is matched with the standard activity area range (i.e., the length or width of the two is the same or close), thereby realizing the normalization of the activity area range of all actions, so that it is possible to avoid the situation that the normalized data of similar actions is large due to the different proportions of the organism in different pictures, thereby solving the problem that the skeleton key point normalized data of similar actions caused by factors such as different cameras, shooting positions and shooting parameters is large, and then improving the accuracy of the application of the skeleton point data. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A schematic diagram of a skeleton key point data enhancement processing method according to an embodiment of the present invention;
[0018] Figure 2 for Figure 1 Schematic diagram of an embodiment of step 102;
[0019] Figure 3 Schematic diagram of the relationship between the range of the first active area and the preset adjusted image size range in an embodiment of the present invention;
[0020] Figure 4 Schematic diagram of the structure of the skeleton key point data enhancement processing device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0021] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0022] The inventor found in the process of realizing the present invention that in the existing scheme of applying skeleton key point data, the processing method of skeleton key point data will affect the accuracy of data application. The existence and specific reasons of the above problems are analyzed as follows in conjunction with the processing of human skeleton point data in the human action recognition scheme:
[0023] 1. Existing action recognition methods need to normalize the skeleton points relative to the width and height of the image when using action recognition models (such as spatiotemporal graph convolutional networks (Stgcn)) for action recognition. For example, assuming that the absolute coordinates of the skeleton point are (x, y), the width and height of the image are w and h respectively, the result of normalization to the range of (-1, 1) is: x′=(xw / 2) / (w / 2); y′=(yh / 2) / (h / 2), and the result of normalization to the range of (0, 1) is: x′=(x) / (w); y′=(y) / (h). The above normalization method, because it normalizes the skeleton points relative to the width and height of the image, makes the normalization result associated with the proportion of the corresponding object in the image, that is, the normalized data of the skeleton points corresponding to actions with different image proportions will be different.
[0024] When collecting action pictures, for the same subject, when photographed with different cameras, shooting positions or different shooting parameters, its position and size in different images will be different. For example, if a telephoto lens is used, the target is larger in the image and located in the middle. When a wide-focus lens is used, the target is smaller in the image and the distance from the center of the picture will also increase. When the camera is closer to the target, the target is larger in the image, and when the camera is farther away from the target, the target is smaller in the image. In this way, due to the influence of different cameras, shooting positions and shooting parameters, similar actions will have different proportions in different images. Therefore, the use of existing skeleton point data normalization methods will result in similar actions having very different skeleton point normalization data, which will affect the accuracy of subsequent action recognition based on skeleton point data.
[0025] 2. In order for the action recognition model to accurately identify the corresponding action based on the skeletal point data, it is necessary to ensure the diversity of the sample data used for model training. At present, most of the sample data is constructed by manual collection. Since the same action may be performed by different organisms with different arm lengths, amplitudes, etc., the process of manually collecting real skeletal point sample data is very long and cumbersome, which makes it difficult to obtain diversified sample data only through manual collection in practical applications, and thus it is impossible to obtain a high-accuracy action recognition model.
[0026] Figure 1 FIG. 1 is a flow chart of a skeleton key point data enhancement processing method according to an embodiment of the present invention. Figure 1As shown, the enhanced processing method of skeleton key point data implemented in this embodiment mainly includes:
[0027] Step 101: Obtain action video data.
[0028] This step is used to obtain the action video segment that needs to be enhanced.
[0029] Step 102: Based on the action video data, for a target object in the video, within a preset standard activity area, the coordinates of the skeleton key points of the target object in the video are adjusted to obtain action video data that meets preset target conditions.
[0030] The target object may be a human being or other organisms, and may be specifically set by those skilled in the art according to actual application requirements.
[0031] This step is used to perform data enhancement on the action video data obtained in step 101, so as to improve the accuracy of the application of the skeleton point data by adjusting the skeleton key point coordinate data based on preset target conditions.
[0032] The target condition is to adjust the coordinates of the key points of the skeleton based on the action video data in order to improve the accuracy of the application of the skeleton point data.
[0033] In one embodiment, in order to avoid the situation where the normalized data of similar actions are greatly different due to the different proportions of organisms in different pictures, and to solve the problem that the normalized data of skeletal key points of similar actions are greatly different due to factors such as different cameras, shooting positions and shooting parameters, the target condition can be set based on the activity area range of the target object in the video, and accordingly, the target condition can specifically include the following contents:
[0034] The activity area range of the target object in the video satisfies: the height difference between the standard activity area range and the activity area range is less than a preset first minimum threshold, or the width difference between the standard activity area range and the activity area range is less than a preset second minimum threshold, and the first minimum threshold and the second minimum threshold are both greater than zero.
[0035] Based on the above target conditions, for the target object in the video, it is necessary to adjust the coordinates of its skeletal key points in the video within the preset standard activity area range, so as to adjust the activity area range of the target object in the video to match the standard activity area range (that is, the length or width of the two are the same or close). In this way, the activity area range of all actions can be adjusted to match the standard activity area range, thereby realizing the normalization of the activity area range of all actions, thereby avoiding the situation where the normalized data of similar actions are large due to the different proportions of organisms in different pictures, and thus solving the problem of large differences in the normalized data of skeletal key points of similar actions caused by factors such as different cameras, shooting positions and shooting parameters.
[0036] The above target conditions are used to ensure that the activity area range of the target object in the video can be adjusted to match the standard activity area range. Specifically, when the height difference between the standard activity area range and the activity area range is less than the preset first minimum threshold, it means that the heights of the two ranges are the same or close, and when the width difference between the standard activity area range and the activity area range is less than the preset second minimum threshold, it means that the widths of the two ranges are the same or close. Here, it is taken into account that the aspect ratios of the activity areas of different actions are different. For the standard activity area range with a fixed aspect ratio, if the aspect ratios of the activity area of the action and the standard activity area range are inconsistent, then the two can only be the same or close in width or height. In addition, since the coordinates of the skeleton key points of the target object are adjusted within the standard activity area range, the adjusted activity area range must be a sub-area of the standard activity area range, that is, the width and height of the activity area range of the action cannot exceed the standard activity area range.
[0037] The first minimum threshold and the second minimum threshold are used to limit the matching conditions between the standard activity area range and the activity area range in terms of height and width. Both are greater than zero. The appropriate values can be set by technical personnel in this field according to actual needs. Preferably, the first minimum threshold and the second minimum threshold can be set so that the activity area range is smaller than and close to the standard activity area range.
[0038] In one implementation, the standard activity area range may be set based on a preset adjusted image size. When specifically setting, the standard activity area range may be slightly smaller than the adjusted image size. Specifically, the following method may be used to implement the setting:
[0039] The height difference between the standard activity area range and the preset adjusted picture size is less than a preset third minimum threshold;
[0040] A width difference between the standard active area range and the adjusted image size is smaller than a preset fourth minimum threshold.
[0041] The third minimum threshold and the fourth minimum threshold are both greater than zero, and are used to limit the standard activity area range to be smaller than and close to the preset adjusted picture size. The specific appropriate values can be set by technical personnel in this field according to actual needs, as long as it is ensured that the image normalized to match the standard activity area range does not exceed the adjusted picture size.
[0042] In one implementation, a suitable value may be set by a person skilled in the art for the adjusted image size according to actual data enhancement processing requirements. Preferably, the adjusted image size may be (1920, 1080), but is not limited thereto.
[0043] In one embodiment, if Figure 2 As shown, the following steps 1021 to 1024 may be used to adjust the coordinates of the skeleton key points of the target object in the video:
[0044] Step 1021: Based on the coordinate set of the skeleton key points of the target object in all video frames of the video, determine the area range through which the skeleton key points of the target object pass in the video to obtain the first activity area range of the target object.
[0045] This step is used to generate an original activity area range (ie, a first activity area range) for the target object in the action video.
[0046] In one implementation, the following method may be used to determine the region through which the skeleton key points of the target object pass in the video:
[0047] The value range of the skeleton key point coordinate set on each coordinate axis is used as the value range of the region range on the corresponding coordinate axis.
[0048] Assume that the coordinate range of the target object's skeleton key point coordinate set on the x-axis is [x min , x max ], the coordinate range of the y-axis is [y min ,y max ], then the range of the first active area can be represented as [x min :x max ,y min :y max ], accordingly, the width of the first active area is x max With x min The height of the first active area is y max With y min The difference.
[0049] Step 1022: Based on the first activity area range and the preset adjusted picture size, the activity area adjustment ratio is determined with the standard activity area range as the adjustment target.
[0050] This step is used to determine the ratio by which the activity area range of the target object in the video needs to be scaled in order to adjust it to match the standard activity area range, so that in subsequent steps the coordinates of the skeleton key points can be adjusted accordingly based on the ratio to adjust the activity area range to match the standard activity area range.
[0051] In one implementation, the following method may be used to determine the activity area adjustment ratio:
[0052] Step 10221: Calculate the width ratio and height ratio of the image size to the range of the first active area to obtain a first width ratio and a first height ratio.
[0053] Figure 3 A schematic diagram of the relationship between the range of the first active area and the preset adjusted image size range is given, such as Figure 3 As shown, this step can be described as the following formula:
[0054]
[0055]
[0056] Among them, Imag w Indicates the width of the preset adjusted image size; Imag h represents the height of the preset adjusted image size; h represents the height of the first active area, and w represents the width of the first active area; ratio w Indicates the first width ratio; ratio h Represents the first height ratio.
[0057] Step 10222: If the first height ratio is smaller than the first width ratio, the height ratio of the standard activity area range to the first activity area range is used as the activity area adjustment ratio; otherwise, the width ratio of the standard activity area range to the first activity area range is used as the activity area adjustment ratio.
[0058] Here, when the first height ratio ratio h is smaller than the first width ratio w, it indicates that the space for adjusting the first active area range in the height dimension within the adjusted image size range is smaller than the width dimension. In order to ensure that the adjusted active area range does not exceed the size of the image, it is necessary to determine the active area adjustment ratio according to the height dimension, that is, the ratio of the height of the standard active area range to the first active area range. h , as the activity area adjustment ratio ratio. Otherwise, it is necessary to determine the activity area adjustment ratio according to the width dimension, that is, the width ratio ratio of the standard activity area range to the first activity area range is w , as the active area adjustment ratio ratio.
[0059] Step 1023: Based on the activity area adjustment ratio, adjust the first activity area range to obtain a second activity area range of the target object in the video.
[0060] This step is used to determine the corresponding activity area range (ie, the second activity area range) when the activity area range of the target object in the video is adjusted to match the standard activity area range.
[0061] In one implementation, the second activity area range of the target object in the video may be obtained by using the following method:
[0062] The height and width of the first active area are multiplied by the active area adjustment ratio to obtain the height and width of the second active area. Specifically, the following formula can be used to represent the height and width of the first active area:
[0063] w2=int(w×ratio)
[0064] h2=int(h×ratio)
[0065] Among them, w2 is the width of the second active area, h2 is the height of the second active area, w is the width of the first active area, h is the height of the first active area, ratio is the active area adjustment ratio, and int() is the rounding function.
[0066] Step 1024: Based on the second activity area range and the activity area adjustment ratio, adjust the coordinates of each skeleton key point of the target object in the video so that the activity area range of the target object in the video reaches the second activity area range.
[0067] In one implementation, the following method may be specifically used to adjust the coordinates of each skeleton key point of the target object in the video based on the second activity area range and the activity area adjustment ratio:
[0068] For each of the bone key point coordinates (x, y), according to and Get the adjusted coordinates (x′, y′); where ratio is the adjustment ratio of the active area, Imagw is the width of the adjusted image size, Imagh is the height of the adjusted image size, w2 is the width of the second active area range, h2 is the height of the second active area range, x min is the minimum x-axis coordinate value of the first active area, y min is the minimum y-axis coordinate value of the first active area.
[0069] Furthermore, in order to increase the diversity of action data and improve the generation efficiency of skeleton key point sample data, more skeleton key point sample data of similar actions (i.e., actions similar to the actions corresponding to the current action video data) can be quickly and conveniently generated by appropriately offsetting the skeleton key point coordinates. Accordingly, the target condition may include: obtaining skeleton key point data of similar actions.
[0070] In practical applications, preferably, in order to facilitate implementation, the above-mentioned skeletal key point coordinates can be offset within a unified activity area, that is, first use the above-mentioned activity area normalization optimization method to perform data enhancement, and then obtain the skeletal key point data of similar actions through coordinate offset, but not limited to this, obtaining the skeletal key point data of similar actions through coordinate offset can also be achieved independently of the activity area normalization result, that is, the skeletal key point data of similar actions can be obtained first, and then the activity area normalization processing can be performed, which will not be repeated here.
[0071] Preferably, the following method can be used to obtain the skeleton key point data of similar actions through coordinate offset based on the normalized result of the activity area:
[0072] In one embodiment, after the adjustment of the coordinates of the skeletal key points of the target object is completed in step 102, for each skeletal key point of the target object in the video, according to a preset offset strategy, based on the preset offset level to which the skeletal key point belongs, the offset parameters of the skeletal key point in each video frame are determined, and the coordinates of the skeletal key point in the corresponding video frame are offset using the offset parameters to obtain skeletal key point data of similar actions.
[0073] It should be noted here that, considering that for the human body, part of the structure of the upper body is stable during the actual action process, that is, no matter how it is transformed, the skeletal key points (i.e., the skeletal key points of the left and right shoulders and the left and right hips) that constitute the stable structure all represent the stable structure of the upper body of the human body. Therefore, to ensure the rationality of the skeletal key point data obtained by offsetting, these points should not be offset too much when offsetting. Based on the above, in an embodiment of the present invention, the skeletal key points that constitute the stable structure of the human body in action are used as the first-level skeletal key points, the skeletal key points that are directly connected to the first-level skeletal key points are used as the second-level skeletal key points, and the skeletal key points that are directly connected to the second-level skeletal key points are used as the third-level skeletal key points. In one implementation manner, the above-mentioned three-level skeletal key points are specifically as follows:
[0074] The first level bone key points include bone key points located at a left shoulder, a right shoulder, a left hip and a right hip.
[0075] The second level bone key points include bone key points located at the neck, the left elbow, the right elbow, the left knee and the right knee.
[0076] The third level skeleton key points include skeleton key points located at the head, left wrist, right wrist, left ankle and right ankle.
[0077] In one implementation, the offset parameter may specifically include an offset direction and an offset amount. To enhance the rationality of the offset processing, the following offset strategy may be specifically adopted:
[0078] 1) When the skeleton key point is a first-level skeleton key point, the offset direction on each coordinate axis (i.e., the positive or negative direction of the coordinate axis) is set randomly, and the offset on each coordinate axis is the product of a first parameter and a first offset coefficient of the corresponding coordinate axis. The first parameter is the minimum value of the height and width of the minimum value of the height and width of the standard activity area range, and the first offset coefficient is randomly selected from a preset first offset coefficient range.
[0079] The first offset coefficient range can be set by a person skilled in the art according to the fluctuation range of the first-level skeleton key points in actual actions. For example, in one embodiment, the first offset coefficient range can be set to be greater than 0 and less than or equal to 0.01, but is not limited thereto.
[0080] For example, for the first level bone key point, the offset on the x-axis can be set to min(center h , center w )×0.002, where center h is the height of the standard activity area, center wis the width of the standard active area, and 0.002 is the first offset coefficient on the x-axis.
[0081] 2) When the skeleton key point is a second-level skeleton key point, the offset direction on each coordinate axis is set randomly, and the offset on each coordinate axis is the product of the second parameter of the corresponding coordinate axis and the second offset coefficient of the corresponding coordinate axis; the second parameter is the distance between the second-level skeleton key point and the first-level skeleton key point connected to it on the corresponding coordinate axis, and the second offset coefficient is randomly selected from the preset second offset coefficient range.
[0082] The second offset coefficient range can be set by a person skilled in the art according to the fluctuation range of the second-level skeleton key points in actual actions. For example, in one embodiment, the second offset coefficient range can be set to be greater than 0 and less than or equal to 0.05, but is not limited thereto.
[0083] For example, the offset of the bone key point at the right elbow on the x-coordinate axis may be 1% of the distance between the x-coordinate value of the right elbow and the x-coordinate value of the right shoulder.
[0084] Furthermore, considering that there may be multiple first-level skeleton key points connected to the second-level skeleton key points, at this time, the second parameter for calculating the offset can be determined based on the first-level skeleton key point closest to the second-level skeleton key point. The specific method is as follows:
[0085] 3) When a skeleton key point is a second-level skeleton key point, if the number of first-level skeleton key points connected to the second-level skeleton key point is greater than 1, then the first-level skeleton key point connected to the second-level skeleton key point and closest to it is selected as the reference point, and the second parameter of each coordinate axis is the distance between the second-level skeleton key point and the reference point on the corresponding coordinate axis.
[0086] For example, for the key bone point at the neck, we can take the point corresponding to the minimum distance from the left and right shoulders to the neck as the reference point, multiply the x-coordinate difference between the neck point and the reference point (that is, the distance between the two) by the proportional coefficient 1% to get the offset of the key bone point at the neck on the x-coordinate axis.
[0087] When the skeleton key point is a third-level skeleton key point, the offset direction on each coordinate axis is set randomly. The offset on each coordinate axis is the product of the third parameter of the corresponding coordinate axis and the third offset coefficient of the corresponding coordinate axis. The third parameter is the distance between the third-level skeleton key point and the second-level skeleton key point connected to it on the corresponding coordinate axis. The third offset coefficient is randomly selected from the preset third offset coefficient range.
[0088] The third offset coefficient range can be set by a person skilled in the art according to the fluctuation range of the third-level skeleton key points in actual actions. For example, in one embodiment, the third offset coefficient range can be set to be greater than 0 and less than or equal to 0.05, but is not limited thereto.
[0089] Furthermore, the inventors have discovered in the process of implementing the present invention that the existing motion recognition solutions have a problem of disordered video frame filling when processing motion video data, thereby reducing the accuracy of data application. The specific reasons are analyzed as follows:
[0090] In existing action recognition schemes, when inputting skeleton point data into the action recognition model, a fixed time window needs to be used. For example, for the Stgcn network, the format of its input data can be represented as [nums, T, Keypoints, 3], where nums represents the number of people, T represents the time window (i.e., the number of frames required for the current input action), and keypoints represents the number of key points of the human skeleton. For example, the number of key points of the human skeleton in the COCO dataset is 17, and 3 represents the information of each key point (x, y, score). When collecting the skeleton point data of the action, due to the different durations occupied by different actions, the corresponding number of video frames will also be different. The number of video frames of some actions may be less than the time window T, and the number of video frames of some actions may exceed the time window T. In view of the above situation where the actual collected action video frames are less than the fixed time window, if the circular padding method is used, the action video frames are supplemented so that the number of supplemented action video frames reaches the number of frames required by the fixed time window. For example, assuming T=50, the actual number of video frames contained in the action is 30 frames. At this time, the first 20 frames of the action need to be filled in behind these 30 frames to make 50 frames. The inventors found that this cyclic filling method is only applicable to some actions (such as walking), but not to all types of actions, which can easily lead to confusion in some action processes. For example, for the action of falling while standing, if the fall occurs for 30 frames, the above-mentioned cyclic filling scheme will use the first 20 frames to splice with the original action video. In this way, the spliced action process will be standing-falling-standing. Obviously, this filling causes the action process to change, that is, it is inconsistent with the original action process, thereby affecting the accurate training and application of the action recognition model.
[0091] Furthermore, in order to solve the problem of disordered filling of video frames in the above-mentioned existing data processing methods, an interpolation method can be used to supplement the number of frames contained in the video to the required number. Specifically, the following method can be used to achieve this purpose:
[0092] When the number of video frames included in the video is less than a specified first number, an interpolation method is used to supplement the number of video frames included in the video to the first number to meet the action frame number requirement of the preset skeleton point data application model.
[0093] Specifically, to meet the input requirement of the skeleton point data application model, the first number may be the number of frames of the input video segment required by the skeleton point data application model, that is, the number of frames corresponding to the time window required by the model.
[0094] In one implementation, the skeleton point data application model may specifically be an action recognition network, but is not limited thereto, and may also be other networks that apply skeleton point data.
[0095] Furthermore, considering that different actions have different lengths, some are long and some are short, the corresponding action video data may contain very few or many frames. For example, the camera frame rate is generally 25 frames / 30 frames / 15 frames per second. For the falling action process, it can be as short as 1 second or as long as 5 seconds. In this way, some falling actions may have only a dozen frames or more than 70 frames. In this way, the number of frames of an action video may be much larger or much smaller than the time window of the application. For example, when the application requires 50 frames, the number of frames of a short falling action may be only one-third of the time window, and the number of frames of a long falling action may exceed one-half of the time window. When the number of frames of the original video is much smaller or much larger than the number of frames of the time window, constructing a video that meets the requirements of the time window through interpolation or extraction will affect the validity of the action data. Therefore, in order to ensure the effectiveness of the application of video frame data, the situation where the number of frames in the video segment is significantly different from the number of frames in the time window can be considered. Under the premise of ensuring the effectiveness of the application of video frame data, the skeleton key point data can be enhanced by interpolation or sampling to meet the requirements of the application time window. Specifically, the following steps x1 to x3 can be used to achieve this goal.
[0096] Step x1: When the number of video frames contained in the video meets a preset discarding condition, the action video data is abandoned for corresponding application.
[0097] In one implementation, the discard condition may be less than a preset first discard threshold or greater than or equal to a preset second discard threshold; the first discard threshold is less than the first number, and the second discard threshold is greater than the first number.
[0098] Here, when the number of video frames contained in the video is less than the first discarding threshold, it means that the number of frames contained in the video is too small. At this time, the interpolation method is used to supplement the video frames. The accuracy of the supplemented skeleton point data will be reduced because the original number of frames is less than the number of supplementary frames that need to be inserted, thereby reducing the effectiveness of the skeleton point data. Therefore, in order to avoid the reduction of the effectiveness of the action data due to the filling of the video frames, the video can be directly discarded.
[0099] The first discarding threshold is used to determine whether the number of video frames contained in the video is small and needs to be discarded. Preferably, in one embodiment, the first discarding threshold can be set to half of the first number, but is not limited thereto. Those skilled in the art can set a suitable value of the first discarding threshold within a range less than the first number based on the validity requirements of the application of the skeleton point data.
[0100] When the video frame number that described video comprises is greater than or equal to the second discarding threshold value, it is explained that the frame number that video comprises is too many, and the frame number (i.e. the first quantity) needed for application is extracted therefrom at this moment, and can make the extracted video frame only be a few video frames of action process because the frame number of original video is too many. These few video frames are limited by the less number of frames and are difficult to present complete action process, thereby can't ensure that the extracted video frame can present complete action process.Like this, the extraction of video frame will cause the disappearance of action process, and then reduce the validity of skeleton point data, therefore, in order to avoid the reduction of video frame extraction to the validity of action data, it is not suitable to directly extract data frame therefrom and apply, and need to carry out enhanced processing again after its editing, therefore, at this moment, this video also needs to be abandoned.
[0101] The second discarding threshold is used to determine whether the number of video frames contained in the video is large and needs to be discarded. Preferably, in one embodiment, the second discarding threshold can be set to twice the first number, but is not limited thereto. Those skilled in the art can set a suitable value of the second discarding threshold within a range greater than the first number based on the validity requirements for the application of the skeleton point data.
[0102] Step x2: When the number of video frames contained in the video is less than the first number and meets the preset filling condition, the number of video frames contained in the video is supplemented to the first number using an interpolation method to obtain action video data that meets the requirements.
[0103] Here, when the number of video frames contained in the video is less than the first number and meets the preset filling condition, it means that the interpolation processing of the action video will not affect the effectiveness of the application of the video frame data. At this time, the interpolation method is used to enhance the action video data. It can ensure that while meeting the effectiveness of the application of the video frame data, the requirements of the application time window are met.
[0104] In one implementation, the filling condition is greater than or equal to the first discard threshold and less than the first number.
[0105] In one implementation, the following method may be specifically used to supplement the number of video frames included in the video to the first number by using an interpolation method:
[0106] Step x21: Sample a second number of video frames from the action video data; the second number is the difference between the first number and the number of video frames contained in the video.
[0107] This step is used to sample a second number of video frames from the video to generate a corresponding number of video frames in a subsequent step, and insert them into the video so that the number of frames contained in the video reaches the number of frames in the time window required by the application model.
[0108] In one implementation, in order to make the interpolated video segment better present the complete action process, this step may adopt a random sampling method to sample the second number of video frames.
[0109] Step x22, for each first video frame sampled, based on the skeleton point frames of the first video frame and its adjacent video frames in the specified direction, calculate the coordinates of each skeleton key point in the corresponding intermediate skeleton point frame according to the trend of motion speed change, and insert the intermediate skeleton point frame between the first video frame and its adjacent video frame; the adjacent video frame is located before or after the first video frame; the skeleton point frame is a frame that only contains the coordinates of all skeleton key points of the target object.
[0110] For example, the total number of frames in a video segment is N, and the number of frames to be inserted is expressed as P=TN, wherein T is the number of frames in a time window. In step x21, P video frames are randomly sampled in the video segment. In step x22, for each frame n in the sampled P video frames, based on the key point skeleton data of the frame n and its adjacent frame (the adjacent frame n-1 before it or the adjacent frame n+1 after it), the coordinate values of the frames between the two frames of each skeleton key point are generated, the skeleton key point data of the skeleton point frame between the frame n and the adjacent frame are obtained, and then the skeleton point frame is inserted between the frame n and the adjacent frame. In this way, since the skeleton key point data of the inserted frame is calculated based on the coordinates of the two adjacent frames before and after according to the motion speed change trend of the two adjacent frames before and after, the skeleton key point data of the inserted frame can accurately reflect the intermediate transition action posture between the two adjacent frames, so it can be ensured that the insertion of the newly generated frame will not cause the timing disorder of the action, thereby solving the problem of the disordered filling of the video frame of the existing scheme.
[0111] Assume N = 30, T = 50, then P = 50-30 = 20. Randomly sample 20 positions in N, for example, sample 5. Then, use the key point coordinates of the 5th and 4th frames to calculate the coordinates of each bone key point between the 5th and 4th frames, and obtain the bone point data for representing the intermediate bone point frame between the 4th and 5th frames (not the RGB image frame, but the bone point frame, which is a frame that only contains the coordinates of all key points). Insert the intermediate bone point frame between the 4th and 5th frames.
[0112] Preferably, in one implementation, the following steps x221-x222 may be used to calculate the coordinates of each skeleton key point in the corresponding intermediate skeleton point frame:
[0113] Step x221, calculate the speed of the skeleton key points on each coordinate axis in the first video frame and its adjacent video frames.
[0114] If the position to be inserted is between the nth frame and the n+1th frame, this step needs to calculate the movement speed (v x ,v y ) so that the subsequent x ,v y ) determines the motion change state between the two frames (i.e., acceleration, deceleration, or uniform speed), and based on the motion change state, calculates the coordinates of the skeleton key points in the middle skeleton point frame (i.e., the coordinate values on each coordinate axis i). x is the velocity in the x-axis direction, v y is the speed of movement in the y-axis direction.
[0115] Step x222: for each coordinate axis i, based on the speed on the coordinate axis i, determine the motion change state of the skeleton key point in the direction of the coordinate axis i between the first video frame and its adjacent video frame.
[0116] In one implementation, the specific implementation of step x222 can be expressed by the following formula:
[0117] when When , it can be determined that it is in an accelerated motion state in the x-axis direction;
[0118] when When , it can be determined that it is in a deceleration motion state in the x-axis direction.
[0119] when , it can be determined that it is in a uniform motion state in the x-axis direction.
[0120] in, is the movement speed of the skeleton key point in the x-axis direction in the nth frame, It is the movement speed of the skeleton key point in the x-axis direction in the n+1th frame.
[0121] when When , it can be determined that it is in an accelerated motion state in the y-axis direction; among them, is the movement speed of the skeleton key point in the y-axis direction in the nth frame, It is the movement speed of the skeleton key point in the y-axis direction in the n+1th frame.
[0122] when , it can be determined that it is in a decelerating motion state in the y-axis direction.
[0123] when , it can be determined that it is in a uniform motion state in the y-axis direction.
[0124] Step x223, for each coordinate axis i, if the motion change state of the skeleton key point in the direction of the coordinate axis i is an accelerated motion state, then calculate the average value of the coordinate value of the skeleton key point on the coordinate axis i in the nth frame and the coordinate value of the corresponding intermediate point on the coordinate axis i, and obtain the coordinate value of the skeleton key point on the coordinate axis i in the intermediate skeleton point frame; the intermediate point is the midpoint of the line between the coordinate points of the skeleton key point in the nth frame and the n+1th frame; the nth frame is the video frame with the smaller frame number among the first video frame and the adjacent video frames; the n+1th frame is the average value of the coordinate value of the skeleton key point on the coordinate axis i in the intermediate skeleton point frame. the video frame with a larger frame number in the adjacent video frames; if the motion change state of the skeleton key point in the direction of the coordinate axis i is a deceleration motion state, then the coordinate value of the skeleton key point on the coordinate axis i in the n+1th frame and the average value of the coordinate value of the intermediate point on the coordinate axis i are calculated to obtain the coordinate value of the skeleton key point on the coordinate axis i in the intermediate skeleton point frame; if the motion change state of the skeleton key point in the direction of the coordinate axis i is a uniform motion state, then the coordinate value of the intermediate point on the coordinate axis i is used as the coordinate value of the skeleton key point on the coordinate axis i in the intermediate skeleton point frame.
[0125] This step can be specifically characterized by the following formula:
[0126] when hour, in, is the x-axis coordinate value of the middle point, which is the midpoint of the line connecting the coordinate points of the skeleton key point in the nth frame and the n+1th frame. x' is the x-axis coordinate value of the skeleton key point in the middle skeleton point frame.
[0127] when hour,
[0128] when hour,
[0129] when hour, in, is the y-axis coordinate value of the midpoint; is the movement speed of the skeleton key point in the y-axis direction in the nth frame, is the movement speed of the skeleton key point in the y-axis direction in the n+1th frame, and y′ is the y-axis coordinate value of the skeleton key point in the intermediate skeleton point frame.
[0130] when hour,
[0131] when hour,
[0132] Step x3: When the number of video frames contained in the video is greater than the first number and meets the preset extraction conditions, the first number of video frames are extracted from the video, and the action video data that meets the requirements is constructed using the extracted video frames.
[0133] In one implementation, the extraction condition is greater than the first number and less than the second discarding threshold.
[0134] In one implementation, in order to make the extracted video segment better present the complete action process, this step may adopt a random extraction method to extract the first number of video frames from the video.
[0135] There is no timing requirement for the above steps x1 to x3 during their specific implementation.
[0136] It can be seen from the above technical scheme that the above invention embodiment adjusts the skeleton key point coordinates of the organism in the video based on the specified standard activity area range, takes the activity area of the organism in the video as the adjustment target, matches the activity area range of all actions with the standard activity area range, thereby realizing the normalization of the activity area range of all actions, and can avoid the situation that the normalized data of similar actions are large due to the different proportions of the organism in different pictures, thereby solving the problem that the normalized data of the skeleton key points of similar actions are large due to factors such as different cameras, shooting positions and shooting parameters, and then improving the accuracy of the application of the skeleton point data. In addition, by further appropriately offsetting the skeleton key point coordinates, generating the skeleton key point data of similar actions, the diversification of the action data is increased, and the generation efficiency of the skeleton key point sample data is improved. By further adopting the interpolation method, the video frame is filled in the video segment that is insufficient for the application required frame number, so as to achieve the number of frames required for the application, the problem of the disordered filling of the video frame in the existing data processing method can be solved.
[0137] In addition, it should be noted that in practical applications, the three enhancement processing methods in the above embodiments: activity area range normalization processing, coordinate offset processing and video frame filling processing, are all used before model training, and there is no constraint requirement on the execution order between the three. That is, in practical applications, technical personnel in this field can choose to adopt one of the processing methods or any combination of processing methods to enhance the action video data according to actual needs, which will not be repeated here.
[0138] Based on the above method embodiment, the embodiment of the present invention accordingly proposes an enhanced processing device for skeleton key point data, such as Figure 4 As shown, including:
[0139] A data acquisition unit 401 is used to acquire action video data;
[0140] The data enhancement unit 402 is used to adjust the coordinates of the skeleton key points of the target object in the video within a preset standard activity area for each object in the video based on the action video data to obtain action video data that meets the preset target conditions.
[0141] It should be noted that the above-mentioned method and device are based on the same inventive concept. Since the principles of solving problems by the method and device are similar, the implementation of the device and method can refer to each other, and the repeated parts will not be repeated.
[0142] Based on the above method embodiment, the embodiment of the present invention also proposes an enhanced processing device for skeleton key point data, including a processor and a memory; the memory stores an application program that can be executed by the processor, which is used to make the processor execute the enhanced processing method for skeleton key point data as described above. Specifically, a system or device equipped with a storage medium can be provided, on which a software program code that realizes the function of any implementation method in the above embodiment is stored, and the computer (or CPU or MPU) of the system or device reads out and executes the program code stored in the storage medium. In addition, the operating system etc. operated on the computer can also be completed partly or completely by the instruction based on the program code. The program code read out from the storage medium can also be written to the memory provided in the expansion board inserted into the computer or to the memory provided in the expansion unit connected to the computer, and then the CPU etc. installed on the expansion board or the expansion unit can be made to perform partly and completely the actual operation based on the instruction of the program code, so as to realize the function of any implementation method in the above method for enhancing the processing of skeleton key point data.
[0143] The memory may be implemented as various storage media such as an electrically erasable programmable read-only memory (EEPROM), a flash memory (Flash memory), and a programmable program read-only memory (PROM). The processor may be implemented as including one or more central processing units or one or more field programmable gate arrays, wherein the field programmable gate array integrates one or more central processing unit cores. Specifically, the central processing unit or the central processing unit core may be implemented as a CPU or an MCU.
[0144] The embodiment of the present application implements a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the method for enhancing the processing of skeleton key point data as described above.
[0145] It should be noted that not all steps and modules in the above processes and structure diagrams are necessary, and some steps or modules can be ignored according to actual needs. The execution order of each step is not fixed and can be adjusted as needed. The division of each module is only for the convenience of describing the functional division adopted. In actual implementation, a module can be implemented by multiple modules, and the functions of multiple modules can also be implemented by the same module. These modules can be located in the same device or in different devices.
[0146] The hardware modules in each embodiment can be implemented mechanically or electronically. For example, a hardware module may include a specially designed permanent circuit or logic device (such as a dedicated processor, such as an FPGA or ASIC) for performing a specific operation. The hardware module may also include a programmable logic device or circuit (such as a general-purpose processor or other programmable processor) temporarily configured by software to perform a specific operation. As for whether to implement the hardware module mechanically, or using a dedicated permanent circuit, or using a temporarily configured circuit (such as configured by software), it can be decided based on cost and time considerations.
[0147] In this article, "schematic" means "serving as an example, instance or explanation", and any diagram or implementation method described as "schematic" in this article should not be interpreted as a more preferred or more advantageous technical solution. In order to make the drawings concise, only the parts related to the present invention are schematically shown in each figure, and do not represent the actual structure of the product. In addition, in order to make the drawings concise and easy to understand, in some figures, only one of the parts with the same structure or function is schematically drawn, or only one of them is marked. In this article, "one" does not mean that the number of the relevant parts of the present invention is limited to "only one", and "one" does not mean that the number of the relevant parts of the present invention is "more than one". In this article, "upper", "lower", "front", "back", "left", "right", "inside", "outside", etc. are only used to indicate the relative position relationship between the relevant parts, rather than to limit the absolute position of these relevant parts.
[0148] The solutions described in this specification and in the examples, if they involve the processing of personal information, will be processed on the premise of having a legal basis (such as obtaining the consent of the subject of personal information, or being necessary for the performance of a contract, etc.), and will only be processed within the scope of regulations or agreements. If a user refuses to process personal information other than the necessary information for basic functions, it will not affect the user's use of basic functions.
[0149] In summary, the above are only preferred embodiments of the present invention and are not intended to limit the protection scope of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for enhancing the processing of skeleton key point data, characterized in that: include: Get action video data; Based on the action video data, for a target object in the video, within a preset standard activity area, the coordinates of the skeleton key points of the target object in the video are adjusted to obtain action video data that meets preset target conditions.
2. The method according to claim 1, characterized in that The adjusting the coordinates of the skeleton key points of the target object in the video comprises: Based on the coordinate set of the skeleton key points of the target object in all video frames of the video, determine the area range through which the skeleton key points of the target object pass in the video, and obtain the first activity area range of the target object; Based on the first activity area range and the preset adjusted picture size, the activity area adjustment ratio is determined with the standard activity area range as the adjustment target; Based on the activity area adjustment ratio, the first activity area range is adjusted to obtain a second activity area range of the target object in the video; Based on the second activity area range and the activity area adjustment ratio, the coordinates of each skeleton key point of the target object in the video are adjusted so that the activity area range of the target object in the video reaches the second activity area range.
3. The method according to claim 2, characterized in that Determining the activity area adjustment ratio includes: Calculating a width ratio and a height ratio of the image size to the first active area to obtain a first width ratio and a first height ratio; If the first height ratio is smaller than the first width ratio, the height ratio of the standard active area range to the first active area range is used as the active area adjustment ratio; otherwise, the width ratio of the standard active area range to the first active area range is used as the active area adjustment ratio.
4. The method according to claim 2, characterized in that: The adjusting of the coordinates of each skeleton key point of the target object in the video based on the second activity area range and the activity area adjustment ratio comprises: For each of the bone key point coordinates (x, y), according to and Get the adjusted coordinates (x′, y′); where ratio is the adjustment ratio of the active area, Imag w is the width of the adjusted image size, Imag h is the height of the adjusted image size, w2 is the width of the second active area, h2 is the height of the second active area, x min is the minimum x-axis coordinate value of the first active area, y min is the minimum y-axis coordinate value of the first active area.
5. The method according to claim 1, characterized in that The target conditions include: obtaining skeleton key point data of similar actions; The method further comprises: For each skeletal key point of the target object in the video, according to a preset offset strategy and based on the preset offset level to which the skeletal key point belongs, the offset parameters of the skeletal key point in each video frame are determined, and the coordinates of the skeletal key point in the corresponding video frame are offset using the offset parameters to obtain skeletal key point data of similar actions.
6. The method according to claim 5, characterized in that The offset strategy includes: When the skeleton key point is a first-level skeleton key point, the offset direction on each coordinate axis is set randomly, and the offset on each coordinate axis is the product of a first parameter and a first offset coefficient of the corresponding coordinate axis, the first parameter is the minimum value of the height and the width of the standard activity area, and the first offset coefficient is randomly selected from a preset first offset coefficient range; When the skeleton key point is a second-level skeleton key point, the offset direction on each coordinate axis is set randomly, and the offset on each coordinate axis is the product of the second parameter of the corresponding coordinate axis and the second offset coefficient of the corresponding coordinate axis; the second parameter is the distance between the second-level skeleton key point and the first-level skeleton key point connected to it on the corresponding coordinate axis, and the second offset coefficient is randomly selected from a preset second offset coefficient range; When the skeleton key point is a third-level skeleton key point, the offset direction on each coordinate axis is set randomly. The offset on each coordinate axis is the product of the third parameter of the corresponding coordinate axis and the third offset coefficient of the corresponding coordinate axis. The third parameter is the distance between the third-level skeleton key point and the second-level skeleton key point connected to it on the corresponding coordinate axis. The third offset coefficient is randomly selected from the preset third offset coefficient range.
7. The method according to claim 6, characterized in that The offset strategy further includes: When a bone key point is a second-level bone key point, if the number of first-level bone key points connected to the second-level bone key point is greater than 1, then the first-level bone key point connected to the second-level bone key point and the closest to it is selected as the reference point, and the second parameter of each coordinate axis is the distance between the second-level bone key point and the reference point on the corresponding coordinate axis.
8. The method according to claim 7, characterized in that The first level of bone key points includes bone key points located at a left shoulder, a right shoulder, a left hip, and a right hip; The second level bone key points include bone key points located at the neck, left elbow, right elbow, left knee and right knee; The third level skeleton key points include skeleton key points located at the head, left wrist, right wrist, left ankle and right ankle.
9. The method according to claim 6, characterized in that The first offset coefficient range is greater than 0 and less than or equal to 0.01; The second offset coefficient range is greater than 0 and less than or equal to 0.05; The third offset coefficient range is greater than 0 and less than or equal to 0.
05.
10. The method according to claim 1, characterized in that The method further comprises: When the number of video frames contained in the video meets a preset discarding condition, abandoning the use of the action video data for corresponding applications; When the number of video frames included in the video is less than a preset first number and meets a preset filling condition, using an interpolation method to supplement the number of video frames included in the video to the first number, so as to obtain action video data that meets the requirement; When the number of video frames contained in the video is greater than the first number and meets the preset extraction condition, the first number of video frames are extracted from the video, and the extracted video frames are used to construct action video data that meets the requirements.
11. The method according to claim 10, characterized in that The method further comprises: The discard condition is less than a preset first discard threshold or greater than or equal to a preset second discard threshold; the first discard threshold is less than the first number, and the second discard threshold is greater than the first number; The filling condition is greater than or equal to the first discard threshold and less than the first number; The extraction condition is greater than the first number and less than the second discarding threshold.
12. The method according to claim 11, characterized in that The method further comprises: The first discard threshold is one-half of the first number; The second discarding threshold is twice the first number.
13. The method according to claim 10, characterized in that The method of supplementing the number of video frames included in the video to the first number by using an interpolation method comprises: Sampling a second number of video frames from the action video data; the second number being a difference between the first number and the number of video frames included in the video; For each first video frame sampled, based on the skeleton point frames of the first video frame and its adjacent video frames in a specified direction, the coordinates of each skeleton key point in the corresponding intermediate skeleton point frame are calculated according to the trend of motion speed change; and the intermediate skeleton point frame is inserted between the first video frame and its adjacent video frame; the adjacent video frame is located before or after the first video frame; the skeleton point frame is a frame that only contains the coordinates of all skeleton key points of the target object.
14. The method according to claim 13, characterized in that The calculation of the coordinates of each skeleton key point in the corresponding intermediate skeleton point frame includes: Calculating the speed of the skeleton key point on each coordinate axis in the first video frame and its adjacent video frames respectively; For each coordinate axis i, based on the speed on the coordinate axis i, determine the motion change state of the skeleton key point in the direction of the coordinate axis i between the first video frame and its adjacent video frame; For each coordinate axis i, if the motion change state of the skeleton key point in the direction of the coordinate axis i is an accelerated motion state, then the coordinate value of the skeleton key point on the coordinate axis i in the nth frame and the average value of the coordinate value of the corresponding intermediate point on the coordinate axis i are calculated to obtain the coordinate value of the skeleton key point on the coordinate axis i in the intermediate skeleton point frame; the intermediate point is the midpoint of the line between the coordinate points of the skeleton key point in the nth frame and the n+1th frame; the nth frame is the video frame with a smaller frame number among the first video frame and the adjacent video frames; the n+1th frame is the video frame with a smaller frame number among the first video frame and the adjacent video frames. a video frame with a larger frame number in the frame; if the motion change state of the skeleton key point in the direction of the coordinate axis i is a deceleration motion state, then the coordinate value of the skeleton key point on the coordinate axis i in the n+1th frame and the average value of the coordinate value of the intermediate point on the coordinate axis i are calculated to obtain the coordinate value of the skeleton key point on the coordinate axis i in the intermediate skeleton point frame; if the motion change state of the skeleton key point in the direction of the coordinate axis i is a uniform motion state, then the coordinate value of the intermediate point on the coordinate axis i is used as the coordinate value of the skeleton key point on the coordinate axis i in the intermediate skeleton point frame.
15. A device for enhancing and processing skeleton key point data, characterized in that: include: A data acquisition unit, used for acquiring action video data; The data enhancement unit is used to adjust the coordinates of the skeleton key points of each target object in the video within a preset standard activity area based on the action video data to obtain action video data that meets the preset target conditions.
