Image retrieval method and device, equipment and storage medium
By performing portrait segmentation and mask processing on video images, the global features of the video background image are extracted and image database searches are performed, and the problem of difficulty in confirming whether the video background image is a white wall background image in the prior art is improved, and the search efficiency and reliability.
Patent Information
- Application Number
- CN202411429095.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-11
- Publication Date
- 2025-02-18
AI Technical Summary
The prior art is difficult to confirm whether the video background image is a white wall background image through retrieval, resulting in an increase in the trigger rate of the early warning system and a decrease in the accuracy rate.
By acquiring the video image and inputting it into a preset portrait segmentation model, obtaining the mask for the portrait and background area, modifying the mask to make the pixel value of the portrait area 0 and the pixel value of the background area 1, fusing the mask and video image to occlude Portrait area, extract the global features of the video background image and search through the image database to determine whether it is a white wall background image.
Effectively confirming whether the video background image is a white wall background image, improving the retrieval efficiency of the video background image and improving the reliability of the obtained video background image.
Smart Images

Figure CN119474433A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology and can be applied to the field of financial technology. In particular, the present invention relates to image retrieval methods, devices, equipment and storage media. Background Art
[0002] In the field of fraud detection, early warning systems use advanced image recognition and processing technology to deeply analyze image information from transactions, documents, and even surveillance videos, extracting subtle but key unique features to identify potential fraud.
[0003] However, white wall background images cannot provide these unique features. Therefore, white wall background images are not only unhelpful in identifying fraudulent behavior, but will increase the trigger rate of the early warning system and reduce the accuracy of the early warning. Therefore, how to confirm whether the video background image is a white wall background image through retrieval is an urgent problem to be solved. Summary of the invention
[0004] The present invention provides an image retrieval method, an apparatus, a computer device and a storage medium to solve the technical problem of how to confirm whether a video background image is a white wall background image by means of retrieval.
[0005] In a first aspect, an image retrieval method is provided, comprising:
[0006] Acquire a video image, input the video image into a preset portrait segmentation model, and acquire a mask output by the portrait segmentation model based on the video image, wherein the mask includes a portrait area and a background area;
[0007] The pixel value of the portrait area is set to 0, and the pixel value of the background area is set to 1, so as to obtain the modified mask;
[0008] Based on a preset fusion method, the modified mask and the video image are fused to obtain a video background image that blocks the portrait area;
[0009] Selecting the global feature of the video background image as the first global feature;
[0010] Obtaining a search request for the first global feature, and obtaining search information returned by a preset image database according to the search request;
[0011] When the search information meets the preset condition, it is determined that the video background image is a white wall background image stored in the image database.
[0012] Furthermore, the step of setting the pixel value of the portrait area to 0 and the pixel value of the background area to 1 to obtain the modified mask includes:
[0013] Reading a first modification instruction and a second modification instruction;
[0014] The pixel value of the portrait area is set to 0 through the first modification instruction, and the pixel value of the background area is set to 1 through the second modification instruction, so as to obtain the modified mask.
[0015] Furthermore, the modified mask and the video image are fused based on a preset fusion method to obtain a video background image that blocks the portrait area, including:
[0016] Acquire the modified pixel values of the mask and the pixel values of the video image;
[0017] The modified mask and the pixel value of the video image are multiplied by pixel-by-pixel multiplication, and a video background image that blocks the portrait area is created based on the multiplication result.
[0018] Furthermore, the selecting the global feature of the video background image as the first global feature includes:
[0019] Using a preset feature extraction network to extract features from the video background image, and obtain global features of the video background image;
[0020] The global feature of the video background image is selected as the first global feature.
[0021] Furthermore, the obtaining of the search request for the first global feature and obtaining the search information returned by the preset image database according to the search request include:
[0022] Packing the first global feature and the search instruction to generate a search request;
[0023] The preset retrieval interface of the image database is called to obtain the retrieval information returned after the retrieval interface executes the retrieval request.
[0024] Further, when the search information satisfies a preset condition, determining that the video background image is a white wall background image stored in the image database includes:
[0025] In the search information, obtaining the similarity between the first global feature and the second global feature of the white wall background image stored in the image database;
[0026] A connected area of the video background image is obtained, and the number of local blocks contained in the connected area is obtained. When the number of local blocks is less than a preset number, it is determined that the video background image is a white wall background image stored in the image database.
[0027] Further, when the search information satisfies a preset condition, after determining that the video background image is a white wall background image stored in the image database, the image search method includes:
[0028] The video background image is marked as an interference image.
[0029] In a second aspect, an image retrieval device is provided, comprising:
[0030] A first acquisition module is used to acquire a video image, input the video image into a preset portrait segmentation model, and acquire a mask output by the portrait segmentation model based on the video image, wherein the mask includes a portrait area and a background area;
[0031] A modification module, used for setting the pixel value of the portrait area to 0 and the pixel value of the background area to 1, so as to obtain the modified mask;
[0032] A fusion module, used for fusing the modified mask with the video image based on a preset fusion method to obtain a video background image that blocks the portrait area;
[0033] A selection module, used for selecting the global feature of the video background image as the first global feature;
[0034] A second acquisition module is used to obtain a search request for the first global feature, and obtain search information returned by a preset image database according to the search request;
[0035] The retrieval module is used to determine that the video background image is a white wall background image stored in the image database when the retrieval information meets a preset condition.
[0036] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned image retrieval method when executing the computer program.
[0037] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned image retrieval method are implemented.
[0038] The present application provides an image retrieval method, apparatus, computer equipment and storage medium, which obtain a video image, input the video image into a preset portrait segmentation model, obtain a mask output by the portrait segmentation model based on the video image, and the mask includes a portrait area and a background area; set the pixel value of the portrait area to 0, and set the pixel value of the background area to 1, to obtain the modified mask; based on a preset fusion method, fuse the modified mask with the video image to obtain a video background image that blocks the portrait area; select the global feature of the video background image as a first global feature; obtain a retrieval request for the first global feature, obtain a preset image database based on the global feature, and obtain the image background image of the preset image database according to the global feature. The retrieval information returned by the retrieval request; when the retrieval information meets the preset conditions, the video background image is determined to be the white wall background image stored in the image database. The beneficial effects are in two aspects. On the one hand, when the retrieval information meets the preset conditions, the video background image is determined to be the white wall background image stored in the image database, which solves the problem of how to confirm whether the video background image is a white wall background image by retrieval, which is beneficial to improving the retrieval efficiency of the video background image; on the other hand, the mask and the video image are merged to obtain the video background image that blocks the portrait area, which will not be affected by the portrait area, and therefore is beneficial to improving the reliability of the acquired video background image. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0040] Figure 1 is a schematic diagram of an application environment of an image retrieval method in one embodiment of the present invention;
[0041] Figure 2 A schematic diagram of a flow chart of an image retrieval method provided by an embodiment of the present invention;
[0042] Figure 3 yes Figure 2 A schematic flow chart of a specific implementation of step S23;
[0043] Figure 4 yes Figure 2 A schematic flow chart of a specific implementation of step S25;
[0044] Figure 5 yes Figure 2 A schematic flow chart of a specific implementation of step S26;
[0045] Figure 6 is a structural schematic diagram of an image retrieval device in one embodiment of the present invention;
[0046] Figure 7 is a schematic diagram of a structure of a computer device in one embodiment of the present invention;
[0047] Figure 8 It is another structural schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0049] See also Figure 1 , Figure 1 FIG. 1 is a schematic diagram of an application environment of an image retrieval method according to an embodiment of the present invention. The image retrieval method provided by the embodiment of the present invention can be applied in the following embodiments: Figure 1 In an application environment, a client communicates with a server through a network.
[0050] The server obtains a video image through the client, inputs the video image into a preset portrait segmentation model, and obtains a mask output by the portrait segmentation model based on the video image, wherein the mask includes a portrait area and a background area;
[0051] The pixel value of the portrait area is set to 0, and the pixel value of the background area is set to 1, so as to obtain the modified mask;
[0052] Based on a preset fusion method, the modified mask and the video image are fused to obtain a video background image that blocks the portrait area;
[0053] Selecting the global feature of the video background image as the first global feature;
[0054] Obtaining a search request for the first global feature, and obtaining search information returned by a preset image database according to the search request;
[0055] When the search information meets the preset condition, it is determined that the video background image is a white wall background image stored in the image database.
[0056] In the scheme implemented by the above-mentioned image retrieval method, device, equipment and medium, the beneficial effects lie in two aspects. On the one hand, when the retrieval information meets the preset conditions, it is determined that the video background image is the white wall background image stored in the image database, which solves the problem of how to confirm whether the video background image is a white wall background image by retrieval, which is beneficial to improving the retrieval efficiency of the video background image; on the other hand, the mask and the video image are merged to obtain the video background image that blocks the portrait area, which will not be affected by the portrait area, and is therefore beneficial to improving the reliability of the acquired video background image.
[0057] The device running the client is referred to as a client device.
[0058] The device running the server is referred to as the server device.
[0059] The client devices may include but are not limited to various personal computers, laptops, smart phones, tablet computers, and portable wearable devices.
[0060] The server device can be implemented with an independent task database or a task database cluster composed of multiple task databases. The present invention is described in detail below through specific embodiments.
[0061] See also Figure 2 , Figure 2 A flowchart of an image retrieval method provided by an embodiment of the present invention includes the following steps:
[0062] S21, acquiring a video image, inputting the video image into a preset portrait segmentation model, and acquiring a mask output by the portrait segmentation model based on the video image, wherein the mask includes a portrait area and a background area;
[0063] The mask is a two-dimensional array of the same size as the original image, in which each element has a specific value to identify whether it belongs to the portrait area or the background area.
[0064] Exemplarily, a video image is acquired, the video image is input into a preset portrait segmentation model, and a mask output by the portrait segmentation model based on the video image is acquired, wherein the mask includes a portrait area and a background area, including:
[0065] Connect to a target system, obtain a video image sent by the target system, input the video image into a preset portrait segmentation model, obtain a mask output by the portrait segmentation model based on the video image, wherein the mask includes a portrait area and a background area, and the target system includes an insurance system, a banking system, a financial system, or a combination thereof.
[0066] By collecting and analyzing video images, insurance systems, banking systems, and financial systems can more accurately verify user identities and prevent fraud.
[0067] For the sake of explanation, take the insurance system as an example.
[0068] In insurance claims scenarios, facial recognition technology can help the insurance system quickly identify people who have been involved in multiple accidents in a row, and further verify whether they deliberately caused the accident to defraud compensation, thereby effectively reducing risks and improving claims efficiency.
[0069] In the process of personal injury claims for auto insurance, when an accident occurs and causes injuries, the insurance system will collect video images of the injured to confirm their identities and use them as the basis for claims. This helps prevent fraud and ensure the accuracy and fairness of claims.
[0070] During the underwriting stage, the insurance system may collect video images of the insured for identity verification to prevent others from impersonating the insured. During the claims stage, by collecting and analyzing video images, the identity of the claimant can be further verified to ensure the legitimacy of the claim.
[0071] For the sake of explanation, take the banking system as an example.
[0072] In banking, the banking system can obtain the user's video image through the camera and compare it with the pre-registered image to verify the user's identity.
[0073] In order to ensure the safety of banks, banking systems will install surveillance cameras in business premises and ATMs to collect video images for real-time monitoring and post-event analysis. This helps to detect and prevent criminal activities in a timely manner and ensure the safety of customers and employees.
[0074] For the sake of explanation, let’s take the financial system as an example.
[0075] The financial system will collect video images of offices and data centers for real-time monitoring and post-analysis, so as to timely discover and prevent potential security risks and ensure the stable operation of the financial system.
[0076] Exemplarily, before S21, the image retrieval method further includes:
[0077] The Euclidean distances between a plurality of white wall background images are obtained, and the white wall background images having the Euclidean distances greater than a preset distance are added into the image database.
[0078] Among them, the white wall background images with the Euclidean distance greater than the preset distance are added to the image database. These white wall background images represent new features, which is beneficial to increase the diversity and coverage of the image database and improve the generalization ability of the image database.
[0079] S22, setting the pixel value of the portrait area to 0, and setting the pixel value of the background area to 1, to obtain the modified mask;
[0080] The step of setting the pixel value of the portrait area to 0 and the pixel value of the background area to 1 to obtain the modified mask includes:
[0081] Reading a first modification instruction and a second modification instruction;
[0082] The pixel value of the portrait area is set to 0 through the first modification instruction, and the pixel value of the background area is set to 1 through the second modification instruction, so as to obtain the modified mask.
[0083] The background area refers to the area other than the portrait area in a scene.
[0084] S23, based on a preset fusion method, fusing the modified mask with the video image to obtain a video background image that blocks the portrait area;
[0085] S24, selecting the global feature of the video background image as the first global feature;
[0086] Among them, the global features of the video background image refer to a set of abstract attributes displayed in the background part of the entire video frame, which can comprehensively describe the overall characteristics of the scene.
[0087] The global features of the video background image include but are not limited to average hue, color histogram distribution, and texture features.
[0088] The selecting the global feature of the video background image as the first global feature includes:
[0089] Using a preset feature extraction network to extract features from the video background image, and obtain global features of the video background image;
[0090] The global feature of the video background image is selected as the first global feature. The feature extraction network includes but is not limited to ResNet50 and feature pyramid network.
[0091] Among them, ResNet50, full name residual network 50 layers, is a deep learning model. The main feature of ResNet50 is its depth, with 50 layers of convolutional neural network, which enables it to learn more complex features, thereby improving the accuracy of recognition.
[0092] Exemplarily, a preset feature extraction network is used to extract features from the video background image to obtain global features of the video background image, including:
[0093] ResNet50 is used to extract features of the video background image to obtain a first feature vector, the first feature vector is input into an attention module, a second feature vector output by the attention module based on the first feature vector is obtained, and the second feature vector is selected as the first global feature.
[0094] Among them, the attention mechanism of the attention module can focus on the important part of a feature vector, thereby extracting a more useful second feature vector.
[0095] S25, obtaining a search request for the first global feature, and obtaining search information returned by a preset image database according to the search request;
[0096] S26, when the search information meets a preset condition, determining that the video background image is a white wall background image stored in the image database.
[0097] Wherein, after obtaining the search request of the first global feature and obtaining the search information returned by the preset image database according to the search request, the image search method includes:
[0098] When the search information meets a preset condition, determining that the video background image is a white wall background image stored in the image database;
[0099] When the search information does not meet the preset condition, it is determined that the video background image is not a white wall background image stored in the image database.
[0100] Among them, the white wall background image refers to the wall background that occupies the main visual space in the image, has a tone that is mainly pure white or close to pure white, and has no obvious patterns, textures or significant color changes.
[0101] Wherein, when the retrieval information satisfies the preset condition, after determining that the video background image is a white wall background image stored in the image database, the image retrieval method includes:
[0102] The video background image is marked as an interference image.
[0103] Among them, marking the video background image as an interference image can help the early warning system filter out these meaningless video background images, allowing the early warning system to focus more on analyzing video images with fraud characteristics. By reducing the processing of unnecessary interference images, the early warning system can more accurately capture the unique characteristics of fraudulent behavior, thereby improving the accuracy of early warnings and reducing false alarm rates.
[0104] In the embodiment of the present invention, the beneficial effects lie in two aspects. On the one hand, when the retrieval information meets the preset conditions, it is determined that the video background image is the white wall background image stored in the image database, which solves the problem of how to confirm whether the video background image is a white wall background image by retrieval, which is beneficial to improving the retrieval efficiency of the video background image; on the other hand, the mask and the video image are merged to obtain the video background image that blocks the portrait area, which will not be affected by the portrait area, and is therefore beneficial to improving the reliability of the acquired video background image.
[0105] See also Figure 3 , Figure 3 yes Figure 1 A specific implementation flow diagram of step S23 is described in detail as follows:
[0106] S31, obtaining the modified pixel values of the mask and the pixel values of the video image;
[0107] S32, multiplying the modified mask and the pixel value of the video image by pixel multiplication, and creating a video background image that blocks the portrait area based on the multiplication result.
[0108] Among them, pixel-by-pixel multiplication is an image processing technology. Through the pixel-by-pixel multiplication, the modified mask and the pixel value of the corresponding position in the video image are multiplied, and the video background image that blocks the portrait area is created through the multiplication result, which can eliminate the influence of the portrait area.
[0109] In an embodiment of the present invention, a video background image that blocks the portrait area is created through the multiplication result, and will not be affected by the portrait area, so that the retrieval process is more focused on the video background image, and the recognition accuracy and consistency of the video background image are improved, thereby significantly enhancing the reliability of the retrieval results of the obtained video background image.
[0110] See also Figure 4 , Figure 4 yes Figure 1 A specific implementation flow diagram of step S25 is described in detail as follows:
[0111] S41, packaging the first global feature and the search instruction to generate a search request;
[0112] S42, calling a preset search interface of the image database to obtain search information returned by the search interface after executing the search request.
[0113] Among them, the retrieval interface can achieve fast retrieval and accurate matching of massive data through efficient indexing technology and query algorithms.
[0114] In an embodiment of the present invention, a retrieval interface of a preset image database is called to obtain retrieval information returned by the retrieval interface after executing the retrieval request. Because the retrieval information directly obtained through the retrieval interface is optimized, the time and energy consumed by users in browsing a large amount of irrelevant information by themselves are reduced. This efficient retrieval information acquisition method not only saves a lot of manpower and material resources, but also significantly improves retrieval efficiency.
[0115] See also Figure 5 , Figure 5 yes Figure 1 A specific implementation flow diagram of step S26 is described in detail as follows:
[0116] S51, obtaining, from the search information, a similarity between the first global feature and a second global feature of a white wall background image stored in the image database;
[0117] S52, obtaining a connected area of the video background image, obtaining the number of local blocks contained in the connected area, and when the number of local blocks is less than a preset number, determining that the video background image is a white wall background image stored in the image database.
[0118] Among them, the preset number is set by the user or by system default.
[0119] Preferably, the preset number is 4.
[0120] The second global feature is a global feature of the white wall background image.
[0121] Exemplarily, after obtaining the similarity between the first global feature and the second global feature of the white wall background image stored in the image database in the search information, the image search further includes:
[0122] When the similarity is not greater than a preset value, it is determined that the video background image is not the white wall background image in the image database, the video background image is marked as an image to be processed, and the image to be processed is sent to an early warning system.
[0123] In an embodiment of the present invention, when the retrieval information meets the preset conditions, it is determined that the video background image is a white wall background image stored in the image database, which solves the problem of how to confirm whether the video background image is a white wall background image by retrieval, and is conducive to improving the retrieval efficiency of the video background image.
[0124] See also Figure 6 , Figure 6 FIG. 1 is a schematic diagram of a structure of an image retrieval device in one embodiment of the present invention. Figure 6As shown, the image retrieval device includes a first acquisition module 101, a modification module 102, a fusion module 103, a selection module 104, a second acquisition module 105, and a retrieval module 106. The functional modules are described in detail as follows:
[0125] A first acquisition module 101 is used to acquire a video image, input the video image into a preset portrait segmentation model, and acquire a mask output by the portrait segmentation model based on the video image, wherein the mask includes a portrait area and a background area;
[0126] A modification module 102, configured to set the pixel value of the portrait area to 0 and the pixel value of the background area to 1, so as to obtain the modified mask;
[0127] A fusion module 103 is used to fuse the modified mask with the video image based on a preset fusion method to obtain a video background image that blocks the portrait area;
[0128] A selection module 104, configured to select a global feature of the video background image as a first global feature;
[0129] A second acquisition module 105 is used to acquire a search request for the first global feature, and acquire search information returned by a preset image database according to the search request;
[0130] The retrieval module 106 is configured to determine that the video background image is a white wall background image stored in the image database when the retrieval information meets a preset condition.
[0131] In one embodiment, the modification module 102 includes:
[0132] A reading subunit, used for reading a first modification instruction and a second modification instruction;
[0133] The modification subunit is used to set the pixel value of the portrait area to 0 through the first modification instruction, and set the pixel value of the background area to 1 through the second modification instruction, so as to obtain the modified mask.
[0134] In one embodiment, the fusion module 103 includes:
[0135] An acquisition subunit, used for acquiring the pixel values of the modified mask and the pixel values of the video image;
[0136] The fusion subunit is used to multiply the modified mask and the pixel value of the video image by pixel multiplication, and create a video background image that blocks the portrait area based on the multiplication result.
[0137] In one embodiment, the selection module 104 includes:
[0138] An extraction subunit, used to extract features from the video background image using a preset feature extraction network to obtain global features of the video background image;
[0139] The selection subunit is used to select the global feature of the video background image as the first global feature.
[0140] In one embodiment, the second acquisition module 105 includes:
[0141] A generating subunit, used for packaging the first global feature and the search instruction to generate a search request;
[0142] The calling subunit is used to call the retrieval interface of the preset image database and obtain the retrieval information returned after the retrieval interface executes the retrieval request.
[0143] In one embodiment, the retrieval module 106 includes:
[0144] A retrieval subunit, configured to obtain, from the retrieval information, a similarity between the first global feature and a second global feature of the white wall background image stored in the image database;
[0145] The determination subunit is used to obtain the connected area of the video background image, obtain the number of local blocks contained in the connected area, and when the number of local blocks is less than a preset number, determine that the video background image is the white wall background image stored in the image database.
[0146] In one embodiment, the image retrieval device further includes:
[0147] The marking module is used to mark the video background image as an interference image.
[0148] In the embodiment of the present invention, the beneficial effects lie in two aspects. On the one hand, when the retrieval information meets the preset conditions, it is determined that the video background image is the white wall background image stored in the image database, which solves the problem of how to confirm whether the video background image is a white wall background image by retrieval, which is beneficial to improving the retrieval efficiency of the video background image; on the other hand, the mask and the video image are merged to obtain the video background image that blocks the portrait area, which will not be affected by the portrait area, and is therefore beneficial to improving the reliability of the acquired video background image.
[0149] For the specific definition of the image retrieval device, please refer to the definition of the image retrieval method above, which will not be repeated here.
[0150] Each module in the above-mentioned image retrieval device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module.
[0151] See also Figure 7 , Figure 7 is a schematic diagram of a computer device in one embodiment of the present invention. In one embodiment, a computer device is provided. The computer device may be a server device, and its internal structure diagram may be as shown in FIG. Figure 7 The computer device includes a processor, a memory, a network interface and a database connected through a system bus.
[0152] The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client through a network connection. When the computer program is executed by the processor, the functions or steps of an image retrieval method can be implemented on the server device.
[0153] See also Figure 8 , Figure 8 is another structural diagram of a computer device in one embodiment of the present invention. In one embodiment, a computer device is provided. The computer device may be a client device, and its internal structure diagram may be as shown in FIG. Figure 8 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external task database through a network connection. When the computer program is executed by the processor, the functions or steps of an image retrieval method can be implemented on the client device.
[0154] In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor.
[0155] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or computer device can refer to the relevant description in the aforementioned method embodiment. In order to avoid repetition, they will not be described one by one here.
[0156] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0157] The above description and accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent possible changes only. Unless explicitly required, separate components and functions are optional, and the order of operation may vary. Parts and subsamples of some embodiments may be included in or replace parts and subsamples of other embodiments. Moreover, the words used in this application are only used to describe the embodiments and are not used to limit the claims. As used in the description of the embodiments and claims, unless the context clearly indicates, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of listings containing one or more associated ones. In addition, when used in the present application, the term "comprise" and its variants "comprises" and / or comprising refer to the presence of a stated sub-sample, whole, step, operation, element, and / or component, but do not exclude the presence or addition of one or more other sub-samples, wholes, steps, operations, elements, components and / or groups of these. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the presence of other identical elements in the process, method or device comprising the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the various embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.
[0158] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. Technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present disclosure. Technicians can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0159] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some sub-samples can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.
[0160] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the embodiment 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 the code, and the module, the program segment or a part of the code 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, which can depend on the functions involved. In the description corresponding to the flowchart and the block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.
Claims
1. An image retrieval method, characterized in that: include: Acquire a video image, input the video image into a preset portrait segmentation model, and acquire a mask output by the portrait segmentation model based on the video image, wherein the mask includes a portrait area and a background area; The pixel value of the portrait area is set to 0, and the pixel value of the background area is set to 1, so as to obtain the modified mask; Based on a preset fusion method, the modified mask and the video image are fused to obtain a video background image that blocks the portrait area; Selecting the global feature of the video background image as the first global feature; Obtaining a search request for the first global feature, and obtaining search information returned by a preset image database according to the search request; When the search information meets the preset condition, it is determined that the video background image is a white wall background image stored in the image database.
2. The image retrieval method according to claim 1, characterized in that: The step of setting the pixel value of the portrait area to 0 and the pixel value of the background area to 1 to obtain the modified mask includes: Reading a first modification instruction and a second modification instruction; The pixel value of the portrait area is set to 0 through the first modification instruction, and the pixel value of the background area is set to 1 through the second modification instruction, so as to obtain the modified mask.
3. The image retrieval method according to claim 1, characterized in that: The step of fusing the modified mask with the video image based on a preset fusion method to obtain a video background image that blocks the portrait area includes: Acquire the modified pixel values of the mask and the pixel values of the video image; The modified mask and the pixel value of the video image are multiplied by pixel-by-pixel multiplication, and a video background image that blocks the portrait area is created based on the multiplication result.
4. The image retrieval method according to claim 1, characterized in that: The selecting the global feature of the video background image as the first global feature includes: Using a preset feature extraction network to extract features from the video background image, and obtain global features of the video background image; The global feature of the video background image is selected as the first global feature.
5. The image retrieval method according to claim 1, characterized in that: The step of obtaining the search request for the first global feature and obtaining the search information returned by the preset image database according to the search request includes: Packing the first global feature and the search instruction to generate a search request; The preset retrieval interface of the image database is called to obtain the retrieval information returned after the retrieval interface executes the retrieval request.
6. The image retrieval method according to claim 1, characterized in that: When the search information satisfies a preset condition, determining that the video background image is a white wall background image stored in the image database comprises: In the search information, obtaining the similarity between the first global feature and the second global feature of the white wall background image stored in the image database; A connected area of the video background image is obtained, and the number of local blocks contained in the connected area is obtained. When the number of local blocks is less than a preset number, it is determined that the video background image is a white wall background image stored in the image database.
7. The image retrieval method according to any one of claims 1 to 6, characterized in that: When the retrieval information satisfies the preset condition, after determining that the video background image is a white wall background image stored in the image database, the image retrieval method includes: The video background image is marked as an interference image.
8. An image retrieval device, characterized in that: include: A first acquisition module is used to acquire a video image, input the video image into a preset portrait segmentation model, and acquire a mask output by the portrait segmentation model based on the video image, wherein the mask includes a portrait area and a background area; A modification module, used for setting the pixel value of the portrait area to 0 and the pixel value of the background area to 1, so as to obtain the modified mask; A fusion module, used for fusing the modified mask with the video image based on a preset fusion method to obtain a video background image that blocks the portrait area; A selection module, used for selecting the global feature of the video background image as the first global feature; A second acquisition module is used to obtain a search request for the first global feature, and obtain search information returned by a preset image database according to the search request; The retrieval module is used to determine that the video background image is a white wall background image stored in the image database when the retrieval information meets a preset condition.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the image retrieval method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the image retrieval method according to any one of claims 1 to 7 are implemented.