Video fingerprint extraction method and device, equipment and medium
By acquiring video keyframe images and using image feature extraction models, the problem of difficulty in taking into account speed and accuracy in video fingerprint extraction technology is solved, and efficient video fingerprint extraction is achieved to adapt to the processing of motion and lighting changes in video.
Patent Information
- Application Number
- CN202410832237.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2024-11-01
AI Technical Summary
Existing video fingerprint extraction technology is difficult to take into account the extraction speed, accuracy and resource consumption, and is particularly poor in handling motion and lighting changes in videos.
By obtaining the keyframe images in the video, using the preset image feature extraction model to extract image features, obtain the image feature vector, thereby obtaining the video fingerprint and storing it in the vector database, achieving fast and accurate extraction of the video fingerprint.
While ensuring the accuracy of video fingerprint extraction, it reduces computing resource consumption, improves the extraction speed of video fingerprints, and adapts to the processing of motion and lighting changes in video.
Smart Images

Figure CN118887580A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of video fingerprint extraction, and more specifically, to a video fingerprint extraction method, device, equipment and medium. Background Art
[0002] In the related art, when extracting video fingerprints, one method is to directly analyze the optical features in the video to extract the video fingerprint of the video. However, this method cannot process a large amount of video data and has difficulty in processing the motion and lighting changes in the video, resulting in low accuracy and speed of video fingerprint extraction. Another method is to directly process the entire video based on a pre-trained model to extract the video fingerprint. However, this method has the problem of high resource consumption and low speed of video fingerprint extraction. In other words, there is currently no method that can take into account extraction speed, extraction accuracy and resources at the same time when extracting video fingerprints. Summary of the invention
[0003] The disclosed embodiments provide a new technical solution for video fingerprint extraction.
[0004] According to a first aspect of the present disclosure, a video fingerprint extraction method is provided, the method comprising:
[0005] Obtain key frame images in the video to be extracted;
[0006] Extracting image features of the key frame image by using a preset image feature extraction model to obtain a first image feature vector corresponding to the key frame image;
[0007] A video fingerprint of the video to be extracted is obtained according to the first image feature vector.
[0008] Optionally, obtaining a key frame image in the video to be extracted includes:
[0009] Perform frame extraction processing on the video to be extracted according to a set frame extraction method to obtain a target image sequence;
[0010] According to the target image sequence, all the key frame images are obtained.
[0011] Optionally, obtaining all the key frame images according to the target image sequence includes:
[0012] Performing grayscale processing on the target image sequence to obtain a grayscale image sequence;
[0013] All the key frame images are obtained according to the grayscale image sequence.
[0014] Optionally, the image intensity of an inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence is obtained; wherein the initial value of i is 1, the first key frame image is the first frame image of the grayscale image sequence, the value of j is each integer from 2 to N, N is the total number of images in the grayscale image sequence, and i is less than or equal to N;
[0015] When the image intensity is greater than the intensity threshold, the difference area of the inter-frame difference image is obtained, and when the image intensity is less than or equal to the intensity threshold, the j-th frame image is discarded, j=j+1 is updated, and the step of obtaining the image intensity of the inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence is continued until j is N;
[0016] When the area of the difference region is greater than the area threshold, the time interval between the i-th key frame image and the j-th frame image is obtained, and when the area of the difference region is less than or equal to the area threshold, the j-th frame image is discarded, j=j+1 is updated, and the step of obtaining the image intensity of the inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence is continued until j is N;
[0017] When the time interval is greater than the time threshold, a first distance between the i-th key frame image and the j-th frame image is obtained, and when the time interval is less than or equal to the time threshold, the j-th frame image is discarded, j=j+1 is updated, and the step of obtaining the image intensity of the inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence is continued until j is N;
[0018] When the first distance is greater than the distance threshold, i=i+1 is updated, and the j-th frame image is used as the i-th key frame image, j=j+1 is updated, and the step of obtaining the image intensity of the inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence is continued; and when the first distance is less than or equal to the distance threshold, the j-th frame image is discarded, j=j+1 is updated, and the step of obtaining the image intensity of the inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence is continued until j is N.
[0019] Optionally, the method further comprises:
[0020] Each of the first image feature vectors and its corresponding image label is stored in a vector database as a mapping data.
[0021] Optionally, the method further comprises:
[0022] Obtain key frame images of the video to be compared;
[0023] Extracting image features of the key frame image of the video to be compared by using the preset image feature extraction model to obtain a second image feature vector;
[0024] Acquire the distance between the second image feature vector and the first image feature vector in the vector database;
[0025] According to the distance, it is determined whether there are repeated segments between the video to be extracted and the video to be compared.
[0026] Optionally, the method further comprises:
[0027] Obtaining metadata information of the video to be extracted;
[0028] Storing the metadata information in the DAMO business database; and,
[0029] The metadata information is associated with a data identifier in the DAMO business database.
[0030] According to a second aspect of the present disclosure, a video fingerprint extraction device is provided, the device comprising:
[0031] The first acquisition module is used to acquire the key frame image in the video to be extracted;
[0032] An extraction module, used to extract the image features of the key frame image through a preset image feature extraction model to obtain a first image feature vector corresponding to the key frame image;
[0033] The second acquisition module is used to obtain the video fingerprint of the video to be extracted according to the first image feature vector.
[0034] According to a third aspect of the present disclosure, an electronic device is provided, comprising a memory for storing executable computer instructions; and a processor for executing the video fingerprint extraction method according to the first aspect under the control of the executable computer instructions.
[0035] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which computer instructions are stored. When the computer instructions are executed by a processor, the video fingerprint extraction method described in the first aspect is executed.
[0036] According to the video fingerprint extraction method of the embodiment of the present disclosure, since the image that is representative of the video content is the key frame image in the video, it only extracts the image features of the key frame image in the video to be extracted through a preset image feature extraction model to obtain the first image feature vector of the key frame image, and then obtains the video fingerprint of the video to be extracted based on the first image feature vector, which reduces the consumption of computing resources while ensuring the extraction accuracy of the video fingerprint and improves the extraction speed of the video fingerprint.
[0037] Other features and advantages of the present disclosure will become apparent from the following detailed description of exemplary embodiments of the present disclosure with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0039] Figure 1 is a schematic diagram of the hardware configuration of an electronic device according to an embodiment of the present disclosure;
[0040] Figure 2 is a flow chart of a video fingerprint extraction method according to an embodiment of the present disclosure;
[0041] Figure 3 is a flow chart of a video fingerprint extraction method according to an example of the present disclosure;
[0042] Figure 4 is a principle block diagram of a video fingerprint extraction device according to an embodiment of the present disclosure;
[0043] Figure 5 is a schematic diagram of the hardware configuration of an electronic device according to another embodiment of the present disclosure. DETAILED DESCRIPTION
[0044] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless otherwise specifically stated.
[0045] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present disclosure, its application, or uses.
[0046] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered as part of the specification.
[0047] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0048] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0049] <Hardware Configuration>
[0050] Figure 1 is a block diagram of a hardware configuration of an electronic device 1000 according to an embodiment of the present disclosure.
[0051] In one embodiment, the electronic device 1000 may be a server or a terminal device. The server may be an integrated server or a distributed server across multiple computers or computer data centers. The terminal device may be a portable computer, a desktop computer, a wearable device, or any other device having a computing device such as a processor and a storage device such as a memory, which is not limited in this embodiment.
[0052] like Figure 1 As shown, the electronic device 1000 may include a processor 1100, a memory 1200, an interface device 1300, a communication device 1400, a display device 1500, an input device 1600, a speaker 1700, a microphone 1800, and the like.
[0053] The processor 1100 may be a mobile version processor. The memory 1200 may include, for example, a ROM (read-only memory), a RAM (random access memory), a non-volatile memory such as a hard disk, etc. The interface device 1300 may include, for example, a USB interface, a headphone interface, etc. The communication device 1400 may, for example, be capable of wired or wireless communication. The communication device 1400 may include a short-range communication device, for example, any device for short-range wireless communication based on short-range wireless communication protocols such as Hilink protocol, WiFi (IEEE 802.11 protocol), Mesh, Bluetooth, ZigBee, Thread, Z-Wave, NFC, UWB, LiFi, etc. The communication device 1400 may also include a remote communication device, for example, any device for WLAN, GPRS, 2G / 3G / 4G / 5G remote communication. The display device 1500 may be, for example, a liquid crystal display, a touch display, etc. The input device 1600 may include, for example, a touch screen, a keyboard, etc. The electronic device 1000 may output audio information through a speaker 1700, and may collect audio information through a microphone 1800.
[0054] Despite Figure 1Although multiple devices are shown for the electronic device 1000, the present disclosure may only involve some of the devices, for example, the electronic device 1000 only involves the memory 1200 and the processor 1100.
[0055] In the embodiment of the present disclosure, the memory 1200 of the electronic device 1000 is used to store instructions, and the instructions are used to control the processor 1100 to execute the video fingerprint extraction method provided by the embodiment of the present disclosure.
[0056] In the above description, the technician can design instructions according to the scheme disclosed in the present disclosure. How instructions control the processor to operate is well known in the art, so it will not be described in detail here.
[0057] <Method Example>
[0058] In this embodiment, a video fingerprint extraction method is provided. The video fingerprint extraction method can be implemented by an electronic device. The electronic device can be as follows: Figure 1 An electronic device 1000 is shown.
[0059] according to Figure 2 As shown, the video fingerprint extraction method of the embodiment of the present disclosure may include the following steps S2100 to S2300.
[0060] Step S2100, obtaining key frame images in the video to be extracted.
[0061] The key frame image is a representative image that can guarantee the video content of the video to be extracted.
[0062] In an optional embodiment, the step S2100 of obtaining the key frame image in the video to be extracted may further include the following steps S2110 to S2120:
[0063] Step S2110, performing frame extraction processing on the video to be extracted according to a set frame extraction method to obtain a target image sequence.
[0064] The frame extraction mode may be set to extract frames at a set time interval. The set time interval may be set according to the video frame rate, or according to actual application scenarios and actual needs. The set time interval may be, for example, 1 second, 0.2 seconds, 5 seconds, etc., which is not limited in this embodiment.
[0065] In this step S2110, the electronic device can use the OpenCV library (cv2) to open the video to be extracted and obtain the metadata information of the video to be extracted, wherein the metadata information of the video includes, for example but not limited to, title, frame rate, format, duration, file size, and file type. At this time, the time interval can be set according to the video frame rate, and the video to be extracted is framed at the set time interval to obtain multiple images, which constitute the target image sequence. Exemplarily, for example, a 15-second video to be extracted is framed at a fixed time interval, such as 5 frames per second, to generate an image sequence of 75 lengths.
[0066] Step S2120: Obtain all the key frame images according to the target image sequence.
[0067] In this step S2120, the electronic device does not directly input the multiple images in the target image sequence into the preset image feature extraction model to extract image features, but first obtains multiple key frame images according to the target image sequence, and then inputs all the key frame images into the preset image feature extraction model to extract image features. This can reduce computing resource consumption and increase the extraction speed.
[0068] Specifically, the step S2120 of obtaining all the key frame images according to the target image sequence may further include: performing grayscale processing on the target image sequence to obtain a grayscale image sequence; and obtaining all the key frame images according to the grayscale image sequence.
[0069] It should be noted that, in order to reduce computational complexity, the electronic device first performs grayscale processing on all images in the target image sequence to obtain a grayscale image sequence, and then obtains all key frame images of the video to be extracted based on the grayscale image sequence.
[0070] Optionally, refer to Figure 3 The above steps of obtaining all the key frame images according to the grayscale image sequence may further include the following steps S2121 to S2125:
[0071] Step S2121, obtaining the image intensity of an inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence.
[0072] Among them, the initial value of i is 1, the first key frame image is the first frame image of the grayscale image sequence, the value of j is each integer from 2 to N, N is the total number of images in the grayscale image sequence, and i is less than or equal to N.
[0073] It should be noted that the inter-frame difference image between two images can be obtained by using an absolute difference method.
[0074] For example, if the grayscale image sequence includes five images, namely, Image 1, Image 2, Image 3, Image 4 and Image 5, in the sampling order, the first image in the grayscale image sequence, that is, Image 1, is first taken as the first key frame image, and the inter-frame difference image between Image 1 and Image 2 is obtained, and then the average intensity of the inter-frame difference image between Image 1 and Image 2 is determined.
[0075] Step S2122, when the image intensity is greater than the intensity threshold, obtain the difference region area of the inter-frame difference image, and when the image intensity is less than or equal to the intensity threshold, discard the j-th frame image, update j=j+1, and continue to execute the step of obtaining the image intensity of the inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence until j is N.
[0076] The intensity threshold may be pre-set according to actual scenarios and actual needs, and this embodiment does not limit this.
[0077] It should be noted that the area of the difference region of the inter-frame difference image can be understood as the ratio of non-zero pixels in the inter-frame difference image.
[0078] Continuing with the above example, the electronic device determines whether the average intensity of the inter-frame difference image between image 1 and image 2 is greater than the intensity threshold. When the average intensity of the inter-frame difference image between image 1 and image 2 is less than or equal to the intensity threshold, it indicates that image 2 is not a key frame image. At this time, image 2 can be discarded, and j=j+1=2+1=3 is updated to further determine whether image 3 is a key frame image, that is, execute the above step S2121 to continue calculating the image intensity of the inter-frame difference image between image 1 and image 3.
[0079] When the average intensity of the inter-frame difference image between the image 1 and the image 2 is greater than the intensity threshold, the difference area of the inter-frame difference images of the two images can be further determined.
[0080] Step S2123, when the area of the difference region is greater than the area threshold, obtain the time interval between the i-th key frame image and the j-th frame image; and when the area of the difference region is less than or equal to the area threshold, discard the j-th frame image, update j=j+1, and continue to execute the step of obtaining the image intensity of the inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence until j is N.
[0081] The area threshold may be pre-set according to actual scenarios and actual needs, and this embodiment does not limit this.
[0082] Continuing with the above example, when the average intensity of the inter-frame difference image between image 1 and image 2 is greater than the intensity threshold, the electronic device continues to determine whether the area of the difference region of the inter-frame difference image is greater than the area threshold. When the area of the difference region of the inter-frame difference image is less than or equal to the area threshold, it indicates that image 2 is not a key frame image. At this time, image 2 can be discarded, and j=j+1=2+1=3 is updated to further determine whether image 3 is a key frame image, that is, execute the above step S2121 to continue calculating the image intensity of the inter-frame difference image between image 1 and image 3.
[0083] When the area of the difference region between image 1 and image 2 is greater than the area threshold, the time interval between image 1 and image 2 can be further obtained.
[0084] Step S2124, when the time interval is greater than the time threshold, obtain the first distance between the i-th key frame image and the j-th frame image, and when the time interval is less than or equal to the time threshold, discard the j-th frame image, update j=j+1, and continue to execute the step of obtaining the image intensity of the inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence until j is N.
[0085] The time threshold may be pre-set according to actual scenarios and actual needs, and this embodiment does not limit this.
[0086] It should be noted that the first distance between two images can be understood as the L1 norm distance between the two images.
[0087] Continuing with the above example, when the area of the difference region of the inter-frame difference image between Image 1 and Image 2 is greater than the area threshold, the electronic device continues to determine whether the time interval between Image 1 and Image 2 is greater than the time threshold. When the time interval between Image 1 and Image 2 is less than or equal to the time threshold, it indicates that Image 2 is not a key frame image. At this time, Image 2 can be discarded, and j=j+1=2+1=3 is updated to further determine whether Image 3 is a key frame image, that is, execute the above step S2121 to continue calculating the image intensity of the inter-frame difference image between Image 1 and Image 3.
[0088] When the time interval between image 1 and image 2 is greater than the time threshold, the first distance between image 1 and image 2 can be further acquired.
[0089] Step S2125, when the first distance is greater than the distance threshold, update i=i+1, and use the j-th frame image as the i-th key frame image, update j=j+1, and continue to execute the step of obtaining the image intensity of the inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence; and, when the first distance is less than or equal to the distance threshold, discard the j-th frame image, update j=j+1, and continue to execute the step of obtaining the image intensity of the inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence, until j is N.
[0090] Continuing with the above example, when the time interval between image 1 and image 2 is greater than the time threshold, the electronic device continues to determine whether the first distance between image 1 and image 2 is greater than the distance threshold. When the first distance between image 1 and image 2 is less than or equal to the distance threshold, it indicates that image 2 is not a key frame image. At this time, image 2 can be discarded, and j=j+1=2+1=3 is updated to further determine whether image 3 is a key frame image, that is, execute the above step S2121 to continue calculating the image intensity of the inter-frame difference image between image 1 and image 3.
[0091] When the first distance between image 1 and image 2 is greater than the distance threshold, it indicates that image 2 can be used as a key frame image, and at this time i=i+1=1+1=2, that is, image 2 is used as the second key frame image, and at this time j=j+1=2+1=3, that is, based on the second key frame image, image 2, it is further determined whether image 3 is a key frame image, that is, the above step S2121 is executed to continue calculating the image intensity of the inter-frame difference image between image 2 and image 3. Through the above steps S2121 to S2125, all key frame images of the video can be obtained.
[0092] To give a simple example, the above process can be understood as follows: if the grayscale image sequence includes image 1, image 2, image 3, image 4 and image 5, first determine whether image 2 is a key frame image based on the first key frame image, that is, the first image in the grayscale image sequence; if image 2 is not a key frame image, then determine whether image 3 is a key frame image based on the first key frame; if image 3 is a key frame image, then continue to determine whether image 4 is a key frame image based on the second key frame image, that is, image 3; if image 4 is a key frame image, then continue to determine whether image 5 is a key frame image based on the third key frame image, that is, image 4; if image 5 is a key frame image, then the process ends, and the video to be extracted includes 4 key frame images.
[0093] After executing the above step S2100 to obtain the key frame image in the video to be extracted, proceed to:
[0094] Step S2200: extracting image features of the key frame image by using a preset image feature extraction model to obtain a first image feature vector corresponding to the key frame image.
[0095] The preset image feature extraction model is used to extract the image features of each key frame image, and then obtain the image feature vector corresponding to each key frame image.
[0096] The above preset image feature extraction model reflects the relationship between the key frame image and the image features. The input of the preset image feature extraction model is the key frame image, and the output is the image features extracted from the key frame image. The preset image feature extraction model can be a neural network model, such as but not limited to a convolutional neural network model, and the convolutional neural network model can be ResNetv2_50.
[0097] It should be noted that the ResNetv2_50 model, with its 50-layer residual network structure, is good at capturing high-level abstract features in images, especially for complex video scenes. It has excellent recognition and distinction capabilities. Applying this technology to video frames has a faster speed when extracting image features from video frames. In addition, the computational complexity of the ResNetv2_50 model is low and the process is simplified. Furthermore, the ResNetv2_50 model has learned stable features in the video by training a large amount of data, so that the extracted video fingerprint has strong robustness.
[0098] In this embodiment, for the video to be extracted, image preprocessing is first performed on each extracted key frame image, and the image preprocessing includes, for example but not limited to, scaling processing and normalization processing; then, each key frame image after image preprocessing is input into a preset image feature extraction model to obtain an image feature vector corresponding to each key frame image.
[0099] After executing the above step S2200 to extract the image features of the key frame image by using the preset image feature extraction model to obtain the first image feature vector corresponding to the key frame image, proceed to:
[0100] Step S2300: obtaining a video fingerprint of the video to be extracted according to the first image feature vector.
[0101] In this embodiment, for the video to be extracted, the video fingerprint of the video to be extracted can be obtained based on the image feature vectors corresponding to all the extracted key frame images. For example, the image feature vectors corresponding to all the key frame images can be combined to obtain the video fingerprint of the video to be extracted.
[0102] According to the method of the embodiment of the present disclosure, since the image that is representative of the video content is the key frame image in the video, it only extracts the image features of the key frame image in the video to be extracted through a preset image feature extraction model to obtain the first image feature vector of the key frame image, and then obtains the video fingerprint of the video to be extracted based on the first image feature vector, which reduces the consumption of computing resources while ensuring the extraction accuracy of the video fingerprint and improves the extraction speed of the video fingerprint.
[0103] In one embodiment, after executing the above step S2200 to extract the image features of the key frame image through a preset image feature extraction model to obtain a first image feature vector corresponding to the key frame image, the video fingerprint extraction method of the embodiment of the present disclosure further includes: storing each of the first image feature vectors and its corresponding image label as a mapping data in a vector database.
[0104] The image tag may include a video ID of the video where the corresponding image is located and a time component of the video where the corresponding image is located.
[0105] The vector database may be a Milvus database, which is a high-performance vector database designed to provide efficient and scalable solutions for artificial intelligence applications, allowing users to store, query and analyze large-scale real-time vector data.
[0106] In this embodiment, for each key frame image of the video to be extracted, the electronic device can form a complete mapping data with the image feature vector corresponding to the key frame image and the image label corresponding to the key frame image. The integrated mapping data records are stored in the Milvus database using the Application Programming Interface (API) of the Milvus database, so as to achieve faster and more accurate similar matching results and retrieval results based on the Milvus database, thereby improving the user experience.
[0107] In one embodiment, after performing the above steps of storing each of the first image feature vectors and its corresponding image label as a mapping data in the vector database, the video fingerprint extraction method of the embodiment of the present disclosure further includes the following steps S3100 to S3400:
[0108] Step S3100, obtaining the key frame image of the video to be compared.
[0109] In this embodiment, the electronic device may obtain all key frame images of the video to be compared based on the same method as that of obtaining the key frame images of the video to be extracted.
[0110] Step S3200: extracting image features of the key frame image of the video to be compared by using the preset image feature extraction model to obtain a second image feature vector.
[0111] In this embodiment, the electronic device can obtain the image feature vector of the key frame image of the video to be compared in the same manner as the image feature vector of the key frame image of the video to be extracted. Specifically, the electronic device can perform image preprocessing on each key frame image of the video to be compared, and then input each key frame image after image preprocessing into a preset image feature extraction model to obtain the image feature vector corresponding to each key frame image.
[0112] Step S3300: Obtain the distance between the second image feature vector and the first image feature vector in the vector database.
[0113] It should be noted that any distance calculation algorithm can be used to calculate the distance between each second image feature vector in the video to be extracted and each second image feature vector in the video to be compared. The distance calculation algorithm can be a cosine similarity algorithm. Of course, it can also be other distance calculation algorithms for calculating the distance between vectors, such as the log-likelihood similarity algorithm, the Manhattan distance algorithm, etc.
[0114] In this embodiment, when it is necessary to compare the video to be compared with the video to be extracted, the electronic device can first obtain each first image feature vector of the video to be extracted from the vector database, and then calculate the distance between each first image feature vector of the video to be extracted and each second image feature vector of the video to be compared frame by frame.
[0115] Step S3400: Determine whether there are repeated segments between the video to be extracted and the video to be compared based on the distance.
[0116] In this embodiment, the electronic device may compare the distance between each first image feature vector of the video to be extracted and each second image feature vector of the video to be compared with a set distance. When the distances between consecutive first feature image feature vectors and consecutive second image feature vectors are all greater than the set distance, it indicates that there are repeated segments between the video to be compared and the video to be extracted.
[0117] In one embodiment, the video fingerprint extraction method of the embodiment of the present disclosure further includes: obtaining metadata information of the video to be extracted; storing the metadata information in the DAMO business database; and associating the metadata information using a data identifier in the DAMO business database.
[0118] Among them, the DAMO business database is a high-performance relational database management system suitable for various enterprise-level application scenarios. It has powerful data processing capabilities, high availability and security, and can meet the needs of big data processing, data storage and data security in the disclosed embodiments.
[0119] In this embodiment, as described in the above embodiment, the electronic device can use the OpenCV library (cv2) to open the video to be extracted, and obtain the metadata information of the video to be extracted, wherein the metadata information of the video includes, for example but not limited to, title, frame rate, format, duration, file size, and file type. Here, the electronic device will store the metadata information of the video to be extracted in the DAMO business database, and associate the metadata information with a data identifier in the DAMO business database. In this way, after comparing the repeated segments between the video to be compared and the video to be extracted based on the above embodiment, the metadata information of the video to be extracted can be obtained from the DAMO business database based on the video ID and time corresponding to the repeated segments, and then the video to be extracted can be displayed.
[0120] <Device Example>
[0121] In this embodiment, a video fingerprint extraction device 4000 is provided. Figure 4 As shown, the video fingerprint extraction device 4000 may include a first acquisition module 4100 , an extraction module 4200 and a second acquisition module 4300 .
[0122] The first acquisition module 4100 is used to acquire the key frame image in the video to be extracted;
[0123] An extraction module 4200 is used to extract image features of the key frame image by using a preset image feature extraction model to obtain a first image feature vector corresponding to the key frame image;
[0124] The second acquisition module 4300 is used to obtain the video fingerprint of the video to be extracted according to the first image feature vector.
[0125] In one embodiment, the first acquisition module 4100 is specifically configured to perform frame extraction processing on the video to be extracted according to a set frame extraction method to obtain a target image sequence; and obtain all the key frame images according to the target image sequence.
[0126] In one embodiment, the first acquisition module 4100 is specifically configured to perform grayscale processing on the target image sequence to obtain a grayscale image sequence; and obtain all the key frame images according to the grayscale image sequence.
[0127] In one embodiment, the first acquisition module 4100 is specifically used to acquire the image intensity of the inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence; wherein the initial value of i is 1, the first key frame image is the first frame image of the grayscale image sequence, the value of j is each integer from 2 to N, N is the total number of images in the grayscale image sequence, and i is less than or equal to N;
[0128] When the image intensity is greater than the intensity threshold, the difference area of the inter-frame difference image is obtained, and when the image intensity is less than or equal to the intensity threshold, the j-th frame image is discarded, j=j+1 is updated, and the step of obtaining the image intensity of the inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence is continued until j is N;
[0129] When the area of the difference region is greater than the area threshold, the time interval between the i-th key frame image and the j-th frame image is obtained, and when the area of the difference region is less than or equal to the area threshold, the j-th frame image is discarded, j=j+1 is updated, and the step of obtaining the image intensity of the inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence is continued until j is N;
[0130] When the time interval is greater than the time threshold, a first distance between the i-th key frame image and the j-th frame image is obtained, and when the time interval is less than or equal to the time threshold, the j-th frame image is discarded, j=j+1 is updated, and the step of obtaining the image intensity of the inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence is continued until j is N;
[0131] When the first distance is greater than the distance threshold, i=i+1 is updated, and the j-th frame image is used as the i-th key frame image, j=j+1 is updated, and the step of obtaining the image intensity of the inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence is continued; and when the first distance is less than or equal to the distance threshold, the j-th frame image is discarded, j=j+1 is updated, and the step of obtaining the image intensity of the inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence is continued until j is N.
[0132] In one embodiment, the apparatus 4000 further includes a storage module (not shown in the figure).
[0133] The storage module is used to store each of the first image feature vectors and its corresponding image label as a mapping data in a vector database.
[0134] In one embodiment, the apparatus 4000 further includes a third acquisition module and a determination module (neither of which are shown in the figure).
[0135] The third acquisition module is used to acquire the key frame image of the video to be compared;
[0136] The extraction module 4200 is further used to extract the image features of the key frame image of the video to be compared by using the preset image feature extraction model to obtain a second image feature vector;
[0137] A third acquisition module is further used to acquire the distance between the second image feature vector and the first image feature vector in the vector database;
[0138] The determination module is used to determine whether there are repeated segments between the video to be extracted and the video to be compared according to the distance.
[0139] According to this embodiment, since the image that is representative of the video content is the key frame image in the video, the preset image feature extraction model is used to extract only the image features of the key frame image in the video to be extracted to obtain the first image feature vector of the key frame image, and then the video fingerprint of the video to be extracted is obtained based on the first image feature vector. While ensuring the accuracy of video fingerprint extraction, the consumption of computing resources is reduced and the speed of video fingerprint extraction is improved.
[0140] <Equipment Embodiment>
[0141] Figure 5 FIG. 1 is a schematic diagram of the hardware structure of an electronic device according to an embodiment. Figure 5 As shown, the electronic device 5000 includes a processor 5100 and a memory 5200 .
[0142] The memory 5200 can be used to store executable computer instructions.
[0143] The processor 5100 can be used to execute the video fingerprint extraction method according to the method embodiment of the present disclosure under the control of the executable computer instructions.
[0144] The electronic device 5000 may be Figure 1 The electronic device 1000 shown may also be a device with other hardware structures, which is not limited here.
[0145] In another embodiment, the electronic device 5000 may include the above video fingerprint extraction device 4000 .
[0146] In one embodiment, each module of the above video fingerprint extraction device 4000 can be implemented by the processor 5100 running computer instructions stored in the memory 5200.
[0147] <Computer Readable Storage Medium>
[0148] The embodiment of the present disclosure further provides a computer-readable storage medium on which computer instructions are stored. When the computer instructions are executed by a processor, the video fingerprint extraction method provided by the embodiment of the present disclosure is executed.
[0149] The present disclosure may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.
[0150] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.
[0151] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0152] The computer program instructions for performing the operation of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be customized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.
[0153] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0154] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0155] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0156] The flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of an instruction, and the module, a program segment or a part of an instruction contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of the boxes in the block diagram and / or the flowchart can be implemented by a dedicated hardware-based system that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions. It is well known to those skilled in the art that it is equivalent to implement it by hardware, implement it by software, and implement it by combining software and hardware.
[0157] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes are obvious to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The choice of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the market, or to enable other ordinary skill in the art to understand the embodiments disclosed herein. The scope of the present disclosure is defined by the appended claims. .
Claims
1. A video fingerprint extraction method, characterized in that: The method comprises: Obtain key frame images in the video to be extracted; Extracting image features of the key frame image by using a preset image feature extraction model to obtain a first image feature vector corresponding to the key frame image; A video fingerprint of the video to be extracted is obtained according to the first image feature vector.
2. The method according to claim 1, characterized in that The step of obtaining a key frame image in a video to be extracted includes: Perform frame extraction processing on the video to be extracted according to a set frame extraction method to obtain a target image sequence; According to the target image sequence, all the key frame images are obtained.
3. The method according to claim 2, characterized in that The step of obtaining all the key frame images according to the target image sequence comprises: Performing grayscale processing on the target image sequence to obtain a grayscale image sequence; All the key frame images are obtained according to the grayscale image sequence.
4. The method according to claim 3, characterized in that The step of obtaining all the key frame images according to the grayscale image sequence comprises: Obtaining the image intensity of an inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence; wherein the initial value of i is 1, the first key frame image is the first frame image of the grayscale image sequence, the value of j is each integer from 2 to N, N is the total number of images in the grayscale image sequence, and i is less than or equal to N; When the image intensity is greater than the intensity threshold, the difference area of the inter-frame difference image is obtained, and when the image intensity is less than or equal to the intensity threshold, the j-th frame image is discarded, j=j+1 is updated, and the step of obtaining the image intensity of the inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence is continued until j is N; When the area of the difference region is greater than the area threshold, the time interval between the i-th key frame image and the j-th frame image is obtained, and when the area of the difference region is less than or equal to the area threshold, the j-th frame image is discarded, j=j+1 is updated, and the step of obtaining the image intensity of the inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence is continued until j is N; When the time interval is greater than the time threshold, a first distance between the i-th key frame image and the j-th frame image is obtained, and when the time interval is less than or equal to the time threshold, the j-th frame image is discarded, j=j+1 is updated, and the step of obtaining the image intensity of the inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence is continued until j is N; When the first distance is greater than the distance threshold, i=i+1 is updated, and the j-th frame image is used as the i-th key frame image, j=j+1 is updated, and the step of obtaining the image intensity of the inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence is continued; and when the first distance is less than or equal to the distance threshold, the j-th frame image is discarded, j=j+1 is updated, and the step of obtaining the image intensity of the inter-frame difference image between the i-th key frame image in the grayscale image sequence and the j-th frame image in the grayscale image sequence is continued until j is N.
5. The method according to claim 1, characterized in that The method further comprises: Each of the first image feature vectors and its corresponding image label is stored in a vector database as a mapping data.
6. The method according to claim 5, characterized in that The method further comprises: Obtain key frame images of the video to be compared; Extracting image features of the key frame image of the video to be compared by using the preset image feature extraction model to obtain a second image feature vector; Acquire the distance between the second image feature vector and the first image feature vector in the vector database; According to the distance, it is determined whether there are repeated segments between the video to be extracted and the video to be compared.
7. The method according to claim 1, characterized in that The method further comprises: Obtaining metadata information of the video to be extracted; Storing the metadata information in the DAMO business database; and, The metadata information is associated with a data identifier in the DAMO business database.
8. A video fingerprint extraction device, characterized in that: The device comprises: The first acquisition module is used to acquire the key frame image in the video to be extracted; An extraction module, used to extract the image features of the key frame image through a preset image feature extraction model to obtain a first image feature vector corresponding to the key frame image; The second acquisition module is used to obtain the video fingerprint of the video to be extracted according to the first image feature vector.
9. An electronic device, characterized in that: include: Memory for storing executable computer instructions; A processor, configured to execute the video fingerprint extraction method according to any one of claims 1 to 7 under the control of the executable computer instructions.
10. A computer-readable storage medium having computer instructions stored thereon, wherein the computer instructions are executed by a processor to execute the video fingerprint extraction method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Moving target detection method and device and electronic equipment
CN110751678A
Method and device for identifying key identifier in video, equipment and storage medium
CN111753762A
Video fingerprint generation method and device, video matching method and device and computer equipment
CN112560832A
Video fingerprint generation method, device, electronic equipment and storage medium
CN113722541A
Neural network model pre-training data processing method and device, storage medium and identification method
CN114708530A
Cited By
Video fingerprint processing method and device, electronic equipment and storage medium
CN121214294A
