Video transfer method, device, equipment and medium
Video frames are extracted through the OpenCV library and combined with artificial intelligence models for pre-processing and post-processing, which solves the problems of discontinuity between frames and insufficient processing capabilities of complex scenes in the existing technology, and achieves efficient and high-quality video rendering effects.
Patent Information
- Application Number
- CN202410998333.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-24
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-07-24
AI Technical Summary
Existing video rendering technology has problems such as discontinuity between frames, limited ability to process complex scenes, and high time and energy consumption, resulting in low quality and low efficiency of the generated paintings or animations.
The video frames are extracted and preprocessed based on the OpenCV library, the pre-trained video rendering model is used for image rendering, the lighting model and the global illumination algorithm are combined for post-processing, the model parameters are optimized through the grid search algorithm, and the temporal convolution network is used and adversarial networks to generate high-quality transcribed images, and continuously optimize the model through user feedback.
It achieves efficient and high-quality video rendering, reduces the difference between frames, improves the processing capabilities of complex scenes, reduces computing resources and time costs, and generates paintings or animations that are more continuous and realistic.
Smart Images

Figure CN118524257B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a video transcoding method, device, equipment and medium. Background Art
[0002] Video transcoding technology refers to the process of converting video content into static paintings or animations using computer vision and image processing technology.
[0003] In the prior art, the video transfer method used mainly has the following problems:
[0004] (1) Inter-frame discontinuity: When processing videos, the generated paintings or animations may have large content differences between adjacent frames, resulting in visual discontinuity and, in turn, flickering.
[0005] (2) Limited ability to process complex scenes: Existing technologies often show limitations in effectively capturing and expressing video content that contains fast motion, complex lighting effects, or large-scale scenes.
[0006] (3) Time-consuming and energy-consuming: The video conversion process requires a lot of computing resources and time, especially for long or high-resolution video content, the time cost is relatively high.
[0007] In view of the above problems, how to efficiently and high-quality video transcoding has become an issue that needs to be solved urgently. Summary of the invention
[0008] In view of the above, it is necessary to provide a video transcoding method, device, equipment and medium that can efficiently and high-quality perform video transcoding.
[0009] A video transfer method, the video transfer method comprising:
[0010] In response to a redraw instruction for a target video, extract each video frame of the target video based on an OpenCV library;
[0011] Preprocess each video frame to obtain each image to be processed;
[0012] Retrieving a pre-trained video-to-image model, and inputting each image to be processed into the video-to-image model to obtain a transcribed image corresponding to each image to be processed;
[0013] Post-processing each transferred image to obtain a painting corresponding to each transferred image;
[0014] Each painting is reorganized to obtain a target painting corresponding to the target video.
[0015] According to a preferred embodiment of the present invention, preprocessing each video frame to obtain each image to be processed includes:
[0016] Perform hierarchical scene segmentation on each video frame to obtain each sub-region image;
[0017] Use background subtraction method to separate the foreground object and the background of each sub-region image to obtain each sub-image;
[0018] Perform grayscale processing on each sub-image to obtain each grayscale image;
[0019] Each grayscale image is denoised using a denoising autoencoder to obtain each image to be processed.
[0020] According to a preferred embodiment of the present invention, before calling the pre-trained video transcoding model, the method further includes:
[0021] Acquire images of different styles to construct a first training set, and use the first training set to train a convolutional neural network to obtain a style transfer model;
[0022] Acquire source domain images and target domain images to construct a second training set, and use the second training set to train an adversarial network to obtain a translation model;
[0023] Acquire a video frame sequence to construct a third training set, and use the third training set to train a temporal convolutional network or a spatiotemporal adversarial network to obtain a video generation model;
[0024] Performing usability evaluation on the style transfer model, the translation model, and the video generation model to obtain evaluation results;
[0025] Selecting a target model from the style transfer model, the translation model, and the video generation model according to the evaluation result;
[0026] Parameters of the target model are adjusted to obtain the video-to-image model.
[0027] According to a preferred embodiment of the present invention, the usability evaluation of the style transfer model, the translation model and the video generation model is performed to obtain the evaluation results, which include:
[0028] Obtaining the image quality of the images generated by the style transfer model, the translation model, and the video generation model; wherein the image quality evaluation index includes image clarity, detail retention, and peak signal-to-noise ratio;
[0029] Detecting the style consistency of the images generated by the style transfer model, the translation model, and the video generation model; wherein the evaluation index of the style consistency includes color consistency and structural similarity index;
[0030] Detecting the temporal consistency of the images generated by the style transfer model, the translation model, and the video generation model; wherein the evaluation index of the temporal consistency includes a temporal similarity index, inter-frame difference, and motion smoothness;
[0031] Obtaining processing efficiencies of the style transfer model, the translation model, and the video generation model;
[0032] Respectively obtaining weights corresponding to the image quality, the style consistency, the timing consistency, and the processing efficiency;
[0033] According to the weights corresponding to the image quality, the style consistency, the temporal consistency, and the processing efficiency, as well as the image quality of the images generated by the style transfer model, the translation model, and the video generation model, the style consistency of the images generated by the style transfer model, the translation model, and the video generation model, the temporal consistency of the images generated by the style transfer model, the translation model, and the video generation model, and the processing efficiency of the style transfer model, the translation model, and the video generation model, respectively, weighted calculations are performed to obtain the corresponding availability of the style transfer model, the translation model, and the video generation model;
[0034] The evaluation result is generated according to the corresponding availability of the style transfer model, the translation model, and the video generation model.
[0035] According to a preferred embodiment of the present invention, adjusting parameters of the target model to obtain the video transcoding model includes:
[0036] Use the grid search algorithm to search within a preset range to obtain the target learning rate;
[0037] Performing optimization training on the target model according to the target learning rate;
[0038] The early stopping method is used to monitor the loss during the training process, and the training is stopped when the loss reaches the stopping condition to obtain the video conversion model.
[0039] According to a preferred embodiment of the present invention, the post-processing of each transferred image to obtain a painting corresponding to each transferred image comprises:
[0040] Rendering each transferred image using the illumination model to obtain each first image;
[0041] Using a global illumination algorithm to simulate illumination and reflection of each first image to obtain each second image;
[0042] Calculate the motion vector between every two adjacent images in the second image using an optical flow algorithm;
[0043] Generate a difference frame between every two adjacent images according to a motion vector between every two adjacent images;
[0044] Perform anti-flicker processing on the difference frame between every two adjacent images;
[0045] Each first image, each second image, and the difference frame between each two adjacent images after anti-flicker processing are combined to obtain a painting corresponding to each transferred image.
[0046] According to a preferred embodiment of the present invention, after obtaining the target painting corresponding to the target video, the method further includes:
[0047] Obtaining user feedback data on the target painting;
[0048] The video transcoding model is updated according to the user feedback data.
[0049] A video transfer device, comprising:
[0050] An extraction unit, configured to extract each video frame of the target video based on an OpenCV library in response to a redraw instruction for the target video;
[0051] A preprocessing unit, used for preprocessing each video frame to obtain each image to be processed;
[0052] A tracing unit, used to call a pre-trained video tracing model, and input each image to be processed into the video tracing model to obtain a tracing image corresponding to each image to be processed;
[0053] A post-processing unit, used for post-processing each transferred image to obtain a painting corresponding to each transferred image;
[0054] The reorganization unit is used to reorganize each painting to obtain a target painting corresponding to the target video.
[0055] A computer device, comprising:
[0056] a memory storing at least one instruction; and
[0057] The processor executes the instructions stored in the memory to implement the video transcoding method.
[0058] A computer-readable storage medium stores at least one instruction, and the at least one instruction is executed by a processor in a computer device to implement the video transcoding method.
[0059] It can be seen from the above technical scheme that the present invention can efficiently extract each video frame of the target video based on the OpenCV library, and preprocess each video frame to obtain each image to be processed, thereby reducing the complexity of subsequent image processing through preprocessing; each image to be processed is input into the video transfer model to obtain a transferred image corresponding to each image to be processed, so as to realize video transfer based on artificial intelligence means; each transferred image is post-processed to obtain a painting corresponding to each transferred image, and each painting is reorganized to obtain a target painting corresponding to the target video, thereby further optimizing the transfer effect through post-processing, so as to obtain a higher quality transferred image. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 It is a flow chart of a preferred embodiment of the video transcoding method of the present invention.
[0061] Figure 2 It is a functional module diagram of a preferred embodiment of the video transfer device of the present invention.
[0062] Figure 3 It is a structural schematic diagram of a computer device of a preferred embodiment of the video transcoding method of the present invention. DETAILED DESCRIPTION
[0063] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is described in detail below with reference to the accompanying drawings and specific embodiments.
[0064] like Figure 1 FIG. 1 is a flow chart of a preferred embodiment of the video transfer method of the present invention. According to different requirements, the order of the steps in the flow chart can be changed, and some steps can be omitted.
[0065] The video transfer method is applied to one or more computer devices, which are devices that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and their hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0066] The computer device may be any electronic product that can perform human-computer interaction with a user, such as a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game console, an interactive network television (IPTV), a smart wearable device, etc.
[0067] The computer device may also include a network device and / or a user device, wherein the network device includes, but is not limited to, a single network server, a server group consisting of multiple network servers, or a cloud consisting of a large number of hosts or network servers based on cloud computing.
[0068] The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.
[0069] Among them, Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0070] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0071] The network where the computer device is located includes but is not limited to the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (VPN), etc.
[0072] S10, in response to a redraw instruction for a target video, extract each video frame of the target video based on an OpenCV library.
[0073] In this embodiment, the redrawing instruction can be triggered by relevant staff according to actual needs.
[0074] In this embodiment, the target video may include, but is not limited to, movies, TV series, advertisements and other videos.
[0075] In this embodiment, the OpenCV library is a lightweight and efficient cross-platform computer vision and machine learning software library. Therefore, each video frame of the target video can be efficiently extracted based on the OpenCV library.
[0076] S11, preprocessing each video frame to obtain each image to be processed.
[0077] In this embodiment, preprocessing each video frame to obtain each image to be processed includes:
[0078] Perform hierarchical scene segmentation on each video frame to obtain each sub-region image;
[0079] Use background subtraction method to separate the foreground object and the background of each sub-region image to obtain each sub-image;
[0080] Perform grayscale processing on each sub-image to obtain each grayscale image;
[0081] Each grayscale image is denoised using a denoising autoencoder to obtain each image to be processed.
[0082] Among them, by performing hierarchical segmentation on a large-scale scene, the scene can be divided into multiple sub-areas, and each sub-area can be processed separately to reduce the computational complexity.
[0083] The multiple sub-areas may also be processed in parallel based on multi-threading and GPU (Graphics Processing Unit) acceleration technology to improve processing efficiency.
[0084] Among them, the background subtraction method is used to separate the foreground object and the background of each sub-region image, which can facilitate targeted processing.
[0085] Among them, by graying each sub-image, the difficulty of subsequent image processing can be reduced.
[0086] Among them, the denoising autoencoder can be a convolutional autoencoder, which can effectively remove noise through learning through the encoding and decoding process, and has better effect than traditional denoising algorithms.
[0087] Through the above series of preprocessing for each video frame, a foundation can be laid for subsequent video transcoding, the accuracy of video transcoding is improved, and the difficulty of image processing is reduced.
[0088] S12, calling a pre-trained video-to-image model, and inputting each image to be processed into the video-to-image model to obtain a transcribed image corresponding to each image to be processed.
[0089] In this embodiment, before calling the pre-trained video-to-image model, the method further includes:
[0090] Acquire images of different styles to construct a first training set, and use the first training set to train a convolutional neural network to obtain a style transfer model;
[0091] Acquire source domain images and target domain images to construct a second training set, and use the second training set to train an adversarial network to obtain a translation model;
[0092] Acquire a video frame sequence to construct a third training set, and use the third training set to train a temporal convolutional network or a spatiotemporal adversarial network to obtain a video generation model;
[0093] Performing usability evaluation on the style transfer model, the translation model, and the video generation model to obtain evaluation results;
[0094] Selecting a target model from the style transfer model, the translation model, and the video generation model according to the evaluation result;
[0095] Parameters of the target model are adjusted to obtain the video-to-image model.
[0096] For example: the first training set may include a large number of style images (such as paintings by Van Gogh and Picasso) and content images (natural scenes, characters, etc.); the second training set may include paired image data such as source domain image sketches and target domain image real photos, source domain images during the day and target domain images at night, etc., and of course, it can also be unpaired images, as long as the source domain and target domain are clear; the third training set may include continuous video frame sequences, so as to learn the motion and transformation rules between frames and generate frame sequences with temporal consistency.
[0097] Among them, when training the style transfer model, the translation model and the video generation model, different batch sizes (such as 8, 16, 32, 64, etc.) can be selected to train the models respectively, and the batch size can be adjusted to balance the computing efficiency and model performance by comprehensively considering the memory limitation and the training time; the number of layers of the network and the number of nodes (number of neurons) in each layer can also be adjusted, and shallow to deep tests can be performed, cross-layer regularization (such as Dropout) can be used to avoid overfitting, and the performance indicator values under different network architectures can be recorded to select the network architecture with the best performance and higher computing efficiency.
[0098] In this embodiment, the usability evaluation of the style transfer model, the translation model, and the video generation model is performed to obtain the evaluation results including:
[0099] Obtaining the image quality of the images generated by the style transfer model, the translation model, and the video generation model; wherein the image quality evaluation index includes image clarity, detail retention, and peak signal-to-noise ratio;
[0100] Detecting the style consistency of the images generated by the style transfer model, the translation model, and the video generation model; wherein the evaluation index of the style consistency includes color consistency and structural similarity index;
[0101] Detecting the temporal consistency of the images generated by the style transfer model, the translation model, and the video generation model; wherein the evaluation index of the temporal consistency includes a temporal similarity index, inter-frame difference, and motion smoothness;
[0102] Obtaining processing efficiencies of the style transfer model, the translation model, and the video generation model;
[0103] Respectively obtaining weights corresponding to the image quality, the style consistency, the timing consistency, and the processing efficiency;
[0104] According to the weights corresponding to the image quality, the style consistency, the temporal consistency, and the processing efficiency, as well as the image quality of the images generated by the style transfer model, the translation model, and the video generation model, the style consistency of the images generated by the style transfer model, the translation model, and the video generation model, the temporal consistency of the images generated by the style transfer model, the translation model, and the video generation model, and the processing efficiency of the style transfer model, the translation model, and the video generation model, respectively, weighted calculations are performed to obtain the corresponding availability of the style transfer model, the translation model, and the video generation model;
[0105] The evaluation result is generated according to the corresponding availability of the style transfer model, the translation model, and the video generation model.
[0106] Specifically, through a series of weighted calculations, the style transfer model, the translation model, and the video generation model will each have a corresponding quantized value, which can indicate the availability of the corresponding video generation model. Further, the model with the highest availability is selected from the models as the video transcoding model, so as to select the optimal model for video transcoding.
[0107] Through the above embodiments, the model can be comprehensively evaluated in combination with multiple dimensions to obtain the model with the highest comprehensive performance, while taking into account the processing effect and ensuring the processing efficiency.
[0108] In this embodiment, adjusting parameters of the target model to obtain the video transcoding model includes:
[0109] Use the grid search algorithm to search within a preset range to obtain the target learning rate;
[0110] Performing optimization training on the target model according to the target learning rate;
[0111] The early stopping method is used to monitor the loss during the training process, and the training is stopped when the loss reaches the stopping condition to obtain the video conversion model.
[0112] Among them, the grid search algorithm can quickly search for the optimal learning rate within a certain range.
[0113] Among them, the early stopping method is used to monitor the loss during the training process so that the training can be stopped when the loss no longer decreases significantly, which improves the training efficiency while ensuring the training effect.
[0114] Through the above embodiments, after selecting a suitable target model, the model parameters can be further adjusted to make the model reach the optimal state.
[0115] S13, performing post-processing on each transferred image to obtain a painting corresponding to each transferred image.
[0116] In this embodiment, the post-processing of each transferred image to obtain a painting corresponding to each transferred image includes:
[0117] Rendering each transferred image using the illumination model to obtain each first image;
[0118] Using a global illumination algorithm to simulate illumination and reflection of each first image to obtain each second image;
[0119] Calculate the motion vector between every two adjacent images in the second image using an optical flow algorithm;
[0120] Generate a difference frame between every two adjacent images according to a motion vector between every two adjacent images;
[0121] Perform anti-flicker processing on the difference frame between every two adjacent images;
[0122] Each first image, each second image, and the difference frame between each two adjacent images after anti-flicker processing are combined to obtain a painting corresponding to each transferred image.
[0123] The illumination model may include a Phong reflection model, a Blinn-Phong model, etc. By rendering each transferred image through the illumination model, complex light and shadow effects can be simulated and rendered.
[0124] The global illumination algorithm is used to perform path tracing, photon mapping, etc. on each first image to simulate complex illumination and reflection in the scene, so that the generated painting or animation can be made more realistic.
[0125] Among them, the difference frame between each two adjacent images is generated according to the motion vector between each two adjacent images, so as to achieve a smooth transition between frames; the difference frame between each two adjacent images is further subjected to anti-flicker processing to smooth the color and texture changes between adjacent frames.
[0126] The interpolation frame may be generated by linear interpolation or other more complex interpolation methods, and the present invention does not limit the interpolation algorithm.
[0127] In the above embodiments, through the illumination model and the global illumination algorithm, complex scenes can be captured and expressed more effectively, thereby generating high-quality paintings or animations; through the optical flow algorithm and the inter-frame difference, the content difference between adjacent frames can be reduced, thereby reducing the occurrence of flickering.
[0128] S14, reorganizing each painting to obtain a target painting corresponding to the target video.
[0129] In this embodiment, after obtaining the target painting corresponding to the target video, the method further includes:
[0130] Obtaining user feedback data on the target painting;
[0131] The video transcoding model is updated according to the user feedback data.
[0132] Through the above embodiments, the user model can be fed back according to the user feedback data to improve the processing effect of the model.
[0133] It can be seen from the above technical scheme that the present invention can efficiently extract each video frame of the target video based on the OpenCV library, and preprocess each video frame to obtain each image to be processed, thereby reducing the complexity of subsequent image processing through preprocessing; each image to be processed is input into the video transfer model to obtain a transferred image corresponding to each image to be processed, so as to realize video transfer based on artificial intelligence means; each transferred image is post-processed to obtain a painting corresponding to each transferred image, and each painting is reorganized to obtain a target painting corresponding to the target video, thereby further optimizing the transfer effect through post-processing, so as to obtain a higher quality transferred image.
[0134] like Figure 2, which is a functional module diagram of a preferred embodiment of the video transfer device of the present invention. The video transfer device 11 includes an extraction unit 110, a preprocessing unit 111, a transfer unit 112, a post-processing unit 113, and a reorganization unit 114. The module / unit referred to in the present invention refers to a series of computer program segments that can be executed by a processor and can complete fixed functions, which are stored in a memory. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.
[0135] The extraction unit 110 is used to extract each video frame of the target video based on the OpenCV library in response to a redraw instruction for the target video;
[0136] The preprocessing unit 111 is used to preprocess each video frame to obtain each image to be processed;
[0137] The trans-image unit 112 is used to call a pre-trained video trans-image model and input each image to be processed into the video trans-image model to obtain a trans-image corresponding to each image to be processed;
[0138] The post-processing unit 113 is used to post-process each transferred image to obtain a painting corresponding to each transferred image;
[0139] The reorganization unit 114 is used to reorganize each painting to obtain a target painting corresponding to the target video.
[0140] It can be seen from the above technical scheme that the present invention can efficiently extract each video frame of the target video based on the OpenCV library, and preprocess each video frame to obtain each image to be processed, thereby reducing the complexity of subsequent image processing through preprocessing; each image to be processed is input into the video transfer model to obtain a transferred image corresponding to each image to be processed, so as to realize video transfer based on artificial intelligence means; each transferred image is post-processed to obtain a painting corresponding to each transferred image, and each painting is reorganized to obtain a target painting corresponding to the target video, thereby further optimizing the transfer effect through post-processing, so as to obtain a higher quality transferred image.
[0141] like Figure 3 FIG. 1 is a schematic diagram of the structure of a computer device of a preferred embodiment of the video transcoding method of the present invention.
[0142] The computer device 1 may include a memory 12 , a processor 13 and a bus, and may also include a computer program stored in the memory 12 and executable on the processor 13 , such as a video transcoding program.
[0143] Those skilled in the art will appreciate that the schematic diagram is merely an example of the computer device 1 and does not constitute a limitation on the computer device 1. The computer device 1 may be a bus-type structure or a star-type structure. The computer device 1 may also include more or less other hardware or software than shown in the diagram, or a different arrangement of components. For example, the computer device 1 may also include input and output devices, network access devices, etc.
[0144] It should be noted that the computer device 1 is only an example, and other existing or future electronic products that are suitable for the present invention should also be included in the protection scope of the present invention and included here by reference.
[0145] The memory 12 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 12 may be an internal storage unit of the computer device 1, such as a mobile hard disk of the computer device 1. In other embodiments, the memory 12 may also be an external storage device of the computer device 1, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the computer device 1. Further, the memory 12 may also include both an internal storage unit of the computer device 1 and an external storage device. The memory 12 may not only be used to store application software and various types of data installed in the computer device 1, such as the code of a video transfer program, etc., but may also be used to temporarily store data that has been output or is to be output.
[0146] In some embodiments, the processor 13 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 13 is the control core (Control Unit) of the computer device 1, and uses various interfaces and lines to connect various components of the entire computer device 1, and executes various functions and processes data of the computer device 1 by running or executing programs or modules stored in the memory 12 (for example, executing video transfer programs, etc.), and calling data stored in the memory 12.
[0147] The processor 13 executes the operating system of the computer device 1 and various installed applications. The processor 13 executes the applications to implement the steps in the above-mentioned video re-drawing method embodiments, for example Figure 1 Steps shown.
[0148] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory 12 and executed by the processor 13 to implement the present invention. The one or more modules / units may be a series of computer-readable instruction segments capable of implementing specific functions, which are used to describe the execution process of the computer program in the computer device 1. For example, the computer program may be divided into an extraction unit 110, a pre-processing unit 111, a transfer unit 112, a post-processing unit 113, and a reorganization unit 114.
[0149] The above-mentioned integrated unit implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, and includes a number of instructions for enabling a computer device (which can be a personal computer, a computer device, or a network device, etc.) or a processor to execute a part of the video re-drawing method described in each embodiment of the present invention.
[0150] If the module / unit integrated in the computer device 1 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 present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware devices through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of each of the above-mentioned method embodiments can be implemented.
[0151] The computer program includes computer program code, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory, etc.
[0152] Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.
[0153] The blockchain referred to in this invention is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the blockchain underlying platform, platform product service layer, and application service layer.
[0154] The bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 The bus is represented by only one straight line, but it does not mean that there is only one bus or one type of bus. The bus is configured to realize the connection and communication between the memory 12 and at least one processor 13, etc.
[0155] Although not shown, the computer device 1 may also include a power source (such as a battery) for supplying power to various components. Preferably, the power source may be logically connected to the at least one processor 13 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include any components such as one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, and power status indicators. The computer device 1 may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
[0156] Furthermore, the computer device 1 may also include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used to establish a communication connection between the computer device 1 and other computer devices.
[0157] Optionally, the computer device 1 may further include a user interface, which may be a display, an input unit (such as a keyboard), or a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the computer device 1 and to display a visual user interface.
[0158] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0159] Figure 3 Only the computer device 1 having components 12-13 is shown, and it can be understood by those skilled in the art that Figure 3 The structure shown does not constitute a limitation on the computer device 1, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0160] Combination Figure 1 , the memory 12 in the computer device 1 stores a plurality of instructions to implement a video transcoding method, and the processor 13 can execute the plurality of instructions to implement:
[0161] In response to a redraw instruction for a target video, extract each video frame of the target video based on an OpenCV library;
[0162] Preprocess each video frame to obtain each image to be processed;
[0163] Retrieving a pre-trained video-to-image model, and inputting each image to be processed into the video-to-image model to obtain a transcribed image corresponding to each image to be processed;
[0164] Post-processing each transferred image to obtain a painting corresponding to each transferred image;
[0165] Each painting is reorganized to obtain a target painting corresponding to the target video.
[0166] Specifically, the specific implementation method of the processor 13 for the above instructions can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0167] It should be noted that the data involved in this case were all obtained legally.
[0168] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0169] The present invention can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present invention can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present invention can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0170] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0171] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0172] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0173] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0174] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the present invention can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.
[0175] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. A video transcoding method, It is characterized in that The video transfer method comprises: In response to a redraw instruction for a target video, extract each video frame of the target video based on an OpenCV library; Preprocessing each video frame to obtain each image to be processed, including: performing hierarchical scene segmentation on each video frame to obtain each sub-region image; using background subtraction method to separate the foreground object and the background of each sub-region image to obtain each sub-image; graying each sub-image to obtain each grayscale image; denoising each grayscale image using denoising autoencoder to obtain each image to be processed; Retrieving a pre-trained video-to-image model, and inputting each image to be processed into the video-to-image model to obtain a transcribed image corresponding to each image to be processed; Post-processing each transferred image to obtain a painting corresponding to each transferred image; Reorganize each painting to obtain a target painting corresponding to the target video; Before calling the pre-trained video transfer model, images of different styles are obtained to construct a first training set, and the first training set is used to train a convolutional neural network to obtain a style transfer model; source domain images and target domain images are obtained to construct a second training set, and the second training set is used to train an adversarial network to obtain a translation model; a video frame sequence is obtained to construct a third training set, and the third training set is used to train a temporal convolutional network or a spatiotemporal adversarial network to obtain a video generation model; the style transfer model, the translation model and the video generation model are evaluated for usability to obtain an evaluation result; a target model is selected from the style transfer model, the translation model and the video generation model according to the evaluation result; parameters of the target model are adjusted to obtain the video transfer model; Wherein, the usability evaluation of the style transfer model, the translation model and the video generation model is performed to obtain the evaluation results including: obtaining the image quality of the images generated by the style transfer model, the translation model and the video generation model; wherein the evaluation indicators of the image quality include image clarity, detail retention, and peak signal-to-noise ratio; detecting the style consistency of the images generated by the style transfer model, the translation model and the video generation model; wherein the evaluation indicators of the style consistency include color consistency and structural similarity index; detecting the temporal consistency of the images generated by the style transfer model, the translation model and the video generation model; wherein the evaluation indicators of the temporal consistency include temporal similarity index, inter-frame difference, and motion smoothness; obtaining the processing efficiency of the style transfer model, the translation model and the video generation model; respectively Obtain weights corresponding to the image quality, the style consistency, the timing consistency, and the processing efficiency; perform weighted calculations according to the weights corresponding to the image quality, the style consistency, the timing consistency, and the processing efficiency, as well as the image quality of the images generated by the style transfer model, the translation model, and the video generation model, the style consistency of the images generated by the style transfer model, the translation model, and the video generation model, the timing consistency of the images generated by the style transfer model, the translation model, and the video generation model, and the processing efficiency of the style transfer model, the translation model, and the video generation model, to obtain the corresponding availability of the style transfer model, the translation model, and the video generation model; generate the evaluation result according to the corresponding availability of the style transfer model, the translation model, and the video generation model.
2. The video transcoding method according to claim 1, It is characterized in that The step of adjusting parameters of the target model to obtain the video-to-image model comprises: Use the grid search algorithm to search within a preset range to obtain the target learning rate; Performing optimization training on the target model according to the target learning rate; The early stopping method is used to monitor the loss during the training process, and the training is stopped when the loss reaches the stopping condition to obtain the video conversion model.
3. The video transcoding method according to claim 1, It is characterized in that The post-processing of each transferred image to obtain a painting corresponding to each transferred image comprises: Rendering each transferred image using the illumination model to obtain each first image; Using a global illumination algorithm to simulate illumination and reflection of each first image to obtain each second image; Calculate the motion vector between every two adjacent images in the second image using an optical flow algorithm; Generate a difference frame between every two adjacent images according to a motion vector between every two adjacent images; Perform anti-flicker processing on the difference frame between every two adjacent images; Each first image, each second image, and the difference frame between each two adjacent images after anti-flicker processing are combined to obtain a painting corresponding to each transferred image.
4. The video transcoding method according to claim 1, It is characterized in that After obtaining the target painting corresponding to the target video, the method further includes: Obtaining user feedback data on the target painting; The video transcoding model is updated according to the user feedback data.
5. A video transfer device for implementing the video transfer method according to any one of claims 1 to 4, It is characterized in that The video transfer device comprises: An extraction unit, configured to extract each video frame of the target video based on an OpenCV library in response to a redraw instruction for the target video; A preprocessing unit, used for preprocessing each video frame to obtain each image to be processed; A tracing unit, used to call a pre-trained video tracing model, and input each image to be processed into the video tracing model to obtain a tracing image corresponding to each image to be processed; A post-processing unit, used for post-processing each transferred image to obtain a painting corresponding to each transferred image; The reorganization unit is used to reorganize each painting to obtain a target painting corresponding to the target video.
6. A computer device, It is characterized in that The computer device comprises: a memory storing at least one instruction; and A processor executes instructions stored in the memory to implement the video transcoding method as described in any one of claims 1 to 4.
7. A computer-readable storage medium, Features: The computer-readable storage medium stores at least one instruction, and the at least one instruction is executed by a processor in a computer device to implement the video transcoding method according to any one of claims 1 to 4.
