Object contour tracking method, active contour line model training method, equipment, medium and product
By training the active contour line model in a specific environment, the problem of inaccurate object contour tracking in complex scenes using the optical flow method is solved, and higher-precision object contour tracking is achieved.
Patent Information
- Application Number
- CN202510892005.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2025-10-14
AI Technical Summary
In complex scenes, the existing optical flow method has difficulty in accurately tracking the outline of objects, especially under the influence of factors such as lighting, occlusion or non-rigid motion, and cannot accurately capture the movement trajectory of objects.
By training the active contour line model in a specific environment, the pre-trained active contour line model is used to process the video frame to obtain the initial contour data, which is then input into the active contour line model and the resulting contour data is superimposed to generate dynamic tracking contour data.
Improves the accuracy of object contour tracking, especially in specific environments, it can more accurately track the dynamic contour changes of objects.
Smart Images

Figure CN120783260A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to an object contour tracking method, an active contour model training method, equipment, medium and product. Background Art
[0002] Tracking object contours in continuous videos through automatic object contour recognition technology can be used in the surveillance camera systems of financial institutions such as banks. By tracking the contours of people or objects in real time and detecting abnormal human behavior, the efficiency of security response can be improved.
[0003] Currently, in related technologies, the contour of an object in a continuous video is tracked by generally calculating the displacement of pixels of the object between consecutive video frames using an optical flow method.
[0004] However, the optical flow method is easily affected by factors such as lighting, occlusion or non-rigid motion in complex scenes, or it cannot accurately capture the motion trajectory of objects in scenes where objects move drastically or change rapidly. As a result, current related technologies are unable to accurately track the contours of objects in some specific scenarios. Summary of the Invention
[0005] The present application provides an object contour tracking method, an active contour line model training method, a device, a medium and a product, so as to improve the accuracy of tracking the object contour.
[0006] In a first aspect, the present application provides an object contour tracking method, applied to a server, comprising:
[0007] Obtain the video to be processed corresponding to the object to be tracked in the preset scene;
[0008] Cutting the video to be processed to obtain a corresponding plurality of video frames;
[0009] Determining initial contour data of the object to be tracked in the first video frame;
[0010] Inputting the initial contour data into a pre-trained active contour line model corresponding to the preset scene, so that the active contour line model outputs result contour data corresponding to the first video frame;
[0011] For the second video frame and each subsequent video frame, inputting the result contour data corresponding to the previous video frame into the pre-trained active contour line model, so that the active contour line model outputs the result contour data corresponding to the video frame;
[0012] The result contour data corresponding to all video frames are superimposed to obtain the dynamic tracking contour data corresponding to the object to be tracked in the preset scene.
[0013] In a second aspect, the present application provides a training method for an active contour model, comprising:
[0014] Determine the type of preset scene;
[0015] Acquire training data corresponding to the type of the preset scene, wherein the training data includes training contour data corresponding to at least one video frame, wherein the training contour data includes training position data corresponding to a plurality of control points;
[0016] Create an initial model;
[0017] generating a parameter group set, wherein the parameter group set includes at least one parameter group instance;
[0018] Determining the fitness of the training position data corresponding to the plurality of control points and each parameter group instance;
[0019] Based on the fitness of each parameter group instance, determine the target parameter group instance that meets the preset conditions;
[0020] The target parameter set instance is applied to the initial model to obtain the active contour model as described above.
[0021] In a third aspect, the present application provides an object contour tracking device, applied to a server, comprising:
[0022] An acquisition module is used to obtain the corresponding video to be processed of the object to be tracked in a preset scene;
[0023] A processing module, configured to cut the video to be processed to obtain a corresponding plurality of video frames;
[0024] The processing module is further configured to determine initial contour data of the object to be tracked in the first video frame;
[0025] The processing module is further configured to input the initial contour data into a pre-trained active contour model corresponding to the preset scene, so that the active contour model outputs result contour data corresponding to the first video frame;
[0026] The processing module is further configured to input the result contour data corresponding to the previous video frame into the pre-trained active contour line model for the second video frame and each subsequent video frame, so that the active contour line model outputs the result contour data corresponding to the video frame;
[0027] The processing module is further configured to superimpose the result contour data corresponding to all video frames to obtain the dynamic tracking contour data corresponding to the object to be tracked in the preset scene.
[0028] In a fourth aspect, the present application provides a training device for an active contour model, comprising:
[0029] A determination module, used to determine the type of the preset scene;
[0030] an acquisition module, configured to acquire training data corresponding to the type of the preset scene, wherein the training data includes training contour data corresponding to at least one video frame, wherein the training contour data includes training position data corresponding to a plurality of control points;
[0031] Processing module, used to create the initial model;
[0032] The processing module is further configured to generate a parameter group set, wherein the parameter group set includes at least one parameter group instance;
[0033] The determination module is further configured to determine the fitness of the training position data corresponding to the plurality of control points and each parameter group instance;
[0034] The processing module is further configured to determine a target parameter group instance that meets a preset condition based on the fitness of each parameter group instance;
[0035] The processing module is further configured to apply the target parameter group instance to the initial model to obtain the active contour model as described above.
[0036] In a fifth aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;
[0037] The memory stores computer-executable instructions;
[0038] The processor executes the computer-executable instructions stored in the memory to implement the object contour tracking method as described in the first aspect or the active contour model training method as described in the second aspect.
[0039] In a sixth aspect, the present application provides a computer-readable storage medium, characterized in that the computer-readable storage medium stores computer execution instructions, which, when executed by a processor, are used to implement the object contour tracking method described in the first aspect or the active contour model training method described in the second aspect.
[0040] In the seventh aspect, the present application provides a computer program product, characterized in that it includes a computer program, which, when executed by a processor, implements the object contour tracking method as described in the first aspect or the active contour line model training method as described in the second aspect.
[0041] The object contour tracking method, active contour line model training method, equipment, medium and product provided in this application can obtain more accurate dynamic tracking contour data of the object in a specific environment by training the active contour line model in a specific environment and using the trained active contour line model, thereby improving the accuracy of tracking the object contour. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0043] Figure 1 This is a schematic diagram of an application scenario for this application example;
[0044] Figure 2 Schematic diagram of the process of the object contour tracking method provided in the embodiment of the present application Figure 1 ;
[0045] Figure 3 is the first video frame of the example;
[0046] Figure 4 Schematic diagram of the process of the object contour tracking method provided in the embodiment of the present application Figure 2 ;
[0047] Figure 5 Schematic diagram of the process of training the active contour model provided in the embodiment of the present application Figure 1 ;
[0048] Figure 6 Schematic diagram of the process of training the active contour model provided in the embodiment of the present application Figure 2 ;
[0049] Figure 7 Schematic diagram of the process of training the active contour model provided in the embodiment of the present application Figure 3 ;
[0050] Figure 8 This is the training flow chart of the initial model for the example;
[0051] Figure 9 A schematic diagram of the structure of an object contour tracking device provided in an embodiment of the present application;
[0052] Figure 10 A schematic diagram of the structure of a training device for an active contour model provided in an embodiment of the present application;
[0053] Figure 11 This is a schematic diagram of the structure of the electronic device provided in this application.
[0054] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION
[0055] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
[0056] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data comply with the relevant laws, regulations and standards of the relevant regions, take necessary confidentiality measures, do not violate public order and good customs, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0057] In addition, this application involves big data analysis of user information (including but not limited to personal biometrics, identity data, consumption data, asset data, electronic terminal operation data, etc.), and the use of artificial intelligence technology for automated decision-making, and a technical solution for making decisions that have a significant impact on personal rights and interests based on the results of automated decision-making. The application provides users with corresponding operation entrances for users to choose to agree or reject the results of automated decision-making; if the user chooses to reject, the expert decision-making process will be entered.
[0058] It should be noted that the object contour tracking method, active contour line model training method, equipment, medium and products provided in this application can be used in the field of artificial intelligence technology, and can also be used in any field other than the field of artificial intelligence technology. This application does not limit the application fields of the object contour tracking method, active contour line model training method, equipment, medium and products.
[0059] Figure 1 This is a schematic diagram of the application scenario of this application example, such as Figure 1As shown, the application scenario of this application is that the server obtains and analyzes the video of the object to be tracked, determines the dynamic tracking contour data of the object to be tracked, and realizes the tracking of the contour of the object to be tracked. For financial institutions such as banks, real-time tracking of the contours of people or objects can be used to detect abnormal behavior to improve the efficiency of security response. For example, object contour tracking can be used to analyze the behavioral patterns of relevant personnel, understand the movement paths and residence time of relevant personnel in the bank hall, and help banks and other financial institutions optimize branch layouts and service processes.
[0060] At present, the optical flow method used in related technologies to track the contours of objects is easily affected by factors such as lighting, occlusion or non-rigid motion in complex scenes, or in scenes where the objects move drastically or change rapidly, resulting in the inability to accurately capture the movement trajectory of the objects.
[0061] The object contour tracking method, active contour model training method, equipment, medium and product provided in this application are intended to solve the above technical problems of the prior art.
[0062] The following specific embodiments describe in detail the technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0063] Figure 2 Schematic diagram of the process of the object contour tracking method provided in the embodiment of the present application Figure 1 , applied to the server, such as Figure 2 Shown, including:
[0064] S201: Obtain a video to be processed corresponding to the object to be tracked in a preset scene.
[0065] In conjunction with the scenario example, the execution entity of the embodiment of the present application can be a server with computing capabilities. The preset scene can be determined based on actual conditions, such as a black and white scene, a complex road scene, or a night scene. If the preset scene is a black and white scene, the black and white video corresponding to the object to be tracked in the black and white scene is determined as the video to be processed.
[0066] S202: Cut the video to be processed to obtain a corresponding plurality of video frames.
[0067] In combination with the scenario example, the video to be processed is composed of multiple video frames, and video frame extraction is performed on the video to be processed to segment the video to be processed into multiple video frames.
[0068] S203: Determine initial contour data of the object to be tracked in the first video frame.
[0069] In combination with the scene example, the multiple video frames obtained above are sorted according to the order of corresponding moments, and the earliest video frame at the corresponding moment is determined as the first video frame. Figure 3 is the first video frame of the example, such as Figure 3 As shown, in the first video frame, there are multiple different types of objects, one of which can be determined as the object to be tracked, such as Figure 3 The sofa in the example is determined as the object to be tracked. The initial contour data of the object to be tracked can be manually annotated around the object to be tracked. By obtaining the manually annotated data, the initial contour data of the sofa in the first video frame can be determined.
[0070] S204: Input the initial contour data into a pre-trained active contour model corresponding to the preset scene, so that the active contour model outputs result contour data corresponding to the first video frame.
[0071] In conjunction with the scene example, the pre-trained active contour model corresponding to the preset scene is an active contour model suitable for the preset scene. For example, the preset scene selected in this example is a black and white scene, and the obtained video frame is also a black and white video frame. Therefore, the active contour model can select an active contour model suitable for black and white scenes. That is, the initial contour data obtained above is input into the active contour model suitable for black and white scenes, so that the active contour model outputs the result contour data corresponding to the first video frame based on the initial contour data.
[0072] S205 . For the second video frame and each subsequent video frame, input the result contour data corresponding to the previous video frame into the pre-trained active contour line model, so that the active contour line model outputs the result contour data corresponding to the video frame.
[0073] In this scenario example, the resulting contour data corresponding to the first video frame is used as the input data corresponding to the second video frame and is input into the active contour model, causing the active contour model to output the resulting contour data corresponding to the second video frame. Similarly, the resulting contour data corresponding to the second video frame is used as the input data corresponding to the third video frame and is input into the active contour model, causing the active contour model to output the resulting contour data corresponding to the third video frame. This process is repeated in this way to obtain the resulting contour data corresponding to each video frame.
[0074] S206 : Superimposing the result contour data corresponding to all video frames to obtain dynamic tracking contour data corresponding to the object to be tracked in the preset scene.
[0075] Combined with the scene example, all video frames are merged to obtain a dynamic video in a black and white scene. Since each video frame includes the corresponding result contour data, the result contour data corresponding to each video frame will be superimposed as the video frames are merged. Finally, the dynamic tracking contour data of the object to be tracked in the dynamic video in the black and white scene is obtained. The dynamic tracking contour data can reflect the contour changes of the object to be tracked, thereby realizing the contour tracking of the object to be tracked.
[0076] Based on the method provided in this example, by training an active contour line model in a specific environment and using the trained active contour line model, more accurate dynamic tracking contour data of the object in the specific environment can be obtained, thereby improving the accuracy of tracking the object contour.
[0077] Optional, Figure 4 Schematic diagram of the process of the object contour tracking method provided in the embodiment of the present application Figure 2 ,like Figure 4 As shown, S203 includes:
[0078] S401: Determine an initial contour curve in the first video frame.
[0079] Combined with the scene example, combined with Figure 3 The initial contour data of the object to be tracked can be manually marked on the edge of the object to be tracked. By obtaining the manually marked data, the initial contour curve of the object to be tracked in the first video frame can be determined.
[0080] S402: Determine the initial position data of each control point on the initial contour curve.
[0081] Combined with the scene example, the initial contour curve of the object to be tracked is composed of multiple control points, and the initial position data of the control points can be coordinate data. For example, the initial position data of the control point s is: V(s) = (x(s), y(s)), where X(s) is the horizontal coordinate of the control point s, and Y(s) is the vertical coordinate of the control point s.
[0082] S403: Determine the initial position data of each control point as the initial contour data.
[0083] Combined with the scene example, the initial position data of each control point on the initial contour is integrated to obtain the initial contour data of the object to be tracked.
[0084] The calculation method used by the active contour model is obtained from the energy function formula of the following curve:
[0085] Esnake=∫(α*V s (s) 2 +β*V ss (s)2 + wl*Eline + we*Eedge + wt*Eterm) ds
[0086] wherein Esnake represents the energy of the contour curve, a represents the elastic potential energy, b represents the bending potential energy, wl represents the line function, we represents the edge function, wt represents the end point function, V s (s) represents the first derivative of the contour curve, V ss (s) represents the second derivative of the contour curve, Eline represents the intensity energy of the contour curve, used to attract the contour curve to a specific gray area in the image, Eedge represents the edge energy of the contour curve, used to attract the contour line to the edge of the image position and the position with the maximum gray gradient amplitude, and Eterm represents the corner and end point energy of the contour curve, used to attract the contour line to the inflection point or the end point of the line based on the curvature of the gradient direction. By solving the local minimum of the equation Esnake, the position data corresponding to each control point in the obtained control point set is determined as the output result contour data.
[0087] Based on the method provided in the example, the position data of each control point on the contour curve can be used to determine the contour data of the object to be tracked, and by solving the control point set based on the active contour model, the result contour data can be more accurate.
[0088] Optionally, Figure 5 The flowchart of the training method of the active contour model provided in the embodiment of the present application is shown in Figure 1 As shown in Figure 5 , it includes:
[0089] 501, determine the type of a preset scene.
[0090] In combination with the scene example, the scene can be a black and white scene, a complex road scene, or a night scene, etc. The preset scene can be determined according to the actual situation, for example, the black and white scene can be determined as the preset scene, and the type of the preset scene is the black and white type.
[0091] 502, obtain training data corresponding to the type of the preset scene, wherein the training data includes training contour data corresponding to at least one video frame, and the training contour data includes training position data corresponding to a plurality of control points.
[0092] With the scene example, when the preset scene is of a black-and-white type, a video of the black-and-white type is selected, and the selected video is preprocessed, such as denoising and image enhancement, and the preprocessed data is determined as the training data in the black-and-white scene. The training video is composed of a plurality of video frames, and each video frame includes contour data of a to-be-tracked object manually labeled. The contour data of the to-be-tracked object manually labeled on the video frame is determined as training contour data. The contour data of the to-be-tracked object is composed of a plurality of control points, and therefore the training contour data includes training position data corresponding to each control point.
[0093] 503, create an initial model.
[0094] With the scene example, the model parameters in the initial model are randomly generated, and the type of the initial model can be a learning model.
[0095] 504, generate a parameter group set, wherein the parameter group set includes at least one parameter group instance.
[0096] With the scene example, the parameter group set includes one or more parameter group instances, and each parameter group instance includes parameters such as elastic potential energy α, bending potential energy β, linear function wl, edge function we, and end point function wt. In different parameter group instances, the parameter values of the respective parameters are different.
[0097] 505, determine the fitness of the training position data of the plurality of control points corresponding to each parameter group instance.
[0098] With the scene example, the fitness of the training position data of the plurality of control points in the training contour data to each parameter group instance can be solved by a preset fitness formula.
[0099] 506, determine a target parameter group instance that meets a preset condition based on the fitness of each parameter group instance.
[0100] With the scene example, the preset condition can be a parameter group instance with the highest fitness, and therefore the parameter group instance with the highest fitness can be determined as the target parameter group instance.
[0101] 507, apply the target parameter group instance to the initial model to obtain the active contour line model as described above.
[0102] With the scene example, after obtaining the target parameter group instance, the parameter values of the respective parameters included in the target parameter group instance are applied to the initial model to obtain a trained active contour line model applicable to the black-and-white scene. In this way, an active contour line model applicable to various specific scenes can be trained.
[0103] Based on the method provided in the example, the model can be trained by the training data corresponding to the specific scene, so that the active contour model obtained by training can be applicable to the specific scene, thereby improving the accuracy of the active contour model in tracking the contour of the object in the specific scene.
[0104] Optionally, Figure 6 The flowchart of the training method of the active contour model provided in the embodiment of the application is shown in Figure 2 As Figure 6 As shown in S505, S505 includes:
[0105] S601, each parameter group instance is applied to the initial model to obtain an instance model corresponding to each parameter group instance.
[0106] In the scene example, the parameter values of the parameters in the initial model are randomly generated, and the specific parameter values in each parameter group instance are applied to the parameters in the initial model to obtain an instance model corresponding to each parameter group instance.
[0107] S602, the training position data corresponding to the plurality of control points is sequentially input into the instance model corresponding to each parameter group instance, so that the instance model corresponding to each parameter group instance outputs a corresponding result point set, wherein the result point set includes result position data corresponding to the plurality of control points.
[0108] In the scene example, the result position data corresponding to each control point is calculated by the instance model corresponding to each parameter group instance, and the result position data corresponding to each control point is collected to obtain a corresponding result point set. The result point set can constitute the result contour data corresponding to the training contour data. In this way, the result point set corresponding to each video frame can be obtained.
[0109] S603, the training position data corresponding to the plurality of control points is determined by a preset fitness formula and the result position data corresponding to the plurality of control points, and the fitness of each parameter group instance is determined.
[0110] In the scene example, the fitness between the result position data and the training position data corresponding to the plurality of control points is calculated by the preset fitness formula. Since the determination of the result position data depends on the actual values of the parameters included in each parameter group instance, the fitness between the result position data and the training position data corresponding to the plurality of control points, i.e. the fitness of the training position data corresponding to the plurality of control points, is determined for each parameter group instance.
[0111] Based on the method provided in the example, the fitness between the training position data and the result position data corresponding to the plurality of control points is calculated by the fitness formula, which can improve the accuracy of the obtained fitness.
[0112] Optionally, the fitness formula is:
[0113]
[0114] Wherein, fit i is the fitness size of the training position data of the control points under the parameter group instance i, B ik is the result position data of the control point k in the result point set corresponding to the parameter group instance i, A j is the training position data of the control point j, and d is the distance.
[0115] In combination with a scene example, the training position data of the control points can be the coordinates of the control points, d(A j ,B ik ) represents the distance between the training position data of the control point j and the result position data of the control point k in the parameter group instance i, and min[d(A j ,B ik )] represents the minimum distance between the training position data of the control point j and the result position data of each control point in the parameter group instance i. In this way, the minimum distances between the training position data of the control points and the result position data of each control point in the parameter group instance i are solved, and the sum of all the minimum distances is obtained. Then, the ratio between a preset constant, such as 100000, and the sum is determined as the fitness corresponding to the parameter group instance i.
[0116] Based on the fitness formula provided in the example, the fitness corresponding to each parameter group instance can be accurately obtained.
[0117] Optionally, Figure 7 is the flowchart of the training method of the active contour model provided in the embodiments of the present application Figure 3 As shown in FIG. 5, the generation of the parameter group set in S504 includes: Figure 7
[0118] S701, if it is the first training of the initial model, at least one initial parameter group instance is randomly generated, and the initial parameter group instance is determined as the parameter group set.
[0119] In combination with a scene example, if the initial model has not been trained before, i.e., it is the first training, one or more initial parameter group instances are randomly generated. The specific parameter values of each parameter in the randomly generated initial parameter group instance can also be randomly generated. The initial parameter group instances generated at this time are collected to obtain the parameter group set.
[0120] S702, if the initial model is iteratively trained, determine the historical parameter group instance, and perform a preset operation on the historical parameter group instance to generate a new parameter group instance, and determine the new parameter group instance as the parameter group set.
[0121] In combination with a scene example, if the initial model needs to be iteratively trained, it is illustrated that the number of initial parameter group instances obtained before is not enough, all the parameter group instances obtained before are determined as historical parameter group instances, and the historical parameter group instances can be cross-operated, mutated, etc. on the basis of the historical parameter group instances generated before to generate new parameter group instances. The cross-operation is to randomly adjust and combine each parameter of the parameter group instance to generate a new parameter group instance. The mutation operation is to randomly float adjust the parameter values of each parameter of the parameter group instance, such as randomly increasing and decreasing within a range of 5% to generate a new parameter group instance.
[0122] Based on the method provided in the example, parameter group instances can be randomly and infinitely generated to provide rich training data, and the active contour model finally trained can be more accurate.
[0123] Optionally, if the number of iterations of the iterative training of the initial model reaches a preset number, the training of the initial model is ended.
[0124] In combination with a scene example, Figure 8 For the training flowchart of the example initial model, as shown in Figure 8 the initial model is initially trained by randomly generating an initial parameter group instance. A parameter group instance can be applied to the initial model, and the process of calculating the fitness corresponding to the parameter group instance is determined as one iteration of the initial model. The preset number can be determined according to actual conditions, the number of iterations of the numerical model is recorded, and when the number of iterations of the numerical model reaches the preset number, the training of the initial model is ended, the target parameter group instance with the highest fitness is selected from all parameter group instances, and the parameter values of each parameter in the target parameter group instance are finally determined as the parameter values of the initial model, so that the active contour model is obtained. When the number of iterations of the numerical model does not reach the preset number, the parameter group instance used for the preset operation is selected from the historical parameter group instance, and the cross-operation, mutation operation, etc. are performed on the selected parameter group instance to update the parameter group instance.
[0125] Based on the method provided in the example, the training of the model can be ended based on the preset number, so as to avoid waste of resources.
[0126] The embodiments provided in this application can obtain more accurate dynamic tracking contour data of an object in a specific environment by training an active contour line model in a specific environment and using the trained active contour line model, thereby improving the accuracy of tracking the object contour.
[0127] Figure 9 The schematic diagram of the structure of the object contour tracking device provided in the embodiment of the present application is applied to a server, such as Figure 9 Shown, including:
[0128] An acquisition module 91 is used to acquire a video to be processed corresponding to the object to be tracked in a preset scene;
[0129] The processing module 92 is used to cut the video to be processed to obtain a plurality of corresponding video frames;
[0130] The processing module 92 is further configured to determine initial contour data of the object to be tracked in the first video frame;
[0131] The processing module 92 is further configured to input the initial contour data into a pre-trained active contour model corresponding to the preset scene, so that the active contour model outputs result contour data corresponding to the first video frame;
[0132] The processing module 92 is further configured to input the result contour data corresponding to the previous video frame into the pre-trained active contour line model for the second video frame and each subsequent video frame, so that the active contour line model outputs the result contour data corresponding to the video frame;
[0133] The processing module 92 is further configured to superimpose the result contour data corresponding to all video frames to obtain the dynamic tracking contour data corresponding to the object to be tracked in the preset scene.
[0134] Optionally, the processing module 92 is specifically configured to determine an initial contour curve in the first video frame;
[0135] The processing module 92 is further configured to determine initial position data of each control point on the initial contour curve;
[0136] The processing module 92 is further configured to determine the initial position data of each control point as the initial contour data.
[0137] The object contour tracking device provided in this embodiment can execute the method provided in the above-mentioned object contour tracking method embodiment. Its implementation principle and technical effects are similar and will not be described in detail in this embodiment.
[0138] Figure 10A structural diagram of the active contour model training device provided in an embodiment of the present application is shown in FIG. Figure 10 As shown,
[0139] Determination module 101, used to determine the type of preset scene;
[0140] An acquisition module 102 is configured to acquire training data corresponding to the type of the preset scene, wherein the training data includes training contour data corresponding to at least one video frame, wherein the training contour data includes training position data corresponding to a plurality of control points;
[0141] Processing module 103, used to create an initial model;
[0142] The processing module 103 is further configured to generate a parameter group set, wherein the parameter group set includes at least one parameter group instance;
[0143] The determination module 103 is further configured to determine the fitness of the training position data corresponding to the plurality of control points and each parameter group instance;
[0144] The processing module 103 is further configured to determine a target parameter group instance that meets a preset condition based on the fitness of each parameter group instance;
[0145] The processing module 103 is further configured to apply the target parameter group instance to the initial model to obtain the active contour model as described above.
[0146] Optionally, the determination module 101 is specifically configured to pre-apply each parameter group instance to the initial model to obtain an instance model corresponding to each parameter group instance;
[0147] The determination module 101 is further configured to sequentially input the training position data corresponding to the plurality of control points into the instance model corresponding to each parameter group instance, so that the instance model corresponding to each parameter group instance outputs a corresponding result point set, wherein the result point set includes the result position data corresponding to the plurality of control points;
[0148] The determination module 101 is further configured to determine the fitness of the training position data corresponding to the plurality of control points and each parameter group instance respectively through a preset fitness formula and the result position data corresponding to the plurality of control points.
[0149] Optionally, the processing module 103 is specifically configured to randomly generate at least one initial parameter group instance if it is the first training of the initial model, and determine the initial parameter group instance as the parameter group set;
[0150] The processing module 103 is further specifically used to determine a historical parameter group instance if it is iterative training of the initial model, and perform a preset operation on the historical parameter group instance to generate a new parameter group instance, and determine the new parameter group instance as the parameter group set.
[0151] Optionally, the processing module 103 is further configured to terminate the training of the initial model if the number of iterative training of the initial model reaches a preset number.
[0152] The training device for the active contour model provided in this embodiment can execute the method provided in the above-mentioned training method embodiment for the active contour model. The implementation principle and technical effects thereof are similar and will not be described in detail in this embodiment.
[0153] Figure 11 This is a schematic diagram of the structure of the electronic device provided in this application. Figure 11 As shown, the electronic device 50 provided in this embodiment includes: at least one processor 501 and a memory 502. Optionally, the electronic device 50 further includes a communication component 503. The processor 501, the memory 502 and the communication component 503 are connected via a bus.
[0154] In a specific implementation process, at least one processor 501 executes the computer-executable instructions stored in the memory 502, so that the at least one processor 501 performs the above method.
[0155] The specific implementation process of the processor 501 can be found in the above method embodiment. Its implementation principle and technical effects are similar and will not be repeated here in this embodiment.
[0156] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the present invention may be directly implemented by a hardware processor or implemented by a combination of hardware and software modules in the processor.
[0157] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (NVM), such as at least one disk memory.
[0158] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be classified into address buses, data buses, and control buses. For ease of illustration, the buses in the drawings of this application are not limited to just one bus or just one type of bus.
[0159] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.
[0160] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.
[0161] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile memory device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0162] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be an integral part of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0163] The division of units is merely a logical functional division; actual implementations may employ alternative divisions, such as combining or integrating multiple units or components into another system, or omitting or disabling certain features. Furthermore, any direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between devices or units, either through an interface, electrical, mechanical, or other means.
[0164] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0165] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0166] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program code.
[0167] Those skilled in the art will appreciate that all or part of the steps in the above-described method embodiments can be implemented using hardware associated with program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0168] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all optional embodiments, and the actions and modules involved are not necessarily required by this application.
[0169] It should be understood that the above device embodiments are merely illustrative, and the device of the present application may also be implemented in other ways. For example, the division of units / modules in the above embodiments is merely a logical function division, and other division methods may be used in actual implementation.
[0170] In the above embodiments, the description of each embodiment has its own emphasis. For parts not described in detail in a particular embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined in any way. To keep the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0171] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present application that follow the general principles of the present application and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0172] It should be understood that the present application is not limited to the exact structure described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A method for tracking an object contour, characterized in that: Applicable to servers, including: Obtain the video to be processed corresponding to the object to be tracked in the preset scene; Cutting the video to be processed to obtain a corresponding plurality of video frames; Determining initial contour data of the object to be tracked in the first video frame; Inputting the initial contour data into a pre-trained active contour line model corresponding to the preset scene, so that the active contour line model outputs result contour data corresponding to the first video frame; For the second video frame and each subsequent video frame, inputting the result contour data corresponding to the previous video frame into the pre-trained active contour line model, so that the active contour line model outputs the result contour data corresponding to the video frame; The result contour data corresponding to all video frames are superimposed to obtain the dynamic tracking contour data corresponding to the object to be tracked in the preset scene.
2. The method according to claim 1, characterized in that The determining of initial contour data of the object to be tracked in the first video frame includes: determining an initial contour curve in the first video frame; Determining initial position data of each control point on the initial contour curve; The initial position data of each control point is determined as the initial contour data.
3. A training method for an active contour model, characterized in that: include: Determine the type of preset scene; Acquire training data corresponding to the type of the preset scene, wherein the training data includes training contour data corresponding to at least one video frame, wherein the training contour data includes training position data corresponding to a plurality of control points; Create an initial model; generating a parameter group set, wherein the parameter group set includes at least one parameter group instance; Determining the fitness of the training position data corresponding to the plurality of control points and each parameter group instance; Based on the fitness of each parameter group instance, determine the target parameter group instance that meets the preset conditions; The target parameter group instance is applied to the initial model to obtain the active contour model according to claim 1 or 2.
4. The method according to claim 3, characterized in that Determining the training position data corresponding to the plurality of control points and the fitness of each parameter group instance includes: Applying each parameter group instance to the initial model in advance to obtain an instance model corresponding to each parameter group instance; Inputting the training position data corresponding to the multiple control points into the instance model corresponding to each parameter group instance in sequence, so that the instance model corresponding to each parameter group instance outputs a corresponding result point set, wherein the result point set includes the result position data corresponding to the multiple control points; The fitness of the training position data corresponding to the multiple control points and each parameter group instance is determined by a preset fitness formula and the result position data corresponding to the multiple control points.
5. The method according to claim 4, characterized in that The fitness formula is: Among them, fit i is the fitness of the training position data corresponding to multiple control points under the parameter group instance i, B ik is the result position data corresponding to the control point k in the result point set corresponding to the parameter group instance i, A j is the training position data corresponding to the control point j, and d is the distance.
6. The method according to claim 3, characterized in that The generation parameter group set includes: If it is the first training of the initial model, randomly generating at least one initial parameter group instance, and determining the initial parameter group instance as the parameter group set; If it is iterative training of the initial model, a historical parameter group instance is determined, and a preset operation is performed on the historical parameter group instance to generate a new parameter group instance, and the new parameter group instance is determined as the parameter group set.
7. The method according to claim 6, characterized in that Also includes: If the number of iterative training of the initial model reaches a preset number, the training of the initial model is terminated.
8. An object contour tracking device, characterized in that: Applicable to servers, including: An acquisition module is used to obtain the corresponding video to be processed of the object to be tracked in a preset scene; A processing module, configured to cut the video to be processed to obtain a corresponding plurality of video frames; The processing module is further configured to determine initial contour data of the object to be tracked in the first video frame; The processing module is further configured to input the initial contour data into a pre-trained active contour model corresponding to the preset scene, so that the active contour model outputs result contour data corresponding to the first video frame; The processing module is further configured to input the result contour data corresponding to the previous video frame into the pre-trained active contour line model for the second video frame and each subsequent video frame, so that the active contour line model outputs the result contour data corresponding to the video frame; The processing module is further configured to superimpose the result contour data corresponding to all video frames to obtain the dynamic tracking contour data corresponding to the object to be tracked in the preset scene.
9. A training device for an active contour model, characterized in that: include: A determination module, used to determine the type of the preset scene; an acquisition module, configured to acquire training data corresponding to the type of the preset scene, wherein the training data includes training contour data corresponding to at least one video frame, wherein the training contour data includes training position data corresponding to a plurality of control points; Processing module, used to create the initial model; The processing module is further configured to generate a parameter group set, wherein the parameter group set includes at least one parameter group instance; The determination module is further configured to determine the fitness of the training position data corresponding to the plurality of control points and each parameter group instance; The processing module is further configured to determine a target parameter group instance that meets a preset condition based on the fitness of each parameter group instance; The processing module is further configured to apply the target parameter group instance to the initial model to obtain the active contour model as claimed in claim 1 or 2.
10. An electronic device, characterized in that: include: a processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the object contour tracking method according to claim 1 or 2 or the active contour model training method according to any one of claims 3 to 7.
11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the object contour tracking method according to claim 1 or 2 or the active contour model training method according to any one of claims 3 to 7.
12. A computer program product, characterized in that The invention comprises a computer program, which, when executed by a processor, implements the object contour tracking method according to claim 1 or 2 or the active contour model training method according to any one of claims 3 to 7.
