Image search method and apparatus, device, and storage medium
By decomposing the image into contour groups in image search and gradually loading it, the problem of excessive storage space occupied by image search in the prior art is solved, and more efficient storage resource utilization and search performance improvement is achieved.
Patent Information
- Application Number
- PCT/CN2024/109731
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-09-28
- Filing Date
- 2024-08-05
- Publication Date
- 2025-04-03
AI Technical Summary
Existing image search methods require the loading of the entire image in the outline search unit, resulting in excessive storage space, especially when the image resolution is high.
By determining the contour group to be loaded in the image and performing contour point search in the contour search unit, we can judge in real time whether a new contour group needs to be loaded, and gradually refresh the storage space of the contour search unit.
The storage space occupation of the contour search unit is reduced, storage resources are saved, and the overall performance of image search is improved.
Smart Images

Figure CN2024109731_03042025_PF_FP_ABST
Abstract
Description
Image search method, device, equipment and storage medium
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on September 28, 2023, with application number 2023112817614 and application name “Image Search Method, Device, Equipment and Storage Medium”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of computer technology, specifically to the field of artificial intelligence technology, and in particular to an image search method, apparatus, device, and storage medium. Background Art
[0003] With the development of computer technology, image search technology has been proposed. This so-called image search technology is a technique for searching for the contours of objects within an image. In existing image search methods, the image to be searched is typically loaded into a contour search unit, which is then called to search for contour points in the loaded image to obtain the contours of the objects within the corresponding image. This method of image search requires loading the entire image into the contour search unit, which consumes a large amount of storage space. This problem is particularly prominent when the image resolution is high.
[0004] Summary of the Invention
[0005] The embodiments of the present application provide an image search method, apparatus, device, and storage medium, which can reduce the storage space occupied by a contour search unit and save storage resources.
[0006] In one aspect, an embodiment of the present application provides an image search method, the method comprising:
[0007] After determining a contour group to be loaded in the image, obtaining the corresponding contour group and loading it into a contour search unit to refresh the storage space of the contour search unit; wherein the currently loaded contour group includes: a first contour block and N second contour blocks, where N is a positive integer; the N second contour blocks include contour blocks located in N neighborhoods of the first contour block, where one neighborhood corresponds to one motion direction; the area where the N second contour blocks are located is a prediction area, and the contour blocks are image blocks divided from the image;
[0008] calling the contour search unit to search for contour points in the currently loaded contour group, starting from the first contour block and based on the N motion directions;
[0009] Each time a contour point is found, the current motion direction of the contour is determined based on the currently found contour point; and the confidence level of the current motion direction at the current moment is obtained; any confidence level is used to indicate the probability of continuing to search for contour points along the corresponding motion direction;
[0010] If the current motion direction falls within the prediction area and the confidence level of the current motion direction at the current moment is greater than or equal to a threshold, determining a contour group to be loaded in the image;
[0011] The above process is iteratively performed until an end search event of the image is detected, and the contour of the image is determined according to each contour point searched by the contour search unit.
[0012] On the other hand, an embodiment of the present application provides an image search device, comprising:
[0013] an acquisition unit configured to, after determining a contour group to be loaded in the image, acquire the corresponding contour group and load it into the contour search unit to refresh the storage space of the contour search unit; wherein the currently loaded contour group includes: a first contour block and N second contour blocks, where N is a positive integer; the N second contour blocks include contour blocks located in N neighborhoods of the first contour block, where one neighborhood corresponds to one motion direction; the area where the N second contour blocks are located is a prediction area, and the contour blocks are image blocks divided from the image;
[0014] a processing unit, configured to call the contour search unit to search for contour points in the currently loaded contour group, starting from the first contour block and based on the N motion directions;
[0015] The processing unit is further configured to determine a current motion direction of the contour based on the currently searched contour point each time a contour point is found; and obtain a confidence level of the current motion direction at the current moment; wherein any confidence level is used to indicate a probability of continuing to search for contour points along the corresponding motion direction;
[0016] The processing unit is further configured to determine a contour group to be loaded in the image if the current motion direction falls within the prediction area and a confidence level of the current motion direction at a current moment is greater than or equal to a threshold;
[0017] The above process is iteratively performed until the processing unit detects an end event of searching the image, and the contour of the image is determined according to each contour point searched by the contour search unit.
[0018] In another aspect, an embodiment of the present application provides a computer device, the computer device including an input interface and an output interface, and the computer device further including:
[0019] processors and computer storage media;
[0020] The processor is suitable for implementing one or more instructions, the computer storage medium stores one or more instructions, and the one or more instructions are suitable for being loaded by the processor and executing the above-mentioned image search method.
[0021] On the other hand, an embodiment of the present application provides a computer storage medium, which stores one or more instructions, and the one or more instructions are suitable for being loaded by a processor and executing the above-mentioned image search method.
[0022] On the other hand, an embodiment of the present application provides a computer program product, which includes a computer program stored in a computer storage medium; a processor of a computer device reads the computer program from the computer storage medium, and the processor executes the computer program, so that the computer device performs the above-mentioned image search method.
[0023] In an embodiment of the present application, in the process of searching for the contour of an image, the image is not directly loaded into the contour search unit. Instead, a contour group consisting of multiple image blocks divided from the image is loaded. In the process of calling the contour search unit to search for contour points in the currently loaded contour group, each time a contour point is searched, it is determined in real time whether the contour search unit needs to load a new contour group, so that the image can be continuously loaded into the contour search unit in the form of contour groups to refresh the storage space of the contour search unit and search until the contour of the image is obtained; this ensures that in the process of searching for the contour of the image based on the contour search unit, only a storage space of the size of a contour group is always occupied in the storage space of the contour search unit. Compared with loading the image in the contour search unit, the storage space occupied by the contour search unit can be reduced and the storage resources of the contour search unit can be saved.
[0024] Moreover, in the process of determining whether a new contour group needs to be loaded each time a contour point is searched, the probability of continuing to search for contour points along the current motion direction can be predicted for the contour point currently searched based on the current motion direction of the contour. Based on the predicted probability of continuing to search for contour points along the current motion direction, it can be accurately determined in real time whether a new contour group needs to be loaded, and when it is determined that a new contour group needs to be loaded, the contour group to be loaded can be determined, and then the contour group to be loaded can be pre-fetched, thereby hiding the storage time required for loading the contour group and improving the overall search performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] FIG1a is a schematic diagram of a structure of four neighborhoods provided in an embodiment of the present application;
[0026] FIG1b is a schematic diagram of the structure of an 8-neighborhood provided in an embodiment of the present application;
[0027] FIG1c is a schematic diagram of the structure of a D neighborhood provided in an embodiment of the present application;
[0028] FIG1d is a schematic diagram of an image area corresponding to a currently loaded contour group provided in an embodiment of the present application;
[0029] FIG1e is a schematic diagram of an interaction between a terminal and a server provided in an embodiment of the present application;
[0030] FIG2 is a flow chart of an image search method provided in an embodiment of the present application;
[0031] FIG3 is a schematic diagram of determining the current motion direction of a profile provided by an embodiment of the present application;
[0032] FIG4 is a flow chart of another image search method provided in another embodiment of the present application;
[0033] FIG5a is a schematic diagram of determining a profile group to be loaded according to an embodiment of the present application;
[0034] FIG5 b is a schematic diagram of another method for determining a profile group to be loaded provided by an embodiment of the present application;
[0035] FIG6 is a schematic structural diagram of an image search device provided in an embodiment of the present application;
[0036] FIG7 is a schematic structural diagram of another image search device provided in an embodiment of the present application;
[0037] FIG8 is a schematic structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0038] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application.
[0039] The embodiments of the present application relate to computer vision technology (CV) in the field of artificial intelligence (AI). Among them, artificial intelligence is the theory, method, technology and application system of using digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. Computer vision is a science that studies how to make machines "see". More specifically, it refers to machine vision such as using cameras and computers to replace human eyes to identify and measure targets, and further perform graphic processing so that the computer processing becomes an image that is more suitable for human eye observation or transmission to instrument detection; it generally includes image processing, image recognition, image semantic understanding, image retrieval, OCR (optical character recognition), video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D (3D) technology, virtual reality, augmented reality, simultaneous positioning and map construction, etc., and also includes common biometric recognition technologies such as face recognition and fingerprint recognition.
[0040] An embodiment of the present application provides an image search solution based on the above-mentioned computer vision technology, which can reduce the storage space occupied by a contour search unit and save the storage resources of the contour search unit on the basis of searching for the image contour (i.e., the contour of the object in the image); wherein the contour of the object in the image refers to: a curve formed by the pixel points of the edge (or boundary) of the object in the image; the image search solution can generally include the following processes: after determining the contour group to be loaded in the image, obtaining the corresponding contour group and loading it into the contour search unit to refresh the storage space of the contour search unit; calling the contour search unit to search for contour points in the currently loaded contour group, where the currently loaded contour group includes multiple image blocks divided from the image; each time a contour point is searched, it is determined whether the contour search unit needs to load a new contour group, and if it is determined that the contour search unit needs to load a new contour group, the contour group to be loaded is determined in the image; the above process is iteratively executed until an end search event of the image is detected, and the contour of the image is determined based on each contour point searched by the contour search unit.
[0041] Among them, the images mentioned above can be images of any format, such as images in picture format, images in video frame format, etc.; the contour search unit can be used to execute relevant processing logic for image search, for example, it can be used to search for contour points in the contour group to obtain contour points, and contour points are pixel points in the image that can be used to represent the contour. Refreshing the storage space of the contour search unit means that the currently loaded contour group will replace the contour group in the storage space of the contour search unit that was last loaded. This means that in the process of searching for the contour of the image based on the contour search unit, only a storage space the size of a contour group is always occupied in the storage space of the contour search unit. Compared with loading the image in the contour search unit, the storage space occupied by the contour search unit can be reduced and the storage resources of the contour search unit can be saved. Moreover, in the process of judging whether the contour search unit needs to load a new contour group each time a contour point is searched, the probability of continuing to search for contour points along the current movement direction can be predicted for the currently searched contour point based on the current movement direction of the contour. Based on the predicted probability of continuing to search for contour points along the current movement direction, it can be accurately judged in real time whether a new contour group needs to be loaded. When it is judged that a new contour group needs to be loaded, the contour group to be loaded is determined, and then the contour group to be loaded can be pre-fetched, hiding the storage time required for loading the contour group, thereby improving the overall search performance.
[0042] Among them, the currently loaded contour group may include: a first contour block and N second contour blocks, where N is a positive integer; the N second contour blocks include contour blocks located in N neighborhoods of the first contour block, one neighborhood corresponds to one motion direction, and the area where the N second contour blocks are located is a prediction area. The contour block refers to an image block divided from an image.
[0043] Taking pixels as an example, according to the different adjacency relationships between pixels, they can usually be divided into 4-neighborhoods, 8-neighborhoods, D-neighborhoods, etc. Referring to Figure 1a, a schematic diagram of a 4-neighborhood structure provided in an embodiment of the present application is shown, where the four pixels to the right (e.g., labeled 0), above (e.g., labeled 1), left (e.g., labeled 2), and below (e.g., labeled 3) of the pixel point P are used as the 4-neighborhood of the pixel point P; one neighborhood corresponds to one motion direction, and 4 neighborhoods correspond to 4 motion directions, with the 1st to 4th motion directions being: right, above, left, and below. Refer to Figure 1b, which is a structural diagram of an 8-neighborhood provided in an embodiment of the present application, in which the 8 pixel points having an adjacent relationship with the pixel point P, namely the right (such as labeled 0), upper right (such as labeled 1), top (such as labeled 2), upper left (such as labeled 3), left (such as labeled 4), lower left (such as labeled 5), bottom (such as labeled 6), and lower right (such as labeled 7) are used as the 8-neighborhood of the pixel point P; one neighborhood corresponds to one motion direction, and there are 8 motion directions corresponding to the 8 neighborhoods. The 1st to 8th motion directions are respectively: right, upper right, top, upper left, left, lower left, bottom, and lower right. See Figure 1c, which is a structural diagram of a D neighborhood provided in an embodiment of the present application. The four pixel points of the upper right (such as labeled 1), upper left (such as labeled 3), lower left (such as labeled 5), and lower right (such as labeled 7) that have an adjacent relationship with the pixel point P are used as the D area of the pixel point P; one neighborhood corresponds to one motion direction, and there are four motion directions corresponding to the D neighborhood. The first to fourth motion directions are: upper right, upper left, lower left, and lower right. It should be noted that the image search method provided in the embodiment of the present application has a wide range of versatility and can be applied to contour searches of any neighborhood including but not limited to 4 neighborhoods, 8 neighborhoods, and D neighborhoods; the complexity can be flexibly adapted according to actual applications. The embodiment of the present application does not limit the specific neighborhoods involved. For the sake of convenience, the embodiment of the present application will be described using the 8 neighborhood as an example.
[0044] 1d , a schematic diagram of an image region corresponding to a currently loaded contour group is shown, wherein a first contour block may be indicated by a mark 100 , and the coordinates of its center point may be indicated by a mark 101 . The eight second contour blocks located in the eight neighborhoods of the first contour block correspond to eight motion directions, namely right, upper right, upper, upper left, left, lower left, lower, and lower right, respectively. The region where the eight second contour blocks are located is a prediction region, and the region where the first contour block, such as the mark 100 , is located may be adaptively referred to as a calculation region. The size of the contour block may be configured according to specific requirements, and is not limited in the embodiment of the present application. For example, if the corresponding requirements indicate that a contour block is composed of m*n tiles (a TILE is the smallest image block defined, and the resolution is k*k), the size of the adaptive contour block may be (m*k)*(n*k), i.e., the length of the contour block is (m*k) and the width is (n*k), wherein m, n, and k may all be configured according to specific requirements.
[0045] Based on the above description of the currently loaded contour group, the above image search scheme is described in more detail below: after determining the contour group to be loaded in the image, the corresponding contour group is obtained and loaded into the contour search unit to refresh the storage space of the contour search unit; the contour search unit is called to search for contour points in the currently loaded contour group, starting from the first contour block, based on N motion directions; each time a contour point is found, the current motion direction of the contour is determined based on the currently searched contour point; and the confidence of the current motion direction at the current moment is predicted, and any confidence is used to indicate: the probability of continuing to search for contour points along the corresponding motion direction; if the current motion direction falls within the prediction area and the confidence of the current motion direction at the current moment is greater than or equal to a threshold, the contour group to be loaded is determined in the image; the above process is iteratively performed until an end search event of the image is detected, and the contour of the image is determined based on each contour point searched by the contour search unit; that is, if the current motion direction falls within the prediction area and the confidence of the current motion direction at the current moment is greater than or equal to a threshold, it is considered that the contour search unit needs to load a new contour group.
[0046] In a specific implementation, the above-mentioned image search solution can be executed by a computer device, which can be a terminal or a server, that is, the above-mentioned image search solution can be executed by the terminal or the server. Alternatively, the above-mentioned image search solution can also be executed jointly by the terminal and the server. Taking the contour search unit being deployed in the server as an example, the terminal device can obtain the corresponding contour group after determining the contour group to be loaded in the image, and send the obtained contour group to the server. The server loads the received contour group into the contour search unit to refresh the storage space of the contour search unit; calls the contour search unit to search for contour points in the currently loaded contour group, starting from the first contour block, based on N motion directions; each time a contour point is searched, the current motion direction of the contour is determined based on the currently searched contour point; and the confidence of the current motion direction at the current moment is obtained; if the current motion direction falls within the prediction area and the confidence of the current motion direction at the current moment is greater than or equal to the threshold, the terminal is requested to send a new contour group. In response to the request of the server, the terminal can determine the contour group to be loaded in the image to obtain the corresponding contour group, and send the obtained contour group to the server; it iterates the above process until the server detects the end search event of the image, determines the contour of the image according to the various contour points searched by the contour search unit, and returns the contour of the image to the terminal; this process can be illustrated by Figure 1e.
[0047] The aforementioned terminals may include smartphones, computers (such as tablets, laptops, and desktop computers), smart wearable devices (such as smart watches and smart glasses), intelligent voice interaction devices, smart home appliances (such as smart TVs), in-vehicle terminals, or aircraft. Furthermore, the aforementioned servers may be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDNs (Content Delivery Networks), and big data and artificial intelligence platforms. Furthermore, the terminals and servers may be located within or outside the blockchain network, without limitation. Furthermore, the terminals and servers may upload any internally stored data to the blockchain network for storage, thereby preventing tampering with the internally stored data and enhancing data security.
[0048] The collection and processing of relevant data (such as profile groups, etc.) in this application should be strictly in accordance with the requirements of laws and regulations when applied in practice, and the informed consent or separate consent of the personal information subject should be obtained. Subsequent data use and processing should be carried out within the scope of authorization of laws and regulations and the personal information subject.
[0049] Based on the above description, an embodiment of the present application provides an image search method. Referring to FIG. 2 , which is a flow chart of an image search method provided by an embodiment of the present application, taking the image search method executed by a computer device as an example, the image search method may include the following steps S201-S205:
[0050] S201 : After determining a contour group to be loaded in an image, obtain the corresponding contour group and load it into a contour search unit to refresh the storage space of the contour search unit.
[0051] The currently loaded contour group includes: a first contour block and N second contour blocks, where N is a positive integer; the N second contour blocks include contour blocks located in N neighborhoods of the first contour block, one neighborhood corresponds to one motion direction, the area where the N second contour blocks are located is a prediction area, and a contour block refers to an image block divided from an image; the embodiments of the present application are subsequently explained using 8 neighborhoods as an example, one neighborhood corresponds to one motion direction, and 8 neighborhoods correspond to 8 motion directions, the first to eighth motion directions being: right, upper right, upper, upper left, left, lower left, lower, and lower right. Refreshing the storage space of the contour search unit means that the currently loaded contour group replaces the contour group last loaded into the storage space of the contour search unit. This ensures that during the process of searching for the contour of the image based on the contour search unit, only one contour group-sized storage space is always occupied in the storage space of the contour search unit. Compared with loading the image into the contour search unit, this can reduce the storage space occupied by the contour search unit and save storage resources of the contour search unit.
[0052] In a scenario where a computer device needs to search for the contour of an image; in a feasible embodiment, the computer device may obtain the image from the data source that provides the image, and store the image in another storage space that is different from the storage space of the contour search unit. After each time the contour group to be loaded is determined, the corresponding contour group is obtained from the other storage space and loaded into the contour search unit to refresh the storage space of the contour search unit; optionally, the other storage space may be a local storage space of the computer device, or a remote storage space located outside the computer device, which may be selected according to specific needs, and the embodiment of the present application does not limit it. In another feasible embodiment, the computer device may not obtain the image, but instead obtain the corresponding contour group from the data source that provides the image and load it into the contour search unit to refresh the storage space of the contour search unit after each time the contour group to be loaded is determined; compared with the above-mentioned method in which the computer device obtains the image and stores it in the local storage space, this method can also reduce the occupation of the local storage space of the computer device and save the local storage resources of the computer device.
[0053] S202 , calling a contour search unit to search for contour points in the currently loaded contour group, starting from the first contour block, based on N motion directions.
[0054] In a feasible embodiment, when the computer device calls the contour search unit to search for contour points based on N motion directions, the contour point currently searched can be based on the contour point searched last time and the N motion directions; that is, during the current search, the pixel points adjacent to the N motion directions of the contour point searched last time can be searched, that is, the N neighborhoods of the contour point searched last time can be searched to obtain the contour point. It is worth noting that if the currently loaded contour group is the first contour group in the image loaded into the contour search unit, then in the currently loaded contour group, starting from the first contour block, in the process of searching for contour points based on N motion directions, it is necessary to first determine the starting contour point from the first contour block, and the starting contour point can be used as the contour point searched last time to continue the contour point search. There are many mature implementation methods for the contour point search process, which can be selected according to specific needs, and the embodiments of the present application do not impose any restrictions.
[0055] S203 , each time a contour point is searched, the current moving direction of the contour is determined based on the currently searched contour point; and the confidence level of the current moving direction at the current moment is obtained.
[0056] Among them, the current movement direction means: the direction in which the contour point searched last time points to the contour point searched currently, and the current movement direction is one of N movement directions; refer to Figure 3, which is a schematic diagram of determining the current movement direction of a contour provided in an embodiment of the present application. If the contour of the image is as shown in the shaded part in Figure 3, if the contour point currently searched is as shown by mark 301, and the contour point searched last time is as shown by mark 302, the contour searched by the end of the current search can be as shown by mark 303, and the direction from the contour point searched last time as shown by mark 302 to the contour point currently searched as shown by mark 301 is "down", then the current movement direction of the contour is "down".
[0057] Among them, any confidence level is used to indicate the probability of continuing to search for contour points along the corresponding motion direction. The greater the probability of continuing to search for contour points along a certain motion direction, the greater the possibility of finding contour points by continuing to search along this motion direction, and also the greater the possibility that the contour moves in this motion direction after a certain contour point. The confidence level of the current motion direction at the current moment is used to indicate the probability of continuing to search for contour points along the current motion direction at the next moment after the current moment (i.e., the next search moment). For example, if the current motion direction is "down", the probability of continuing to search for contour points along the "down" motion direction at the next moment after the current moment can indicate the possibility of finding contour points by searching along the "down" motion direction in the next search.
[0058] S204: If the current motion direction falls within the prediction area and the confidence level of the current motion direction at the current moment is greater than or equal to the threshold, a contour group to be loaded is determined in the image.
[0059] In a feasible embodiment, the computer device can determine whether the current motion direction falls into the prediction area based on the currently searched contour point. When the currently searched contour point falls into the prediction area, the current motion direction is determined to fall into the prediction area; otherwise, the current motion direction is determined not to fall into the prediction area. Wherein, when the confidence of the current motion direction at the current moment is greater than or equal to the threshold, it can be indicated that it is predicted that the contour point will continue to be searched along the current motion direction at the next moment, and it can also be indicated that the contour is predicted to continue to move in the current motion direction after the currently searched contour point. Since the search for contour points starts from the first contour block, if the current motion direction falls into the prediction area and it is predicted that the search for contour points will continue along the current motion direction at the next moment, it can be indicated that the search trend of the predicted contour point is to search away from the first contour block, that is, it is predicted that the search in the first contour block of the currently loaded contour group has ended, and therefore the contour group to be loaded can be re-determined to obtain the corresponding contour group to be loaded into the contour search unit, so that the search for contour points can be continued from the first contour block of the newly loaded contour group.
[0060] S205 , iteratively executing the above process until an image search end event is detected, and determining the contour of the image based on each contour point searched by the contour search unit.
[0061] Among them, iterating the above process means: iteratively executing the above steps S201-S204; that is, jumping to step S201 again, and executing steps S201, S202, S203 and S204 in sequence. The end search event of the image can be: an event that can indicate the end of the search for the image; for example, the end search event can be: the contour point currently searched is the same contour point as the starting contour point, and the contour point search starts from the starting contour point and returns to the starting contour point. The computer device can end the search for the image when it detects that the contour point currently searched is the same contour point as the starting contour point, and determine the contour of the image based on the contour points searched by the contour search unit; for example, the end search event can be: no contour point is found when the next search is performed based on the contour point currently searched; there are many mature implementation methods for determining the end of the contour point search process, which can be selected according to specific needs, and the embodiments of the present application do not limit it.
[0062] In an embodiment of the present application, in the process of searching for the contour of an image, the image is not directly loaded into the contour search unit. Instead, a contour group consisting of multiple image blocks divided from the image is loaded. In the process of calling the contour search unit to search for contour points in the currently loaded contour group, each time a contour point is searched, it is determined in real time whether the contour search unit needs to load a new contour group, so that the image can be continuously loaded into the contour search unit in the form of contour groups to refresh the storage space of the contour search unit and search until the contour of the image is obtained; this ensures that in the process of searching for the contour of the image based on the contour search unit, only a storage space of the size of a contour group is always occupied in the storage space of the contour search unit. Compared with loading the image in the contour search unit, the storage space occupied by the contour search unit can be reduced and the storage resources of the contour search unit can be saved.
[0063] Moreover, in the process of determining whether a new contour group needs to be loaded each time a contour point is searched, the probability of continuing to search for contour points along the current motion direction can be predicted for the contour point currently searched based on the current motion direction of the contour. Based on the predicted probability of continuing to search for contour points along the current motion direction, it can be accurately determined in real time whether a new contour group needs to be loaded, and when it is determined that a new contour group needs to be loaded, the contour group to be loaded can be determined, and then the contour group to be loaded can be pre-fetched, thereby hiding the storage time required for loading the contour group and improving the overall search performance.
[0064] Based on the above description, the present embodiment provides another image search method. Referring to FIG4 , there is shown a flowchart of another image search method provided by the present embodiment. Taking the image search method executed by a computer device as an example, the image search method may include the following steps S401-S406:
[0065] S401 : After determining a contour group to be loaded in an image, obtain the corresponding contour group and load it into a contour search unit to refresh the storage space of the contour search unit.
[0066] Among them, the currently loaded contour group includes: a first contour block and N second contour blocks, N is a positive integer; the N second contour blocks include contour blocks located in N neighborhoods of the first contour block, one neighborhood corresponds to one motion direction, the area where the N second contour blocks are located is a prediction area, and a contour block refers to an image block divided from an image; the embodiment of the present application is subsequently explained using 8 neighborhoods as an example, one neighborhood corresponds to one motion direction, and 8 neighborhoods correspond to 8 motion directions, and the 1st to 8th motion directions are respectively: right, upper right, upper, upper left, left, lower left, lower, and lower right 8 motion directions; the relevant process of step S401 is similar to the relevant process of the above-mentioned step S201, and will not be repeated here.
[0067] S402 : calling a contour search unit to search for contour points in the currently loaded contour group, starting from the first contour block, based on N motion directions.
[0068] The process of step S402 is similar to that of step S202, and will not be described in detail here.
[0069] S403 : Whenever a contour point is found, the current moving direction of the contour is determined based on the currently found contour point; and the confidence level of the current moving direction at the current moment is obtained.
[0070] The current motion direction refers to the direction in which the contour point found in the last search points to the contour point found in the current search, and the current motion direction is one of N motion directions. Any confidence level indicates the probability of continuing to search for contour points along the corresponding motion direction. The greater the probability of continuing to search for contour points along a certain motion direction, the greater the possibility of finding contour points by continuing to search along that motion direction, and the greater the possibility that the contour will move in that motion direction after a certain contour point. The confidence level of the current motion direction at the current moment indicates the probability of continuing to search for contour points along the current motion direction at the next moment after the current moment (i.e., the next search moment). For example, if the current motion direction is "down," the probability of continuing to search for contour points along the "down" motion direction at the next moment after the current moment indicates the probability of finding contour points by searching along the "down" motion direction in the next search.
[0071] In a feasible embodiment, when a computer device obtains the confidence of the current motion direction at the current moment, the following steps may be performed: determining the motion direction at the previous moment and obtaining the confidence of the current motion direction at the previous moment; wherein the previous moment refers to the moment when the contour point was last searched; performing a consistency check on the motion direction at the previous moment and the current motion direction, and predicting the confidence of the current motion direction at the current moment based on the consistency check result and the confidence of the current motion direction at the previous moment. wherein the motion direction at the previous moment refers to the direction in which the contour point last searched points to the contour point last searched; it is worth noting that if the currently loaded contour group is the first contour group in the image loaded into the contour search unit, and if the current search is a contour point search performed using the starting contour point as the contour point last searched, the current motion direction, i.e., the direction in which the starting contour point points to the contour point currently searched, the motion direction at the previous moment in this case may be the initial motion direction, which may be pre-configured according to specific needs. It can be seen that this method can comprehensively consider two factors: whether the movement direction at the previous moment is consistent with the current movement direction, and the confidence of the current movement direction at the current moment, to predict the confidence of the current movement direction at the current moment, which can improve the accuracy of the confidence prediction.
[0072] Regarding the process of predicting the confidence of the current motion direction at the current moment based on the consistency check result and the confidence of the current motion direction at the previous moment by a computer device, in a feasible implementation method, the computer device can call the target confidence prediction model to perform confidence prediction based on the position coordinates of the contour point currently searched to obtain a predicted value; and calibrate the predicted value based on the consistency check result and the confidence of the current motion direction at the previous moment to obtain the confidence of the current motion direction at the current moment. It can be seen that in this way, in the process of confidence prediction, the target confidence prediction model can be introduced to increase the randomness and diversity of confidence, and avoid the situation where the confidence of the current motion direction at each moment remains unchanged due to the continuous invariance of the motion direction. Among them, the target confidence prediction model can be a probability model (i.e., probability distribution function) selected according to specific needs, for example, a normal distribution function, a uniform distribution function, a Bernoulli distribution function and other probability distribution functions can be selected. The computer device calibrates the predicted value based on the consistency check result and the confidence of the current motion direction at the previous moment. When obtaining the confidence of the current motion direction at the current moment, the following steps can be performed: If the consistency check result is a result that passes the consistency check, then the confidence of the current motion direction at the previous moment and the predicted value are summed to obtain the confidence of the current motion direction at the current moment; if the consistency check result is a result that fails the consistency check, then the confidence of the current motion direction at the previous moment and the predicted value are differenced to obtain the confidence of the current motion direction at the current moment. In an optional embodiment, if the consistency check result is a result that passes the consistency check, the predicted value can also be used as the confidence of the current motion direction at the current moment.
[0073] Among them, the result of passing the consistency check indicates that the current movement direction is the same as the movement direction at the previous moment, that is, the current movement direction and the movement direction at the previous moment are the same direction, and the result of failing the consistency check indicates that the current movement direction and the movement direction at the previous moment are different, that is, the current movement direction and the movement direction at the previous moment are different directions; optionally, when summing the confidence and the predicted value of the current movement direction at the previous moment, the summation operation can be performed by direct summation, weighted summation, etc., wherein the corresponding weights when using the weighted summation method can be set according to specific needs, and the embodiments of the present application are not limited thereto. The embodiments of the present application will subsequently use the direct summation method. The following is explained using the summation method as an example; similarly, when performing difference calculation on the confidence and predicted value of the current motion direction at the previous moment, direct difference calculation, weighted difference calculation, etc. can also be used for difference calculation. The embodiments of the present application are not limited thereto. The embodiments of the present application will be explained later using the direct difference method as an example. In one exemplary implementation, the difference obtained by subtracting the predicted value from the confidence of the current motion direction at the previous moment can be used as the confidence of the current motion direction at the current moment. In another exemplary implementation, the difference obtained by subtracting the predicted value from the confidence of the current motion direction at the previous moment can be used as the confidence of the current motion direction at the current moment.
[0074] In a feasible implementation, since the current motion direction is one of the N motion directions, the embodiment of the present application proposes to support configuring a confidence prediction model for each of the N motion directions. The confidence prediction models configured for different motion directions can be configured according to specific needs. The confidence prediction models configured for different motion directions can be the same model or different models, and the embodiment of the present application does not impose any restrictions. Based on this, it can be seen that each of the N motion directions is configured with a confidence prediction model, and each time a contour point is searched and the corresponding motion direction is determined, the confidence prediction model corresponding to each motion direction is used to independently predict the confidence of the corresponding motion direction at the corresponding moment. This not only can achieve timely confidence to avoid subsequent interference from other factors that affect the accuracy of the confidence, but also can achieve that the confidence prediction process of each motion direction at any moment is independent of each other and does not interfere with each other, thereby further improving the accuracy of the confidence prediction. Among them, the target confidence prediction model refers to: the confidence prediction model corresponding to the current motion direction; the step of predicting the confidence of the current motion direction at the current moment is performed by calling the target confidence prediction model; in the process of predicting the confidence of the current motion direction at the current moment, the target confidence prediction model obtains the confidence of the current motion direction at the previous moment by the historical prediction of the target confidence prediction model; it can be seen that the target confidence prediction model performs confidence prediction based on the confidence of the current motion direction at the previous moment predicted by its own history. In this way, the target confidence model can make full use of the relevant knowledge such as the confidence change trend learned from the history when making confidence predictions, thereby improving the accuracy of confidence predictions. Among them, the confidence prediction model corresponding to any motion direction is used to independently predict the confidence of the corresponding motion direction at the corresponding moment in a similar manner to the above-mentioned target confidence prediction model (that is, the confidence prediction model corresponding to the current motion direction) in independently predicting the confidence of the current motion direction at the current moment, that is, the confidence prediction model corresponding to any motion direction is called, and confidence prediction is performed based on the position coordinates of the contour point currently searched to obtain the prediction value (corresponding to the any motion direction); based on the consistency check result and the confidence of the any motion direction at the previous moment, the prediction value (corresponding to the any motion direction) is calibrated to obtain the confidence of the any motion direction at the current moment.
[0075] If the consistency check result is a passed consistency check result, that is, the current movement direction is the same as the movement direction at the previous moment, the confidence level of the nth movement direction among the N movement directions at the current moment can be expressed by the following formula 1.1:
[0076] confidence(t1)(n)=confidence(t0)(n)+f(x1*α(n)+y1*β(n)) (1.1)
[0077] Among them, t1 represents the current moment, t0 represents the previous moment, n∈[1,N]; confidence(t1)(n) represents the confidence of the nth motion direction at the current moment, confidence(t0)(n) represents the confidence of the nth motion direction at the previous moment; f(x1*α(n)+y1*β(n)) represents the confidence prediction model corresponding to the nth motion direction based on the position coordinates of the currently searched contour point, and the predicted value (corresponding to the nth motion direction) obtained by performing confidence prediction, wherein the position coordinates of the currently searched contour point are represented by (x1,y1), α(n) and β(n) can represent the configurable model parameters used by the confidence prediction model corresponding to the nth motion direction, which can be configured according to specific needs.
[0078] If the consistency check result is a failure, that is, the current movement direction is different from the movement direction at the previous moment, the confidence level of the nth movement direction at the current moment can be expressed by the following formula 1.2:
[0079] confidence(t1)(n)=confidence(t0)(n)-f(x1*α(n)+y1*β(n)) (1.2)
[0080] In a feasible implementation, the embodiment of the present application proposes to support configuring an information table corresponding to each of the N motion directions, which is used to store the confidence predicted by the confidence prediction model corresponding to the corresponding motion direction. Specifically, it can be used to store: the confidence of the corresponding motion direction at the previous moment predicted by the confidence prediction model corresponding to the corresponding motion direction. Based on this, it can be seen that each of the N motion directions is configured with an information table, and any information table is used to store: the confidence predicted by the confidence prediction model corresponding to the corresponding motion direction; wherein, in the process of the target confidence prediction model predicting the confidence of the current motion direction at the current moment, the confidence of the current motion direction at the previous moment is obtained from the information table corresponding to the current motion direction. After the computer device determines the confidence of the current motion direction at the current moment, it can use the target confidence prediction model to predict the confidence of the current motion direction at the current moment to refresh the information table corresponding to the current motion direction; that is, the confidence of the current motion direction at the current moment can be stored in the information table corresponding to the current motion direction for storing the table entry of the confidence of the current motion direction at the previous moment. Similarly, the confidence of any motion direction at the current moment can be used to refresh the information table corresponding to the corresponding motion direction. In this way, during each search, the confidence of each direction at the previous moment of each search can be quickly found from the information table corresponding to each direction, thereby improving the search efficiency.
[0081] Refer to Table 1 below, which takes 8 neighborhoods as an example, and shows an information table corresponding to the configuration of each movement direction. The information table corresponding to any movement direction can be used to store: the confidence of the movement direction at the previous moment, the confidence of the movement direction at the current moment, and optionally, it can also be used to store the confidence prediction model corresponding to the movement direction, the configurable model parameters used by the confidence prediction model corresponding to the movement direction, the prediction value corresponding to the movement direction, and other data.
[0082] Table 1
[0083] Regarding the process of a computer device predicting the confidence of the current motion direction at the current moment based on the consistency check result and the confidence of the current motion direction at the previous moment, in another feasible implementation manner, if the consistency check result is a result that passes the consistency check, the confidence of the current motion direction at the previous moment is increased to obtain the confidence of the current motion direction at the current moment; if the consistency check result is a result that fails the consistency check, the confidence of the current motion direction at the previous moment is reduced to obtain the confidence of the current motion direction at the current moment. Among them, when increasing the confidence of the current motion direction at the previous moment, an adaptive increase method can be selected according to specific needs, and the embodiments of the present application are not limited. For example, it can be increased based on a preset amplification coefficient (that is, the preset amplification coefficient is multiplied by the confidence of the current motion direction at the previous moment, and the preset amplification coefficient can be configured according to needs), or it can be increased based on a preset value (that is, on the basis of the confidence of the current motion direction at the previous moment, the preset value is superimposed, and the preset value can be configured according to needs), and so on; similarly, when reducing the confidence of the current motion direction at the previous moment, an adaptive reduction method can be selected according to specific needs, and the embodiments of the present application are not limited. For example, it can be reduced based on a preset reduction coefficient (that is, the preset reduction coefficient is multiplied by the preset reduction coefficient and the confidence of the current motion direction at the previous moment, and the preset reduction coefficient can be configured according to needs), or it can be reduced based on a preset value (that is, on the basis of the confidence of the current motion direction at the previous moment, the preset value is subtracted, and the preset value can be configured according to needs), and so on.
[0084] Regarding the process of a computer device predicting the confidence of the current motion direction at the current moment based on the consistency check result and the confidence of the current motion direction at the previous moment, in another feasible implementation, if the consistency check result is a result that passes the consistency check, the confidence of the current motion direction at the previous moment is used as the confidence of the current motion direction at the current moment; if the consistency check result is a result that fails the consistency check, then based on the confidence of the current motion direction at the previous moment, the confidence of the current motion direction at the current moment is obtained. Wherein, in the case where the consistency check result is a result that fails the consistency check, any of the above-mentioned methods for obtaining the confidence of the current motion direction at the current moment shown in the case where the consistency check fails can be selected according to specific needs, such as performing a difference operation on the confidence of the current motion direction at the previous moment and the predicted value to obtain the confidence of the current motion direction at the current moment, or reducing the confidence of the current motion direction at the previous moment to obtain the confidence of the current motion direction at the current moment.
[0085] In a feasible embodiment, in the process of obtaining the confidence of the current motion direction at the current moment, the computer device can perform the following steps: determining the motion direction at the previous moment, and obtaining the confidence of the motion direction at the previous moment; wherein the previous moment refers to the moment when the contour point was last searched; performing a consistency check on the motion direction at the previous moment and the current motion direction, and predicting the confidence of the current motion direction at the current moment based on the consistency check result and the confidence of the motion direction at the previous moment. Wherein, the confidence of the motion direction at the previous moment refers to: the confidence of the motion direction at the previous moment at the previous moment, when the motion direction at the current moment is the same as the current motion direction, the confidence of the motion direction at the previous moment at the previous moment, that is, the confidence of the current motion direction at the previous moment; the related process of predicting the confidence of the current motion direction at the current moment based on the consistency check result and the confidence of the motion direction at the previous moment is similar to the related process of predicting the confidence of the current motion direction at the current moment based on the consistency check result and the confidence of the current motion direction at the previous moment. It can be seen that this method can comprehensively consider two factors: whether the movement direction at the previous moment is consistent with the current movement direction, and the confidence of the movement direction at the previous moment, to predict the confidence of the current movement direction at the current moment, which can improve the accuracy of the confidence prediction.
[0086] Regarding the process of a computer device predicting the confidence level of the current motion direction at the current moment based on the consistency check result and the confidence level of the motion direction at the previous moment, in one feasible implementation, the computer device can call a target confidence prediction model to perform confidence prediction based on the position coordinates of the currently searched contour point to obtain a predicted value; and calibrate the predicted value based on the consistency check result and the confidence level of the motion direction at the previous moment to obtain the confidence level of the current motion direction at the current moment. The target confidence prediction model can be a probability model (i.e., a probability distribution function) selected according to specific needs, for example, a normal distribution function, a uniform distribution function, a Bernoulli distribution function, or other probability distribution functions can be selected. The computer device calibrates the predicted value based on the consistency check result and the confidence of the motion direction at the previous moment, and when obtaining the confidence of the current motion direction at the current moment, the following steps can be performed: if the consistency check result is a result that passes the consistency check, the confidence of the motion direction at the previous moment and the predicted value are summed to obtain the confidence of the current motion direction at the current moment; if the consistency check result is a result that fails the consistency check, the confidence of the motion direction at the previous moment and the predicted value are differenced to obtain the confidence of the current motion direction at the current moment. In an optional embodiment, if the consistency check result is a result that passes the consistency check, the predicted value can also be used as the confidence of the current motion direction at the current moment. In another optional embodiment, if the consistency check result is a result that passes the consistency check, the confidence of the motion direction at the previous moment is increased to obtain the confidence of the current motion direction at the current moment. In another optional embodiment, if the consistency check result is a result that passes the consistency check, the confidence of the motion direction at the previous moment is used as the confidence of the current motion direction at the current moment.
[0087] In a feasible implementation, since the current motion direction is one of the N motion directions, the embodiment of the present application proposes to support configuring a confidence prediction model for each of the N motion directions. The confidence prediction models configured for different motion directions can be configured according to specific needs. The confidence prediction models configured for different motion directions can be the same model or different models. The embodiment of the present application does not impose any restrictions. Based on this, it can be seen that each of the N motion directions is configured with a confidence prediction model, and each time a contour point is searched and the corresponding motion direction is determined, the confidence prediction model corresponding to each motion direction is used to independently predict the confidence of the corresponding motion direction at the corresponding moment; wherein, the target confidence prediction model refers to: the confidence prediction model corresponding to the current motion direction; the step of predicting the confidence of the current motion direction at the current moment is performed by calling the target confidence prediction model; in the process of predicting the confidence of the current motion direction at the current moment, the confidence of the motion direction at the previous moment obtained by the target confidence prediction model is predicted by the history of the confidence prediction model corresponding to the motion direction at the previous moment.
[0088] In a feasible implementation, an embodiment of the present application proposes to support configuring an information table for each of the N motion directions, which is used to store the confidence predicted by the confidence prediction model corresponding to the corresponding motion direction. Specifically, it can be used to store: the confidence of the corresponding motion direction at the previous moment predicted by the confidence prediction model corresponding to the corresponding motion direction. Based on this, it can be seen that each of the N motion directions is configured with an information table, and any information table is used to store: the confidence predicted by the confidence prediction model corresponding to the corresponding motion direction; wherein, in the process of the target confidence prediction model predicting the confidence of the current motion direction at the current moment, the confidence of the motion direction at the previous moment is obtained from the information table corresponding to the motion direction at the previous moment; after the computer device determines the confidence of the current motion direction at the current moment, it can use the confidence of the current motion direction at the current moment predicted by the target confidence prediction model to refresh the information table corresponding to the current motion direction; that is, the confidence of the current motion direction at the current moment can be stored in the information table corresponding to the current motion direction for storing the table entry of the confidence of the current motion direction at the previous moment. Similarly, it can be seen that the confidence of any motion direction at the current moment can be used to refresh the information table corresponding to the corresponding motion direction. In this way, in each search, the confidence of each direction at the previous moment of each search can be quickly found from the information table corresponding to each direction.
[0089] S404: If the current motion direction falls within the prediction area and the confidence level of the current motion direction at the current moment is greater than or equal to the threshold, a contour group to be loaded is determined in the image.
[0090] In a feasible implementation, the computer device can determine whether the current motion direction falls into the prediction area based on the currently searched contour point. When the currently searched contour point falls into the prediction area, it is determined that the current motion direction falls into the prediction area; otherwise, it is determined that the current motion direction does not fall into the prediction area. For example, if the size of the contour block is (m*k)*(n*k), that is, the length of the contour block is (m*k) and the width is (n*k), if the center point coordinates of the first contour block are expressed as (x, y), the distance between the center point coordinates of the first contour block and the boundary of the first contour block can be: [(M-2)*K / 2, (N-2)*K / 2], based on this, the four vertex coordinates of the first contour block can be: [x+(M-2)*K / 2, y+(N-2)*K / 2], [x+(M-2)*K / 2, y-(N-2)*K / 2], [x-(M-2)*K / 2, y+(N-2)*K / 2], [x-(M-2)*K / 2, y-(N-2)*K / 2], then, based on the positional relationship between the position coordinates of the currently searched contour point and the four vertex coordinates of the first contour block, it can be determined whether the currently searched contour point falls into the prediction area.
[0091] In one feasible embodiment, when determining a contour group to be loaded in an image, a computer device may predict block attribute information of a first contour block to be loaded to obtain predicted block attribute information; based on the predicted block attribute information, the computer device may determine the first contour block to be loaded in the image, as well as N second contour blocks corresponding to the first contour block; and the determined first contour block and the corresponding N second contour blocks are used as the contour group to be loaded. This approach allows for relatively accurate determination of the contour group to be loaded by only performing a single block attribute information prediction process, eliminating the need to predict block attribute information for each contour block in the contour group to be loaded. This approach can conserve processing resources and improve efficiency in determining the contour group to be loaded.
[0092] In a feasible implementation, any block of attribute information includes the center point coordinates of the corresponding contour block, and the predicted block attribute information includes the predicted center point coordinates; based on this, the first contour block to be loaded in the image can be determined according to the predicted center point coordinates, specifically based on the predicted center point coordinates and the configured contour block size, and then the contour blocks in the N neighborhoods of the determined first contour block can be determined as the corresponding second contour blocks.
[0093] In a feasible embodiment, when any block of attribute information includes the center point coordinates of the corresponding contour block and the predicted block attribute information includes the predicted center point coordinates, the computer device predicts the block attribute information of the first contour block to be loaded. When the predicted block attribute information is obtained, the position coordinates of the contour point currently searched can be obtained as the predicted center point coordinates. Since the predicted center point coordinates are the predicted center point coordinates of the first contour block in the contour group to be loaded next time (i.e., the contour group to be loaded), this method can be used to make the contour block centered on the currently searched contour point the first contour block in the contour group to be loaded next time, so that after the contour search unit loads the contour group next time, it can continue to search for contour points starting from the contour block where the currently searched contour point is located, thereby ensuring that the searched contour points are continuous with the currently searched contour points, thereby improving the continuity of the contour points. Optionally, the coordinates of a pixel point can be selected in the contour block where the currently searched contour point is located as the predicted center point coordinates.
[0094] In another feasible embodiment, when any block attribute information includes the center point coordinates of the corresponding contour block and the predicted block attribute information includes the predicted center point coordinates, since the current motion direction is one of N motion directions, each of the N motion directions is configured with an information table. The present application supports writing at least one center point coordinate set in the corresponding motion direction in any information table; based on this, any information table includes: at least one center point coordinate set in the corresponding motion direction, the computer device predicts the block attribute information of the first contour block to be loaded, and when obtaining the predicted block attribute information, it can use the information table corresponding to the current motion direction as the target information table according to the correspondence between the motion direction and the information table; and pre-take a center point coordinate from the center point coordinates included in the target information table as the predicted center point coordinate. It can be seen that in this way, the predicted center point coordinates are the center point coordinates of the first contour block in the contour group to be loaded next time (i.e., the contour group to be loaded) predicted by referring to the current movement direction. Therefore, in this way, the first contour block in the contour group to be loaded next time can be determined by referring to the current movement direction. In this way, the first contour block in the contour group to be loaded next time can be matched with the current movement direction, thereby improving the accuracy of the first contour block, and thus improving the accuracy of the contour points searched based on the first contour block.
[0095] For the currently loaded contour group, the coordinates of the pixels in the nth second contour block are set as the center coordinates in the nth motion direction, where the nth second contour block is the second contour block located in the nth neighborhood of the first contour block, and the nth motion direction is the motion direction corresponding to the nth neighborhood. The coordinates of the pixels in the nth second contour block that are set as the center coordinates in the nth motion direction can be selected based on specific needs. For example, the coordinates of the pixels in the nth second contour block can be randomly selected and set as the center coordinates in the nth motion direction. For another example, the center coordinates of the nth second contour block can be selected and set as the center coordinates in the nth motion direction. It can be understood that when a new contour group is loaded, at least one center coordinate set in the corresponding motion direction stored in each information table is refreshed, and the refreshed center coordinates are adapted to the new contour group. See Figure 5a, which is a schematic diagram of determining the contour group to be loaded provided in an embodiment of the present application. If the currently loaded contour group is as shown by mark 500, the predicted center point coordinates are the position coordinates of the currently searched contour point, as shown by mark 501, then the determined contour group to be loaded can be as shown by mark 502.
[0096] Refer to Table 2 below. Taking the 8-neighborhood as an example, an information table corresponding to the configuration of each motion direction is shown. The information table corresponding to any motion direction can be used to store: the confidence of the motion direction at the previous moment, the confidence of the motion direction at the current moment, and at least one center point coordinate set in the motion direction. Optionally, it can also be used to store the confidence prediction model corresponding to the motion direction, the configurable model parameters used by the confidence prediction model corresponding to the motion direction, the predicted value corresponding to the motion direction, and other data; of course, if there is a need to write other data, the corresponding data (such as the contour block size) can also be written into the information table corresponding to the motion direction; exemplarily, Table 2 describes the example of setting a center point coordinate for each motion direction.
[0097] Table 2
[0098] In one feasible embodiment, an image can be divided into multiple contour blocks according to a configured contour block size. The attribute information of any block includes identification information of the corresponding contour block, and the predicted block attribute information includes predicted identification information. Optionally, the identification information can be a contour block number or the coordinates of the center point of the contour block. The contour block number can be obtained by labeling the multiple contour blocks obtained by image division according to a preset labeling rule. For example, the preset labeling rule can be: increasing the number row by row from top to bottom, increasing the number row by row from bottom to top, etc. Based on this, a first contour block to be loaded in the image can be determined based on the predicted identification information, and then contour blocks in N neighborhoods of the determined first contour block can be determined as corresponding second contour blocks.
[0099] In a feasible implementation, when any block attribute information includes identification information of the corresponding contour block and the predicted block attribute information includes predicted identification information, the computer device predicts the block attribute information of the first contour block to be loaded. When the predicted block attribute information is obtained, the identification information of the contour block where the currently searched contour point is located can be obtained as the predicted identification information.
[0100] In another feasible embodiment, when any block attribute information includes identification information of the corresponding contour block, and the predicted block attribute information includes predicted identification information, since the current motion direction is one of N motion directions, each of the N motion directions is configured with an information table. The present application supports writing the identification information set in the corresponding motion direction into any information table. Based on this, any information table includes: identification information set in the corresponding motion direction. When the computer device predicts the block attribute information of the first contour block to be loaded and obtains the predicted block attribute information, it can use the information table corresponding to the current motion direction as the target information table based on the correspondence between the motion direction and the information table; and select the identification information included in the target information table as the predicted identification information. Specifically, for the currently loaded contour group, it supports setting the identification information of the nth second contour block as identification information in the nth motion direction, wherein the nth second contour block is the second contour block located in the nth neighborhood of the first contour block, and the nth motion direction is the motion direction corresponding to the nth neighborhood. It can be known that when a new profile group is loaded, the identification information stored in each information table and set in the corresponding movement direction will be refreshed, and the refreshed identification information is adapted to the new profile group.
[0101] See Figure 5b, which is a schematic diagram of another method for determining the contour group to be loaded provided in an embodiment of the present application. If the preset labeling rule adopted is a rule of increasing the labeling row by row from top to bottom, the contour block label of each contour block in the image is shown in each contour block; if the currently loaded contour group is as shown by mark 510, the position coordinates of the currently searched contour point are as shown by mark 511, and the predicted identification information is the contour block label 10, then the determined contour group to be loaded can be as shown by mark 512.
[0102] S405: If the current motion direction does not fall within the predicted area, or if the current motion direction falls within the predicted area and the confidence of the current motion direction at the current moment is less than the threshold, continue searching for contour points in the currently loaded contour group.
[0103] S406 , iteratively executing the above process until an image search end event is detected, and determining the contour of the image based on each contour point searched by the contour search unit.
[0104] In a feasible implementation, the contour search unit supports running multiple contour search acceleration engines for processing multiple images to be searched in parallel, respectively obtaining contours of each image, so as to improve the image search rate.
[0105] In an embodiment of the present application, in the process of searching for the contour of an image, the image is not directly loaded into the contour search unit. Instead, a contour group consisting of multiple image blocks divided from the image is loaded. In the process of calling the contour search unit to search for contour points in the currently loaded contour group, each time a contour point is searched, it is determined in real time whether the contour search unit needs to load a new contour group, so that the image can be continuously loaded into the contour search unit in the form of contour groups to refresh the storage space of the contour search unit and search until the contour of the image is obtained; this ensures that in the process of searching for the contour of the image based on the contour search unit, only a storage space of the size of a contour group is always occupied in the storage space of the contour search unit. Compared with loading the image in the contour search unit, the storage space occupied by the contour search unit can be reduced and the storage resources of the contour search unit can be saved, so that higher performance can be achieved with smaller storage space.
[0106] Moreover, each time a contour point is searched, the contour search unit is judged in real time whether it needs to load a new contour group. For the contour point currently searched, the probability of continuing to search for contour points along the current motion direction (i.e., the confidence of the current motion direction at the current moment) can be predicted based on the context in the image search (i.e., the current motion direction and historical motion direction of the contour). Based on the predicted probability of continuing to search for contour points along the current motion direction, it can be accurately judged in real time whether a new contour group needs to be loaded. When it is judged that a new contour group needs to be loaded, the contour group to be loaded is determined, and then the contour group to be loaded can be pre-fetched to hide the storage time required for loading the contour group. This allows the image to be continuously loaded into the contour search unit in the form of contour groups to refresh the storage space of the contour search unit and perform searches, while also improving the overall search performance.
[0107] The image search method provided in the embodiment of the present application can be deployed in an image search device, and the image search device is executed by a computer device to implement the image search method; the image search device can specifically be a chip, hardware system (including but not limited to a dedicated integrated circuit, a programmable logic circuit, a processor, etc.) or central processing system firmware (such as a central processing unit (CPU) or a graphics processing unit (GPU)) running in the computer device. The structure of the image search device involved in the embodiment of the present application is exemplarily introduced below; refer to Figure 6, which is a structural schematic diagram of an image search device provided in the embodiment of the present application. The image search device may include: a loading unit, a contour search unit, and a prediction unit. Among them, the loading unit can be used to execute the relevant processing logic of data loading, for example, it can be used to obtain a contour group and load it into the contour search unit; the contour search unit can be used to execute the relevant processing logic of image search, for example, it can be used to search for contour points in the contour group to obtain contour points; the prediction unit can be used to execute the relevant processing logic of predicting the contour group to be loaded, for example, it can be used to determine whether a new contour group needs to be loaded after each contour point is searched. When the three units cooperate to execute the image search method proposed in the embodiment of the present application, the execution process can be roughly described as follows:
[0108] After obtaining the block attribute information corresponding to the contour group to be loaded, the loading unit can obtain the corresponding contour group and load it into the contour search unit to refresh the storage space of the contour search unit; wherein the currently loaded contour group includes: a first contour block and N second contour blocks, the N second contour blocks include contour blocks located in N neighborhoods of the first contour block, one neighborhood corresponds to one motion direction, and the area where the N second contour blocks are located is the prediction area.
[0109] The contour search unit can search for contour points in the currently loaded contour group, starting from the first contour block, based on N motion directions, and transmit relevant information of the currently searched contour point to the prediction unit each time a contour point is found; wherein the relevant information of the currently searched contour point includes: relevant data required for predicting the block attribute information corresponding to the contour group to be loaded (i.e., the new contour group), which may at least include the position coordinates of the currently searched contour point.
[0110] After receiving the relevant information of the currently searched contour point, the prediction unit may determine the current moving direction of the contour based on the relevant information of the currently searched contour point, and predict the confidence of the current moving direction at the current moment.
[0111] If the current motion direction does not fall within the predicted area, or if the current motion direction falls within the predicted area and the confidence of the current motion direction at the current moment is less than the threshold, feedback information indicating that the contour point search should continue in the currently loaded contour group is returned to the contour search unit so that the contour search unit continues to search for contour points in the currently loaded contour group.
[0112] If the current motion direction falls within the prediction area and the confidence of the current motion direction at the current moment is greater than or equal to the threshold, the block attribute information corresponding to the contour group to be loaded (i.e., the new contour group) is predicted (i.e., the block attribute information of the first contour block to be loaded is predicted) to obtain the predicted block attribute information; the predicted block attribute information is returned to the contour search unit, and the predicted block attribute information is passed to the loading unit, so that the loading unit determines the contour group to be loaded according to the predicted block attribute information, and obtains the corresponding contour group to be loaded into the contour search unit.
[0113] The three units cooperate and iteratively execute the above process until the contour search unit detects an image search end event, and determines the contour of the image based on each contour point searched by the contour search unit.
[0114] Among them, the contour search unit can also be used to perform pre-processing tasks and post-processing tasks. Pre-processing tasks refer to: each time the contour search unit loads a contour group, before performing contour point search, the operations performed, for example, may include input format adjustment, resolution adjustment, filtering and image processing (such as image enhancement, noise reduction, filtering, smoothing) and other operations. Pre-processing tasks are operations performed to make the loaded contour group meet the requirements of contour point search. The operations that may be involved in the pre-processing task can be selected according to specific needs. It can be known that when the loaded contour group already meets the requirements of contour point search, the pre-processing task is not necessary. Post-processing tasks refer to: tasks designed and executed according to specific business needs after determining the contours of the image. It can be known that post-processing tasks are designed and executed according to needs and are not necessary to implement the image processing method proposed in this application; for example, the contour search unit supports the operation of multiple contour search acceleration engines, which are used to perform parallel processing on multiple images to be searched for image, and obtain the contours of each image respectively, so as to improve the rate of image search. Post-processing tasks may include but are not limited to processing of contours obtained by each contour search acceleration engine. For example, it may include screening, merging, sorting, packaging and other processing of contours obtained by each contour search acceleration engine. For example, under a certain business requirement, it is necessary to extract contours that meet specific conditions, and screening processing is required. For example, under a certain business requirement, it is necessary to merge and output the contours of multiple images, and merging processing is required, etc.
[0115] The loading unit can also be used to load relevant data required to implement the image search method proposed in the embodiment of the present application. For example, the loading unit can be used to load input instructions, which may include image resolution (such as height and width), parameters required for pre-processing tasks, or parameters required for post-processing tasks. For another example, the loading unit can be used to load configurable data required to implement the image search method (including the contour block size, initial motion direction, confidence prediction model corresponding to different motion directions, and configurable model parameters used by the model, etc. mentioned in the above embodiment); for another example, when there is a need to acquire an image, the loading unit can also be used to acquire an image.
[0116] It can be seen that the loading unit and prediction unit provided in the embodiment of the present application are a new technology. For the contour points currently searched during the image search process, the current movement direction of the contour can be determined and the probability of continuing to search for contour points along the current movement direction (that is, the confidence of the current movement direction at the current moment) can be predicted. Based on the predicted probability of continuing to search for contour points along the current movement direction, it can be accurately judged in real time whether a new contour group needs to be loaded, and when it is judged that a new contour group needs to be loaded, the contour group to be loaded is determined, thereby enabling the image to be continuously loaded into the contour search unit in the form of contour groups to refresh the storage space of the contour search unit and perform a search, which can reduce the occupancy of the storage space of the contour search unit, save the storage resources of the contour search unit, and improve the overall search performance.
[0117] Based on the description of the above-mentioned image search method embodiment, the present application also discloses another image search device; the image search device can be a computer program (including one or more instructions) running on a computer device or chip, and the image search device can execute each step of the method flow shown in Figure 2 or Figure 4. Referring to Figure 7, the image search device can run the following units:
[0118] An acquisition unit 701 is configured to, after determining a contour group to be loaded in an image, acquire the corresponding contour group and load it into a contour search unit to refresh the storage space of the contour search unit. The currently loaded contour group includes: a first contour block and N second contour blocks, where N is a positive integer. The N second contour blocks include contour blocks located in N neighborhoods of the first contour block, where one neighborhood corresponds to one motion direction. The area where the N second contour blocks are located is a prediction area, and the contour blocks are image blocks divided from the image.
[0119] The processing unit 702 is configured to call the contour search unit to search for contour points in the currently loaded contour group, starting from the first contour block and based on the N motion directions;
[0120] The processing unit 702 is further configured to determine a current motion direction of the contour based on the currently searched contour point each time a contour point is found; and obtain a confidence level of the current motion direction at the current moment; each confidence level is used to indicate a probability of continuing to search for contour points along the corresponding motion direction;
[0121] The processing unit 702 is further configured to determine a contour group to be loaded in the image if the current motion direction falls within the prediction area and the confidence level of the current motion direction at the current moment is greater than or equal to a threshold;
[0122] The above process is iteratively performed until the processing unit 702 detects an end event of searching the image, and determines the contour of the image based on each contour point searched by the contour search unit.
[0123] In one embodiment, when the processing unit 702 is used to determine the contour group to be loaded in the image, it can be specifically used to:
[0124] Predicting the block attribute information of the first contour block to be loaded to obtain predicted block attribute information;
[0125] Determining a first contour block to be loaded and N second contour blocks corresponding to the first contour block in the image according to the predicted block attribute information;
[0126] The determined first contour block and the corresponding N second contour blocks are used as the contour group to be loaded.
[0127] In another embodiment, any block attribute information includes the center point coordinates of the corresponding contour block, and the predicted block attribute information includes the predicted center point coordinates;
[0128] When the processing unit 702 is used to predict the block attribute information of the first contour block to be loaded and obtain the predicted block attribute information, it can be specifically used to: obtain the position coordinates of the currently searched contour point as the predicted center point coordinates.
[0129] In another embodiment, any block attribute information includes the center point coordinates of the corresponding contour block, and the predicted block attribute information includes the predicted center point coordinates;
[0130] The current motion direction is one of the N motion directions, each of the N motion directions is configured with an information table, and any information table includes: at least one center point coordinate set in the corresponding motion direction;
[0131] When the processing unit 702 is used to predict the block attribute information of the first contour block to be loaded and obtain the predicted block attribute information, it can be specifically used to: based on the correspondence between the motion direction and the information table, use the information table corresponding to the current motion direction as the target information table; and pre-take a center point coordinate from the center point coordinates included in the target information table as the predicted center point coordinate.
[0132] In another embodiment, the current movement direction refers to the direction in which the contour point searched last time points to the contour point searched currently;
[0133] When used to obtain the confidence level of the current motion direction at the current moment, the processing unit 702 may be specifically used to:
[0134] Determine the direction of motion at the previous moment, and obtain the confidence level of the current direction of motion at the previous moment; wherein the previous moment refers to the moment when the contour point was last searched;
[0135] A consistency check is performed on the movement direction at the previous moment and the current movement direction, and the confidence of the current movement direction at the current moment is predicted based on the consistency check result and the confidence of the current movement direction at the previous moment.
[0136] In another embodiment, when the processing unit 702 is used to predict the confidence level of the current motion direction at the current moment based on the consistency check result and the confidence level of the current motion direction at the previous moment, it can be specifically used to:
[0137] Calling the target confidence prediction model to perform confidence prediction based on the position coordinates of the currently searched contour point to obtain a predicted value;
[0138] The predicted value is calibrated according to the consistency check result and the confidence of the current motion direction at a previous moment to obtain the confidence of the current motion direction at a current moment.
[0139] In another embodiment, the processing unit 702, when used to calibrate the predicted value based on the consistency check result and the confidence of the current motion direction at the previous moment to obtain the confidence of the current motion direction at the current moment, can be specifically used to:
[0140] If the consistency check result is a result of passing the consistency check, performing a sum operation on the confidence of the current motion direction at the previous moment and the predicted value to obtain the confidence of the current motion direction at the current moment;
[0141] If the consistency check result is a result that fails the consistency check, a difference operation is performed on the confidence of the current motion direction at the previous moment and the predicted value to obtain the confidence of the current motion direction at the current moment.
[0142] In another embodiment, the current motion direction is one of the N motion directions;
[0143] Each of the N motion directions is configured with a confidence prediction model, and after each contour point is searched and the corresponding motion direction is determined, the confidence prediction model corresponding to each motion direction is used to independently predict the confidence of the corresponding motion direction at the corresponding moment;
[0144] Among them, the target confidence prediction model refers to: the confidence prediction model corresponding to the current motion direction; the step of predicting the confidence of the current motion direction at the current moment is performed by calling the target confidence prediction model; in the process of predicting the confidence of the current motion direction at the current moment, the confidence of the current motion direction at the previous moment obtained by the target confidence prediction model is historically predicted by the target confidence prediction model.
[0145] In another embodiment, each of the N movement directions is configured with an information table, and any information table is used to store: the confidence predicted by the confidence prediction model corresponding to the corresponding movement direction;
[0146] Wherein, in the process of predicting the confidence of the current motion direction at the current moment by the target confidence prediction model, the confidence of the current motion direction at the previous moment is obtained from the information table corresponding to the current motion direction;
[0147] The processing unit 702 is further configured to: update the information table corresponding to the current motion direction using the confidence of the current motion direction at the current moment predicted by the target confidence prediction model.
[0148] In another embodiment, when the processing unit 702 is used to predict the confidence level of the current motion direction at the current moment based on the consistency check result and the confidence level of the current motion direction at the previous moment, it can be specifically used to:
[0149] If the consistency check result is a result of passing the consistency check, increasing the confidence of the current motion direction at the previous moment to obtain the confidence of the current motion direction at the current moment;
[0150] If the consistency check result is a result of failing the consistency check, the confidence level of the current motion direction at the previous moment is reduced to obtain the confidence level of the current motion direction at the current moment.
[0151] In another embodiment, the current movement direction refers to the direction in which the contour point searched last time points to the contour point searched currently;
[0152] When used to obtain the confidence level of the current motion direction at the current moment, the processing unit 702 may be specifically used to:
[0153] Determining the direction of motion at a previous moment, and obtaining a confidence level of the direction of motion at the previous moment; wherein the previous moment refers to the moment when a contour point was last searched;
[0154] A consistency check is performed on the movement direction at the previous moment and the current movement direction, and the confidence of the current movement direction at the current moment is predicted based on the consistency check result and the confidence of the movement direction at the previous moment.
[0155] In another implementation, the processing unit 702 is further configured to:
[0156] If the current motion direction does not fall within the predicted area, or if the current motion direction falls within the predicted area and the confidence of the current motion direction at the current moment is less than a threshold, the contour point search continues in the currently loaded contour group.
[0157] According to another embodiment of the present application, the various units in the image search device shown in Figure 7 can be individually or entirely combined into one or several other units to form a whole, or one (or more) of the units can be further divided into multiple functionally smaller units to form a whole, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In actual applications, the functions of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present application, the image search device may also include other units. In actual applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0158] According to another embodiment of the present application, an image search device as shown in FIG7 can be constructed and the image search method of the embodiment of the present application can be implemented by running a computer program (including one or more instructions) capable of executing each step involved in the corresponding method shown in FIG2 or FIG4 on a general-purpose computing device such as a computer, which includes processing elements and storage elements such as a central processing unit (CPU), a random access memory (RAM), and a read-only memory (ROM). The computer program can be recorded on a computer-readable storage medium, for example, and loaded into the computing device via the computer-readable storage medium and executed therein.
[0159] In an embodiment of the present application, in the process of searching for the contour of an image, the image is not directly loaded into the contour search unit. Instead, a contour group consisting of multiple image blocks divided from the image is loaded. In the process of calling the contour search unit to search for contour points in the currently loaded contour group, each time a contour point is searched, it is determined in real time whether the contour search unit needs to load a new contour group, so that the image can be continuously loaded into the contour search unit in the form of contour groups to refresh the storage space of the contour search unit and search until the contour of the image is obtained; this ensures that in the process of searching for the contour of the image based on the contour search unit, only a storage space of the size of a contour group is always occupied in the storage space of the contour search unit. Compared with loading the image in the contour search unit, the storage space occupied by the contour search unit can be reduced and the storage resources of the contour search unit can be saved.
[0160] Moreover, in the process of determining whether a new contour group needs to be loaded each time a contour point is searched, the probability of continuing to search for contour points along the current motion direction can be predicted for the contour point currently searched based on the current motion direction of the contour. Based on the predicted probability of continuing to search for contour points along the current motion direction, it can be accurately determined in real time whether a new contour group needs to be loaded, and when it is determined that a new contour group needs to be loaded, the contour group to be loaded can be determined, and then the contour group to be loaded can be pre-fetched, thereby hiding the storage time required for loading the contour group and improving the overall search performance.
[0161] Based on the description of the above method embodiments and device embodiments, the embodiments of the present application also provide a computer device; the computer device may include an independent device (such as one or more of a server, a node, a terminal, etc.), or may include components inside an independent device (such as a chip, a software module, or a hardware module, etc.). Referring to Figure 8, the computer device includes at least a processor 801, an input interface 802, an output interface 803, and a computer storage medium 804. Among them, the processor 801, the input interface 802, the output interface 803, and the computer storage medium 804 in the computer device may be connected via a bus or other means. The computer storage medium 804 may be stored in the memory of the computer device, the computer storage medium 804 being used to store a computer program, the computer program including one or more instructions, and the processor 801 being used to execute one or more instructions in the computer program stored in the computer storage medium 804. The processor 801 (or CPU (Central Processing Unit, central processing unit)) is the computing core and control core of the computer device, which is suitable for implementing one or more instructions, specifically suitable for loading and executing one or more instructions to implement the corresponding method flow or corresponding function.
[0162] In one embodiment, the processor 801 described in the embodiment of the present application can be used to implement related processes of image search, which may specifically include: after determining the contour group to be loaded in the image, obtaining the corresponding contour group and loading it into the contour search unit to refresh the storage space of the contour search unit; wherein the currently loaded contour group includes: a first contour block and N second contour blocks, N is a positive integer; the N second contour blocks include contour blocks located in N neighborhoods of the first contour block, one neighborhood corresponds to one motion direction, the area where the N second contour blocks are located is a prediction area, and a contour block refers to an image block divided from the image; calling the contour search unit to select the contour block from the currently loaded contour group. Starting from the first contour block, a contour point search is performed based on the N motion directions; each time a contour point is searched, the current motion direction of the contour is determined based on the currently searched contour point; and the confidence of the current motion direction at the current moment is obtained; any confidence is used to indicate: the probability of continuing to search for contour points along the corresponding motion direction; if the current motion direction falls within the prediction area and the confidence of the current motion direction at the current moment is greater than or equal to a threshold, a contour group to be loaded is determined in the image; the above process is iteratively performed until an end search event of the image is detected, and the contour of the image is determined according to each contour point searched by the contour search unit, and so on.
[0163] The embodiment of the present application also provides a computer storage medium (Memory), which is a memory device in a computer device for storing computer programs and data. It is understandable that the computer storage medium here can include both built-in storage media in the computer device and, of course, extended storage media supported by the computer device. The computer storage medium provides a storage space that stores the operating system of the computer device. In addition, a computer program is also stored in the storage space, and the computer program includes one or more instructions suitable for being loaded and executed by the processor 801, and these instructions can be one or more program codes. It should be noted that the computer storage medium here can be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk storage; optionally, it can also be at least one computer storage medium located away from the aforementioned processor.
[0164] In one embodiment, a processor may load and execute one or more instructions stored in a computer storage medium to implement the corresponding steps in the method embodiments shown in FIG. 2 or FIG. 4 . In a specific implementation, the processor may load and execute the following steps:
[0165] After determining a contour group to be loaded in the image, obtaining the corresponding contour group and loading it into a contour search unit to refresh the storage space of the contour search unit; wherein the currently loaded contour group includes: a first contour block and N second contour blocks, where N is a positive integer; the N second contour blocks include contour blocks located in N neighborhoods of the first contour block, where one neighborhood corresponds to one motion direction; the area where the N second contour blocks are located is a prediction area, and the contour blocks are image blocks divided from the image;
[0166] calling the contour search unit to search for contour points in the currently loaded contour group, starting from the first contour block and based on the N motion directions;
[0167] Each time a contour point is found, the current motion direction of the contour is determined based on the currently found contour point; and the confidence level of the current motion direction at the current moment is obtained; any confidence level is used to indicate the probability of continuing to search for contour points along the corresponding motion direction;
[0168] If the current motion direction falls within the prediction area and the confidence level of the current motion direction at the current moment is greater than or equal to a threshold, determining a contour group to be loaded in the image;
[0169] The above process is iteratively performed until an end search event of the image is detected, and the contour of the image is determined according to each contour point searched by the contour search unit.
[0170] In one embodiment, when the processor 801 is used to determine the contour group to be loaded in the image, it can be specifically used to:
[0171] Predicting the block attribute information of the first contour block to be loaded to obtain predicted block attribute information;
[0172] Determining a first contour block to be loaded and N second contour blocks corresponding to the first contour block in the image according to the predicted block attribute information;
[0173] The determined first contour block and the corresponding N second contour blocks are used as the contour group to be loaded.
[0174] In another embodiment, any block attribute information includes the center point coordinates of the corresponding contour block, and the predicted block attribute information includes the predicted center point coordinates;
[0175] When the processor 801 is used to predict the block attribute information of the first contour block to be loaded and obtain the predicted block attribute information, it can be specifically used to: obtain the position coordinates of the currently searched contour point as the predicted center point coordinates.
[0176] In another embodiment, any block attribute information includes the center point coordinates of the corresponding contour block, and the predicted block attribute information includes the predicted center point coordinates;
[0177] The current motion direction is one of the N motion directions, each of the N motion directions is configured with an information table, and any information table includes: at least one center point coordinate set in the corresponding motion direction;
[0178] When the processor 801 is used to predict the block attribute information of the first contour block to be loaded and obtain the predicted block attribute information, it can be specifically used to: based on the correspondence between the motion direction and the information table, use the information table corresponding to the current motion direction as the target information table; and pre-take a center point coordinate from the center point coordinates included in the target information table as the predicted center point coordinate.
[0179] In another embodiment, the current movement direction refers to the direction in which the contour point searched last time points to the contour point searched currently;
[0180] When used to obtain the confidence level of the current motion direction at the current moment, the processor 801 may be specifically used to:
[0181] Determine the direction of motion at the previous moment, and obtain the confidence level of the current direction of motion at the previous moment; wherein the previous moment refers to the moment when the contour point was last searched;
[0182] A consistency check is performed on the movement direction at the previous moment and the current movement direction, and the confidence of the current movement direction at the current moment is predicted based on the consistency check result and the confidence of the current movement direction at the previous moment.
[0183] In another embodiment, when the processor 801 is used to predict the confidence level of the current motion direction at the current moment based on the consistency check result and the confidence level of the current motion direction at the previous moment, it can be specifically used to:
[0184] Calling the target confidence prediction model to perform confidence prediction based on the position coordinates of the currently searched contour point to obtain a predicted value;
[0185] The predicted value is calibrated according to the consistency check result and the confidence of the current motion direction at a previous moment to obtain the confidence of the current motion direction at a current moment.
[0186] In another embodiment, the processor 801, when used to calibrate the predicted value based on the consistency check result and the confidence of the current motion direction at the previous moment to obtain the confidence of the current motion direction at the current moment, can be specifically used to:
[0187] If the consistency check result is a result of passing the consistency check, performing a sum operation on the confidence of the current motion direction at the previous moment and the predicted value to obtain the confidence of the current motion direction at the current moment;
[0188] If the consistency check result is a result that fails the consistency check, a difference operation is performed on the confidence of the current motion direction at the previous moment and the predicted value to obtain the confidence of the current motion direction at the current moment.
[0189] In another embodiment, the current motion direction is one of the N motion directions;
[0190] Each of the N motion directions is configured with a confidence prediction model, and after each contour point is searched and the corresponding motion direction is determined, the confidence prediction model corresponding to each motion direction is used to independently predict the confidence of the corresponding motion direction at the corresponding moment;
[0191] Among them, the target confidence prediction model refers to: the confidence prediction model corresponding to the current motion direction; the step of predicting the confidence of the current motion direction at the current moment is performed by calling the target confidence prediction model; in the process of predicting the confidence of the current motion direction at the current moment, the confidence of the current motion direction at the previous moment obtained by the target confidence prediction model is historically predicted by the target confidence prediction model.
[0192] In another embodiment, each of the N movement directions is configured with an information table, and any information table is used to store: the confidence predicted by the confidence prediction model corresponding to the corresponding movement direction;
[0193] Wherein, in the process of predicting the confidence of the current motion direction at the current moment by the target confidence prediction model, the confidence of the current motion direction at the previous moment is obtained from the information table corresponding to the current motion direction;
[0194] The processor 801 is further configured to: use the confidence of the current motion direction at the current moment predicted by the target confidence prediction model to refresh the information table corresponding to the current motion direction.
[0195] In another embodiment, when the processor 801 is used to predict the confidence level of the current motion direction at the current moment based on the consistency check result and the confidence level of the current motion direction at the previous moment, it can be specifically used to:
[0196] If the consistency check result is a result of passing the consistency check, increasing the confidence of the current motion direction at the previous moment to obtain the confidence of the current motion direction at the current moment;
[0197] If the consistency check result is a result of failing the consistency check, the confidence level of the current motion direction at the previous moment is reduced to obtain the confidence level of the current motion direction at the current moment.
[0198] In another embodiment, the current movement direction refers to the direction in which the contour point searched last time points to the contour point searched currently;
[0199] When used to obtain the confidence level of the current motion direction at the current moment, the processor 801 may be specifically used to:
[0200] Determining the direction of motion at a previous moment, and obtaining a confidence level of the direction of motion at the previous moment; wherein the previous moment refers to the moment when a contour point was last searched;
[0201] A consistency check is performed on the movement direction at the previous moment and the current movement direction, and the confidence of the current movement direction at the current moment is predicted based on the consistency check result and the confidence of the movement direction at the previous moment.
[0202] In another implementation, the processor 801 is further configured to:
[0203] If the current motion direction does not fall within the predicted area, or if the current motion direction falls within the predicted area and the confidence of the current motion direction at the current moment is less than a threshold, the contour point search continues in the currently loaded contour group.
[0204] In an embodiment of the present application, in the process of searching for the contour of an image, the image is not directly loaded into the contour search unit. Instead, a contour group consisting of multiple image blocks divided from the image is loaded. In the process of calling the contour search unit to search for contour points in the currently loaded contour group, each time a contour point is searched, it is determined in real time whether the contour search unit needs to load a new contour group, so that the image can be continuously loaded into the contour search unit in the form of contour groups to refresh the storage space of the contour search unit and search until the contour of the image is obtained; this ensures that in the process of searching for the contour of the image based on the contour search unit, only a storage space of the size of a contour group is always occupied in the storage space of the contour search unit. Compared with loading the image in the contour search unit, the storage space occupied by the contour search unit can be reduced and the storage resources of the contour search unit can be saved.
[0205] Moreover, in the process of determining whether a new contour group needs to be loaded each time a contour point is searched, the probability of continuing to search for contour points along the current motion direction can be predicted for the contour point currently searched based on the current motion direction of the contour. Based on the predicted probability of continuing to search for contour points along the current motion direction, it can be accurately determined in real time whether a new contour group needs to be loaded, and when it is determined that a new contour group needs to be loaded, the contour group to be loaded can be determined, and then the contour group to be loaded can be pre-fetched, thereby hiding the storage time required for loading the contour group and improving the overall search performance.
[0206] The embodiments of the present application provide a computer program product, which includes a computer program stored in a computer storage medium; a processor of a computer device reads the computer program from the computer storage medium and executes the computer program, causing the computer device to perform the method embodiment shown in Figures 2 or 4 above. It should be understood that the above disclosure is merely a preferred embodiment of the present application and is not intended to limit the scope of the rights of the present application. Therefore, equivalent changes made in accordance with the claims of the present application are still within the scope of the present application.
Claims
1. An image search method, characterized in that: include: After determining the contour group to be loaded in the image, the corresponding contour group is obtained and loaded into the contour search unit to refresh the storage space of the contour search unit; wherein the currently loaded contour group includes: a first contour block and N second contour blocks, N is a positive integer; the N second contour blocks include contour blocks located in N neighborhoods of the first contour block, one neighborhood corresponds to one motion direction, the area where the N second contour blocks are located is a prediction area, and the contour block refers to an image block divided from the image; calling the contour search unit to search for contour points in the currently loaded contour group, starting from the first contour block, based on the N motion directions; Each time a contour point is searched, the current moving direction of the contour is determined based on the currently searched contour point; and the confidence of the current moving direction at the current moment is obtained; any confidence is used to indicate: the probability of continuing to search for contour points along the corresponding moving direction; If the current motion direction falls within the prediction area and the confidence of the current motion direction at the current moment is greater than or equal to a threshold, determining a contour group to be loaded in the image; The above process is iteratively performed until an end search event of the image is detected, and the contour of the image is determined according to each contour point searched by the contour search unit.
2. The method according to claim 1, characterized in that Determining the contour group to be loaded in the image comprises: Predicting the block attribute information of the first contour block to be loaded to obtain predicted block attribute information; Determine, in the image, a first contour block to be loaded and N second contour blocks corresponding to the first contour block according to the predicted block attribute information; The determined first contour block and the corresponding N second contour blocks are used as the contour group to be loaded.
3. The method according to claim 1 or 2, characterized in that Any block attribute information includes the center point coordinates of the corresponding contour block, and the predicted block attribute information includes the predicted center point coordinates; The step of predicting the block attribute information of the first contour block to be loaded to obtain the predicted block attribute information includes: obtaining the position coordinates of the contour point currently searched as the predicted center point coordinates.
4. The method according to any one of claims 1 to 3, characterized in that: Any block attribute information includes the center point coordinates of the corresponding contour block, and the predicted block attribute information includes the predicted center point coordinates; The current motion direction is one of the N motion directions, each of the N motion directions is configured with an information table, and any information table includes: at least one center point coordinate set in the corresponding motion direction; The block attribute information of the first contour block to be loaded is predicted to obtain the predicted block attribute information, including: according to the correspondence between the motion direction and the information table, the information table corresponding to the current motion direction is used as the target information table; from the center point coordinates included in the target information table, a center point coordinate is pre-taken as the predicted center point coordinate.
5. The method according to any one of claims 1 to 4, characterized in that: The current movement direction refers to the direction in which the contour point searched last time points to the contour point searched currently; The obtaining of the confidence of the current motion direction at the current moment includes: Determine the direction of motion at the previous moment, and obtain the confidence of the current direction of motion at the previous moment; wherein the previous moment refers to the moment when the contour point was last searched; A consistency check is performed on the movement direction at the previous moment and the current movement direction, and the confidence of the current movement direction at the current moment is predicted based on the consistency check result and the confidence of the current movement direction at the previous moment.
6. The method according to any one of claims 1 to 5, characterized in that: The predicting the confidence of the current motion direction at the current moment according to the consistency check result and the confidence of the current motion direction at the previous moment includes: Calling the target confidence prediction model to perform confidence prediction according to the position coordinates of the contour point currently searched to obtain a predicted value; The predicted value is calibrated according to the consistency check result and the confidence of the current motion direction at a previous moment to obtain the confidence of the current motion direction at a current moment.
7. The method according to any one of claims 1 to 6, characterized in that: The step of calibrating the predicted value according to the consistency check result and the confidence of the current motion direction at a previous moment to obtain the confidence of the current motion direction at a current moment includes: If the consistency check result is a result that passes the consistency check, then the confidence of the current motion direction at the previous moment and the predicted value are summed to obtain the confidence of the current motion direction at the current moment; If the consistency check result is a result that fails the consistency check, a difference operation is performed on the confidence of the current motion direction at the previous moment and the predicted value to obtain the confidence of the current motion direction at the current moment.
8. The method according to any one of claims 1 to 7, characterized in that: The current movement direction is one of the N movement directions; Each of the N movement directions is configured with a confidence prediction model, and after each contour point is searched and the corresponding movement direction is determined, the confidence prediction model corresponding to each movement direction is used to independently predict the confidence of the corresponding movement direction at the corresponding moment; Among them, the target confidence prediction model refers to: the confidence prediction model corresponding to the current motion direction; the step of predicting the confidence of the current motion direction at the current moment is performed by calling the target confidence prediction model; in the process of predicting the confidence of the current motion direction at the current moment, the confidence of the current motion direction at the previous moment obtained by the target confidence prediction model is historically predicted by the target confidence prediction model.
9. The method according to any one of claims 1 to 8, characterized in that: Each of the N movement directions is configured with an information table, and any information table is used to store: the confidence predicted by the confidence prediction model corresponding to the corresponding movement direction; Wherein, in the process of predicting the confidence of the current motion direction at the current moment by the target confidence prediction model, the confidence of the current motion direction at the previous moment is obtained from the information table corresponding to the current motion direction; The method further includes: using the confidence of the current motion direction at the current moment predicted by the target confidence prediction model to refresh the information table corresponding to the current motion direction.
10. The method according to any one of claims 1 to 9, characterized in that: The predicting the confidence of the current motion direction at the current moment according to the consistency check result and the confidence of the current motion direction at the previous moment includes: If the consistency check result is a result of passing the consistency check, increasing the confidence of the current motion direction at the previous moment to obtain the confidence of the current motion direction at the current moment; If the consistency check result is a result that fails the consistency check, the confidence of the current motion direction at the previous moment is reduced to obtain the confidence of the current motion direction at the current moment.
11. The method according to any one of claims 1 to 10, characterized in that: The current movement direction refers to the direction in which the contour point searched last time points to the contour point searched currently; The obtaining of the confidence of the current motion direction at the current moment includes: Determine the direction of motion at a previous moment, and obtain the confidence of the direction of motion at the previous moment; wherein the previous moment refers to the moment when the contour point was last searched; A consistency check is performed on the movement direction at the previous moment and the current movement direction, and the confidence of the current movement direction at the current moment is predicted based on the consistency check result and the confidence of the movement direction at the previous moment.
12. The method according to any one of claims 1 to 11, characterized in that: The method further comprises: If the current motion direction does not fall within the predicted region, or if the current motion direction falls within the predicted region and the confidence of the current motion direction at the current moment is less than a threshold, the contour point search continues in the currently loaded contour group.
13. An image search device, characterized in that: include: an acquisition unit, configured to, after determining a contour group to be loaded in the image, acquire the corresponding contour group and load it into the contour search unit, so as to refresh the storage space of the contour search unit; wherein the contour group currently loaded includes: a first contour block and N second contour blocks, where N is a positive integer; the N second contour blocks include contour blocks located in N neighborhoods of the first contour block, one neighborhood corresponds to one motion direction, the area where the N second contour blocks are located is a prediction area, and the contour block refers to an image block divided from the image; A processing unit, configured to call the contour search unit to search for contour points in the currently loaded contour group, starting from the first contour block, based on the N motion directions; The processing unit is further configured to determine the current moving direction of the contour based on the currently searched contour point each time a contour point is searched; and obtain the confidence of the current moving direction at the current moment; any confidence is used to indicate: the probability of continuing to search for contour points along the corresponding moving direction; The processing unit is further configured to determine a contour group to be loaded in the image if the current motion direction falls within the prediction area and the confidence of the current motion direction at a current moment is greater than or equal to a threshold; The above process is iteratively performed until the processing unit detects an end-of-search event for the image, and the contour of the image is determined according to each contour point searched by the contour search unit.
14. A computer device comprising an input interface and an output interface, characterized in that: Also includes: processor and computer storage media; The processor is suitable for implementing one or more instructions, the computer storage medium stores one or more instructions, and the one or more instructions are suitable for being loaded by the processor and executing the image search method as described in any one of claims 1-12.
15. A computer storage medium, characterized in that The computer storage medium stores one or more instructions, and the one or more instructions are suitable for being loaded by a processor and executing the image search method as described in any one of claims 1-12.
Citation Information
Patent Citations
Method for extracting gesture contour in augmented reality system
CN106326872A
Object contour detection method, device and equipment and storage medium
CN112085755A
Image processing method and device, electronic equipment and storage medium
CN113936074A
SEM image contour extraction method and device, computer equipment and storage medium
CN115841496A
Image searching method and device, equipment and storage medium
CN117290537A