Convex hull detection method and apparatus, device, and storage medium
By adjusting the first stack sequence, the n+1th data point and the cached data point are analyzed more comprehensively, and the problems of slow convex hull detection speed and low energy efficiency in the prior art are solved, and faster and more accurate convex hull detection is achieved.
Patent Information
- Application Number
- PCT/CN2024/103145
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-09-06
- Filing Date
- 2024-07-02
- Publication Date
- 2025-03-13
AI Technical Summary
The prior art relies on processor performance and needs to run on OpenCV-enabled processors when performing convex hull detection, resulting in slower read speed and lower energy efficiency.
By timely adjusting the first stack sequence, the n+1 data point and some data points cached in the first stack sequence are more comprehensively convex hull detection and analysis, and the real-time processing speed is improved.
The convex hull detection processing speed and energy efficiency ratio are improved, so that the convex hull set corresponding to the data point set can be determined more quickly and accurately.
Smart Images

Figure CN2024103145_13032025_PF_FP_ABST
Abstract
Description
Convex hull detection method, device, equipment and storage medium
[0001] This application claims priority to Chinese patent application No. 202311140125.X, filed on September 6, 2023, entitled “Convex hull detection method, device, apparatus and storage medium”, the entire contents of which are incorporated herein by reference. Technical Field
[0002] The embodiments of the present application relate to the field of computer technology, and in particular to a convex hull detection method, apparatus, device, and storage medium. Background Art
[0003] The convex hull is a common concept in graphics. It refers to the convex polygon formed by connecting the outermost points of a set of data points on a two-dimensional plane. Convex hull detection (Graham scanning) analyzes a set of data points to determine the convex hull. It is commonly used in fields such as object recognition, gesture recognition, and edge detection.
[0004] In related art, an open source computer vision library (OpenCV) runs on a processor. When an application running on the processor needs to perform convex hull detection on a set of data points, the convexHull function in OpenCV is called to analyze the set of data points stored in the memory module to implement a Graham scan. As shown in FIG1 , the processor 110 is implemented as a processor such as a central processing unit (CPU), a graphics processing unit (GPU), or a digital signal processor (DSP). The application running on the processor 110 performs the convex hull detection and analysis process on the set of data points by calling the convexHull function.
[0005] The above-mentioned process of performing convex hull detection is highly dependent on the performance of the processor, and the application must be run on a processor that supports OpenCV to achieve the purpose of calling the convexHull function to perform Graham scan. This function call process makes the reading speed of the data point set in the memory module slow when analyzing it, making the Graham scan less energy-efficient.
[0006] Summary of the Invention
[0007] Embodiments of the present application provide a convex hull detection method, apparatus, device, and storage medium. These methods enable timely adjustment of a first stack sequence to enable more comprehensive convex hull detection and analysis of the n+1th data point and a portion of the data points cached in the first stack sequence, thereby improving the real-time processing speed of the convex hull detection process. The technical solution is as follows.
[0008] In one aspect, a convex hull detection method is provided, which is performed by a computer device, and the method includes:
[0009] Obtaining the n+1th data point from a set of data points, where each data point in the set of data points has a corresponding position coordinate, and the position coordinate is used to indicate a distribution position of the data point, where n is an integer greater than 1;
[0010] Determining, from the first stack sequence, a first data point and a second data point corresponding to a predetermined position in the stack, wherein the first data point and the second data point are obtained from the data point set before the (n+1)th data point and are stacked into the data points of the first stack sequence;
[0011] Based on the relative positional relationship between the position coordinates corresponding to the (n+1)th data point, the first data point, and the second data point, respectively, performing convex hull detection on the first data point to obtain a convex hull detection result corresponding to the first data point;
[0012] Based on the convex hull detection result corresponding to the first data point, the storage of the data points in the first stack sequence is adjusted until the data points in the data point set are detected and a convex hull point set is obtained.
[0013] On the other hand, a convex hull detection device is provided, the device comprising a convex hull detection module and a memory module;
[0014] The memory module is used to store a data point set, each data point in the data point set corresponds to a position coordinate, and the position coordinate is used to indicate the distribution position of the data point;
[0015] The convex hull detection module is used to obtain the n+1th data point from the data point set stored in the memory module, where n is an integer greater than 1; determine a first data point and a second data point corresponding to a preset position in the stack from the first stack sequence, where the first data point and the second data point are data points obtained from the data point set before the n+1th data point and stacked into the first stack sequence; perform convex hull detection on the first data point based on the relative position relationship of the position coordinates corresponding to the n+1th data point, the first data point, and the second data point, to obtain a convex hull detection result corresponding to the first data point; and adjust the storage status of the data points in the first stack sequence based on the convex hull detection result corresponding to the first data point until the data points in the data point set are detected and the convex hull point set is obtained.
[0016] On the other hand, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set, or an instruction set, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the convex hull detection method as described in any of the above embodiments of the present application.
[0017] On the other hand, a computer-readable storage medium is provided, wherein the storage medium stores at least one instruction, at least one program, a code set, or an instruction set, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the convex hull detection method as described in any of the above embodiments of the present application.
[0018] In another aspect, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the convex hull detection method described in any of the above embodiments.
[0019] The beneficial effects of the technical solutions provided in the embodiments of the present application include at least:
[0020] Based on at least two data points in the data point set cached in the first stack sequence, a comprehensive analysis is performed on the n+1th data point obtained from the data point set and the first data point and the second data point at a preset in-stack position of the first stack sequence, thereby performing convex hull detection on the first data point based on the relative positional relationship of the position coordinates of the three data points. The convex hull detection result enables timely adjustment of the storage status of the data points in the first stack sequence, which facilitates a more comprehensive convex hull detection analysis of the n+1th data point and some data points cached in the first stack sequence based on the adjustment result. The real-time acquisition of data points and the real-time convex hull detection process facilitates improving the energy efficiency of comprehensive analysis of multiple data points in the data point set while increasing the convex hull detection processing speed, thereby more quickly and accurately determining the convex hull point set corresponding to the data point set. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] FIG1 is a schematic diagram of related technologies provided by an exemplary embodiment of the present application;
[0022] FIG2 is a schematic diagram of an implementation environment provided by an exemplary embodiment of the present application;
[0023] FIG3 is a flow chart of a convex hull detection method provided by an exemplary embodiment of the present application;
[0024] FIG4 is a flow chart of a convex hull detection method provided by another exemplary embodiment of the present application;
[0025] FIG5 is a schematic diagram of determining convex hull points provided by an exemplary embodiment of the present application;
[0026] FIG6 is a schematic diagram of determining convex hull points provided by another exemplary embodiment of the present application;
[0027] FIG7 is a flowchart of a convex hull detection method provided by another exemplary embodiment of the present application;
[0028] FIG8 is a structural block diagram of a convex hull detection device provided by an exemplary embodiment of the present application;
[0029] FIG9 is a structural block diagram of a convex hull detection device provided by another exemplary embodiment of the present application;
[0030] FIG10 is a structural block diagram of a convex hull detection device provided by another exemplary embodiment of the present application;
[0031] FIG11 is a structural block diagram of a convex hull detection device provided by another exemplary embodiment of the present application;
[0032] FIG12 is a structural block diagram of a convex hull detection device provided by another exemplary embodiment of the present application;
[0033] FIG13 is a structural block diagram of a convex hull detection device provided by another exemplary embodiment of the present application;
[0034] FIG14 is a block diagram of a convex hull scanning stack provided by an exemplary embodiment of the present application;
[0035] FIG15 is a schematic diagram showing the relative relationship between parameters on a stack cache sub-unit and a stack unit provided by an exemplary embodiment of the present application;
[0036] FIG16 is a structural block diagram of an optional convex hull detection device provided by an exemplary embodiment of the present application;
[0037] FIG17 is a structural block diagram of another optional convex hull detection device provided by an exemplary embodiment of the present application;
[0038] FIG18 is a structural block diagram of a server provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0039] First, a brief introduction is given to the terms involved in the embodiments of this application.
[0040] Convex Hull: It is a concept in computational geometry (graphics). In a real vector space V, for a given set X, the intersection S of all convex sets containing X is called the convex hull of X.
[0041] Graham scan: is a commonly used convex hull point detection algorithm, which is used to enclose the convex hull of a set of points, that is, the smallest convex polygon that can enclose the points in the point set.
[0042] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant region. For example, the data point set, first data point, second data point, convex hull detection results and other contents involved in this application are all obtained with full authorization.
[0043] Next, the implementation environment involved in the embodiments of the present application is described. The convex hull detection method provided in the embodiments of the present application can be implemented by a terminal alone, by a server, or by a terminal and a server through data interaction, and the embodiments of the present application are not limited thereto. Optionally, the convex hull detection method is described using the interaction between a terminal and a server as an example.
[0044] Schematically, please refer to FIG. 2 , the implementation environment involves a terminal 210 and a server 220 , and the terminal 210 and the server 220 are connected via a communication network 230 .
[0045] In some embodiments, terminal 210 is equipped with a memory module capable of data storage. The memory module stores a set of data points, each of which has corresponding location coordinates indicating the distribution of the data points. Illustratively, the set of data points is used to store multiple key points obtained after recognizing an image.
[0046] In some embodiments, the server 220 obtains the n+1th data point from the data point set stored in the terminal 210 through the communication network 230 , where n is an integer greater than 1.
[0047] Optionally, the server 220 determines a first data point and a second data point corresponding to a preset position in the stack from the first stack sequence, wherein the first data point and the second data point are data points obtained from the data point set before the n+1th data point and pushed into the first stack sequence. Schematically, the first stack sequence is a stack deployed on the server 220. Before the convex hull detection is performed on the data points in the data point set, the first stack sequence is an empty stack, that is, no data points are stored in the first stack sequence. As the convex hull detection process proceeds, the data points are pushed into the stack based on the convex hull detection results of the data points, thereby filling the first stack sequence, wherein the first data point and the second data point are data points determined after at least two data points are stored in the first stack sequence, and the first data point and the second data point are data points stored at the preset position in the stack of the first stack sequence.
[0048] In some embodiments, the server 220 performs a convex hull detection on the first data point based on the relative positional relationship between the position coordinates corresponding to the n+1th data point, the first data point, and the second data point, respectively, to obtain a convex hull detection result corresponding to the first data point. Illustratively, the convex hull detection result is used to characterize the enclosing relationship of the first data point relative to the n+1 data points and the second data point, such as: the convex hull detection result is implemented as the first data point being a convex hull point relative to the n+1 data point and the second data point; or the convex hull detection result is implemented as the first data point being not a convex hull point relative to the n+1 data point and the second data point.
[0049] In some embodiments, server 220 adjusts the storage of data points in the first stack sequence based on the convex hull detection result corresponding to the first data point. For example, after determining the convex hull detection result corresponding to the first data point, server 220 performs a pop operation on the data points stored in the first stack sequence, or performs a push operation on n+1 data points, or performs a pop operation on the data points stored in the first stack sequence and a push operation on n+1 data points, etc., based on the difference in the convex hull detection results.
[0050] Optionally, a convex hull point set is obtained after all data points in the data point set are detected. Schematically, the convex hull point set is used to represent a point set that can enclose the data points in the data point set, and based on the position coordinates of the data points in the convex hull point set, a minimum convex polygon that encloses the data points in the data point set can be determined.
[0051] Optionally, the server 220 sends the convex hull point set to the terminal 210 via the communication network 230 so that the terminal 210 can determine the data points in the convex hull point set, for example, determining the convex hull point set surrounding the key point in the image to determine the main body range of the image.
[0052] It is worth noting that the above-mentioned terminals include but are not limited to mobile terminals such as mobile phones, tablets, portable laptops, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, etc., and can also be implemented as desktop computers, etc.; the above-mentioned servers can be independent physical servers, or they can be server clusters or distributed systems composed of multiple physical servers, or they can be 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, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0053] Cloud technology refers to a hosting technology that unifies hardware, applications, networks, and other resources within a wide or local area network (WAN) to enable data computing, storage, processing, and sharing. Cloud technology is a general term for network, information, integration, management platform, and application technologies used in the cloud computing business model. It can form a resource pool that can be used flexibly and conveniently on demand.
[0054] In some embodiments, the above-mentioned server can also be implemented as a node in a blockchain system.
[0055] In combination with the above-mentioned term introduction and application scenarios, the convex hull detection method provided in this application is explained. The method is executed by a computer device. Taking the method executed by a server as an example, as shown in Figure 3, the method includes the following steps 310 to 340.
[0056] Step 310: Obtain the (n+1)th data point from the data point set.
[0057] Where n is an integer greater than 1. Illustratively, a data point set stores multiple data points, and the multiple data points in the data point set are the data points on which convex hull detection is performed. Convex hull detection is used to determine a point boundary that encloses the multiple data points, and the data points on the point boundary are included in the multiple data points.
[0058] Optionally, the data point set corresponds to an image. For example, the data point set includes multiple key points obtained after performing key point recognition on the image. Optionally, the data point set is composed of multiple subsets, each subset storing a portion of the multiple data points, and each subset corresponding to an image.
[0059] Schematically, the above-mentioned images can be implemented as pre-captured images or as images captured in real time in application scenarios, such as: images containing objects captured in real time in object recognition scenarios; or gesture images captured in real time in gesture recognition scenarios; or environmental images captured in real time in boundary detection scenarios, etc.
[0060] The data points in the data point set have corresponding position coordinates, and the position coordinates are used to indicate the distribution positions of the data points.
[0061] Schematically, multiple data points in a data point set correspond to different position coordinates, which are used to represent the location information of the data points. For example, a data point set corresponds to an image, which includes multiple data points obtained after key point detection on the image; the position coordinates corresponding to the data points are used to represent the location information of the data points in the image, and each data point corresponds to a position coordinate to represent the distribution of different data points in the image.
[0062] In some embodiments, the n+1th data point is a data point determined based on the order in which multiple data points in the data point set are acquired; or, the multiple data points in the data point set have an arrangement order in advance, and the n+1th data point ranked n+1th among the multiple data points is determined based on the arrangement order.
[0063] Optionally, the arrangement order is an order determined based on position coordinates corresponding to a plurality of data points; or, the arrangement order is a pre-set order, etc.
[0064] Schematically, for multiple data points in a data point set, first determine the data point with the smallest horizontal axis and the smallest vertical axis based on the position coordinates of the multiple data points, and use this data point as the pole. Then determine the polar angles of other data points relative to the pole, and arrange the multiple data points according to the polar angles, such as: take the data point corresponding to the pole as the first data point, and arrange the other data points in order from small to large according to the polar angles, so as to determine the arrangement order of the multiple data points.
[0065] Step 320: Determine, from the first stack sequence, a first data point and a second data point corresponding to a predetermined position in the stack.
[0066] Illustratively, the first stack sequence is a sequence determined based on performing convex hull detection on first n data points, wherein at least two data points among the first n data points are stored.
[0067] Optionally, a stack is deployed on the server in advance. Before convex hull detection is performed on the data points in the data point set, the stack is empty, that is, no data points are cached in the stack. As the convex hull detection process proceeds, the data points are pushed into the stack based on the convex hull detection results of the data points, and a first stack sequence is obtained after at least two data points are stored in the stack.
[0068] The first data point and the second data point are obtained from the data point set before the (n+1)th data point and are stacked into the data points of the first stack sequence.
[0069] Therefore, the first data point and the second data point are data points determined after at least two data points are buffered in the first stack sequence, and the first data point and the second data point are data points buffered at preset in-stack positions in the first stack sequence.
[0070] Optionally, the preset stack position is a stack position indicated by a predetermined pointer. Illustratively, the preset stack position is a stack position indicated by a top-of-stack pointer. As data points are pushed into the stack, the stack position indicated by the top-of-stack pointer changes. The first data point and the second data point are determined based on the data point cached at the top-of-stack position.
[0071] Illustratively, the first data point is a data point cached at a preset stack location indicated by a stack top pointer, the second data point is a data point sorted after the first data point in the first stack sequence, and so on.
[0072] Step 330 : Based on the relative positional relationship between the position coordinates corresponding to the (n+1)th data point, the first data point, and the second data point, a convex hull detection is performed on the first data point to obtain a convex hull detection result corresponding to the first data point.
[0073] Schematically, after obtaining the n+1th data point and determining the first data point and the second data point in the first stack sequence, the position coordinates corresponding to the n+1th data point, the position coordinates corresponding to the first data point, and the position coordinates corresponding to the second data point are determined, and then convex hull detection is performed on the first data point in the first stack sequence based on the relative position relationship of the position coordinates corresponding to the three data points.
[0074] Optionally, the relative position relationship is used to characterize the spatial relative relationship between the three data points. Convex hull detection is used to determine whether the first data point is a convex hull point relative to the second data point and the (n+1)th data point. The convex hull detection result corresponding to the first data point is used to characterize the convex hull status of the first data point relative to the second data point and the (n+1)th data point.
[0075] Schematically, the convex hull detection result includes the following two results: (1) the convex hull detection result indicates that the first data point is a convex hull point relative to the second data point and the n+1th data point; (2) the convex hull detection result indicates that the first data point is not a convex hull point relative to the second data point and the n+1th data point.
[0076] Step 340 : Based on the convex hull detection result corresponding to the first data point, the storage of the data points in the first stack sequence is adjusted until the data points in the data point set are detected and a convex hull point set is obtained.
[0077] Schematically, after obtaining the convex hull detection result corresponding to the first data point, the positional relationship of the first data point relative to the second data point and the n+1th data point can be known, and two situations are realized based on the convex hull detection result. Therefore, based on the difference in the convex hull detection results, there will also be a differential adjustment process when adjusting the storage of data points in the first stack sequence.
[0078] Optionally, the storage status of the data points in the first stack sequence is adjusted in at least one of the following ways: (1) adjusting the data points that have been stored in the first stack sequence (such as the first data point, the second data point, etc.); (2) adjusting the data points that are undergoing convex hull detection but have not yet been stored in the first stack sequence (such as the n+1th data point, etc.), etc.
[0079] Optionally, adjusting the storage of data points in the first stack sequence includes at least one of a pop adjustment and a push adjustment. Illustratively, performing a pop adjustment on the first stack sequence indicates performing a pop operation on the data points in the first stack sequence; performing a push adjustment on the first stack sequence indicates writing the (n+1)th data point into the first stack sequence, etc.
[0080] For illustration, a stack is an abstract data type frequently used in computer science. When used for data caching, a stack has a characteristic: the last data point pushed into the stack is the first data point taken out. Queues based on this characteristic are often called last-in, first-out (LIFO) queues, or first-in, last-out queues, such as the first stack sequence described above. In other words, when a stack is used for caching, the last data point pushed into the stack is treated as the first data point popped from the stack when a pop operation is performed.
[0081] Optionally, a stack defines several operations, the two most important of which are push and pop. A push operation adds a data point to the top of the stack; a pop does the opposite, removing a data point from the top of the stack and reducing the stack size by one.
[0082] In some embodiments, when a push operation is performed on the first stack sequence, the data point is cached in the first stack sequence; when a pop operation is performed on the first stack sequence, the pop operation is performed by updating the first top stack pointer corresponding to the first stack sequence (i.e., no specific move-out operation may be performed on the data point in the first stack sequence) to indicate that the data point stored at the top of the stack has changed.
[0083] The first stack top pointer represents a stack top pointer corresponding to the first stack sequence, and is used to point to the stack top position of the first stack sequence.
[0084] In some embodiments, when adjusting the storage status of data points in the first stack sequence based on the convex hull detection result corresponding to the first data point, when the convex hull detection result indicates that the first data point is a convex hull point, one sequence adjustment method is used to adjust the storage status of the data points in the first stack sequence; when the convex hull detection result indicates that the first data point is not a convex hull point, another sequence adjustment method is used to adjust the storage status of the data points in the first stack sequence.
[0085] Optionally, when the convex hull detection result indicates that the first data point is a convex hull point, the n+1th data point is written into the first stack sequence, thereby increasing the number of cached data points in the first stack sequence, and the top data point in the first stack sequence becomes the n+1th data point, so as to achieve the purpose of adjusting the storage situation of the data points in the first stack sequence.
[0086] Optionally, when the convex hull detection result indicates that the first data point is not a convex hull point, the preset pointer indicating the first data point is adjusted, such as: the first data point is the data point pointed to by the first stack top pointer. When the first data point is not a convex hull point, the first stack top pointer is adjusted to point to the second data point, thereby achieving the purpose of adjusting the storage status of the data points in the first stack sequence, etc.
[0087] In an optional embodiment, multiple data points in the data point set are analyzed in sequence, and convex hull detection results corresponding to the multiple data points are obtained, and then the first stack sequence is adjusted based on the convex hull detection results corresponding to each data point, until the data points in the data point set are detected and the convex hull point set is obtained.
[0088] Illustratively, a convex hull point set is a set of data points that belong to the convex hull point after performing convex hull detection analysis on multiple data points. That is, the convex hull point set includes some data points, which are convex hull points determined after convex hull detection. These data points can enclose the remaining data points in the multiple data points, and these data points and the remaining data points together constitute the multiple data points in the data point set.
[0089] Optionally, when the above-mentioned pop operation is used to represent an operation of removing a data point from the first stack sequence, it means that when the first data point does not belong to a convex hull point, it is removed from the first stack sequence. Through the above-mentioned removal process, the data points stored in the first stack sequence are data points in the convex hull point set.
[0090] Optionally, when the above-mentioned pop operation is used to represent an operation of adjusting the first top pointer of the first stack sequence, that is, data points that do not belong to the convex hull points are not read out from the first stack sequence, a convex hull point identifier can be added to the data point when it is determined that the data point belongs to the convex hull point, so that after analyzing multiple data points, the data points marked with the convex hull point identifier are determined from the multiple data points and form a convex hull point set.
[0091] It should be noted that the above are merely illustrative examples and are not limited to the embodiments of the present application.
[0092] In summary, based on the fact that at least two data points in the data point set are cached in the first stack sequence, a comprehensive analysis is performed on the n+1th data point obtained from the data point set and the first data point and the second data point at the preset stack position of the first stack sequence, thereby performing convex hull detection on the first data point based on the relative position relationship of the position coordinates of the three data points. The convex hull detection result enables timely adjustment of the storage status of the data points in the first stack sequence, which is conducive to performing a more comprehensive convex hull detection analysis on the n+1th data point and some data points cached in the first stack sequence based on the adjustment result. The real-time acquisition of data points and the real-time convex hull detection process are conducive to improving the processing speed and flexibility of the convex hull detection, as well as improving the energy efficiency of comprehensive analysis of multiple data points in the data point set, thereby more quickly and accurately determining the convex hull point set corresponding to the data point set. Regardless of how many data points are stored in the first stack sequence, the convex hull detection process can be used for identification.
[0093] In an optional embodiment, based on the position coordinates corresponding to the n+1th data point, the first data point, and the second data point, respectively, the convex hull detection result corresponding to the first data point is analyzed by the vector formed between the first data point and the n+1th data point and the first data point and the second data point; in addition, after determining the convex hull detection result corresponding to the first data point, the discard analysis result of the data point is determined based on the difference in the convex hull detection results, thereby adjusting the storage of the data points in the first stack sequence. Schematically, as shown in FIG4 , step 330 shown in FIG3 above can also be implemented as steps 410 to 430 as follows; and step 340 above can also be implemented as steps 440 to 450 as follows.
[0094] Step 410 : Determine a first vector formed by the (n+1)th data point and the first data point based on the position coordinates corresponding to the (n+1)th data point and the first data point, respectively.
[0095] Illustratively, the position coordinates corresponding to the (n+1)th data point and the position coordinates corresponding to the first data point are determined, and then a first vector pointing from the first data point to the (n+1)th data point is constructed based on the position coordinates.
[0096] For example: the n+1th data point is data point M2, and the position coordinates corresponding to data point M2 are (M 2x , M 2y ), the first data point is data point M0, and the position coordinates corresponding to data point M2 are (M 2x , M 0y ), then the first vector formed by the n+1th data point and the first data point is represented as vector M0M2.
[0097] Step 420 : Determine a second vector formed by the first data point and the second data point based on the position coordinates corresponding to the first data point and the second data point, respectively.
[0098] Illustratively, the position coordinates corresponding to the second data point and the position coordinates corresponding to the first data point are determined, and then a second vector pointing from the first data point to the second data point is constructed based on the position coordinates.
[0099] For example: the second data point is data point M1, and the position coordinates corresponding to data point P1 are (M 1x , M 1y ), the first data point is data point M0, and the position coordinates corresponding to data point M0 are (M 0x , M 0y ), then the second vector formed by the first data point and the second data point is represented as vector M0M1.
[0100] Step 430 : Obtain a convex hull detection result corresponding to the first data point based on the vector cross product between the first vector and the second vector.
[0101] Schematically, after determining the first vector and the second vector, the vector cross product between the first vector and the second vector is solved. Taking the first vector as vector M0M2 and the second vector as vector M2M1 as an example, the vector cross product between the first vector and the second vector is calculated as shown in Formula 1 below.
[0102] Formula 1: M2M2×M2M1=(M 2x -M 2x )(M 1y -M 0y )-(M 2y -M 0y )(M 1x -M 1y )
[0103] Among them, M 2x is the horizontal coordinate corresponding to the n+1th data point; M 0x is the horizontal coordinate corresponding to the first data point; M 1y is the ordinate corresponding to the second data point; M 0y is the vertical coordinate corresponding to the first data point; M 2y is the vertical coordinate corresponding to the n+1th data point; M 1x is the horizontal coordinate corresponding to the second data point.
[0104] In an optional embodiment, in response to the vector cross product being a positive value, determining that the first data point is a convex hull point is used as the convex hull detection result.
[0105] Schematically, if the vector cross product between the first vector formed by data point M2 and data point M0 and the second vector formed by data point M0 and data point M1 is a positive value, it means that the angle between vector M0M1 and vector M0M2 is less than 180 degrees, and data point M0 is a convex hull point.
[0106] Figure 5 shows a schematic diagram for determining whether data point M0 is a convex hull point. Some data points are cached in GS_STACK, and the stack top pointer is used as the location pointed to by the preset stack position. The current first data point is data point M0 pointed to by the stack top pointer, and the second data point is data point M1 cached after data point M0.
[0107] The n+1th data point currently undergoing convex hull detection is data point M2. The convex hull condition of data point M0 is determined based on the vector cross product between vector M0M1 and vector M0M2. For example, the vector cross product between vector M0M1 and vector M0M2 is a positive value, indicating that the angle 510 between vector M0M1 and vector M0M2 is less than 180°. Therefore, data point M0 is a data point located outside data point M2 and data point M1, and therefore data point M0 is a convex hull point.
[0108] In an optional embodiment, in response to the vector cross product being a negative value, determining that the first data point is not a convex hull point is used as the convex hull detection result.
[0109] Schematically, if the vector cross product between the first vector formed by the data point M2 and the data point M0 and the second vector formed by the data point M0 and the data point M1 is a negative value, it means that the angle between the vector M0M1 and the vector M0M2 is greater than 180 degrees, and the data point M0 is not a convex hull point.
[0110] Figure 6 shows a schematic diagram for determining whether data point M0 is a convex hull point. Some data points are cached in GS_STACK, and the stack top pointer is used as the location pointed to by the preset stack position. The current first data point is data point M0 pointed to by the stack top pointer, and the second data point is data point M1 cached after data point M0.
[0111] The n+1th data point currently performing convex hull detection is data point M2. The convex hull condition of data point M0 is determined based on the vector cross product between vector M0M1 and vector M0M2. For example, the vector cross product between vector M0M1 and vector M0M2 is a negative value, indicating that the angle 610 between vector M0M1 and vector M0M2 is greater than 180°. Therefore, data point M0 is a data point that can be surrounded by the straight line connecting data point M2 and data point M1. Therefore, data point M0 is not a convex hull point.
[0112] It should be noted that the above are merely illustrative examples and are not limited to the embodiments of the present application.
[0113] Step 440 : Determine, based on the convex hull detection result, a rejection analysis result of the data points in the first stack sequence based on the (n+1)th data point.
[0114] Illustratively, after obtaining the convex hull detection result corresponding to the first data point, the rejection and retention of the first data point in the first stack sequence is analyzed using the convex hull detection result to obtain a rejection and retention analysis result.
[0115] The discard analysis result is used to indicate whether to retain the data point in the first stack sequence or to pop the data point from the first stack sequence. In other words, the discard analysis result is used to represent the processing result of the data point in the first stack sequence.
[0116] In an optional embodiment, in response to the convex hull detection result indicating that the first data point is a convex hull point, the rejection analysis result is determined to be a retention result of retaining the data point in the first stack sequence, such as retaining the first data point in the first stack sequence.
[0117] Illustratively, the retention result of retaining the first data point in the first stack sequence is used as the discard analysis result when the first data point is a convex hull point.
[0118] In an optional embodiment, in response to the convex hull detection result indicating that the first data point is not a convex hull point, the rejection analysis result is determined to be a pop result of popping the data point from the first stack sequence, such as popping the first data point from the first stack sequence.
[0119] Illustratively, when the first data point is not a convex hull point, a popping result of popping the first data point from the first stack sequence is determined as a discard analysis result when the first data point is not a convex hull point.
[0120] Specifically, the results of the discard analysis include a retain result that retains the data point in the first stack sequence, and a pop result that pops the data point from the first stack sequence. The discard analysis results determine whether a data point remains in the first stack sequence, thereby intelligently managing convex hull and non-convex hull points, reducing unnecessary data storage and processing and reducing computing resource consumption.
[0121] Step 450: Adjust the storage of data points in the first stack sequence based on the rejection analysis result.
[0122] Illustratively, in addition to determining the rejection analysis result corresponding to the first data point based on the convex hull detection result of the first data point, the storage of data points in the first stack sequence is adjusted based on the (n+1)th data point according to the difference represented by the rejection analysis result.
[0123] Optionally, the discard analysis result includes a retain result of retaining the first data point in the first stack sequence, and a pop result of popping the first data point from the first stack sequence.
[0124] In an optional embodiment, based on a retention result of the rejection analysis that the first data point is retained in the first stack sequence, the (n+1)th data point is written into the first stack sequence.
[0125] Schematically, when the discarded analysis result is realized as the retention result of the first data point in the first stack sequence, the n+1th data point currently undergoing convex hull point detection is written into the first stack sequence, that is, a write operation (PUSH) is performed on the n+1th data point, thereby increasing the number of cached data points in the first stack sequence.
[0126] In an optional embodiment, based on the rejection analysis result indicating that the first data point is to be popped from the first stack sequence, a pop operation is performed on the first data point from the first stack sequence.
[0127] Optionally, the first data point is a data point pointed to by a first stack top pointer, and the pop operation process is used to adjust the first stack top pointer so that the data point pointed to by the first stack top pointer changes.
[0128] In some embodiments, after performing a pop operation on the first data point, the first stack top pointer is pointed to the second data point.
[0129] Schematically, the first top pointer represents the top pointer corresponding to the first stack sequence, and is used to point to the top position of the first stack sequence. Based on the "first in, last out" feature of the first stack sequence, the preset stack position pointed to by the first top pointer is the cache position of the data point most recently pushed into the first stack sequence, that is, the data point pointed to by the first top pointer is the data point most recently pushed into the first stack sequence.
[0130] Optionally, the first data point is the top data point pointed to by the first top pointer, and the second data point is the data point in the first stack sequence that is located after the first data point. Therefore, after performing a pop operation on the first stack sequence, the data point at the top of the stack is the second data point, that is, the data point pointed to by the first top pointer is the second data point.
[0131] In some embodiments, the determination to retain the second data point in the first stack sequence is made in response to the second data point being a convex hull point relative to the (n+1)th data point and the third data point.
[0132] Illustratively, after determining that the first stack top pointer points to the second data point, a third data point located after the second data point in the first stack sequence is determined, and based on the coordinate positions corresponding to the second data point, the third data point, and the (n+1)th data point, the convex hull condition of the second data point is determined. The third data point is equivalent to the second data point when the convex hull detection is not performed on the first data point; and the second data point is equivalent to the first data point when the convex hull detection is not performed on the first data point.
[0133] Optionally, if the second data point is a convex hull point relative to the (n+1)th data point and the third data point, the second data point is retained in the first stack sequence.
[0134] In some embodiments, the (n+1)th data point is written to the first stacked sequence based on the second data point remaining in the first stacked sequence.
[0135] Optionally, the pop operation corresponding to the first data point is implemented by adjusting the first top stack pointer corresponding to the first stack sequence. Therefore, although the first data point undergoes a pop operation, it is not moved out of the first stack sequence. Based on this, when the n+1th data point is written into the first stack sequence, after the n+1th data point is written into the first stack sequence, the n+1th data point is the data point pointed to by the first top stack pointer; the first data point is the data point located after the n+1th data point in the first stack sequence; the second data point is still the data point located after one data point in the first stack sequence, and so on.
[0136] Optionally, the pop operation corresponding to the first data point is achieved by moving the first data point out of the first stack sequence. Based on the "first in, last out" feature of the first stack sequence, after the n+1th data point is written into the first stack sequence, the n+1th data point is the data point pointed to by the first stack top pointer; the second data point is the data point located after the n+1th data point in the first stack sequence, and so on.
[0137] It is worth noting that the above pop operation is only an illustrative example and is not limited to this embodiment of the present application.
[0138] In some embodiments, the salient point scanning process is described as follows.
[0139] 1. In the initial state.
[0140] (1) The data point set is implemented as an input point set sorted according to the order of data point arrangement: M0, M1, M2 to Mn.
[0141] (2) The first stack sequence (GS_Stack) is empty.
[0142] 2. Read point M0 from the input point set. Since the number of data points in GS_Stack is less than 2, M0 is pushed into the stack.
[0143] 3. Read point M1 from the input point set. Since the number of data points in GS_Stack is less than 2, M1 is pushed into the stack.
[0144] 4. Read point M2 from the input point set, and perform convex hull determination on point M2 and the stack vertices M0 (first data point) and M1 (second data point) of GS_Stack. If point M1 is a convex hull point, point M2 is pushed into the stack; wherein, the stack vertex M0 is the first data point and M1 is the second data point.
[0145] 5. Read point M3 from the input point set, and perform convex hull determination on point M3 and the stack vertices M1 and M2 of GS_Stack. If point M2 is a convex hull point, point M3 is pushed into the stack; wherein, the stack vertex M2 is the first data point and M1 is the second data point.
[0146] 6. Read point M4 from the input point set, and perform convex hull determination on point M4 and the stack vertices M2 and M3 of GS_Stack. If point M3 is a convex hull point, point M4 is pushed into the stack; wherein, the stack vertex M3 is the first data point and M2 is the second data point.
[0147] 7. Read point M5 from the input point set, and perform convex hull point determination on point M5 and the stack vertices M3 and M4 of GS_Stack. If point M4 is not a convex hull point, point M4 is popped from the stack; at this time, the stack vertex M4 is the first data point and M3 is the second data point.
[0148] Illustratively, based on the popping process of point M4, the stack top pointer is adjusted so that it points to point M3. That is, point M5 is compared with the convex hull points of GS_Stack, M3 and M2. If M3 is not a convex hull point, then M3 is popped from the stack. At this point, the stack vertex M3 becomes the first data point, and M2 becomes the second data point.
[0149] Schematically, based on the popping process of point M3, the stack top pointer is adjusted again so that it points to point M2. In other words, point M5 is compared with the convex hull points of GS_Stack, M1 and M2. If M2 is a convex hull point, M5 is pushed onto the stack. At this point, the stack vertex M2 is the first data point, and M1 is the second data point.
[0150] 8. Repeat the above process by adjusting the first top pointer of the first stack sequence to implement the pop operation until Mn points are read from the input point set and processed, and the entire processing process is completed.
[0151] It should be noted that the above are merely illustrative examples and are not limited to the embodiments of the present application.
[0152] In some embodiments, the first stack sequence is implemented as the aforementioned GS_Stack; alternatively, the first stack sequence is implemented as the top portion of the GS_Stack, such as represented by Stack_Buf. Due to the "last-in, first-out" nature of the first stack sequence, the data points belonging to the top portion of the stack sequence represented by Stack_Buf (i.e., data points located at the top portion of the stack) are identical to the data points at the top portion of the stack represented by GS_Stack. Using Stack_Buf as the first stack sequence for performing convex hull detection avoids caching bottom-of-stack data that is not temporarily needed for convex hull detection. By using the portion of top-of-stack data points capable of performing a pop operation as data points in the first stack sequence, the storage space of the first stack sequence can be effectively reduced.
[0153] Optionally, based on the stack top pointer being used to point to the stack top position, if the data points belonging to the stack top partial sequence represented by Stack_Buf are used as data points in the first stack sequence, then as the stack top pointer of GS_Stack changes, the data points cached in Stack_Buf change accordingly; at this time, Stack_Buf is the first stack sequence, in which part of the stack top data (such as: a preset number of stack top data) is cached; GS_Stack is used to cache n data points before the n+1th data point.
[0154] In some embodiments, after the first stack top pointer points to the second data point, if no other data point is cached after the second data point in the first stack sequence, the (n+1)th data point is written into the first stack sequence.
[0155] Illustratively, two data points (i.e., the first data point and the second data point) are cached in the first stack sequence, and the (n+1)th data point is implemented as the third data point. If the first data point is a convex hull point relative to the second data point and the third data point, the third data point is written into the first stack sequence; if the first data point is not a convex hull point relative to the second data point and the third data point, the first data point is popped from the first stack sequence. Since performing convex hull detection on the third data point requires that more than two data points are cached in the first stack sequence, the third data point can be cached in the first stack sequence first, so that the convex hull detection can be continued on the third data point through subsequently received data points, such as performing the next convex hull detection process through the fourth data point, the third data point, and the second data point.
[0156] It should be noted that the above are merely illustrative examples and are not limited to the embodiments of the present application.
[0157] In summary, based on storing at least two data points in the first stack sequence, the real-time acquisition of data points and the real-time convex hull detection process are beneficial to improving the convex hull detection processing speed while improving the energy efficiency of comprehensive analysis of multiple data points in the data point set, thereby more quickly and accurately determining the convex hull point set corresponding to the data point set.
[0158] In an embodiment of the present application, the content of determining two vectors by the position coordinates corresponding to the data points, and then determining the convex hull detection result of the first data point based on the angle between the two vectors is introduced. Through the positive and negative values of the vector cross product, the relative positions of the three data points can be more intuitively known, thereby determining the convex hull of the first data point relative to the remaining two data points, so as to perform a more targeted analysis of the convex hull of the subsequent data points; in addition, the content of adjusting the storage of data points in the first stack sequence according to the difference in the convex hull detection results is also introduced. By pushing the n+1th data point into the stack, or performing a pop operation on the first data point to perform the convex hull detection process again based on the first stack sequence after the pop, a more comprehensive convex hull detection analysis is performed on multiple data points as much as possible, thereby improving the accuracy of convex hull point acquisition.
[0159] In an optional embodiment, the first stack sequence is a subsequence of the second stack sequence. Schematically, as shown in FIG7 , step 340 shown in FIG3 may further include the following steps 710 to 720 .
[0160] Step 710 : In response to the convex hull detection result indicating that a pop operation is to be performed on the first data point, a second stack top pointer corresponding to the second stack sequence is adjusted.
[0161] Illustratively, the second stack sequence is a stack for storing all data points. For the second stack sequence, there is a push operation to write data points into the stack, but there is no pop operation to read data points from the second stack sequence. During the convex hull point detection process for the (n+1)th data point, the second stack sequence stores n data points, and the second stack sequence waits for the convex hull detection to complete before storing the (n+1)th data point.
[0162] The data point pointed to by the first stack top pointer in the first stack sequence is in synchronization with the data point pointed to by the second stack top pointer in the second stack sequence.
[0163] Illustratively, the second top pointer is the top pointer corresponding to the second stack sequence. Before the pop operation is performed on the first stack sequence, the data point pointed to by the second top pointer in the second stack sequence is the data point at the top of the stack, that is, the data point most recently pushed into the second stack sequence.
[0164] Optionally, when a pop operation occurs on the first stack sequence, the second top pointer corresponding to the second stack sequence is adjusted. Illustratively, the first data point is the data point pointed to by the first top pointer; the convex hull detection result indicates that the first data point should be popped from the first stack sequence, and based on the pop result, the second top pointer corresponding to the second stack sequence is adjusted so that the second top pointer is adjusted to point to the data point.
[0165] Step 720 : Determine a second data point for performing convex hull detection based on the second stack top pointer.
[0166] Illustratively, according to the order in which the data points in the second stack sequence are written, the second stack top pointer is adjusted in reverse to determine the data point written most recently before the first data point. This data point is the second data point used to detect whether the first data point is a convex hull point.
[0167] In an optional embodiment, the first stack sequence is a stack for performing convex hull detection on multiple data points, in which some or all of the multiple data points are stored. For the first stack sequence, during a convex hull detection process, there is a push operation to write data points, and there may also be a pop operation to read data points from the first stack sequence; during the convex hull point detection process on the n+1th data point, the first stack sequence initially stores n data points. Based on the convex hull detection result corresponding to the first data point, the n+1th data point may be pushed into the first stack sequence, a pop operation may be performed on the data points in the first stack sequence, and the n+1th data point may be pushed into the first stack sequence after performing a pop operation on some data points, etc.
[0168] Optionally, before performing convex hull point detection on the n+2th data point, the missing data points in the first stack sequence are filled based on the stack top position represented by the second stack top pointer corresponding to the second stack sequence to start the convex hull point detection process for the n+2th data point.
[0169] In some embodiments, before performing convex hull point detection on the n+1th data point, the same n data points are stored in the first stack sequence and the second stack sequence; during the convex hull point detection on the n+1th data point, based on the popping process of the data point in the first stack sequence, the second top stack pointer in the second stack sequence is adjusted accordingly, such as: when one data point in the first stack sequence is popped, the second top stack pointer is adjusted in the opposite direction by one unit (i.e., one data point cache bit) based on the original top stack position; when three data points in the first stack sequence are popped, the second top stack pointer is adjusted in the opposite direction by three units (i.e., three data point cache bits) based on the original top stack position, etc.
[0170] It should be noted that the above are merely illustrative examples and are not limited to the embodiments of the present application.
[0171] In summary, based on storing at least two data points in the first stack sequence, the real-time acquisition of data points and the real-time convex hull detection process are beneficial to improving the convex hull detection processing speed while improving the energy efficiency of comprehensive analysis of multiple data points in the data point set, thereby more quickly and accurately determining the convex hull point set corresponding to the data point set.
[0172] In an optional embodiment, the convex hull detection method is implemented by a convex hull detection device. As shown in FIG8 , the convex hull detection device includes a convex hull detection module 810 and a memory module 820 .
[0173] The memory module 820 is used to store a set of data points.
[0174] The data points in the data point set each have corresponding position coordinates, and the position coordinates are used to indicate the distribution position of the data points.
[0175] The convex hull detection module 810 is used to obtain the n+1th data point from the data point set stored in the memory module 820, where n is an integer greater than 1.
[0176] Illustratively, the data point set corresponds to a set address, and the convex hull detection module 810 determines the data point set according to the set address, and obtains the (n+1)th data point currently requiring convex hull detection from the data point set.
[0177] The convex hull detection module 810 is further configured to determine, from the first stack sequence, a first data point and a second data point corresponding to a preset position in the stack.
[0178] The first data point and the second data point are obtained from the data point set before the (n+1)th data point and are stacked into the data points of the first stack sequence.
[0179] The convex hull detection module 810 is further used to perform convex hull detection on the first data point based on the relative position relationship of the position coordinates corresponding to the (n+1)th data point, the first data point, and the second data point, to obtain a convex hull detection result corresponding to the first data point.
[0180] The convex hull detection module 810 is further configured to adjust the storage of data points in the first stack sequence based on the convex hull detection result corresponding to the first data point, until the convex hull point set is obtained after all data points in the data point set are detected.
[0181] In an optional embodiment, the convex hull detection module 810 is further used to determine, based on the convex hull detection result, a rejection analysis result of the data points in the first stack sequence based on the (n+1)th data point, where the rejection analysis result is used to indicate whether to retain the data points in the first stack sequence or to pop the data points from the first stack sequence; and to adjust the storage status of the data points in the first stack sequence based on the rejection analysis result.
[0182] In an optional embodiment, the convex hull detection module 810 is further configured to, in response to the convex hull detection result indicating that the first data point is a convex hull point, determine to retain the first data point in the first stack sequence; and write the (n+1)th data point into the first stack sequence based on the first data point retained in the first stack sequence.
[0183] In an optional embodiment, the convex hull detection module 810 is further configured to, in response to the convex hull detection result indicating that the first data point is not a convex hull point, perform a pop operation on the first data point from the first stack sequence.
[0184] Among them, the first data point is the data point pointed to by the first top pointer corresponding to the first stack sequence; the first top pointer and the second top pointer corresponding to the second stack sequence have a synchronization relationship, and the first data point is also the data point pointed to by the second top pointer for the second stack sequence.
[0185] Optionally, the second stack sequence is a stack for storing all data points in the dataset. That is, the second stack sequence is used for performing a push operation (pushing a data point outside the second stack sequence into the second stack sequence to store the data point), but is not used for performing a pop operation (no need to pop a data point within the second stack sequence from the second stack sequence).
[0186] The memory module 820 is further configured to store n data points in the data point set in the second stack sequence based on the convex hull detection process.
[0187] The first stack sequence is a subsequence of the second stack sequence.
[0188] Illustratively, the memory module 820 includes a stack unit (STACK) for storing a second stack sequence; before the convex hull detection is performed on multiple data points in the data set, the stack unit is empty; in the process of sequentially performing convex hull detection on multiple data points in the data set, based on the completion of the convex hull detection on the first n data points, the first n data points are written into the second stack sequence stored in the stack unit in the memory module 820, that is: based on the convex hull detection process, n data points in the data point set have been stored in the second stack sequence, and the n data points are the data points that have previously undergone the convex hull detection process.
[0189] It should be noted that the above are merely illustrative examples and are not limited to the embodiments of the present application.
[0190] In summary, based on storing at least two data points in the first stack sequence, the real-time acquisition of data points and the real-time convex hull detection process are beneficial to improving the convex hull detection processing speed while improving the energy efficiency of comprehensive analysis of multiple data points in the data point set, thereby more quickly and accurately determining the convex hull point set corresponding to the data point set.
[0191] In an embodiment of the present application, the content of a convex hull detection method performed by a convex hull detection device is introduced. The convex hull detection device includes a memory module for storing a set of data points and a convex hull detection module for performing a convex hull detection process. The convex hull detection module can determine the convex hull detection result corresponding to the first data point based on the convex hull detection process between the currently input n+1th data point and the first data point and the second data point in the first stack sequence cached by itself, so as to achieve the purpose of timely adjustment of the first stack sequence. Compared with the process of the processor directly calling the convexHull function to perform convex hull detection, the convex hull detection device has higher processing efficiency; in addition, the convex hull detection device can also be integrated into the chip, and compared with the method of performing the convex hull detection process by the processor, the convex hull detection device can occupy a smaller chip area.
[0192] In an optional embodiment, as shown in FIG9 , the convex hull detection module 910 further includes a stack access unit 911 and a convex hull detection unit 912 , and the memory module 920 includes a stack unit 921 .
[0193] The stack access unit 911 is configured to store a first stack sequence.
[0194] The stack access unit 911 is further configured to perform data interaction with the second stack sequence stored in the memory module 920 .
[0195] Illustratively, the memory module 920 includes a stack unit 921 , and the stack unit 921 is used to store a second stack sequence, and the second stack sequence is used to store multiple data points in the data point set.
[0196] Optionally, before the salient point detection process is performed, the second stack sequence is an empty stack. As the salient point detection process is performed, the data point is cached in the first stack sequence and the data point is cached in the second stack sequence.
[0197] The stack access unit 911 is further configured to provide the convex hull detection unit 912 with an interface for accessing the stack unit 921 in the memory module 920 .
[0198] In an optional embodiment, as shown in FIG10 , the stack access unit 1010 includes a stack cache subunit 1011 and a stack control subunit 1012 .
[0199] In some embodiments, the stack cache subunit 1011 is used to cache the first stack sequence.
[0200] In some embodiments, the stack control subunit 1012 is used to control the push and pop relationships between the plurality of data points and the first stack sequence.
[0201] The push relationship is used to represent writing the data points for which the convex hull detection process is performed into the first stack sequence; the pop relationship is used to represent performing a pop operation on the data points in the first stack sequence, such as removing the data points in the first stack sequence that are not convex hull points; or adjusting the first stack top pointer corresponding to the first stack sequence so that the first stack top pointer points to the data points that have not undergone convex hull point judgment in the current convex hull detection process, thereby performing convex hull point detection on other data points cached in the first stack sequence.
[0202] Illustratively, in the process of performing convex hull detection on the n+1th data point, the n+1th data point, the first data point, and the second data point are comprehensively analyzed, and a determination is made as to whether the first data point is a convex hull point relative to the n+1th data point and the second data point, so as to obtain the convex hull detection result corresponding to the first data point. The stack control subunit 1012 controls the pop operation and push operation corresponding to the first stack sequence based on the convex hull detection result.
[0203] Optionally, the stack control subunit 1012 controls the n+1th data point to be pushed into the stack based on the convex hull detection result; or, the stack control subunit 1012 controls the first data point to be popped from the first stack sequence based on the convex hull detection result; or, the stack control subunit 1012 controls the adjustment of the first top stack pointer of the first stack sequence based on the convex hull detection result to perform a subsequent convex hull point detection process, etc.
[0204] The convex hull detection unit 1020 is used to obtain the (n+1)th data point.
[0205] The convex hull detection unit 1020 is further configured to determine the first data point and the second data point from the stack access unit 1010 .
[0206] Illustratively, the convex hull detection unit 1020 determines a first data point at the top of the stack pointed to by the first top pointer and a second data point after the first data point based on the first stack sequence cached in the stack cache subunit 1011 in the stack access unit 1010.
[0207] In an optional embodiment, as shown in FIG11 , the convex hull detection module 1110 further includes a set reading unit 1111 ; the device further includes a control module 1120 .
[0208] The control module 1120 is configured to perform configuration operations on the convex hull detection module 1110 .
[0209] The configuration operation is used to configure a set reading address for the set reading unit 1111 in the convex hull detection module 1110 , and the set reading address is used to obtain a data point set.
[0210] Illustratively, the control module 1120 configures the set read address in the set read unit 1111 based on the configuration operation, and the location represented by the set read address is the storage location in the memory module 1130 for storing the data point set.
[0211] Optionally, the configuration operation is an operation automatically triggered by the control module 1120 when it receives a convex hull detection instruction; or, the configuration operation is an operation triggered by the control module based on manual adjustment, etc.
[0212] In some embodiments, the multiple data points stored in the data point set are pre-sorted, that is, the multiple data points have a corresponding arrangement order.
[0213] Optionally, for a plurality of data points in the data point set, the plurality of data points are pre-arranged according to the position coordinates corresponding to the plurality of data points. Illustratively, a data point with the smallest horizontal axis and the smallest vertical axis is determined based on the position coordinates of the plurality of data points, and this data point is used as the pole. Polar angles of the other data points relative to the pole are then determined, and the plurality of data points are arranged according to the polar angles. For example, the data point corresponding to the pole is used as the first data point, and the other data points are arranged in ascending order of polar angles, thereby determining the arrangement order of the plurality of data points.
[0214] Optionally, when there are at least two data points among the other data points that have the same polar angle, the polar diameters corresponding to the at least two data points are determined, and then the at least two data points are sorted in order from small to large or from large to small according to the polar diameters, and then the other data points are comprehensively analyzed in combination with the polar diameters and the polar angles corresponding to the polar coordinates to determine the arrangement order of the multiple data points.
[0215] Schematically, based on the sorting process of the data point set, the first data point as the extreme point is a convex hull point relative to other data points. If the convex hull detection process is performed according to the arrangement order of multiple data points in the data point set, it can be determined that the first data point is a convex hull point in the data point set.
[0216] The set reading unit 1111 is used to obtain a data point set based on the set reading address after the configuration operation is completed.
[0217] Illustratively, after the control module 1120 completes the configuration operation on the convex hull detection module 1110, the control module 1120 automatically controls the convex hull detection module 1110 to start the convex hull detection process; alternatively, after the control module 1120 completes the configuration operation on the convex hull detection module 1110 based on the convex hull detection instruction, it waits to receive a convex hull detection start instruction, and after receiving the convex hull detection start instruction, controls the convex hull detection module 1110 to start the convex hull detection process, etc.
[0218] Illustratively, after the convex hull detection process is started, the set reading unit 1111 obtains a data point set from the set reading address of the memory module 1130 based on a pre-configured set reading address, so that the convex hull detection module 1110 performs a convex hull point detection process on multiple data points in the data point set based on the data point set.
[0219] In an optional embodiment, as shown in FIG12 , the convex hull detection module 1210 further includes a data reading unit 1211 .
[0220] The data reading unit 1211 is used to cache multiple data points read by the set reading unit 1212.
[0221] Illustratively, after the set reading unit obtains the data point set from the memory module based on the configured set address, the data point set is input into the data reading unit 1211. Optionally, in the data reading unit 1211, multiple data points in the data point set are arranged in sequence according to the arrangement order.
[0222] The data reading unit 1211 is further configured to send the plurality of data points to the convex hull detection unit 1213 in the order in which the data points are arranged.
[0223] The data point arrangement order is obtained by arranging multiple data points in the data point set based on the position coordinates, and the first data point in the data point set is a convex hull point.
[0224] Illustratively, the data reading unit sequentially arranges the multiple data points in the form of a data point arrangement order, and then sequentially inputs each of the multiple data points into the convex hull detection unit 1213 in the data point arrangement order.
[0225] For example, according to the arrangement order of the data points, when a data point is input into the convex hull detection unit 1213 for the n+1th time, the input data point is the n+1th data point.
[0226] It should be noted that the above are merely illustrative examples and are not limited to the embodiments of the present application.
[0227] In summary, based on storing at least two data points in the first stack sequence, the real-time acquisition of data points and the real-time convex hull detection process are beneficial to improving the convex hull detection processing speed while improving the energy efficiency of comprehensive analysis of multiple data points in the data point set, thereby more quickly and accurately determining the convex hull point set corresponding to the data point set.
[0228] In an embodiment of the present application, units implementing different functions within a convex hull detection module are introduced, as well as subunits implementing more detailed functions under a stack access unit. A data point set is read in by a set reading unit, and then, with the help of the data reading unit, multiple data points in the data point set are sequentially input into a convex hull detection unit in the order in which the data points are arranged to perform a convex hull detection process. The convex hull detection unit accesses a first stack sequence cached in a stack cache subunit, thereby performing convex hull detection based on the first data point, the second data point indicated by the first stack top pointer, and the currently input data point. The stack control subunit can control the push and pop operations of the first stack sequence, thereby improving the management efficiency of the stack access unit and enhancing the orderliness of the push and pop processes of the first stack sequence. In addition, the stack control subunit can also adjust the second stack pointer of the second stack sequence cached in the stack unit based on the push and pop status of the first stack sequence cached in the stack cache subunit, so as to determine the data point at the stack top position more timely based on the synchronization relationship between the second stack pointer and the first stack pointer, so as to continue to perform the convex hull detection process and improve the efficiency of the convex hull detection.
[0229] In an optional embodiment, when the convex hull detection method is performed by a convex hull detection device, the convex hull detection device can also perform a data prefetch operation (load) during the convex hull detection process, so that the architecture of the stack cache subunit in the convex hull detection module is more similar to the architecture of the stack unit that stores all data points, thereby improving the detection reliability of the convex hull detection module when performing convex hull detection.
[0230] As shown in FIG. 12 , the memory module 1220 includes a stack unit 1221 ; the convex hull detection module 1210 includes a stack access unit 1214 , and the stack access unit 1214 includes a stack cache subunit 12141 and a stack control subunit 12142 .
[0231] The stack control subunit 12142 is used to perform data interaction with the stack unit 1221 .
[0232] Illustratively, the stack control sub-unit 12142 controls the stack cache sub-unit 12141 to perform data interaction with the stack unit 1221 , so as to load the data in the stack unit 1221 into the stack cache sub-unit 12141 .
[0233] The stack control subunit 12142 is further configured to load the configuration data in the stack unit 1221 into the stack cache subunit when the stack cache subunit 12141 and the stack unit 1221 meet preset conditions.
[0234] The configuration data is used to represent the configuration of the stack unit 1221 .
[0235] Schematically, the configuration data is data different from the data points for performing push operations and pop operations, and is used to represent various data information generated by the stack unit during the convex hull point detection process.
[0236] In an optional embodiment, the stack control subunit 12142 is further configured to determine the number of first data points in the stack buffer subunit 12141 and the number of second data points in the stack unit.
[0237] The first number of data points is used to represent the number of data points cached in the stack cache sub-unit; and the second number of data points is used to represent the number of data points cached in the stack unit.
[0238] The stack control subunit 12142 is further configured to determine a first unit capacity of the stack cache subunit 12141 for caching the first stack sequence; and determine whether a preset condition is satisfied based on the first data point quantity, the second data point quantity, and the first unit capacity.
[0239] The first unit capacity is used to characterize the storage capacity of the stack cache sub-unit 12141 ; correspondingly, the second unit capacity is used to characterize the storage capacity of the stack unit 1221 , and so on.
[0240] In an optional embodiment, the stack control subunit 12142 is further configured to determine that a preset condition is satisfied in response to the number of the second data points being not less than the first unit capacity and the number of the first data points being less than the first unit capacity.
[0241] In an optional embodiment, the stack control subunit 12142 is further configured to determine that a preset condition is satisfied in response to the second data point quantity being smaller than the first unit capacity and the first data point quantity being smaller than the second data point quantity.
[0242] In an optional embodiment, the stack cache subunit 12141 is used to cache the first stack sequence; is also used to receive configuration data; and is further used to configure the configuration data at a specified location.
[0243] The designated location is a pre-set location for loading configuration data.
[0244] It should be noted that the above are merely illustrative examples and are not limited to the embodiments of the present application.
[0245] In summary, based on storing at least two data points in the first stack sequence, the real-time acquisition of data points and the real-time convex hull detection process are beneficial to improving the convex hull detection processing speed while improving the energy efficiency of comprehensive analysis of multiple data points in the data point set, thereby more quickly and accurately determining the convex hull point set corresponding to the data point set.
[0246] In an embodiment of the present application, the stack control subunit in the stack access unit is used to control the push relationship and pop relationship between multiple data points and the first stack sequence, that is, the stack control subunit can control the first stack sequence to perform a pop process or a push process based on the convex hull detection result obtained after performing convex hull detection on the data points, such as controlling the data points in the first stack sequence to be popped, or pushing the data points into the first stack sequence.
[0247] Furthermore, through interaction between the stack access unit and the stack unit, the stack control subunit also exchanges data with the stack unit in the memory module. The stack unit is used to store the second stack sequence, of which the first stack sequence is a subsequence. This means that the stack unit stores more data points through the second stack sequence, while the stack cache subunit used to store the first stack sequence stores relatively fewer data points. This prevents the convex hull detection module from slowing down its convex hull detection speed due to the large amount of data points stored.
[0248] At the same time, the stack control subunit also integrates the stack cache subunit and the stack unit to determine whether the preset conditions for executing the configuration data loading process are met. Specifically, it determines whether the configuration data within the stack unit can be loaded into the stack cache subunit. This configuration data is used to represent the data information generated by the stack unit during the convex hull point detection process. In other words, if it is determined that the preset conditions are met, the configuration data within the stack unit can be loaded into the stack cache subunit during the convex hull detection process. This allows the stack cache subunit to more accurately understand the deep data information within the stack unit used to store all data points. This allows the stack access unit to be minimized in terms of area within the convex hull detection module without compromising convex hull detection performance.
[0249] Accordingly, based on the process of the stack control subunit loading the configuration data into the stack cache subunit under the preset conditions, the stack cache subunit can receive the configuration data and configure the configuration data at the specified location, so as to synchronize the information of the stack unit storing more data points in the convex hull detection process to the stack cache subunit without affecting the convex hull detection process. Even if the stack cache subunit does not store all the data point information, it can still grasp the deep information of all the data points, thereby improving the performance stability of the entire convex hull detection process executed through the interaction between the convex hull detection module and the memory module.
[0250] In an optional embodiment, the above-mentioned convex hull detection method is implemented by a convex hull detection device, which can also be called "a Graham scanning device". The Graham scanning device can also be called a Graham scanning hardware acceleration device, as shown in Figure 13, which is a structural block diagram of the Graham scanning device (convex hull detection device), wherein the contents of each module, unit, sub-unit, etc. are described as follows.
[0251] (1) Control Module 1310
[0252] The control module 1310 is used to parse the convex hull detection instruction (Graham scan instruction) sent by the upper module.
[0253] Schematically, the upper module is a module connected to the Graham scanning device (convex hull detection device), which can send a convex hull detection instruction to the Graham scanning device. The convex hull detection instruction is used to instruct the control module 1310 to configure parameters for the convex hull detection process to perform the convex hull detection process.
[0254] The control module 1310 is further configured to configure the convex hull detection module 1320 (Graham scanning module) in the convex hull detection device according to the parameters carried in the convex hull detection instruction.
[0255] Illustratively, the parameters carried in the convex hull detection instruction include a dataset address corresponding to the dataset, which is used to inform convex hull detection module 1320 of the address information of the dataset on which convex hull detection is to be performed. When control module 1310 configures convex hull detection module 1320, the dataset address is configured for convex hull detection module 1320 so that convex hull detection module 1320 can subsequently determine the dataset on which convex hull detection is to be performed based on the dataset address.
[0256] The control module 1310 is further configured to control the convex hull detection module 1320 to start the convex hull detection process after the convex hull detection module 1320 parameters are configured.
[0257] Illustratively, after the control module 1310 completes configuring the parameters of the convex hull detection module 1320 based on the convex hull detection instruction, the control module 1310 automatically controls the convex hull detection module 1320 to start the convex hull detection process; alternatively, after the control module 1310 completes configuring the parameters of the convex hull detection module 1320 based on the convex hull detection instruction, the control module 1310 waits to receive a convex hull detection start instruction, and after receiving the convex hull detection start instruction, controls the convex hull detection module 1320 to start the convex hull detection process, etc.
[0258] The control module 1310 is further configured to return a command completion response to the upper layer module after the convex hull detection module 1320 completes the processing.
[0259] Illustratively, after the convex hull detection module 1320 performs convex hull detection on multiple data points, the control module 1310 receives a convex hull detection completion response from the convex hull detection module 1320, and feeds back a convex hull detection instruction completion response to the upper-level module that sent the convex hull detection instruction, so as to inform the upper-level module that the convex hull detection process is completed for multiple data points in the data set.
[0260] (2) Convex Hull Detection Module 1320
[0261] Schematically, the convex hull detection module 1320 is a module that performs the convex hull detection process, which includes a set reading unit 1321, a data reading unit 1322, a convex hull detection unit 1323 and a stack access unit 1324, and the stack access unit 1324 includes a stack cache subunit 13241 and a stack control subunit 13242.
[0262] Collection read unit 1321
[0263] Illustratively, the set reading unit 1321 (LD_POINT) is used to read a data point set from the memory module 1330 (Memory) according to the data set address configured in the convex hull detection instruction.
[0264] Data reading unit 1322
[0265] Illustratively, the data reading unit 1322 (POINT_FIFO) is used to cache the data points read by the set reading unit 1321; then, multiple data points in the data point set are sent point by point to the convex hull detection unit 1323 for processing.
[0266] Convex hull detection unit 1323
[0267] Schematically, the convex hull detection unit 1323 (GS_PROC module) is used to determine whether the top data point of the GS_STACK stack (the first data point and the second data point) is a convex hull point based on the two data points at the top of the GS_STACK stack (the first data point and the second data point) and the newly input data point (the n+1th data point).
[0268] Stack access unit 1324
[0269] Illustratively, the stack access unit 1324 (GS_STACK_INTF) is used to provide the convex hull detection unit 1323 with an interface for accessing GS_STACK, which is a convex hull scan stack 1340 (GS is the abbreviation of Graham Scan), which includes a stack sequence for caching multiple data points.
[0270] The stack access unit 1324 is composed of two subunits: a stack buffer subunit 13241 (STACK_BUF) and a stack control subunit 13242 (STACK_CTRL).
[0271] The stack cache subunit 13241 is used to cache part of the data at the top of GS_STACK. Taking the stack cache subunit 13241 being used to cache the first stack sequence as an example, the data points cached in the first stack sequence are the data points cached in the convex hull scan stack 1340 and located at the top of the stack.
[0272] The stack control subunit 13242 is used to control the push operation (PUSH) and pop operation of GS_STACK, and to control the data prefetch operation (LOAD operation) of the stack cache subunit 13241.
[0273] Optionally, the convex hull scan stack 1340 (GS_STACK) is described as follows.
[0274] The convex hull scanning stack 1340 consists of the following two parts: a stack access unit 1324 integrated in the convex hull scanning module 1320 and a stack unit 1331 (STACK) stored in the memory module 1330. As shown in Figure 13, all data of GS_STACK is stored in the stack unit 1331 of the memory module 1330, and only part of the data at the top of the stack is cached in the stack access unit 1324. This part of the data is used by the convex hull detection unit 1323 to perform the convex hull scanning process.
[0275] Schematically, when the convex hull scanning stack 1340 performs a push operation, it is necessary to write the input data (such as the n+1th data point mentioned above) into the memory module 1330 (the stack unit 1331 in the memory module 1330) and the stack cache sub-unit 13241 in the stack access unit 1324 at the same time; when the convex hull scanning stack 1340 performs a pop operation, it is only necessary to update the stack top pointer cached in the stack cache sub-unit 13241 and the data depth parameter of the convex hull scanning stack 1340. The data depth parameter is implemented as parameter information such as the number of data points cached in the convex hull scanning stack 1340.
[0276] As shown in Figure 14, it is a schematic diagram of the structure of a convex hull scanning stack 1400 (GS_STACK), wherein the convex hull scanning stack 1400 includes a stack access unit (GS_STACK_INTF) 1410 and a stack unit 1420 (STACK) stored in a memory module.
[0277] The stack unit 1420 stores all data of the convex hull scan stack 1400. It involves two operations: a read operation and a write operation. The write operation corresponds to the push operation of the convex hull scan stack 1400, that is, writing the pushed data point to the stack unit 1420 of the memory module. The read operation corresponds to the data prefetch operation (load) of the stack cache subunit 1411, which is used to read the data to be written to the stack cache subunit 1411 from the stack unit 1420 of the memory module. The data targeted by the read operation here is different from the data point performing the push and pop operations.
[0278] In an optional embodiment, the stack buffer subunit 1411 (STACK_BUF) and the stack control subunit 1412 (STACK_CTRL) included in the stack access unit 1410 are supplementarily described as follows.
[0279] Stack cache subunit 1411
[0280] In some embodiments, the stack cache subunit 1411 is used to cache part of the data at the top of the convex hull scan stack 1400 (GS_STACK); the stack cache subunit 1411 mainly involves three operations, namely, push operation, pop operation and data prefetch operation (load).
[0281] The push operation corresponds to the push operation of the convex hull scanning stack 1400, which is used to write the input data point to the specified location in the stack cache subunit 1411; the pop operation corresponds to the pop operation of the convex hull scanning stack 1400, which is only used to update the stack top pointer of the stack cache subunit 1411.
[0282] The load operation is used to load the data in the stack unit 1420 into the stack cache sub-unit 1411. The data involved in this loading process is different from the data points for the push and pop operations described above. That is, the data targeted by the load operation is not the data points for performing the convex hull detection process, but data related to the stack unit 1420 itself, such as the operation data and running data of the stack unit 1420.
[0283] In an optional embodiment, the depth of the stack unit 1420 is determined, and the parameter is expressed as gs_stack_depth, which is used to characterize the number of data points stored in the stack unit 1420 (i.e., the second number of data points mentioned above); the size of the stack cache sub-unit 1411 is determined, and the parameter is expressed as stack_buf_size, which is used to characterize the capacity of the stack cache sub-unit 1411 (i.e., the first unit capacity mentioned above); the depth of the stack cache sub-unit 1411 is determined, and the parameter is expressed as stack_buf_depth, which is used to characterize the number of data points stored in the stack cache sub-unit 1411 (i.e., the first number of data points mentioned above).
[0284] When gs_stack_depth is greater than or equal to stack_buf_size and stack_buf_depth is less than stack_buf_size, the load operation is automatically triggered.
[0285] In an optional embodiment, gs_stack_depth of the stack unit 1420 is determined; stack_buf_size of the stack cache sub-unit 1411 is determined; and stack_buf_depth of the stack cache sub-unit 1411 is determined.
[0286] When gs_stack_depth is less than stack_buf_size and stack_buf_depth is less than gs_stack_depth, the load operation is automatically triggered.
[0287] Optionally, the process of automatically triggering the load operation is implemented by controlling the stack control subunit 1412 .
[0288] Stack control subunit 1412
[0289] The stack control subunit 1412 (STACK_CTRL) is used to control the push operation and pop operation of the convex hull scan stack 1400 and control the load operation of the stack cache subunit 1411 to automatically prefetch data.
[0290] Optionally, the stack control subunit 1412 needs to generate corresponding control logic according to the following parameters. The control parameters involved are as follows.
[0291] (1) stack_buf_size, namely the first unit capacity mentioned above, is used to represent the capacity of the stack buffer sub-unit 1411.
[0292] (2) stack_buf_depth, i.e., the number of the first data points mentioned above, is used to represent the number of data points stored in the stack buffer subunit 1411; when the stack buffer subunit 1411 has a pop, push, or load operation, the value of this parameter is updated using stack_buf_inc_step.
[0293] (3) stack_buf_inc_step, used to record the step size of stack_buf_depth update; when stack_buf_depth is greater than or equal to stack_buf_size, this parameter is 0; otherwise, the parameter is assigned a value according to Table 1 below.
[0294] Table 1: Configuration table of stack_buf_inc_step parameters
[0295] (4) stack_buf_top_ptr, i.e., the first stack top pointer, is used to indicate the position of the stack top of the convex hull scan stack 1400 in the stack cache subunit 1411; after the push operation, the stack_buf_wptr parameter is used to update the pointer.
[0296] (5) stack_buf_wptr, which can be represented as a data point write pointer, is used to record the location in STACK_BUF where data is written during the push operation of the convex hull scan stack 1400. The default value is 0. When the push operation is completed, the pointer is updated. If stack_buf_wptr is equal to stack_buf_size-1 when the pointer is updated, the pointer is updated to 0; otherwise, the pointer is incremented by 1.
[0297] (6) stack_buf_load_ptr, which can be represented as a data load pointer, is used to represent the location where the data point is written into the stack cache subunit 1411 when performing an automatic prefetch load operation. The default value is gs_stack_buf_size-1.
[0298] 1) When stack_buf_depth is not full, that is, stack_buf_depth is less than stack_buf_size, only the load operation will update the pointer; the specific operation is as follows.
[0299] Optionally, when stack_buf_depth is less than stack_buf_size-1, the pointer is decremented by 1 as soon as the load operation is completed.
[0300] Optionally, when stack_buf_depth is equal to stack_buf_size-1, if the load operation and the push pointer exist at the same time, the pointer remains unchanged; otherwise, the pointer is decremented by 1.
[0301] 2) When stack_buf_depth is full, that is, stack_buf_depth is equal to stack_buf_size, both the push and load operations of the convex hull scan stack 1400 need to update the pointer, as shown below.
[0302] If there is a push operation but no pop operation, the pointer is incremented by 1; if there is a load operation and a pop operation, the pointer is decremented by 1.
[0303] (7) gs_stack_depth, i.e., the second number of data points mentioned above, is used to record the number of data points stored in the convex hull scan stack 1400; when there is a push operation but no pop operation, this parameter is incremented by 1.
[0304] (8) stack_baddr, which can be represented as a first address, is used to record the base address of the stack unit 1420 in the memory module.
[0305] (9) stack_waddr, which can be represented as a second address, is used to record the location of the stack unit 1420 in the memory module where data is written during the push operation of the convex hull scanning stack 1400; this parameter is equal to stack_baddr+gs_stack_depth.
[0306] (10) stack_raddr, which can be represented as a third address, is used to record the location of the stack unit 1420 in the memory module when the data is read during the load operation of the stack cache subunit 1411; this parameter is equal to stack_baddr+gs_stack_depth-stack_buf_depth.
[0307] FIG15 is a schematic diagram showing the relative relationship between the above parameters in the stack buffer sub-unit 1510 (STACK_BUF) and the stack unit 1520 (STACK) in the memory module.
[0308] Among them, M0 is the data point pointed to by the stack top pointer, which is represented by the parameter stack_buf_top_ptr; M0 to D0 are used to represent the number of data points cached by the stack cache sub-unit 1510.
[0309] Convex hull detection unit 1323
[0310] The convex hull detection unit 1323 is used to determine whether the first data point M0 at the top of the convex hull scan stack 1340 is a convex hull point based on the two data points (first data point M0 and second data point M1) at the top of the stack and the newly input data point M2.
[0311] The method for determining whether the first data point M0 is a convex hull point is as follows.
[0312] If the cross product of the vector formed by data point M2 and data point M0 and the vector formed by data point M0 and data point M1 is negative, it means that the angle formed by vector M0M1 and vector M0M2 is greater than 180 degrees, and data point M0 is not a convex hull point. At this time, it is necessary to pop the top data point M0 of the GS_STACK stack, and then continue to use the input data point M2 and the two data points at the top of the GS_STACK stack to continue the above judgment until the cross product of the above two vectors is positive or the number of data points in GS_STACK is less than 3.
[0313] If the cross product of the vector formed by data points M2 and M0 and the vector formed by data points M0 and M1 is positive, it means that the angle formed by vector M0M1 and vector M0M2 is less than 180 degrees, and data point M0 is a convex hull point. At this time, the input data point M2 needs to be pushed into the convex hull scan stack 1340.
[0314] Among them, the calculation formula of the cross product of vector M0M1 and vector M0M2 is shown in the above formula 1.
[0315] (3) Memory module 1330
[0316] Illustratively, the memory module 1330 is used to store a set of data points; and the memory module is used to deploy a stack unit for storing multiple data points.
[0317] Optionally, the memory module 1330 can be implemented as an on-chip memory or an off-chip memory, that is, the memory module 1330 can be implemented as a module deployed in the convex hull detection device or as an external module deployed outside the convex hull detection device.
[0318] In an optional embodiment, the convex hull detection module can also be implemented as the architecture shown in FIG15 .
[0319] Schematically, compared with Figure 13, the integrated stack access unit 1324 (GS_STACK_INTF) in the convex hull detection module in Figure 13 is replaced by the convex hull scanning stack 1610 (GS_STACK) shown in Figure 16; after the replacement, all data of the convex hull scanning stack 1610 are stored in the convex hull detection module and are no longer stored in the memory module 1620.
[0320] In an optional embodiment, the convex hull detection module can also be implemented as the architecture shown in FIG17 .
[0321] Schematically, compared with FIG16 , the integrated convex hull scanning stack 1610 (GS_STACK) in FIG16 is removed, and an external convex hull scanning stack 1710 (GS_STACK) is used for data storage.
[0322] It should be noted that the above are merely illustrative examples and are not limited to the embodiments of the present application.
[0323] In summary, on the basis of storing at least two data points in the first stack sequence, by timely adjusting the first stack sequence, the n+1th data point and some data points cached in the first stack sequence are subjected to a more comprehensive convex hull detection and analysis, thereby improving the real-time processing speed of the convex hull detection process and improving the energy efficiency.
[0324] In the embodiment of the present application, the convex hull detection device has a faster processing speed and a higher energy efficiency ratio than processors such as CPU, GPU, and DSP. In addition, the convex hull detection device can be integrated into a chip. Compared with the integrated CPU, GPU, DSP and other processors, it occupies a smaller chip area, which can improve chip utilization. In addition, through the convex hull scanning stack structure, an external large-capacity memory module is used to store all the data in the stack unit. In the convex hull detection module, only a small-capacity stack cache sub-unit can be used to cache the top part of the stack unit. At the same time, an automatic prefetching device is used to automatically synchronize the data in the external memory module. The data of the stack unit and the internal stack cache sub-unit can be stored in this way. In this way, the area ratio of GS_STACK in the Graham scan accelerator can be reduced without reducing the performance. In addition, the stack cache sub-unit can grasp the deep information semantics represented by a large number of data points without caching a large number of data points, avoiding the problem of disconnection with a large number of data points during the convex hull detection process. By performing the configuration data loading process at the same time as the convex hull detection, the information between the stack cache sub-unit and the stack unit is synchronized, the information consistency under different modules during the convex hull detection process is maintained, and the stability of the convex hull detection process is improved.
[0325] It should be noted that the convex hull detection device provided in the above embodiment is merely an example of the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the convex hull detection device provided in the above embodiment and the convex hull detection method embodiment are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0326] Figure 18 shows a schematic diagram of the structure of a server provided by an exemplary embodiment of the present application. The server 1800 includes a central processing unit (CPU) 1801, a system memory 1804 including a random access memory (RAM) 1802 and a read-only memory (ROM) 1803, and a system bus 1805 connecting the system memory 1804 and the CPU 1801. The server 1800 also includes a mass storage device 1806 for storing an operating system 1813, application programs 1814, and other program modules 1815.
[0327] The mass storage device 1806 is connected to the central processing unit 1801 through a mass storage controller (not shown) connected to the system bus 1805. The mass storage device 1806 and its associated computer-readable media provide non-volatile storage for the server 1800. The system memory 1804 and the mass storage device 1806 described above may be collectively referred to as memory.
[0328] According to various embodiments of the present application, the server 1800 may also be connected to a remote computer on a network such as the Internet for operation. That is, the server 1800 may be connected to a network 1812 via a network interface unit 1811 connected to the system bus 1805, or the network interface unit 1811 may be used to connect to other types of networks or remote computer systems (not shown).
[0329] The memory also includes one or more programs, which are stored in the memory and configured to be executed by the CPU.
[0330] An embodiment of the present application also provides a computer device, which includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, code set, or instruction set, and the at least one instruction, at least one program, code set, or instruction set is loaded and executed by the processor to implement the convex hull detection method provided by the above-mentioned method embodiments.
[0331] An embodiment of the present application also provides a computer-readable storage medium, on which is stored at least one instruction, at least one program, code set, or instruction set. The at least one instruction, at least one program, code set, or instruction set is loaded and executed by a processor to implement the convex hull detection method provided in the above-mentioned method embodiments.
[0332] Embodiments of the present application also provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the convex hull detection method described in any of the above embodiments.
[0333] The above description is merely an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A convex hull detection method, performed by a computer device, the method comprising: Obtaining the n+1th data point from a data point set, wherein the data points in the data point set correspond to position coordinates, the position coordinates are used to indicate the distribution position of the data point, and n is an integer greater than 1; Determine a first data point and a second data point corresponding to a preset position in the stack from the first stack sequence, wherein the first data point and the second data point are obtained from the data point set before the n+1th data point and are stacked into the data points of the first stack sequence; Based on the relative position relationship between the position coordinates corresponding to the n+1th data point, the first data point, and the second data point, respectively, a convex hull detection is performed on the first data point to obtain a convex hull detection result corresponding to the first data point; Based on the convex hull detection result corresponding to the first data point, the storage of the data points in the first stack sequence is adjusted until the convex hull point set is obtained after the data points in the data point set are detected.
2. The method according to claim 1, wherein: The adjusting the storage of the data points in the first stack sequence based on the convex hull detection result corresponding to the first data point includes: Based on the convex hull detection result, determining a discard analysis result of the data points in the first stack sequence based on the n+1th data point; The storage of the data points in the first stack sequence is adjusted based on the abandonment analysis result, wherein the abandonment analysis result is used to indicate whether to keep the data points in the first stack sequence or to pop the data points from the first stack sequence.
3. The method according to claim 1 or 2, wherein: The step of determining, based on the convex hull detection result, a discard analysis result of the data points in the first stack sequence based on the n+1th data point comprises: In response to the convex hull detection result indicating that the first data point is a convex hull point, retaining the first data point in the first stack sequence; The adjusting the storage of data points in the first stack sequence based on the rejection analysis result includes: The n+1th data point is written to the first stack sequence based on the first data point remaining in the first stack sequence.
4. The method according to any one of claims 1 to 3, wherein: The step of determining, based on the convex hull detection result, a discard analysis result of the data points in the first stack sequence based on the n+1th data point comprises: In response to the convex hull detection result indicating that the first data point is not a convex hull point, determining to pop the first data point from the first stack sequence; The adjusting the storage of data points in the first stack sequence based on the rejection analysis result includes: The first data point is popped from the first stack sequence.
5. The method according to any one of claims 1 to 4, wherein: The first data point is a data point pointed to by a first stack top pointer for the first stack sequence; After performing a pop operation on the first data point from the first stack sequence, the method further includes: Point the first stack top pointer to the second data point; In response to the second data point being a convex hull point relative to the (n+1)th data point and the third data point, determining to retain the second data point in the first stack sequence; The n+1th data point is written to the first stack sequence based on the second data point remaining in the first stack sequence.
6. The method according to any one of claims 1 to 5, wherein: The performing convex hull detection on the first data point based on the relative position relationship of the position coordinates corresponding to the n+1th data point, the first data point, and the second data point, to obtain a convex hull detection result corresponding to the first data point includes: Determine a first vector formed by the n+1th data point and the first data point based on the position coordinates corresponding to the n+1th data point and the first data point respectively; Determine a second vector formed by the first data point and the second data point based on the position coordinates corresponding to the first data point and the second data point respectively; Based on the vector cross product between the first vector and the second vector, a convex hull detection result corresponding to the first data point is obtained.
7. The method according to any one of claims 1 to 6, wherein: The obtaining, based on the vector cross product between the first vector and the second vector, a convex hull detection result corresponding to the first data point includes: In response to the vector cross product being a negative value, determining that the first data point is a convex hull point as the convex hull detection result; or, In response to the vector cross product being a positive value, a result that the first data point is not a convex hull point is determined as the convex hull detection result.
8. The method according to any one of claims 1 to 7, wherein: The first stack sequence is a subsequence of the second stack sequence, and there is a data interaction relationship between the second stack sequence and the first stack sequence; The method further comprises: In response to the convex hull detection result indicating that a pop operation is performed on the first data point, a second stack top pointer corresponding to the second stack sequence is adjusted, and a data point pointed to by the first stack top pointer in the first stack sequence is in synchronization with a data point pointed to by the second stack top pointer in the second stack sequence; The second data point for performing convex hull detection is determined based on the second stack top pointer.
9. The method according to any one of claims 1 to 8, wherein: The convex hull detection module includes a stack access unit, and the stack access unit includes a stack cache subunit and a stack control subunit. The first stack sequence is cached in the stack cache subunit. The stack control subunit is used to control the push relationship and pop relationship between multiple data points and the first stack sequence. The push relationship and the pop relationship are used to indicate the adjustment of the storage status of the data points in the first stack sequence.
10. The method according to any one of claims 1 to 9, wherein: The method further comprises: Receive configuration data, the configuration data is used to characterize the configuration of the stack unit in the memory module, and is data information generated by the stack unit during the convex hull point detection process; the stack control subunit performs data interaction with the stack unit, and the configuration data loads the configuration data in the stack unit to the stack cache subunit through the stack control subunit; the memory module is a module for storing the data point set; the stack unit is also used to store a second stack sequence, the first stack sequence is a subsequence of the second stack sequence, and the configuration data is data sent when the stack cache subunit and the stack unit meet preset conditions; The configuration data is configured at a specified location.
11. A convex hull detection device, comprising: Convex hull detection module and memory module; The memory module is used to store a data point set, each of the data points in the data point set corresponds to a position coordinate, and the position coordinate is used to indicate the distribution position of the data point; The convex hull detection module is used to obtain the n+1th data point from the data point set stored in the memory module, where n is an integer greater than 1; determine a first data point and a second data point corresponding to a preset position in the stack from the first stack sequence, where the first data point and the second data point are data points obtained from the data point set before the n+1th data point and stacked into the first stack sequence; Based on the relative position relationship of the position coordinates corresponding to the n+1th data point, the first data point and the second data point, respectively, a convex hull detection is performed on the first data point to obtain a convex hull detection result corresponding to the first data point; based on the convex hull detection result corresponding to the first data point, the storage of the data points in the first stack sequence is adjusted until the data points in the data point set are detected and a convex hull point set is obtained.
12. The device according to claim 11, wherein The memory module is further used to store n data points in the data point set in a second stack sequence based on a convex hull detection process, the first stack sequence being a subsequence of the second stack sequence; The convex hull detection module is further configured to, in response to the convex hull detection result indicating that the first data point is not a convex hull point, The first data point is popped from the first stack sequence, and the first data point is the data point pointed to by a preset stack top pointer for the second stack sequence.
13. The device according to claim 11 or 12, wherein: The convex hull detection module includes a stack access unit and a convex hull detection unit; the memory module includes a stack unit; The stack access unit is used to store the first stack sequence; performing data interaction with a second stack sequence stored in the memory module; Providing an interface for the convex hull detection unit to access the stack unit in the memory module, wherein the stack unit is used to store the second stack sequence; The convex hull detection unit is used to obtain the (n+1)th data point; and determine the first data point and the second data point from the stack access unit.
14. The device according to any one of claims 11 to 13, wherein: The convex hull detection module also includes a set reading unit; the device also includes a control module; The control module is used to perform a configuration operation on the convex hull detection module, wherein the configuration operation is used to configure a set reading address for the set reading unit in the convex hull detection module, and the set reading address is used to obtain the data point set; The set reading unit is used to obtain the data point set based on the set reading address after the configuration operation is completed.
15. The device according to any one of claims 11 to 14, wherein: The convex hull detection module also includes a data reading unit; The data reading unit is used to cache multiple data points read by the set reading unit; and send the multiple data points to the convex hull detection unit according to the data point arrangement order, wherein the data point arrangement order is obtained by arranging the multiple data points in the data point set based on the position coordinates, and the first data point in the data point set is the convex hull point.
16. The device according to any one of claims 11 to 15, wherein: The memory module includes a stack unit; the convex hull detection module includes a stack access unit, and the stack access unit includes a stack cache subunit and a stack control subunit; The stack control subunit is used to control the stacking relationship and the popping relationship between the plurality of data points and the first stack sequence; Performing data interaction with the stack unit; loading configuration data in the stack unit into the stack cache subunit when the stack cache subunit and the stack unit meet preset conditions, the configuration data being used to characterize the configuration of the stack unit; The stack cache subunit is used to cache the first stack sequence; receive the configuration data; The configuration data is configured at a specified location.
17. The device according to any one of claims 11 to 16, wherein: The stack control subunit is further used to determine the number of first data points in the stack cache subunit and the number of second data points in the stack unit; determining a first unit capacity of the stack cache subunit for caching a second stack sequence; Based on the first number of data points, the second number of data points, and the first unit capacity, it is determined whether the preset condition is satisfied.
18. The device according to any one of claims 11 to 17, wherein: The stack control subunit is further configured to determine that the preset condition is satisfied in response to the number of the second data points being not less than the first unit capacity and the number of the first data points being less than the first unit capacity; Alternatively, in response to the second number of data points being less than the first unit capacity, and the first number of data points being less than the second number of data points, it is determined that the preset condition is satisfied.
19. A computer device, comprising a processor and a memory, wherein the memory stores at least one program, and the at least one program is loaded and executed by the processor to implement the convex hull detection method according to any one of claims 1 to 10.
20. A computer-readable storage medium, wherein at least one program is stored in the storage medium, and the at least one program is loaded and executed by a processor to implement the convex hull detection method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Stack information tracking method and device, computer readable medium and computing device
CN110618940A
Contour extraction method, device and equipment, program product and storage medium
CN113420735A
Method and device for constructing convex hull for plane point set, electronic equipment and medium
CN113689524A
Explosion fireball contour detection method based on convex hull algorithm
CN115937160A
Convex hull detection method and device, equipment and storage medium
CN116894864A