Hairstyling method, apparatus, and related products

The device receives user requests and generates hair movement videos that match head movements and styles, solving the problem of inconsistent hair movements and enhancing the realism of hair movements.

CN122115191APending Publication Date: 2026-05-29HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
Filing Date
2024-11-28
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

In existing technologies, the hair movement of the target person in the target video is not smooth after hairstyle editing, which affects the user's viewing experience.

Method used

The hairstyle editing device receives the user's specified new hairstyle and hair movement style, extracts the target person's head movement posture, generates hair movement video using templates in the hairstyle library and a rendering engine, and edits it in conjunction with optical flow information to ensure that the hair movement is consistent with the head movement and meets the user's expectations.

Benefits of technology

It achieves smooth hair movement of the target character in the target video, enhances the realism of hair movement, and meets the user's viewing needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122115191A_ABST
    Figure CN122115191A_ABST
Patent Text Reader

Abstract

The application provides a hairstyle editing method and device and related products, which can replace the hairstyle of a target person in an original video, and the movement of the hair in the new hairstyle is realistic. The method can be applied to a hairstyle editing device. Specifically, the hairstyle editing device receives a hairstyle editing request, which is used to indicate editing of the hairstyle of a target person in an original video. The hairstyle editing request includes a new hairstyle specified by a user for the target person and a corresponding hair movement style. Then, the hairstyle of the target person in the original video is edited according to the new hairstyle and the hair movement style, and a target video is obtained. In the target video, the hairstyle of the target person is the new hairstyle, and the hair of the target person moves according to the hair movement style specified by the user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of cloud computing, and more particularly to a hair editing method, apparatus, and related products. Background Technology

[0002] When watching a video (hereinafter referred to as the "original video"), users may be dissatisfied with the hairstyle of the target person in the original video. In this case, users can use a hairstyle editing device to edit the hairstyle of the target person in the original video to change it to a hairstyle that satisfies the user. Specifically, the hairstyle editing device can edit each video frame in the original video according to the new hairstyle specified by the user for the target person, thereby obtaining the target video, which includes the multiple edited video frames mentioned above. However, in the target video obtained by the above method, the hair movement of the target person shown in different video frames may be inconsistent. Therefore, when playing the target video, the hair movement of the target person may appear unrealistic, affecting the user's viewing experience. Summary of the Invention

[0003] This application provides a hairstyle editing method, apparatus, and related products, which can edit the hairstyle of a target person in the original video, and the hairstyle of the target person in the edited target video is a new hairstyle specified by the user, and the hair movement of the target person has a realistic feel.

[0004] Firstly, this application provides a hairstyle editing method. This method can be applied to a hairstyle editing device. Specifically, the hairstyle editing device receives a hairstyle editing request, which instructs the editing of the hairstyle of a target person in an original video. The request includes a new hairstyle specified by the user for the target person and a corresponding first hair movement style. Then, the hairstyle editing device edits the hairstyle of the target person in the original video according to the new hairstyle specified by the user and the corresponding first hair movement style, resulting in a first target video. In the first target video, the target person's hairstyle is the new hairstyle, and the target person's hair moves according to the first hair movement style.

[0005] In the technical solution provided in this application, the hairstyle editing device can edit the hairstyle of the target person in the original video according to the new hairstyle specified by the user for the target person and the style of hair movement in the hairstyle, so that the hairstyle of the target person in the edited target video is changed to the new hairstyle specified by the user, and the hair movement of the target person in the target video is uniformly dynamically expressed according to the movement style specified by the user, making the hair movement of the target person in the target video coherent and more realistic.

[0006] In one possible implementation, the hairstyle editing device edits the hairstyle of the target person in the original video based on a new hairstyle specified by the user and the corresponding first hair movement style, to obtain a target video. This includes the following steps: The hairstyle editing device extracts the head movement posture of the target person from the original video, and then determines first hair movement information based on the new hairstyle, the first hair movement style, and the target person's head movement posture. This first hair movement information characterizes the movement of the hair in the new hairstyle, where the hair in the new hairstyle moves according to the movement pattern defined by the target person's head movement and the first hair movement style. Afterward, the hairstyle editing device edits the hairstyle of the target person in the original video based on the new hairstyle and the first hair movement information to obtain the first target video.

[0007] In the above implementation, the hair movement in the new hairstyle represented by the first hair movement information is as follows: the hair in the new hairstyle moves with the head movement of the target person, and the hair movement is dynamically expressed according to the hair movement style specified by the user. Therefore, in the target video obtained based on the first hair movement information and the new hairstyle editing, the target person's hair will not only move according to the user-specified movement style, but will also move with the head movement of the target person, making the hair movement of the target person more realistic.

[0008] In one possible implementation, the aforementioned hairstyle editing request includes descriptive information about the new hairstyle. Therefore, the hairstyle editing device determines the first hair motion information based on the new hairstyle, the first hair motion style, and the head motion posture of the target person, including the following steps: The hairstyle editing device determines a target hairstyle template based on the matching relationship between the descriptive information of the new hairstyle and hairstyle templates in a hairstyle library, wherein the target hairstyle template is a hairstyle template that matches the descriptive information of the new hairstyle; then, based on the first hair motion style and the head motion posture of the target person, the hair in the target hairstyle template is rendered to obtain a first hair motion video, wherein the first hair motion video is used to display the movement of the hair in the new hairstyle. Afterwards, the hairstyle editing device determines the first hair motion information based on the optical flow between adjacent video frames in the first hair motion video.

[0009] It is understandable that, since the optical flow between adjacent video frames can reflect the motion of objects in the video frame, and the first hair motion video shows the motion of hair in the new hairstyle, the optical flow between adjacent video frames extracted from the first hair motion video can be used to reflect the motion of hair in the new hairstyle.

[0010] In one possible implementation, the target hairstyle template is a three-dimensional model, and the first hair motion information is used to characterize the three-dimensional motion of the hair in the new hairstyle. Thus, the hairstyle editing device can use the three-dimensional motion of the hair in the new hairstyle as prior information to instruct the editing of the target person's hairstyle in the original video, thereby enhancing the realism of the hair motion of the target person in the target video.

[0011] In one possible implementation, before the hair editing device determines the first hair motion information based on the optical flow between adjacent video frames in the first hair motion video, the hair editing device also displays the first hair motion video so that the user can determine whether the first hair motion style meets the requirements.

[0012] In one possible implementation, when the first hair movement style does not meet the requirements, the hairstyle editing device edits the hairstyle of the target person in the original video according to the new hairstyle and the second hair movement style to obtain a second target video. In the second target video, the hairstyle of the target person is the new hairstyle, and the hair of the target person moves according to the second hair movement style.

[0013] Using the above implementation method, users can change the movement style of the hair in the new hairstyle according to business needs, so that the hair of the target person in the target video moves according to the desired movement style.

[0014] Secondly, this application provides a hairstyle editing device. The device includes an acquisition module and a generation module. The acquisition module receives a hairstyle editing request, which instructs the editing of the hairstyle of a target person in an original video. The request includes a new hairstyle specified by the user for the target person and a corresponding first hair movement style. The generation module edits the hairstyle of the target person in the original video according to the new hairstyle specified by the user and the corresponding first hair movement style, resulting in a first target video. In the first target video, the target person's hairstyle is the new hairstyle, and the target person's hair moves according to the first hair movement style.

[0015] In one possible implementation, the generation module is used to extract the head movement posture of the target person from the original video; based on the new hairstyle, the first hair movement style, and the head movement posture of the target person, the first hair movement information is determined, which is used to characterize the movement of the hair in the new hairstyle, wherein the hair in the new hairstyle moves according to the movement form defined by the head movement of the target person and the first hair movement style; based on the new hairstyle and the first hair movement information, the hairstyle of the target person in the original video is edited to obtain the first target video.

[0016] In one possible implementation, the aforementioned hairstyle editing request includes descriptive information about the new hairstyle. The generation module is used to determine a target hairstyle template based on the matching relationship between the new hairstyle's descriptive information and hairstyle templates in a hairstyle library, wherein the target hairstyle template is a hairstyle template that matches the new hairstyle's descriptive information; render the hair in the target hairstyle template according to a first hair motion style and the target person's head movement posture to obtain a first hair motion video, wherein the first hair motion video is used to display the movement of the hair in the new hairstyle; and determine the first hair motion information based on the optical flow between adjacent video frames in the first hair motion video.

[0017] In one possible implementation, the target hairstyle template is a three-dimensional model, and the first hair motion information is used to characterize the three-dimensional motion of the hair in the new hairstyle.

[0018] In one possible implementation, the hairstyle editing device further includes a display module. The display module is used to display a first hair movement video so that the user can determine whether the first hair movement style meets the requirements.

[0019] In one possible implementation, the generation module is further configured to edit the hairstyle of the target person in the original video according to the new hairstyle and the second hair motion style when the first hair motion style does not meet the requirements, thereby obtaining a second target video in which the hairstyle of the target person is the new hairstyle and the hair of the target person moves according to the second hair motion style.

[0020] Thirdly, this application provides a computing device. The computing device includes a processor and a memory, wherein the processor executes instructions stored in the memory to cause the computing device to perform some or all of the methods described in the first aspect and any implementation thereof.

[0021] Fourthly, this application provides a computing device cluster. The computing device cluster includes at least one computing device, each computing device including a processor and a memory. The processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, causing the computing device cluster to perform some or all of the methods described in the first aspect and any implementation thereof.

[0022] Fifthly, this application provides a computer program product containing instructions. This computer program product may be a software or program product containing instructions that can run on a computing device or be stored on any usable medium. When the computer program product is run on a computing device, it causes the computing device to perform some or all of the methods described in the first aspect and any implementation thereof.

[0023] Sixthly, this application provides a computer-readable storage medium. The computer storage medium includes computer program instructions that, when executed by a computing device, cause the computing device to perform some or all of the methods described in the first aspect and any implementation thereof. Attached Figure Description

[0024] Figure 1 This is a schematic diagram of a hairstyle editing scenario provided in this application;

[0025] Figure 2 This is a schematic diagram of an application scenario provided in this application;

[0026] Figure 3 This is a flowchart illustrating a hair styling method provided in this application;

[0027] Figure 4 This is a schematic diagram of the structure of a hair editing device provided in this application;

[0028] Figure 5 This is a schematic diagram of the structure of a computing device provided in this application;

[0029] Figure 6 This is a schematic diagram of the structure of a computing device cluster provided in this application;

[0030] Figure 7 This is a schematic diagram of another computing device cluster provided in this application. Detailed Implementation

[0031] To edit the hairstyle of a target person in an original video and enhance the realism of the hair movement in the resulting video, this application provides a hairstyle editing method. This method can be applied to a hairstyle editing device. Specifically, the user provides the hairstyle editing device with a new hairstyle for the target person and a corresponding hair movement style, where the hair movement style indicates the movement of the hair in the new hairstyle. The hairstyle editing device then extracts the head movement posture of the target person from the original video and renders the hair in the new hairstyle based on the head movement posture, the new hairstyle specified by the user, and the corresponding hair movement style. This results in a hair movement effect where the hair moves with the target person's head, and the hair movement dynamically follows the user-specified hair movement style. Subsequently, the hairstyle editing device extracts the hair movement information from the rendered hair movement effect and edits the hairstyle of the target person in the original video based on this information, thereby obtaining a target video with a changed hairstyle. Understandably, in the above scheme, the hairstyle editing device uses the hair movement style specified by the user as prior information for hair movement to instruct the editing of the target person's hairstyle. Therefore, the target person's hair can be dynamically expressed according to a unified movement style, making the hair movement of the target person in the target video more coherent and enhancing the realism of the hair movement of the target person in the target video.

[0032] The technical solution provided in this application will be described below with reference to the accompanying drawings.

[0033] See Figure 1 , Figure 1 A schematic diagram illustrating a hairstyle editing scenario to which this application applies is shown. For example... Figure 1 As shown, the scenario includes a client 100 and a hairstyle editing device 200, wherein the client 100 and the hairstyle editing device 200 can be connected via a network, which can be a wide area network or a local area network.

[0034] The client 100 is used to realize human-computer interaction. It can be deployed on terminal devices, which may include smartphones, tablets, laptops, desktops, augmented reality (AR) devices, virtual reality (VR) devices, wearable devices, handheld processing devices, all-in-one handheld consoles, smart conferencing devices, smart advertising devices, smart home appliances, etc. This application does not limit the scope of the application.

[0035] In specific implementation, the client 100 can be software or application (APP) running on a terminal device controlled by the user, such as a personal computer (PC) client, APP client, etc., or a World Wide Web (web) client accessed based on a browser, or a console of a cloud management platform, etc. This application does not limit this.

[0036] The hairstyle editing device 200 is used to edit the hairstyle of a target person in the original video, thereby changing the hairstyle of the target person in the original video. In specific implementation, the hairstyle editing device 200 can be deployed on a single computing device or a cluster of computing devices consisting of multiple computing devices. The computing device can be a server, such as a central server or edge server in a cloud data center or a local server in a local data center, or it can be a terminal device such as a desktop computer or a laptop computer.

[0037] exist Figure 1 In the scenario shown, when a user wants to change the hairstyle of a target person in the original video, the user can send a hairstyle editing request to the hairstyle editing device 200 through the client 100. This request instructs the user to edit the hairstyle of the target person in the original video, and includes the new hairstyle and corresponding hair movement style specified by the user. The hairstyle editing device 200 then edits the hairstyle of the target person in the original video according to the new hairstyle and corresponding hair movement style specified by the user, resulting in the target video. In the target video, the target person's hairstyle is the new hairstyle specified by the user, and the target person's hair dynamically displays according to the user-specified hair movement style.

[0038] Furthermore, if the current hair movement style does not meet the user's expectations, the user can adjust the hair movement style. Accordingly, the hairstyle editing device 200 can edit the hairstyle of the target person in the original video according to the new hair movement style, so that the hair of the target person in the edited target video can dynamically express the movement style as desired by the user.

[0039] As one possible implementation, such as Figure 2As shown, client 100 can be deployed on a user-controlled terminal device, and hairstyle editing device 200 can be deployed in a data center. In this case, hairstyle editing device 200 can provide users with cloud services based on the basic resources (including computing resources, storage resources, and network resources) provided by the data center. Specifically, users can register an account on the cloud management platform, log in to the platform, and purchase the aforementioned cloud services. After successful purchase, users can provide the original video to hairstyle editing device 200 through client 100 and send a hairstyle editing request. Hairstyle editing device 200 then completes the editing process of the target person's hairstyle in the original video according to the request.

[0040] Next, combined Figure 3 The flowchart shown illustrates the hairstyle editing method, providing a more detailed explanation of how the hairstyle editing device 200 edits the hairstyle of the target person in the original video.

[0041] In step 301, client 100 sends the original video and a hairstyle editing request to hairstyle editing device 200. Correspondingly, hairstyle editing device 200 receives the original video and hairstyle editing request sent by client 100.

[0042] The original video is a video containing a target person, used to record the target person's behavior in a specific scenario. This behavior can specifically include the target person's head movements and postures. For example, the original video could be a live stream video featuring a digital human. The target person in this video could be the aforementioned digital human, a virtual character existing in digital space in digital form. It possesses anthropomorphic or real-person appearance and behavioral characteristics, and has a certain degree of intelligence and emotion, capable of interaction and expression. The video records the digital human's postures during the live stream, such as turning its head left and right, shaking its head up and down, tilting its head forward, and tilting its head back. It should be understood that the above example only illustrates one possible original video. In practical applications, the original video could also be a film or television drama video, an animated video, a news video, or a conference video, etc. The target person in the original video could be a digital human or a real person; this application does not limit this.

[0043] The hairstyle editing request includes the identifier of the target person in the original video. In practice, the target person can be identified by using an identifier box (such as a rectangle or ellipse) in one or more video frames (such as the first or last frame) contained in the original video.

[0044] The hairstyle editing request also includes hairstyle requirements, which describe the new hairstyle that the user specifies for the target person in the original video. In other words, the hairstyle requirements are the descriptive information for the new hairstyle. Specifically, hairstyle requirements can include multiple dimensions such as the user's requirements regarding the target person's hair length (e.g., short or long), hair curliness (e.g., straight or curly), hair color (e.g., black or brown), hair style (e.g., loose or tied up), and hair distribution (e.g., dense or sparse).

[0045] Optionally, the hairstyle editing request may also include a first hair motion style, which refers to the motion style defined by the user for the target person's hair, used to describe the characteristics of the target person's hair when dynamically displayed. In specific implementations, the first hair motion style can be the visual effect of hair movement in different scenarios, such as hair swaying when turning, hair movement when running and jumping, hair movement when blowing in the wind, and hair swinging under external impact.

[0046] The hairstyle editing device 200 can obtain the original video and hairstyle editing request in the following ways: The hairstyle editing device 200 provides an access interface, which can be implemented through an application programming interface (API) or a graphical user interface (GUI). Users can access the access interface provided by the hairstyle editing device 200 through the client 100, and then provide the hairstyle editing device 200 with the original video and hairstyle editing request, thereby enabling the hairstyle editing device 200 to obtain the original video and hairstyle editing request.

[0047] For example, the hairstyle editing device 200 can provide a video upload page, which includes a video upload box. Users can use the video upload box to provide the original video to the hairstyle editing device 200, and then use an identification box to identify the target person on one or more video frames contained in the original video.

[0048] The hairstyle editing device 200 also provides a hairstyle configuration page, which includes a hairstyle options bar, an image upload box, and a text input box. Users can choose any method to provide hairstyle requirements to the hairstyle editing device 200 according to their needs. Specifically:

[0049] ① This page offers multiple hairstyle options, such as "Hair Length," "Hair Curl," and "Hair Color." "Hair Length" includes "Short Hair" and "Long Hair," "Hair Curl" includes "Straight Hair" and "Curly Hair," and "Hair Color" includes "Black" and "Brown." Users can select the appropriate option to configure their desired hairstyle.

[0050] ② Users can also provide images that express their hairstyle requirements to the hairstyle editing device 200 through the image upload box. For example, if a user wants the target person to have long, black, curly hair, the user can provide an image of a person with long, black, curly hair to the hairstyle editing device 200 through the image upload box, thereby completing the configuration of the hairstyle requirements.

[0051] ③ Users can also enter a text description of their hairstyle requirements in the text input box. Taking the above example of long black curly hair, users can enter the following keywords in the text input box: black, curly hair, long hair, to complete the configuration of their hairstyle requirements.

[0052] The hair editing device 200 also provides a hair movement style configuration page, which displays multiple hair movement style options, such as "hair swaying effect when turning," "hair movement effect when running and jumping," and "hair movement effect when blowing in the wind." Users can select the appropriate option as the primary hair movement style according to their needs, thereby completing the configuration of the primary hair movement style.

[0053] It should be understood that the above example is only one possible way for the hairstyle editing device 200 to obtain the original video and hairstyle editing request. In practical applications, the hairstyle editing device 200 can also obtain the original video and hairstyle editing request by providing other methods, which are not limited in this application.

[0054] Step 302: The hairstyle editing device 200 determines the target hairstyle template based on the matching relationship between the hairstyle requirements and the hairstyle templates in the hairstyle library. The target hairstyle template is a hairstyle template in the hairstyle library that matches the hairstyle requirements.

[0055] In its specific implementation, the hairstyle editing device 200 pre-stores a hairstyle library, which includes multiple hairstyle templates, each representing a specific hairstyle requirement. The hairstyle templates in the library can be represented using three-dimensional (3D) models. Therefore, the hairstyle editing device 200 can determine the target hairstyle template through the following sub-steps:

[0056] In step 302a, the hairstyle editing device 200 performs semantic recognition on the hairstyle requirement to obtain first semantic information. The first semantic information is used to characterize the features of the hairstyle indicated by the hairstyle requirement.

[0057] As mentioned above, hairstyle requirements can be described by the user through images or text, specifying a new hairstyle for a target person. Therefore, the hairstyle editing device 200 can perform corresponding semantic recognition based on the representation of the hairstyle requirements. Specifically, when the hairstyle requirements are represented as images (hereinafter referred to as "hairstyle reference images"), the hairstyle editing device 200 performs object detection on the hairstyle reference images to obtain a feature map. This feature map contains the hairstyle portion of the hairstyle reference images. Then, feature extraction is performed on the feature map, and the extracted feature vectors can be used as the first semantic information. When the hairstyle requirements are represented as text (hereinafter referred to as "hairstyle description text"), the hairstyle editing device 200 performs semantic analysis on the hairstyle description text to obtain one or more keywords. These one or more keywords are information in the hairstyle description text that reflects the new hairstyle. Then, these one or more keywords are embedded into a vector space to obtain the first semantic information.

[0058] As one possible implementation, the hairstyle editing device 200 can directly use a pre-trained neural network model to achieve semantic recognition of hairstyle reference images. The neural network model used here can be an existing model in the industry that can accurately perform image semantic recognition, such as a ResNet or a vision-based self-attention network (ViT). Similarly, the hairstyle editing device 200 can use a pre-trained neural network model to achieve semantic recognition of hairstyle description text. The neural network model used here can be an existing model in the industry that can accurately perform text semantic recognition, such as a contrastive language-image pretraining (CLIP) model or a text-to-text transfer transformer (T5) model.

[0059] In step 302b, the hairstyle editing device 200 performs semantic recognition on the hairstyle template n in the hairstyle library to obtain second semantic information. The second semantic information is used to characterize the features of the hairstyle indicated by the hairstyle template n.

[0060] Specifically, since the hairstyle template n usually only contains hairstyle information, the hairstyle editing device 200 can directly perform feature extraction on the hairstyle template n, and the extracted feature vector can be used as the second semantic information.

[0061] As one possible implementation, the hairstyle editing device 200 can directly use a pre-trained neural network model to implement the above steps, such as a ResNet or ViT model.

[0062] In step 302c, the hairstyle editing device 200 compares the first semantic information and the second semantic information. If the similarity between the first semantic information and the second semantic information is greater than or equal to a similarity threshold, it is determined that the hairstyle requirement matches the hairstyle template n. If the similarity between the first semantic information and the second semantic information is less than the similarity threshold, it is determined that the hairstyle requirement does not match the hairstyle template n, and steps 302d to 302e are executed. The aforementioned similarity threshold can be set by the user or by the hairstyle editing device 200.

[0063] In step 302d, the hairstyle editing device 200 performs semantic recognition on the next hairstyle template in the hairstyle library to obtain third semantic information.

[0064] It should be understood that the specific implementation method of this step can be found in step 302b above, and for the sake of brevity, it will not be described in detail here.

[0065] In step 302e, the hairstyle editing device 200 compares the first semantic information and the third semantic information. If the similarity between the first semantic information and the third semantic information is greater than or equal to a similarity threshold, it is determined that the hairstyle requirement matches the aforementioned hairstyle template. If the similarity between the first semantic information and the third semantic information is less than the similarity threshold, it is determined that the hairstyle requirement does not match the aforementioned hairstyle template, and steps 302d to 302e are repeated until a hairstyle template matching the hairstyle requirement (i.e., the target hairstyle template) is determined.

[0066] Step 303: The hairstyle editing device 200 extracts the head movement posture of the target person from the original video.

[0067] The head movement posture of the target person is used to describe the posture of the target person's head in the original video, such as turning the head left and right, shaking the head up and down, tilting the head forward, tilting the head back, etc. The head movement posture of the target person can be represented by the position information of various key points of the target person's head in each video frame contained in the original video. The key points of the target person's head can include the top key points and facial key points (such as the edge points and center points of eyebrows, eyes, nose, mouth, ears, and chin). In addition, it can also include some other key points of the head, which will not be elaborated on here for the sake of brevity.

[0068] In practice, the hairstyle editing device 200 can extract the head movement of the target person from the original video through the following sub-steps:

[0069] Step 303a: The hairstyle editing device 200 performs head detection on multiple video frames in the original video to obtain the head image of the target person in each video frame.

[0070] It is worth noting that the multiple video frames mentioned here can be all video frames in the original video, or only a portion of the original video frames. When the multiple video frames are only a portion of the original video frames, the hairstyle editing device 200 can obtain the multiple video frames in the following way: the hairstyle editing device 200 extracts multiple video frames from the original video in chronological order. The time interval between any two adjacent video frames in the extracted multiple video frames can be the same or different. The number of video frames extracted can be set by the user or by the hairstyle editing device 200. Furthermore, the time interval between any two adjacent video frames in the extracted video frames can also be set by the user or by the hairstyle editing device 200; this application does not limit this.

[0071] Taking a video frame (hereinafter referred to as "video frame 1") as an example, the hairstyle editing device 200 can obtain the head image of the target person in the video frame in the following way: The hairstyle editing device 200 obtains a reference target person image based on the identifier of the target person carried in the hairstyle editing request. The reference target person image is the image identified by the identifier box corresponding to the aforementioned identifier. Then, the hairstyle editing device 200 performs feature extraction on the reference target person image to obtain the feature vector of the reference target person image. The hairstyle editing device 200 also performs person detection on video frame 1 to obtain one or more person images, then performs feature extraction on the one or more person images to obtain the feature vectors of the one or more person images, and then compares the feature vectors of the one or more person images with the feature vector of the reference target person image to determine the target person image in video frame 1. The target person image in video frame 1 is the person image among the one or more person images whose feature vector has the highest similarity to the reference target person image. Then, the hairstyle editing device 200 performs head detection on the target person image in video frame 1 to obtain the head image of the target person in video frame 1.

[0072] As one possible implementation, the hairstyle editing device 200 can directly use a pre-trained neural network model to implement the above steps, such as a ResNet or ViT model.

[0073] It should be understood that the above method is only one possible implementation of the hairstyle editing device 200 to obtain the head image of the target person in video frame 1. In practical applications, the hairstyle editing device 200 can also use other methods to obtain the head image of the target person in video frame 1. For example, the hairstyle editing device 200 can directly perform head detection on video frame 1 to obtain one or more head images, and then compare the feature vectors of the one or more head images with the feature vector of the reference head image (i.e., the head image of the target person marked by the user with a bounding box in a certain video frame of the original video) to determine the head image of the target person in video frame 1.

[0074] It should also be understood that for other video frames in the original video, the hairstyle editing device 200 can also refer to the above-described method of obtaining the head image of the target person in video frame 1 to obtain the head image of the target person in other video frames. For the sake of brevity, this will not be described in detail here.

[0075] Step 303b: The hairstyle editing device 200 performs key point detection on each head image to obtain the position information of the head key points in each head image.

[0076] Taking a head image (hereinafter referred to as "head image 1") as an example, the hairstyle editing device 200 can obtain the position information and angle information of the head key points in the head image in the following way: The hairstyle editing device 200 performs feature extraction on the head image 1 to obtain the features related to the head key points in the head image 1, and then identifies the head key points in the head image 1 based on the obtained features. After that, the coordinates of the identified head key points in the head image 1 are determined, and the position information of each head key point in the head image 1 can be obtained.

[0077] As one possible implementation, the hair editing device 200 can directly use a pre-trained neural network model to perform this step, such as a pose estimation (OpenPose) model or a multimedia machine learning (MediaPipe) model.

[0078] It should be understood that for other head images, the hairstyle editing device 200 can also refer to the above-described method of obtaining the position information of the head key points in head image 1 to obtain the position information of the head key points in other head images. For the sake of brevity, it will not be described in detail here.

[0079] In step 303c, the hairstyle editing device 200 obtains the movement posture of the target person's head based on the obtained position information of the key points of the head.

[0080] Specifically, when the multiple video frames involved in step 303a are all the video frames in the original video, the motion posture of the target person's head is composed of the position information of the key points of the target person's head in each video frame. When the multiple video frames involved in step 303a are only some of the video frames in the original video, the hairstyle editing device 200 can use interpolation to supplement the position information of the key points of the target person's head in the video frames in which steps 303a and 302b were not performed, thereby obtaining the position information of the key points of the target person's head in each video frame contained in the original video, and thus obtaining the motion posture of the target person's head.

[0081] Step 304: The hairstyle editing device 200 renders the hair in the target hairstyle template according to the head movement posture of the target person to obtain the first hair movement video.

[0082] The first hair motion video is used to demonstrate the visual effect of the hair in the target hairstyle template moving with the head of the target person. The first hair motion video can be a 3D video.

[0083] In its implementation, the hairstyle editing device 200 is pre-installed with a rendering engine. This rendering engine can be an existing industry-leading engine capable of rendering the motion effects of human hair effectively, such as the Maya rendering engine or the Unreal Engine. Therefore, the hairstyle editing device 200 can input the head movement posture of the target person and the target hairstyle template into the rendering engine. Subsequently, the rendering engine will adjust the position and angle of the hair in the target hairstyle template according to the head movement posture of the target person, so that the hair in the target hairstyle template can change accordingly with the movement of the target person's head.

[0084] When a hairstyle editing request includes a first hair movement style, the hairstyle editing device 200 can render the hair in the target hairstyle template based on the target person's head movement posture and the first hair movement style to obtain a first hair movement video. In this first hair movement video, the hair in the target hairstyle template not only moves with the target person's head but also reflects the first hair movement style. For example, if the target person's head turns to the left and the first hair movement style is a flowing style, then the first hair movement video will present a visual effect where the hair in the target hairstyle template swings to the left with light and soft strands.

[0085] More specifically, the hairstyle editing device 200 also has a pre-installed solver, which can be an existing solver in the industry capable of simulating the physical state of human hair well (such as Groom, TressFX, etc.). Therefore, the hairstyle editing device 200 renders the hair in the target hairstyle template according to the head movement posture of the target person and the first hair movement style, to obtain the first hair movement video, including:

[0086] The hair editing device 200 first inputs the first hair motion style into the solver. Then, the solver performs a physical simulation of the hair based on the first hair motion style and built-in physical laws (such as laws related to hair dynamics, elasticity, friction, and fluid dynamics) to obtain a first parameter set. The first parameter set includes multiple parameters. The parameters in the first parameter set are used to reflect the characteristics of the target person's hair under the first hair motion style, such as the speed, acceleration, elasticity, and deformation of the target person's hair at a certain moment or position.

[0087] The hairstyle editing device 200 then inputs the target person's head movement posture, the target hairstyle template, and the first parameter set into the rendering engine. The rendering engine then adjusts the position and angle of the hair in the target hairstyle template according to the target person's head movement posture, so that the hair in the target hairstyle template changes accordingly with the target person's head movement. The rendering engine also adjusts the position and angle of the hair ends and hair shafts (i.e., the part between the hair root and the hair end) in the target hairstyle template according to the first parameter set, so that the hair in the target hairstyle template meets the first hair movement style. Thus, the first hair movement video can be rendered.

[0088] Step 305, the hair editing device 200 displays the first hair movement video.

[0089] In practice, the hairstyle editing device 200 can display the first hair movement video through the client 100. Specifically, the hairstyle editing device 200 sends the first hair movement video to the client 100, which then displays the first hair movement video. In this way, the user can view the first hair movement video and determine whether the hair movement style presented in the first hair movement video (i.e., the first hair movement style) meets the user's expectations.

[0090] If the first hair movement video meets the user's expectations, then proceed to steps 306, 307, and 312. Conversely, if the first hair movement video does not meet the user's expectations, then proceed to steps 308 through 312.

[0091] Step 306: The hair editing device 200 obtains the first optical flow information based on the first hair motion video.

[0092] The first optical flow information refers to the hair movement information of the target person under the new hairstyle, and can be used to characterize the movement of the target person's hair in the first hair movement video. The first optical flow information can include the optical flow between adjacent video frames in the first hair movement video. For example, if the first hair movement video includes m video frames, namely video frame 1, video frame 2, ..., video frame m, then the first optical flow information includes: the optical flow between video frame 1 and video frame 2, ..., the optical flow between video frame i and video frame i+1, ..., the optical flow between video frame m-1 and video frame m. Wherein, 1≦i≦m, and i and m are both integers.

[0093] For ease of description, we will now take video frame i and video frame i+1 in the first hair motion video as examples to explain this step.

[0094] The hairstyle editing device 200 can obtain the optical flow between video frame i and video frame i+1 in any of the following ways:

[0095] Method 1: The hairstyle editing device 200 calculates the displacement of each pixel in video frame i relative to each pixel in video frame i+1, thereby obtaining the optical flow between video frame i and video frame i+1. The optical flow between video frame i and video frame i+1 includes the displacement between each pixel in video frame i+1 and its corresponding pixel in video frame i.

[0096] In a specific implementation, the hairstyle editing device 200 may use a global optimization-based optical flow estimation algorithm (Horn-Schunck algorithm) or an optical flow network (FlowNet) to implement the above process, and this application does not limit it.

[0097] Method 2: The hairstyle editing device 200 performs feature point detection on video frame i to obtain feature points in video frame i. The feature points in video frame i can be key points of the hair in that video frame, such as the hair root, hair end, or the midpoint of the hair, and the number of feature points in video frame i can be one or more. The hairstyle editing device 200 also performs feature point detection on video frame i+1 to obtain feature points in video frame i+1. The feature points in video frame i+1 correspond to the feature points in video frame i. Here, "corresponds" means that the feature points in video frame i+1 and the feature points in video frame i represent the same object. For example, if the feature points in video frame i include the hair root and hair end of a certain hair, then the feature points in video frame i+1 also include the hair root and hair end of that hair. Subsequently, the hairstyle editing device 200 calculates the displacement of the feature points in video frame i+1 relative to the feature points in video frame i, and obtains the optical flow between video frame i and video frame i+1, wherein the optical flow between video frame i and video frame i+1 includes the displacement between each feature point in video frame i+1 and the corresponding feature point in video frame i.

[0098] In specific implementation, the hairstyle editing device 200 can use a corner tracking algorithm (Kanade-Lucas-Tomasi, KLT algorithm) or a feature point detection algorithm (such as Harris algorithm, HOG algorithm, etc.) combined with an optical flow algorithm (such as Lucas-Kanade algorithm, pyramid optical flow algorithm, etc.) to implement the above process, and this application does not limit it.

[0099] Step 307: The hairstyle editing device 200 edits the hairstyle of the target person in the original video according to the first optical flow information and the target hairstyle template to obtain the target video.

[0100] In its specific implementation, the hairstyle editing device 200 can use the first optical flow information and the target hairstyle template as prompting information, and edit the hair of the target person in the original video according to the prompting information to obtain a target video that conforms to the prompting information. The hairstyle of the target person in the target video is the hairstyle indicated by the target hairstyle template, and the hair of the target person dynamically displays the movement represented by the first optical flow information.

[0101] As one possible implementation, the hairstyle editing device 200 can use a stable diffusion (SD) model to implement the above process. Specifically, the SD model includes an encoder, a U-Net, and a decoder. After the hairstyle editing device 200 inputs the first optical flow information, the target hairstyle template, and the original video into the SD model, the encoder in the SD model performs feature extraction on the first optical flow information and the target hairstyle template (i.e., the prompt information) to obtain the feature vector corresponding to the prompt information, where the feature vector corresponding to the prompt information is used to represent the prompt information. The encoder also performs feature extraction on the original video to obtain the feature vector corresponding to the original video, where the feature vector corresponding to the original video is used to represent the image features of the original video. Then, the encoder sends the feature vector corresponding to the prompt information and the feature vector corresponding to the original video to the U-Net. After receiving the feature vector corresponding to the prompt information and the feature vector corresponding to the original video, the U-Net performs iterative noise reduction processing on the received feature vector, and then sends the processed feature vector to the decoder. After receiving the processed feature vector, the decoder performs decoding processing on the feature vector to obtain the target video.

[0102] It should be understood that in practical applications, in addition to the SD model mentioned above, the hairstyle editing device 200 can also use other existing video generation models in the industry to generate target videos, such as video generation models (CogVideoX), stable video diffusion (SVD) models, etc., and this application does not limit this.

[0103] In step 308, the client 100 sends a second hair movement style to the hairstyle editing device 200. Correspondingly, the hairstyle editing device 200 receives the second hair movement style sent by the client 100. The second hair movement style refers to a new movement style defined by the user for the target person's hair.

[0104] In the specific implementation, the method by which the hair editing device 200 obtains the second hair motion style can refer to the method of "obtaining the first hair motion style" described in step 301, so it will not be described in detail here.

[0105] In step 309, the hairstyle editing device 200 renders the hair in the target hairstyle template based on the head movement posture of the target person and the second hair movement style, thus obtaining a second hair movement video. Compared with the first hair movement video, the hair in the target hairstyle template in the second hair movement video will reflect the second hair movement style.

[0106] In practice, the process by which the hair editing device 200 obtains the second hair motion video can be referred to the process of "obtaining the first hair motion video" described in step 304, so it will not be described in detail here.

[0107] Step 310: The hair editing device 200 obtains the second optical flow information based on the second hair motion video.

[0108] In practice, the process by which the hair editing device 200 obtains the second optical flow information can be referred to the process of "obtaining the first optical flow information" described in step 306, so it will not be described in detail here.

[0109] Step 311: The hairstyle editing device 200 edits the hairstyle of the target person in the original video according to the second optical flow information and the target hairstyle template to obtain the target video.

[0110] In practice, the process by which the hairstyle editing device 200 obtains the target video can be referred to in step 307 as “obtaining the target video”, so it will not be described in detail here.

[0111] In step 312, the hairstyle editing device 200 sends the target video to the client 100. Correspondingly, the client 100 receives the target video sent by the hairstyle editing device 200.

[0112] As can be seen from the hairstyle editing process of the target person described in steps 301 to 312 above, for the hairstyle of the target person in the original video, the hairstyle editing device 200 can first render the motion effect of the hair in the new hairstyle of the target person as the target person's head moves, based on the head movement posture of the target person in the original video and the motion style specified by the user for the hair in the new hairstyle of the target person. Then, based on the rendered hair motion effect, the hairstyle of the target person in the original video is edited to obtain the target video. Since the rendered hair motion effect in the above scheme shows a continuous hair movement, the hair movement of the target person in the target video based on the hair motion effect is continuous. In addition, since the rendered hair motion effect not only reflects how the hair in the new hairstyle of the target person moves with the head movement of the target person (here the hair movement is rigid, that is, the hair only moves stiffly with the head movement), but also reflects the flexibility of the hair during the movement, the hair movement of the target person is more realistic.

[0113] The above text combined Figures 1 to 3 This application details the hair styling methods provided, and the following section combines them with... Figure 4 The structure of the hair editing device 200 that performs the above method will be described.

[0114] See Figure 4 , Figure 4 A schematic diagram of a hair-editing device 200 is shown. Figure 4 As shown, the hairstyle editing device 200 includes an acquisition module 201 and a generation module 202. Optionally, the hairstyle editing device 200 also includes a display module 203.

[0115] The acquisition module 201 is used to perform the step of receiving the original video and hairstyle editing request sent by the client 100 in step 301 above, and is also used to perform the step of receiving the second hair movement style sent by the client 100 in step 308 above. The generation module 202 is used to perform steps 302 to 304, and steps 306 to 311 above. The display module 203 is used to perform steps 305 and 312 above.

[0116] It is understood that the specific details of any possible implementation of the relevant steps by each module of the above-mentioned hair editing device 200 can be referred to the relevant content of the foregoing method embodiments, and will not be repeated here.

[0117] In specific implementations, the acquisition module 201, generation module 202, and display module 203 can be implemented in software or hardware. For example, the implementation of the acquisition module 201 will be described below. Similarly, the implementation of the generation module 202 and display module 203 can refer to the implementation of the acquisition module 201.

[0118] As an example of a software functional unit, the acquisition module 201 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, or a container. Further, the aforementioned computing instance may be one or more. For example, the acquisition module 201 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region or in different regions. Further, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one or more geographically proximate data centers. Typically, a region may include multiple AZs.

[0119] Similarly, multiple hosts / virtual machines / containers used to run this code can be distributed within the same Virtual Private Cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Communication between two VPCs within the same region, as well as between VPCs in different regions, requires a communication gateway to be set up within each VPC to enable interconnection between VPCs.

[0120] As an example of a hardware functional unit, the acquisition module 201 may include at least one computing device, such as a server. The acquisition module 201 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The aforementioned PLD can be implemented using a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0121] The multiple computing devices included in the acquisition module 201 can be distributed in the same region or in different regions. Similarly, the multiple computing devices included in the acquisition module 201 can be distributed in the same Availability Zone (AZ) or in different AZs. Likewise, the multiple computing devices included in the acquisition module 201 can be distributed in the same Virtual Private Cloud (VPC) or in multiple VPCs. These multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.

[0122] It should be noted that, in other embodiments, the acquisition module 201 can be used to execute any step in the above-described hairstyle editing method, the generation module 202 can be used to execute any step in the above-described hairstyle editing method, and the display module 203 can be used to execute any step in the above-described hairstyle editing method. The steps implemented by the acquisition module 201, the generation module 202, and the display module 203 can be specified as needed. By implementing different steps in the above-described hairstyle editing method through the acquisition module 201, the generation module 202, and the display module 203, all functions of the hairstyle editing device 200 can be realized.

[0123] This application also provides a computing device. The computing device can be a server, such as a server in a cloud data center, an edge server, or a local server in a local data center, or it can be a terminal device such as a desktop computer, a laptop computer, or a smartphone.

[0124] See Figure 5 , Figure 5 An exemplary schematic diagram of a computing device is shown. For example... Figure 5 As shown, the computing device 300 includes a bus 301, a processor 302, a memory 303, and a communication interface 304, wherein the processor 302, the memory 303, and the communication interface 304 communicate via the bus 301. It should be understood that this application does not limit the number of processors 302 and memory 303 in the computing device 300; that is, the computing device 300 may include one or more processors 302 and one or more memories 303, but for ease of description... Figure 6 Only one processor 302 and one memory 303 are shown. The various parts of the computing device 300 are described in detail below.

[0125] Bus 301 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, Figure 5 The bus 301 is represented by only one line, but this does not mean that the computing device 300 has only one bus or one type of bus. The bus 301 may include a path for transmitting information between various components of the computing device 300 (e.g., processor 302, memory 303, and communication interface 304).

[0126] Processor 302 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0127] Memory 303 may include volatile memory, such as random access memory (RAM). Memory 303 may also include non-volatile memory, such as SSD, flash memory, read-only memory (ROM), or hard disk drive (HDD).

[0128] The memory 303 stores executable code. The processor 302 executes the code stored in the memory 303 to implement the functions of the acquisition module 201, the generation module 202, and the display module 203, respectively, thereby realizing the hairstyle editing method described above. That is to say, the memory 303 stores instructions for executing the hairstyle editing method described above.

[0129] The communication interface 304 uses transceiver modules such as, but not limited to, network interface cards and transceivers to enable communication between the computing device 300 and other devices or communication networks. For example, the computing device 300 can communicate with the client 100 through the communication interface 304 to obtain original video and hairstyle editing requests.

[0130] It should be understood that the computing device 300 provided according to this application can correspond to the hair editing device 200 described above, and the functions of each component in the computing device 300 are respectively for realizing Figure 3 For the sake of brevity, the corresponding processes of each step in the method shown will not be elaborated here.

[0131] This application also provides a computing device cluster. The computing device cluster includes at least one computing device, which may be a server, such as a central server or edge server in a cloud data center, or a local server in a local data center. In some embodiments, the computing device in the computing device cluster may also be a terminal device such as a desktop computer, laptop computer, or smartphone.

[0132] See Figure 6 , Figure 6 An exemplary schematic diagram of a computing device cluster is shown. For example... Figure 6 As shown, the computing device cluster includes at least one computing device 300. The memory 303 of one or more computing devices 300 in the computing device cluster may store the same instructions for performing the above-described hairstyle editing method.

[0133] In some possible implementations, the memory 303 of one or more computing devices 300 in the computing device cluster may also store partial instructions for executing the aforementioned hairstyle editing method. In other words, a combination of one or more computing devices 300 can jointly execute the instructions of the hairstyle editing method described above.

[0134] It should be noted that the memory 303 of different computing devices 300 in the computing device cluster can store different instructions, which are used to execute some functions of the hairstyle editing device 200. That is, the instructions stored in the memory 303 of different computing devices 300 can realize the function of at least one of the acquisition module 201, the generation module 202 and the display module 203.

[0135] In some possible implementations, one or more computing devices 300 in a computing device cluster can be connected via a network, which can be a wide area network or a local area network, etc. Figure 7 One possible implementation is shown. For example... Figure 7 As shown, computing devices 300A and 300B are connected via a network. Specifically, they are connected to the network through communication interfaces in computing devices 300A and 300B. In this implementation, the memory 303 in computing device 300A stores instructions for implementing the functions of the acquisition module 201 and the display module 203, while the memory 303 in computing device 300B stores instructions for implementing the functions of the generation module 202.

[0136] Figure 7 The connection method between computing devices 300 in the computing device cluster shown can be such that, considering the large amount of computation required by the hairstyle editing method provided in this application, the function of the generation module 202 is delegated to the computing device 300B.

[0137] It should be understood that Figure 7 The functions of the computing device 300A shown can also be performed by multiple computing devices 300. Similarly, the functions of the computing device 300B can also be performed by multiple computing devices 300.

[0138] It should also be understood that the computing device cluster provided according to this application can correspond to the hair editing device 200 described above, and the functions of each component in the computing device cluster are respectively for realizing Figure 3 For the sake of brevity, the corresponding processes of each step in the method shown will not be elaborated here.

[0139] This application also provides a computer program product containing instructions. The computer program product may be a software or program product containing instructions that can run on a computing device or be stored on any available medium. When the computer program product is run on a computing device, it causes the computing device to perform the hairstyle editing method described above.

[0140] This application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium capable of being stored by a computing device, or a data storage device such as a data center containing one or more available media. The aforementioned available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives), etc. The computer-readable storage medium includes instructions that instruct the computing device to perform the hairstyle editing method described above.

[0141] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of this application.

Claims

1. A haircut editing method, applied to a haircut editing device, characterized in that, The method includes: Receive a hairstyle editing request, which is used to instruct the hairstyle of the target person in the original video to be edited. The hairstyle editing request includes a new hairstyle specified by the user for the target person and the corresponding first hair movement style. Based on the new hairstyle and the first hair movement style, the hairstyle of the target person in the original video is edited to obtain a first target video. The hairstyle of the target person in the first target video is the new hairstyle, and the hair of the target person moves according to the first hair movement style.

2. The method according to claim 1, characterized in that, The step of editing the hairstyle of the target person in the original video based on the new hairstyle and the first hair movement style to obtain the first target video includes: Extract the head movement posture of the target person from the original video; Based on the new hairstyle, the first hair movement style, and the head movement posture of the target person, the first hair movement information is determined. The first hair movement information is used to characterize the movement of the hair in the new hairstyle, wherein the hair in the new hairstyle moves according to the movement pattern defined by the head movement of the target person and the first hair movement style. Based on the new hairstyle and the first hair movement information, the hairstyle of the target person in the original video is edited to obtain the first target video.

3. The method according to claim 2, characterized in that, The hairstyle editing request includes a description of the new hairstyle; The step of determining the first hair movement information based on the new hairstyle, the first hair movement style, and the head movement posture of the target person includes: Based on the matching relationship between the description information of the new hairstyle and the hairstyle templates in the hairstyle library, a target hairstyle template is determined, wherein the target hairstyle template is a hairstyle template that matches the description information of the new hairstyle; Based on the first hair movement style and the head movement posture of the target person, the hair in the target hairstyle template is rendered to obtain a first hair movement video, which is used to show the movement of the hair in the new hairstyle. The first hair motion information is determined based on the optical flow between adjacent video frames in the first hair motion video.

4. The method according to claim 3, characterized in that, The target hairstyle template is a three-dimensional model, and the first hair motion information is used to characterize the three-dimensional motion of the hair in the new hairstyle.

5. The method according to claim 4, characterized in that, Before determining the first hair motion information based on the optical flow between adjacent video frames in the first hair motion video, the method further includes: The first hair movement video is displayed so that the user can determine whether the first hair movement style meets the requirements.

6. The method according to claim 5, characterized in that, The method further includes: When the first hair movement style does not meet the requirements, the hairstyle of the target person in the original video is edited according to the new hairstyle and the second hair movement style to obtain a second target video. The hairstyle of the target person in the second target video is the new hairstyle, and the hair of the target person moves according to the second hair movement style.

7. A hair editing device, characterized in that, The device includes: The acquisition module is used to receive a hairstyle editing request, which is used to instruct the hairstyle of the target person in the original video to be edited. The hairstyle editing request includes a new hairstyle specified by the user for the target person and the corresponding first hair movement style. The generation module is used to edit the hairstyle of the target person in the original video according to the new hairstyle and the first hair movement style to obtain a first target video, wherein the hairstyle of the target person in the first target video is the new hairstyle, and the hair of the target person moves according to the first hair movement style.

8. The apparatus according to claim 7, characterized in that, The generation module is used to extract the head movement posture of the target person from the original video; determine the first hair movement information based on the new hairstyle, the first hair movement style, and the head movement posture of the target person, wherein the first hair movement information is used to characterize the movement of the hair in the new hairstyle, wherein the hair in the new hairstyle moves according to the movement form defined by the head movement of the target person and the first hair movement style; and edit the hairstyle of the target person in the original video based on the new hairstyle and the first hair movement information to obtain the first target video.

9. The apparatus according to claim 8, characterized in that, The hairstyle editing request includes a description of the new hairstyle; The generation module is used to determine a target hairstyle template based on the matching relationship between the description information of the new hairstyle and the hairstyle templates in the hairstyle library, wherein the target hairstyle template is a hairstyle template that matches the description information of the new hairstyle; to render the hair in the target hairstyle template according to the first hair movement style and the head movement posture of the target person to obtain a first hair movement video, which is used to display the movement of the hair in the new hairstyle; and to determine the first hair movement information based on the optical flow between adjacent video frames in the first hair movement video.

10. The method according to claim 9, characterized in that, The target hairstyle template is a three-dimensional model, and the first hair motion information is used to characterize the three-dimensional motion of the hair in the new hairstyle.

11. The apparatus according to claim 10, characterized in that, The device further includes: The display module is used to display the first hair movement video so that the user can determine whether the first hair movement style meets the requirements.

12. The apparatus according to claim 11, characterized in that, The generation module is used to edit the hairstyle of the target person in the original video according to the new hairstyle and the second hair movement style when the first hair movement style does not meet the requirements, so as to obtain a second target video. The hairstyle of the target person in the second target video is the new hairstyle, and the hair of the target person moves according to the second hair movement style.

13. A computing device cluster, characterized in that, It includes at least one computing device, each computing device including a processor and memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device to cause the cluster of computing devices to perform the method as described in any one of claims 1 to 6.

14. A computer-readable storage medium, characterized in that, It includes computer program instructions, which, when executed by a computing device, cause the computing device to perform the method as described in any one of claims 1 to 6.

15. A computer program product containing instructions, characterized in that, When the instruction is executed by the computing device cluster, the computing device cluster causes the computing device cluster to perform the method as described in any one of claims 1 to 6.