An AI-based target tracking detection method, system, device and medium

By distinguishing between targets with holes and those without holes and employing different processing strategies for each, and utilizing the maximum contour and the center of the inscribed circle, the problem of low target tracking accuracy in traditional methods is solved, achieving more efficient and stable target detection.

CN119180935BActive Publication Date: 2026-06-26ZHEJIANG LIANYUN ZHIHUI TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG LIANYUN ZHIHUI TECH CO LTD
Filing Date
2024-08-30
Publication Date
2026-06-26

Smart Images

  • Figure CN119180935B_ABST
    Figure CN119180935B_ABST
Patent Text Reader

Abstract

An AI-based target tracking detection method, system, device and medium are provided, and relate to the field of artificial intelligence. In the method, a target image is obtained, and the target image is processed to distinguish between a target with holes and a target without holes; a first maximum contour of the target without holes is determined, and a first center of the target without holes is determined according to the first maximum contour; the target with holes is divided into an object region and a hole region, a maximum inscribed circle of the object region is determined, and the center of the maximum inscribed circle is taken as a second center; the target without holes is processed according to the first center, and the target with holes is processed according to the second center. By distinguishing between the target with holes and the target without holes and adopting different processing strategies respectively, the target can be more accurately recognized and positioned, and the misrecognition or missed recognition caused by the difference in the shape of the target can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, specifically to an AI-based target tracking and detection method, system, device, and medium. Background Technology

[0002] Target tracking and detection is an important technology in the field of computer vision, and it is widely used in many fields such as security monitoring, intelligent transportation, and human-computer interaction.

[0003] Traditional target tracking and detection methods often fail to adequately consider the impact of holes on target detection, resulting in low tracking accuracy. In recent years, the development of artificial intelligence technology, especially breakthroughs in deep learning, has provided new solutions for target tracking and detection. However, accurately distinguishing and tracking targets with and without holes in complex real-world environments remains a pressing problem in this field.

[0004] Therefore, how to provide a detection method that can effectively distinguish and accurately track targets with holes and without holes has become an important technical challenge for those skilled in the art. Summary of the Invention

[0005] This application provides an AI-based target tracking and detection method, system, device, and medium. By distinguishing between targets with holes and those without holes and employing different processing strategies for each, it can more accurately identify and locate targets, reducing misidentification or missed identification caused by differences in target shape.

[0006] The first aspect of this application provides an AI-based target tracking and detection method, applied to a target tracking and detection platform, the method comprising:

[0007] Acquire a target image and process the target image to distinguish between targets with holes and targets without holes;

[0008] Determine the first maximum contour of the non-porous target, and determine the first center of the non-porous target based on the first maximum contour;

[0009] The target with holes is divided into an object region and a hole region. The largest inscribed circle of the object region is determined, and the center of the largest inscribed circle is used as the second center.

[0010] The non-porous target is processed according to the first center, and the porous target is processed according to the second center.

[0011] By employing the above technical solution, and by distinguishing between targets with and without holes, and using different processing strategies for each (such as using the center of the largest contour and the center of the largest inscribed circle as processing references), this method can more accurately identify and locate targets, reducing misidentification or missed identification due to differences in target shape. For targets without holes, using the center of the first largest contour as the tracking reference ensures that the tracking point remains relatively stable when the target moves, rotates, or undergoes slight deformation, improving the continuity and accuracy of tracking. For targets with holes, using the center of the largest inscribed circle of the object region effectively avoids the tracking point offset problem caused by the presence of holes, further enhancing the stability of tracking. By distinguishing target types before processing them separately, a uniform and potentially inefficient processing method is avoided for all targets. In particular, for the processing of targets with holes, by focusing on the object region rather than the entire target region, unnecessary computation is reduced, improving the overall efficiency of the algorithm.

[0012] Optionally, determining the maximum inscribed circle of the object region includes:

[0013] Determine the second maximum contour of the object region and the third maximum contour of the hole region, construct a binary image of the target with holes based on the second maximum contour and the third maximum contour, and determine the third center of the hole region based on the third maximum contour;

[0014] The first minimum bounding rectangle of the binary image is determined by the contour function. Based on the third center, the four sides of the first minimum bounding rectangle are offset to obtain four first maximum inscribed circles. The second maximum inscribed circle with the largest radius among the four first maximum inscribed circles is taken as the maximum inscribed circle.

[0015] By employing the above technical solution, the second maximum contour of the object region and the third maximum contour of the hole region are determined respectively, and a binary map is constructed, which clearly defines the region to be analyzed. Subsequently, based on the third center of the hole region, the four sides of the first minimum bounding rectangle are offset to generate four potential maximum inscribed circle candidates, and finally the one with the largest radius is selected as the maximum inscribed circle. This process fully considers the influence of the hole on the shape of the object region, thereby improving the accuracy of the maximum inscribed circle positioning. For targets with holes, their shapes are often more complex than those without holes. The embodiments of this application, by constructing a binary map, determining the minimum bounding rectangle, and using a center-based offset strategy, can flexibly handle holes of different shapes and sizes, thereby achieving effective processing of complex-shaped targets. This adaptability makes the method perform well in a variety of application scenarios. Although the embodiments of this application involve multiple steps, each step aims to reduce unnecessary computation and improve computational efficiency. For example, constructing a binary map simplifies the analysis object, and offsetting the sides of the minimum bounding rectangle quickly generates potential maximum inscribed circle candidates. These optimizations make the entire calculation process more efficient, reducing computation time while ensuring accuracy. Because the embodiments of this application can accurately determine the maximum inscribed circle of a target with holes and use its center as the processing reference, they can maintain high robustness during target tracking and detection. Even if the target moves, rotates, or undergoes slight deformation, as long as the change in the hole area does not affect the determination of the maximum inscribed circle, the embodiments of this application can maintain stable tracking and detection performance.

[0016] Optionally, the step of offsetting the four sides of the first minimum bounding rectangle based on the third center to obtain four first maximum inscribed circles includes:

[0017] A rectangular coordinate system is established with the target endpoint of the first minimum bounding rectangle as the origin, where the target endpoint is any one of the endpoints of the first minimum bounding rectangle;

[0018] Determine the coordinates of the two endpoints on the target edge, and determine the equation of the first straight line based on the two endpoints. The target edge is any one of the four sides of the first minimum bounding rectangle.

[0019] A new rectangle is determined based on the equation of the first straight line, the coordinates of the third center, and the coordinates of the two endpoints;

[0020] Determine the overlapping area between the new rectangle and the object region, and calculate the first maximum inscribed circle of the overlapping area.

[0021] By adopting the above technical solution, a rectangular coordinate system is established with the target endpoint of the first minimum bounding rectangle as the origin. Based on this coordinate system, the equation of the line is calculated and the new rectangle is determined. This embodiment of the application can precisely control the offset process, ensuring that the new rectangle closely fits the boundary of the object region, thereby obtaining a more accurate maximum inscribed circle. During the offset process, by introducing the coordinates of the third center (i.e., the center of the hole region), this application can consider the influence of the hole on the shape of the object region, avoiding the hole region being mistakenly included in the calculation range of the inscribed circle. This processing method makes the final maximum inscribed circle more consistent with the actual situation of the object region. Although this method involves multiple steps such as coordinate transformation, calculation of the equation of the line, and determination of the new rectangle, these steps are all standard operations based on geometry and linear algebra, and have high computational efficiency. In addition, by offsetting only the four sides of the first minimum bounding rectangle and calculating the inscribed circle of the area overlapping with the object region, this embodiment of the application avoids complex iterative calculations on the entire image, further improving computational efficiency.

[0022] Optionally, determining the new rectangle based on the equation of the first straight line, the coordinates of the third center, and the coordinates of the two endpoints includes:

[0023] Based on the first line equation, construct a second line equation, a third line equation, and a fourth line equation. The second line equation passes through the third center and is parallel to the first line equation. The third line equation passes through the first endpoint and is perpendicular to the first line equation. The fourth line equation passes through the second endpoint and is perpendicular to the second line equation. The two endpoints include the first endpoint and the second endpoint.

[0024] A new rectangle is determined based on the first endpoint, the second endpoint, the third endpoint, and the fourth endpoint, wherein the third endpoint is the point where the second line equation and the third line equation intersect, and the fourth endpoint is the point where the second line equation and the fourth line equation intersect.

[0025] By employing the above technical solution, a second straight line equation is constructed that passes through the third center (i.e., the center of the hole region) and is parallel to the first straight line equation. This embodiment of the application can precisely control the direction and distance of the offset. Simultaneously, by constructing a third and fourth straight line equation perpendicular to the first and second straight line equations, it can be ensured that the edges of the new rectangle maintain a perpendicular relationship with the edges of the original circumscribed rectangle, thus maintaining the regularity of the new rectangle's shape. Due to the presence of the hole, the shape of the object region may become complex. Using this method, even if the position and size of the hole change, the position of the second straight line equation can be adjusted to adapt to this change, thereby ensuring that the new rectangle closely fits the boundary of the object region. The vertices of the new rectangle are determined using analytical geometry methods (i.e., solving the straight line equations and calculating the intersection points), avoiding complex iteration and search processes. This method has high computational efficiency and can complete the determination of the new rectangle in a short time. This embodiment of the application provides a new approach to processing target objects containing holes. By further optimizing the process of constructing the straight line equations and calculating the intersection points, the efficiency and accuracy of the algorithm can be further improved.

[0026] Optionally, constructing the second, third, and fourth line equations based on the first line equation includes:

[0027] Determine whether the first slope of the first straight line equation meets the preset conditions;

[0028] When the first slope of the first straight line equation meets the preset conditions, a second straight line equation is constructed based on the first slope and the third center. The second slope is obtained based on the ratio of the preset value to the first slope. The third straight line equation is determined based on the second slope and the coordinates of the first endpoint. The fourth straight line equation is determined based on the second slope and the coordinates of the second endpoint.

[0029] By employing the above technical solution and determining the applicability of the first slope using preset conditions, the algorithm can flexibly adjust the construction method of the line equation according to different situations. This flexibility helps the algorithm better adapt to holes of different shapes and sizes, as well as object boundaries of different directions and angles. When constructing the second line equation, the first slope and the coordinates of the third center are directly used for calculation, ensuring that the second line equation is parallel to the first line equation and passes through the center of the hole. Simultaneously, determining the second slope by using a preset value as a ratio to the first slope ensures that the third and fourth line equations are perpendicular to the first and second line equations, thereby improving the accuracy of the line equations. Using the ratio relationship between slopes to determine the new slope avoids complex trigonometric function calculations or iterative solutions. This simplified calculation method not only improves computational efficiency but also reduces potential errors during calculation. By using preset conditions to filter and adjust the construction method of the line equation, the algorithm can maintain stable performance when facing noise, errors, or abnormal situations. Even if the input data has a certain degree of uncertainty, the algorithm can obtain accurate results through reasonable adjustments.

[0030] Optionally, calculating the first maximum inscribed circle of the overlapping region includes:

[0031] An orthogonal rectangle is defined based on the second minimum bounding rectangle of the overlapping region, and the orthogonal rectangle is divided into multiple grids, each grid representing a point.

[0032] Calculate the nearest distance from each grid to the boundary of the overlapping region, and store the nearest distance of each grid in a matrix, where the rows and columns of the matrix correspond to the grid positions and the matrix values ​​correspond to the nearest distances;

[0033] The maximum value is searched in the matrix and determined as the radius of the first maximum inscribed circle.

[0034] By employing the above technical solution, the overlapping region is divided into multiple grids, and the nearest distance from each grid to the boundary of the overlapping region is calculated, allowing for a more detailed description of the shape and size of the overlapping region. This method captures more details of the overlapping region than traditional methods based on the overall shape or boundary, thereby improving the accuracy of calculating the radius of the maximum inscribed circle. Transforming the complex geometric calculation problem into a numerical search problem within a matrix greatly simplifies the calculation process. By constructing a distance matrix and using matrix operations to search for the maximum value, the radius of the maximum inscribed circle can be quickly determined without complex iterative or optimization calculations. Because this embodiment is based on grid partitioning and distance calculation, it can better handle the complexity and irregularity of the overlapping region boundary. Even if the shape of the overlapping region is complex and varied, this embodiment can adapt by adjusting the grid size and density, thus maintaining the robustness of the algorithm.

[0035] Optionally, constructing the binary image of the perforated target based on the second maximum contour and the third maximum contour includes:

[0036] Create a completely black image of the same size as the original image of the target with holes as a mask, use the second maximum contour as the boundary, and fill the inside of the second maximum contour with white to obtain the object mask;

[0037] The position of the hole in the image is determined based on the third maximum contour, and a hole mask is created based on the position. The hole mask is a black circular or elliptical mask.

[0038] The hole mask and the object mask are merged using an XOR operation to construct a binary image of the target with holes.

[0039] By adopting the above technical solution, the aperture mask is designed as a black circular or elliptical mask. This design allows the method to flexibly handle apertures of different shapes and sizes. Although the shape of the aperture may be more complex in practical applications, a circular or elliptical shape as an approximation is usually sufficient to meet the needs of most application scenarios. By filling the interior of the second largest contour with white to create an object mask, and performing an XOR operation between the aperture mask and the object mask, the object and the aperture can be effectively distinguished. The characteristic of the XOR operation ensures that when merging masks, only those regions that do not belong to either the object mask or the aperture mask are preserved (in this scenario, since the initial mask is a completely black image, only the different parts of the object mask and the aperture mask are actually preserved), thus generating a clear binary image. The embodiments of this application simplify the image processing flow by constructing masks and using simple logical operations to merge them. Compared to complex image segmentation and morphological operations, this method is more intuitive and easier to implement.

[0040] A second aspect of this application provides an AI-based target tracking and detection system, including an image processing module, a hole-free processing module, a hole-within-hole processing module, and an execution module, wherein:

[0041] An image processing module is configured to acquire a target image and process the target image to distinguish between targets with holes and targets without holes.

[0042] A hole-free processing module is configured to determine a first maximum contour of the hole-free target and determine a first center of the hole-free target based on the first maximum contour.

[0043] A hole processing module is configured to divide the hole target into an object region and a hole region, determine the maximum inscribed circle of the object region, and use the center of the maximum inscribed circle as a second center.

[0044] An execution module is configured to process the non-porous target according to the first center and to process the porous target according to the second center.

[0045] A third aspect of this application provides an electronic device including a processor, a memory, a user interface, and a network interface, wherein the memory is used to store instructions, the user interface and the network interface are both used to communicate with other devices, and the processor is used to execute the instructions stored in the memory to cause the electronic device to perform the method as described in any of the foregoing.

[0046] A fourth aspect of this application provides a computer-readable storage medium storing instructions that, when executed, perform the method described in any of the preceding descriptions.

[0047] In summary, one or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages:

[0048] 1. By differentiating the target image, the target is divided into two types: with holes and without holes. This subdivision allows subsequent processing to be optimized more accurately for different types of targets. The center of the target without holes is determined by the maximum contour, while the center of the target with holes is determined by the maximum inscribed circle of the object region. This method effectively avoids the influence of holes on the target center positioning, thereby improving the accuracy of target detection.

[0049] 2. Accurate target center localization is the foundation of target tracking stability. For targets without holes, determining the center through the first maximum contour can ensure that even if the target undergoes some deformation or rotation in the image, the tracking system can stably lock the target center. For targets with holes, using the maximum inscribed circle of the object region to determine the center can effectively avoid the interference of holes on the tracking process and improve the tracking stability.

[0050] 3. By differentiating target types and adopting targeted processing strategies for each, unnecessary computation is reduced. For example, for targets without holes, only their maximum outline needs to be considered; while for targets with holes, the focus is mainly on the object region. This differentiated processing not only improves the efficiency of the algorithm but also makes resource allocation more reasonable.

[0051] 4. It can flexibly handle targets of different shapes, including those with holes and those without. In practical applications, target shapes can vary greatly, and this highly adaptable method can ensure effective operation in various complex scenarios, improving the robustness of the system. Attached Figure Description

[0052] Figure 1This is a flowchart illustrating the AI-based target tracking and detection method disclosed in the embodiments of this application;

[0053] Figure 2 This is a binary image of a perforated target disclosed in an embodiment of this application;

[0054] Figure 3 This is a schematic diagram showing the positions of the first minimum bounding rectangle and the third center disclosed in the embodiments of this application;

[0055] Figure 4 This is a schematic diagram of an embodiment of offsetting the sides of the first minimum bounding rectangle disclosed in this application;

[0056] Figure 5 This is a schematic diagram of another embodiment of offsetting the sides of the first minimum bounding rectangle disclosed in this application;

[0057] Figure 6 This is a schematic diagram illustrating the effects of the embodiments disclosed in this application;

[0058] Figure 7 This is a schematic diagram of the modules of the AI-based target tracking and detection system disclosed in the embodiments of this application;

[0059] Figure 8 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of this application.

[0060] Explanation of reference numerals in the attached drawings: 701, Image processing module; 702, Hole-free processing module; 703, Hole-containing processing module; 704, Execution module; 801, Processor; 802, Communication bus; 803, User interface; 804, Network interface; 805, Memory. Detailed Implementation

[0061] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.

[0062] In the description of the embodiments of this application, the words "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design that is described as "for example" or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design options. Rather, the use of the words "for example" or "for instance" is intended to present the relevant concepts in a specific manner.

[0063] In the description of the embodiments of this application, the term "multiple" means two or more. For example, multiple systems means two or more systems, and multiple screen terminals means two or more screen terminals. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.

[0064] This embodiment discloses an AI (artificial intelligence)-based target tracking and detection method, which is applied to a target tracking and detection platform. Figure 1 This is a flowchart illustrating the AI-based target tracking and detection method disclosed in the embodiments of this application, as shown below. Figure 1 As shown, the method includes the following steps:

[0065] S110. Obtain the target image and process the target image to distinguish between targets with holes and targets without holes;

[0066] The process begins by acquiring a target image containing the target object and then denoising it to eliminate noise interference such as random noise and sensor noise. This improves the accuracy and efficiency of subsequent processing. Image enhancement techniques, such as contrast enhancement and edge sharpening, may be necessary to better highlight target features and facilitate subsequent analysis. Feature extraction is a crucial step in distinguishing between targets with and without holes. This typically involves identifying features such as shape, texture, and edges in the image. For hole detection, particular attention is paid to blank or low-brightness areas within the target, as these areas may indicate the presence of holes. Target contours are extracted using contour detection algorithms (such as the Canny edge detector and Hough transform). For targets with holes, the contour may contain smaller internal contours (representing holes), while the contours of targets without holes are relatively simple, usually consisting of only an outer contour. Analyzing the hierarchical structure and topological relationships of the contours can further confirm whether the target contains holes. For example, detecting nested contours likely indicates the presence of holes within the target. Based on the results of the feature extraction described above, classification algorithms (such as support vector machines, neural networks, etc.) are used to classify the targets, distinguishing between targets with holes and those without holes. The recognition process may also need to consider other factors, such as the target's size, shape, and texture, to improve the accuracy and robustness of the classification.

[0067] S120. Determine the first maximum contour of the non-porous target, and determine the first center of the non-porous target based on the first maximum contour;

[0068] Edge detection is performed on images of objects without holes. Edge detection is a fundamental technique in image processing used to identify points in an image with significant brightness variations, which typically correspond to the boundaries of objects. Common edge detection algorithms include the Canny edge detector and the Sobel operator. Based on edge detection, contour extraction algorithms (such as Hough transform and contour tracking) are used to extract the complete contour of the target from the image. Since the target is hole-free, its contour should be continuous and not contain smaller internal contours. If multiple contours exist in the image, they need to be filtered based on target features (such as size, shape, and position) to determine the first largest contour of the hole-free target. Typically, the first largest contour refers to the contour with the largest area or longest perimeter, as it is most likely to represent the primary target. Once the first largest contour of the hole-free target is determined, the first center of the target can be determined by calculating the geometric center of this contour. The geometric center (also called the centroid or centroid) is the average position of the mass of all points on the contour and can be obtained by weighted averaging of the points on the contour. For discrete contours, a weighted average of pixel coordinates can be used to calculate the geometric center. Another method for determining the target center is to use the minimum bounding rectangle or ellipse of the contour. Parameters of the minimum bounding rectangle or ellipse (such as center coordinates, dimensions, orientation, etc.) are calculated based on the contour points. Then, the center of the minimum bounding rectangle or ellipse is used as the primary center of the target. This method is particularly effective when dealing with targets of regular shapes.

[0069] S130. Divide the target with holes into an object region and a hole region, determine the largest inscribed circle of the object region, and take the center of the largest inscribed circle as the second center.

[0070] The extracted contours are analyzed, and based on their hierarchical structure and topological relationships, contours belonging to the exterior of the object are distinguished from those belonging to the interior of the hole. Typically, the exterior contours are the largest or outermost contours, while the interior contours are smaller contours nested within the object contours. Based on these contours, the image is divided into object regions (i.e., regions enclosed by the outer contours) and hole regions (i.e., regions enclosed by the inner contours). The inscribed circle is the largest circle tangent to the boundary of the object region and completely located within it. Finding the largest inscribed circle is an optimization problem that can be solved using various algorithms, such as variations of the minimum circle covering problem, and algorithms based on convex or concave hulls. A common approach is to approximate the shape of the object region using Voronoi diagrams or Delaunay triangulations and then search for the largest inscribed circle based on this. Another approach is to iteratively try circles at different positions and radii until the circle with the largest radius and tangent to the boundary of the object region is found. Once the largest inscribed circle of the object region is determined, its center can be used as the second center of the target with the hole. This center location is usually more representative of the actual location of a target with holes than simply taking the geometric center of the object's outline, because it takes into account the effect of the holes on the target's shape.

[0071] Determining the maximum inscribed circle of the object region includes:

[0072] Determine the second maximum contour of the object region and the third maximum contour of the hole region, construct a binary image of the target with holes based on the second maximum contour and the third maximum contour, and determine the third center of the hole region based on the third maximum contour;

[0073] The first minimum bounding rectangle of the binary image is determined by the contour function. Based on the third center, the four sides of the first minimum bounding rectangle are offset to obtain four first maximum inscribed circles. The second maximum inscribed circle with the largest radius among the four first maximum inscribed circles is taken as the maximum inscribed circle.

[0074] Create a binary map on the original image using the maximum contours of the object region and the maximum contours of the hole region. Figure 2 This is a binary image of a perforated target disclosed in an embodiment of this application, such as... Figure 2As shown, in this binary image, the object region is marked as 1 (or white), while the background and other regions (including holes) are marked as 0 (or black). The third largest contour of the hole region can be determined using geometric center calculation or the minimum bounding rectangle / ellipse method; this is the third center. This center will be used in subsequent incircle calculations. On the binary image, a contour function (such as `minAreaRect` in OpenCV) is used to find the minimum bounding rectangle containing the object region. This rectangle will serve as a reference for subsequent incircle calculations. Using the third center as a reference, the four sides of the first minimum bounding rectangle are offset. The offset distance can be adjusted as needed, but is usually related to the size and position of the hole. For each side, the offset will intersect the boundary of the object region at two points. An incircle can be determined using these two points and the third center. Therefore, the four sides will produce four incircles. The radii of these four incircles are compared, and the one with the largest radius is selected as the largest incircle of the object region.

[0075] By determining the maximum contour of the object region and the maximum contour of the hole region, the extent of the object and the hole can be defined more accurately. This helps reduce errors caused by inaccurate contour recognition. A binary image is constructed, and the edges of the first minimum bounding rectangle are offset based on the third center of the hole region to find the possible location of the maximum inscribed circle. This method considers the actual impact of the hole on the object's shape, thereby improving the accuracy of the maximum inscribed circle determination. This embodiment not only considers the overall shape of the object region but also pays special attention to the position and size of the hole region. Multiple possible locations of the maximum inscribed circle are found by offsetting the edges of the bounding rectangle, and the one with the largest radius is selected. This multi-step verification and selection process enhances the robustness of the algorithm, enabling it to handle holes of different shapes and sizes. This embodiment is not only applicable to targets with a single hole but can also be extended to targets with multiple holes or complex shapes. By appropriately adjusting the algorithm parameters and steps, it can flexibly meet the target detection needs in different application scenarios.

[0076] The step of constructing a binary image of the target with holes based on the second maximum contour and the third maximum contour includes: creating a completely black image of the same size as the original image of the target with holes as a mask, using the second maximum contour as the boundary, and filling the interior of the second maximum contour with white to obtain the object mask;

[0077] The position of the hole in the image is determined based on the third maximum contour, and a hole mask is created based on the position. The hole mask is a black circular or elliptical mask.

[0078] The hole mask and the object mask are merged using an XOR operation to construct a binary image of the target with holes.

[0079] The second largest contour is considered the boundary, and the area inside this contour is filled with white (i.e., pixel values ​​are set to 255) in the mask image. This filling process is typically implemented using a filling algorithm from a graphics library, such as a seed fill algorithm. The filled image is called the "object mask," which represents the position and shape of the object in the image. Based on the third largest contour (i.e., the contour of the hole region), the specific location of the hole in the image can be determined. This step usually involves geometric calculations of the contour, such as calculating the centroid (center point) or bounding box of the contour. Based on the position and possible shape (circular or elliptical) of the hole, a black circular or elliptical mask of appropriate size and shape is created on the mask image. The size and shape of this mask should match the actual size and shape of the hole to ensure that subsequent operations can accurately remove the hole region from the object mask. The hole mask and the object mask are merged using an XOR operation. The characteristic of the XOR operation is that the result is 1 (true) when the two compared bits are different, and 0 (false) otherwise. In this scenario, since the hole mask is black (pixel value 0) and the object mask is white (pixel value 255) outside the hole location, the XOR operation removes the black area (hole) from the object mask while leaving other areas unchanged. After the XOR operation, a new mask image is obtained, containing only the object region (excluding the hole), with the object region being white and the background black. This image is the binary image of the target with the hole that we want to construct. It clearly represents the shape and position of the object while removing the influence of the hole region.

[0080] By filling the interior of the second largest contour with white to form the object mask, only the main part of the target object is preserved, eliminating noise and unnecessary edges. The hole mask is created considering the actual location and shape of the holes (black circles or ellipses), allowing for accurate representation of the holes in the binary image, thus improving the accuracy of subsequent processing. Creating a completely black image of the same size as the original image as the starting point for the mask simplifies the mask generation process. By applying the object contour and hole contour to this base mask respectively, the target object and hole regions can be clearly distinguished. The object mask and hole mask are merged using an XOR operation; this method is concise and efficient, directly generating a binary image containing hole information without complex image processing operations. By decomposing the problem into the generation of object masks and hole masks, and their merging, the complex image processing task is simplified into a few simple steps, thus improving processing efficiency. Since the binary image only contains black and white, subsequent image processing operations (such as contour detection, shape analysis, etc.) are also more efficient. This application's embodiments can handle holes of different shapes, sizes, and locations because it does not construct masks based on the specific shape or size of the holes, but rather determines their positions based on the maximum outline of the holes. This makes the method more robust when dealing with complex images. By using XOR operations to merge masks, errors caused by mask overlap or misalignment are reduced, improving the accuracy and reliability of binary images.

[0081] The step of offsetting the four sides of the first minimum bounding rectangle based on the third center to obtain four first maximum inscribed circles includes:

[0082] A rectangular coordinate system is established with the target endpoint of the first minimum bounding rectangle as the origin, where the target endpoint is any one of the endpoints of the first minimum bounding rectangle;

[0083] Determine the coordinates of the two endpoints on the target edge, and determine the equation of the first straight line based on the two endpoints. The target edge is any one of the four sides of the first minimum bounding rectangle.

[0084] A new rectangle is determined based on the equation of the first straight line, the coordinates of the third center, and the coordinates of the two endpoints;

[0085] Determine the overlapping area between the new rectangle and the object region, and calculate the first maximum inscribed circle of the overlapping area.

[0086] Figure 3 This is a schematic diagram showing the positions of the first minimum bounding rectangle and the third center disclosed in the embodiments of this application, as shown below. Figure 3As shown, the rectangle formed by the four endpoints a, b, e, and f is the first minimum bounding rectangle. The circle in the figure represents the hole, and c is the center of the hole (i.e., the third center). We choose one endpoint of the first minimum bounding rectangle as the origin to establish a Cartesian coordinate system. This choice is arbitrary, but usually a corner point of the rectangle is chosen for ease of calculation and representation. The establishment of the coordinate system allows us to use mathematical equations to describe the sides and interior points of the rectangle. We choose one of the four sides of the first minimum bounding rectangle as the target side. Next, we determine the coordinates of the two endpoints of this target side and use these coordinates to calculate the equation of the line. The equation of the line is usually expressed in the form Ax + By + C = 0, where A, B, and C are constants, and x and y are points in the coordinate system. Using the coordinates of the third center (a known point that may represent an important location inside the object, such as the center of the hole), the equation of the target side, and the coordinates of the two endpoints of the target side, we can calculate a line parallel to the target side and passing through the third center. This new line will serve as a side of the new rectangle. Similarly, three additional sides can be calculated, forming a new rectangle. This new rectangle may represent an extension or offset centered on the third center, taking into account the direction of the target side. The overlapping region between the new rectangle and the object region (i.e., the interior of the actual object's outline in the original image) is determined. This overlapping region may be a complex shape, but it contains the parts of interest, such as holes or internal recesses. Finally, the first maximal incircle is calculated within the overlapping region. This incircle is the maximal circle that satisfies the following conditions: it lies entirely within the overlapping region and has at least two points of contact with the boundary of the overlapping region (i.e., it is internally tangent). Calculating such a circle typically requires some geometric or numerical optimization method, such as gradient descent, linear programming, or specialized geometric algorithms.

[0087] By establishing a Cartesian coordinate system using any endpoint of the first minimum bounding rectangle as the origin, the algorithm's flexibility allows it to adapt to objects of different shapes and positions, enhancing its versatility and robustness. The accuracy of the calculation is ensured by determining the equation of the line along the target edge (i.e., any edge of the first minimum bounding rectangle) and using this equation in conjunction with the coordinates of the third center to calculate the new rectangle (i.e., the offset rectangle). Since the equation of the line can accurately describe the position and direction of the line segment, the offset calculation can be performed precisely. After determining the new rectangle, the algorithm further calculates the overlap area between the new rectangle and the object region and finds the first largest inscribed circle within this overlap area. This step aims to find the largest possible inscribed circle that is completely located within the object region. For certain applications (such as object detection, object recognition, path planning, etc.), such an inscribed circle has significant practical value, providing more accurate shape descriptions or boundary information. Although the process involves multiple steps and calculations, each step has a clear mathematical basis and is supported by efficient algorithms (such as the calculation of the equation of a straight line, the offset of a rectangle, the determination of overlapping areas, and the calculation of the inscribed circle). These steps work together to significantly improve the computational efficiency of the entire process.

[0088] Determining the new rectangle based on the equation of the first straight line, the coordinates of the third center, and the coordinates of the two endpoints includes:

[0089] Based on the first line equation, construct a second line equation, a third line equation, and a fourth line equation. The second line equation passes through the third center and is parallel to the first line equation. The third line equation passes through the first endpoint and is perpendicular to the first line equation. The fourth line equation passes through the second endpoint and is perpendicular to the second line equation. The two endpoints include the first endpoint and the second endpoint.

[0090] A new rectangle is determined based on the first endpoint, the second endpoint, the third endpoint, and the fourth endpoint, wherein the third endpoint is the point where the second line equation and the third line equation intersect, and the fourth endpoint is the point where the second line equation and the fourth line equation intersect.

[0091] Construct a second line passing through the third center and parallel to the equation of the first line; construct a third line passing through the first endpoint and perpendicular to the equation of the first line; and construct a fourth line passing through the second endpoint and perpendicular to the equation of the second line. The third endpoint is the point where the equations of the second and third lines intersect. This is usually achieved by solving a system of equations for these two lines. The coordinates obtained are the coordinates of the third endpoint. The fourth endpoint is the point where the equations of the second and fourth lines intersect. Similarly, this is achieved by solving a system of equations for these two lines. The coordinates obtained are the coordinates of the fourth endpoint. Determine the new rectangle based on the first, second, third, and fourth endpoints.

[0092] like Figure 4 As shown, a and b are the points before the offset, A and B are the points after the offset, L1 is the first line equation, the first line equation L1 is translated and passes through point c to obtain the second line equation L2, the third line equation is set perpendicular to the first line equation and passes through point a, and the fourth line equation is set perpendicular to the first line equation and passes through point b. Figure 4 (a) and Figure 4 (b) are the cases where the equation of the first straight line is horizontal and vertical, respectively.

[0093] This method ensures the precision and accuracy of the new rectangle by precisely calculating the intersection points of the line equations to determine each vertex (i.e., endpoints). Regardless of the precision of the original data, as long as the input data is correct, the generated rectangle will be drawn strictly according to these data, reducing human error. It can flexibly construct new rectangles based on different inputs (such as different line equations, center point, and endpoint coordinates). This means it can adapt to various application scenarios; simply adjusting the input parameters will yield the desired rectangle shape and position. Although it involves constructing line equations and calculating intersection points, these operations are relatively efficient in a computer. Once the line equations are determined, calculating the intersection points (i.e., the vertices of the rectangle) typically only requires performing basic mathematical operations, making the entire process computationally feasible and relatively fast.

[0094] The step of constructing the second, third, and fourth line equations based on the first line equation includes: determining whether the first slope of the first line equation meets a preset condition;

[0095] When the first slope of the first straight line equation meets the preset conditions, a second straight line equation is constructed based on the first slope and the third center. The second slope is obtained based on the ratio of the preset value to the first slope. The third straight line equation is determined based on the second slope and the coordinates of the first endpoint. The fourth straight line equation is determined based on the second slope and the coordinates of the second endpoint.

[0096] Figure 5This is a schematic diagram of an embodiment of offsetting the sides of the first minimum bounding rectangle disclosed in this application, as shown below. Figure 5 As shown, the rectangle formed by the four endpoints a, b, e, and f is the first minimum bounding rectangle. The points to be offset are a and b, and the offset results are A and B. If the slope of the first line equation meets the preset conditions (i.e., not zero and not positive infinity), then the first line equation L1 is formed based on a and b, with a and b being the first and second endpoints, respectively. The second line equation L2 has the same slope as L1, and it passes through point c (the center of the hole), thus determining the second line equation L2. The product of the slope of the third line equation L3 and the slope of the first line equation L1 is -1. The third line equation L3 passes through point a, hence the third line equation L3 is obtained. Since the third line equation L3 intersects the second line equation L2 at point A, the coordinates of A are obtained. The product of the slope of the fourth line equation L4 and the slope of the first line equation L1 is -1. The fourth line equation L4 passes through point b, hence the fourth line equation L4 is obtained. Since the fourth line equation L4 intersects the second line equation L2 at point B, the coordinates of B are obtained. Reassemble the two stationary points (e and f) and the offset results (point A and point B) into a new rotating rectangle. Compare this new rotating rectangle with the original image to obtain the overlapping area, and then draw the maximum inscribed circle in the overlapping area.

[0097] The calculation of the first maximum inscribed circle of the overlapping region includes:

[0098] An orthogonal rectangle is defined based on the second minimum bounding rectangle of the overlapping region, and the orthogonal rectangle is divided into multiple grids, each grid representing a point.

[0099] Calculate the nearest distance from each grid to the boundary of the overlapping region, and store the nearest distance of each grid in a matrix, where the rows and columns of the matrix correspond to the grid positions and the matrix values ​​correspond to the nearest distances;

[0100] The maximum value is searched in the matrix and determined as the radius of the first maximum inscribed circle.

[0101] An orthogonal rectangle is defined based on the minimum bounding rectangle (i.e., the second minimum bounding rectangle) of the overlapping region. This orthogonal rectangle should completely contain the overlapping region, and its boundaries should be parallel to the coordinate axes (i.e., horizontally and vertically). This orthogonal rectangle is divided into multiple grids. Each grid represents a point, and the grid division should be fine enough to accurately reflect the shape and size of the overlapping region. The grid density depends on the required computational accuracy and performance requirements. For each grid point (or the center point of the grid), the nearest distance to the boundary of the overlapping region is calculated. This distance can be calculated in various ways, such as using a point-to-polygon distance calculation algorithm, or by traversing the boundary segments of the overlapping region to find the closest point to the grid point. The calculated nearest distances are stored in a matrix, where the rows and columns of the matrix correspond to the grid positions, and the matrix values ​​correspond to the nearest distance from each grid point to the boundary of the overlapping region. The maximum value is searched in the matrix storing the nearest distances from all grid points to the boundary of the overlapping region. This maximum value represents the radius of the largest inscribed circle that can be placed within the overlapping region. Since the center of the inscribed circle must be located within the overlapping region, and its radius cannot exceed the shortest distance from the center to the boundary of the overlapping region, the maximum value in the matrix is ​​the radius of the first largest inscribed circle.

[0102] By mapping the overlapping region to an orthogonal rectangle and further dividing that rectangle into multiple grids, a detailed subdivision of the overlapping region can be achieved. Each grid represents a point, and the shortest distance from that point to the boundary of the overlapping region is calculated. This method can accurately capture the shape and size of the overlapping region, thus more accurately calculating the radius of the largest inscribed circle. Transforming the problem into matrix operations allows for faster computation by leveraging the efficiency of matrix operations. Each row and column of the matrix corresponds to a grid position, while the matrix value stores the shortest distance from each grid to the boundary of the overlapping region. This data structure simplifies and simplifies the subsequent maximum value search operation. Visualizing the overlapping region and the grid system provides an intuitive understanding of the distance from each grid point to the boundary and how these distances affect the radius of the largest inscribed circle. This intuitiveness helps verify the correctness of the calculation results and allows for adjustments and optimizations when necessary.

[0103] S140. Process the non-porous target according to the first center, and process the porous target according to the second center.

[0104] Figure 6 This is a schematic diagram illustrating the effects of the embodiments disclosed in this application, such as... Figure 6As shown, the outer rectangle is the smallest bounding rectangle of the entire object, the inner rectangle is the smallest bounding rectangle of the hole, and the inner circle is the largest inscribed circle of the object region. For example, in the scavenging of recyclables, recyclables without holes can be scavenged based on the first center, and recyclables with holes can be scavenged based on the second center.

[0105] The success rate of inscribed circle detection was 93.25%, and the specific error statistics are shown in the table below.

[0106]

[0107]

[0108] The following problems exist:

[0109] (1) Bottle recognition is normal, hole recognition is normal, but the correct inscribed circle is not detected (the circle may be biased towards a narrower area);

[0110] (2) Bottle recognition is abnormal (the detected bottle is covered by other bottles, becoming a mask area of ​​multiple bottles), hole recognition is normal, but the correct inscribed circle is not detected;

[0111] (3) The hole is blocked, and the hole is missed (the hole is not identified);

[0112] (4) Error detection hole;

[0113] (5) There really are bottles with two holes;

[0114] (6) Draw the inscribed circle to the side of the bottle;

[0115] (7) Others.

[0116] This embodiment also discloses an AI-based target tracking and detection system. Figure 7 This is a schematic diagram of the modules of the AI-based target tracking and detection system disclosed in the embodiments of this application, as shown below. Figure 7 As shown, the system includes an image processing module 701, a hole-free processing module 702, a hole-within-hole processing module 703, and an execution module 704, wherein:

[0117] Image processing module 701 is configured to acquire a target image and process the target image to distinguish between targets with holes and targets without holes;

[0118] A hole-free processing module 702 is configured to determine a first maximum contour of the hole-free target and determine a first center of the hole-free target based on the first maximum contour.

[0119] A hole processing module 703 is configured to divide the hole target into an object region and a hole region, determine the maximum inscribed circle of the object region, and use the center of the maximum inscribed circle as a second center.

[0120] The execution module 704 is configured to process the non-porous target according to the first center and to process the porous target according to the second center.

[0121] The perforated processing module 703 is configured to:

[0122] Determine the second maximum contour of the object region and the third maximum contour of the hole region, construct a binary image of the target with holes based on the second maximum contour and the third maximum contour, and determine the third center of the hole region based on the third maximum contour;

[0123] The first minimum bounding rectangle of the binary image is determined by the contour function. Based on the third center, the four sides of the first minimum bounding rectangle are offset to obtain four first maximum inscribed circles. The second maximum inscribed circle with the largest radius among the four first maximum inscribed circles is taken as the maximum inscribed circle.

[0124] The hole processing module 703 is also configured to:

[0125] Create a completely black image of the same size as the original image of the target with holes as a mask, use the second maximum contour as the boundary, and fill the inside of the second maximum contour with white to obtain the object mask;

[0126] The position of the hole in the image is determined based on the third maximum contour, and a hole mask is created based on the position. The hole mask is a black circular or elliptical mask.

[0127] The hole mask and the object mask are merged using an XOR operation to construct a binary image of the target with holes.

[0128] The hole processing module 703 is also configured to:

[0129] A rectangular coordinate system is established with the target endpoint of the first minimum bounding rectangle as the origin, where the target endpoint is any one of the endpoints of the first minimum bounding rectangle;

[0130] Determine the coordinates of the two endpoints on the target edge, and determine the equation of the first straight line based on the two endpoints. The target edge is any one of the four sides of the first minimum bounding rectangle.

[0131] A new rectangle is determined based on the equation of the first straight line, the coordinates of the third center, and the coordinates of the two endpoints;

[0132] Determine the overlapping area between the new rectangle and the object region, and calculate the first maximum inscribed circle of the overlapping area.

[0133] The hole processing module 703 is also configured to:

[0134] Based on the first line equation, construct a second line equation, a third line equation, and a fourth line equation. The second line equation passes through the third center and is parallel to the first line equation. The third line equation passes through the first endpoint and is perpendicular to the first line equation. The fourth line equation passes through the second endpoint and is perpendicular to the second line equation. The two endpoints include the first endpoint and the second endpoint.

[0135] A new rectangle is determined based on the first endpoint, the second endpoint, the third endpoint, and the fourth endpoint, wherein the third endpoint is the point where the second line equation and the third line equation intersect, and the fourth endpoint is the point where the second line equation and the fourth line equation intersect.

[0136] The hole processing module 703 is also configured to:

[0137] Determine whether the first slope of the first straight line equation meets the preset conditions;

[0138] When the first slope of the first straight line equation meets the preset conditions, a second straight line equation is constructed based on the first slope and the third center. The second slope is obtained based on the ratio of the preset value to the first slope. The third straight line equation is determined based on the second slope and the coordinates of the first endpoint. The fourth straight line equation is determined based on the second slope and the coordinates of the second endpoint.

[0139] The hole processing module 703 is also configured to:

[0140] An orthogonal rectangle is defined based on the second minimum bounding rectangle of the overlapping region, and the orthogonal rectangle is divided into multiple grids, each grid representing a point.

[0141] Calculate the nearest distance from each grid to the boundary of the overlapping region, and store the nearest distance of each grid in a matrix, where the rows and columns of the matrix correspond to the grid positions and the matrix values ​​correspond to the nearest distances;

[0142] The maximum value is searched in the matrix and determined as the radius of the first maximum inscribed circle.

[0143] It should be noted that the above embodiments of the apparatus are only illustrated by the division of the above functional modules. In practical 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 apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.

[0144] This embodiment also discloses an electronic device, as shown in the reference. Figure 8 The electronic device may include: at least one processor 801, at least one communication bus 802, user interface 803, network interface 804, and at least one memory 805.

[0145] The communication bus 802 is used to enable communication between these components.

[0146] The user interface 803 may include a display screen and a camera. Optionally, the user interface 803 may also include a standard wired interface and a wireless interface.

[0147] The network interface 804 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).

[0148] The processor 801 may include one or more processing cores. The processor 801 connects to various parts of the server using various interfaces and lines, and performs various server functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 805, and by calling data stored in the memory 805. Optionally, the processor 801 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 801 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also be implemented as a separate chip without being integrated into the processor 801.

[0149] The memory 805 may include random access memory (RAM) or read-only memory. Optionally, the memory 805 may include a non-transitory computer-readable storage medium. The memory 805 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 805 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 805 may also be at least one storage device located remotely from the aforementioned processor 801. Figure 8 As shown, the memory 805, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an application program for an AI-based target tracking and detection method.

[0150] exist Figure 8 In the electronic device shown, the user interface 803 is mainly used to provide an input interface for the user and to obtain the user input data; while the processor 801 can be used to call the application program stored in the memory 805 for AI-based target tracking and detection methods. When executed by one or more processors 801, the electronic device performs one or more methods as described in the above embodiments.

[0151] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0152] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0153] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the shown or discussed mutual couplings or direct couplings or communication connections may be through some service interfaces; indirect couplings or communication connections between apparatuses or units may be electrical or other forms.

[0154] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0155] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0156] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory 805 and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory 805 includes various media capable of storing program code, such as a USB flash drive, external hard drive, magnetic disk, or optical disk.

[0157] The foregoing description is merely an exemplary embodiment of this disclosure and should not be construed as limiting the scope of this disclosure. Any equivalent changes and modifications made in accordance with the teachings of this disclosure shall still fall within the scope of this disclosure. Other embodiments of this disclosure will be readily apparent to those skilled in the art upon consideration of the disclosure in this specification. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not described in this disclosure. The specification and embodiments are to be considered exemplary only, and the scope and spirit of this disclosure are defined by the claims.

Claims

1. An AI-based target tracking and detection method, characterized in that, Applied to a target tracking and detection platform, the method includes: Acquire a target image and process the target image to distinguish between targets with holes and targets without holes; Determine the first maximum contour of the non-porous target, and determine the first center of the non-porous target based on the first maximum contour; The target with holes is divided into an object region and a hole region. The largest inscribed circle of the object region is determined, and the center of the largest inscribed circle is used as the second center. The target without holes is processed according to the first center, and the target with holes is processed according to the second center. Determining the maximum inscribed circle of the object region includes: Determine the second maximum contour of the object region and the third maximum contour of the hole region, construct a binary image of the target with holes based on the second maximum contour and the third maximum contour, and determine the third center of the hole region based on the third maximum contour; The first minimum bounding rectangle of the binary image is determined by a contour function. Based on the third center, the four sides of the first minimum bounding rectangle are offset to obtain four first maximum incircles. The second maximum incircle with the largest radius among the four first maximum incircles is taken as the maximum incircle. The step of offsetting the four sides of the first minimum bounding rectangle based on the third center to obtain four first maximum inscribed circles includes: A rectangular coordinate system is established with the target endpoint of the first minimum bounding rectangle as the origin, where the target endpoint is any one of the endpoints of the first minimum bounding rectangle; Determine the coordinates of the two endpoints on the target edge, and determine the equation of the first straight line based on the two endpoints. The target edge is any one of the four sides of the first minimum bounding rectangle. A new rectangle is determined based on the equation of the first straight line, the coordinates of the third center, and the coordinates of the two endpoints; Determine the overlapping area between the new rectangle and the object region, and calculate the first maximum inscribed circle of the overlapping area.

2. The AI-based target tracking and detection method according to claim 1, characterized in that, Determining the new rectangle based on the equation of the first straight line, the coordinates of the third center, and the coordinates of the two endpoints includes: Based on the first line equation, construct a second line equation, a third line equation, and a fourth line equation. The second line equation passes through the third center and is parallel to the first line equation. The third line equation passes through the first endpoint and is perpendicular to the first line equation. The fourth line equation passes through the second endpoint and is perpendicular to the second line equation. The two endpoints include the first endpoint and the second endpoint. A new rectangle is determined based on the first endpoint, the second endpoint, the third endpoint, and the fourth endpoint, wherein the third endpoint is the point where the second line equation and the third line equation intersect, and the fourth endpoint is the point where the second line equation and the fourth line equation intersect.

3. The AI-based target tracking and detection method according to claim 1, characterized in that, The step of constructing the second, third, and fourth line equations based on the first line equation includes: Determine whether the first slope of the first straight line equation meets the preset conditions; When the first slope of the first straight line equation meets the preset conditions, a second straight line equation is constructed based on the first slope and the third center. The second slope is obtained based on the ratio of the preset value to the first slope. The third straight line equation is determined based on the second slope and the coordinates of the first endpoint. The fourth straight line equation is determined based on the second slope and the coordinates of the second endpoint.

4. The AI-based target tracking and detection method according to claim 1, characterized in that, The calculation of the first maximum inscribed circle of the overlapping region includes: An orthogonal rectangle is defined based on the second minimum bounding rectangle of the overlapping region, and the orthogonal rectangle is divided into multiple grids, each grid representing a point. Calculate the nearest distance from each grid to the boundary of the overlapping region, and store the nearest distance of each grid in a matrix, where the rows and columns of the matrix correspond to the grid positions and the matrix values ​​correspond to the nearest distances; The maximum value is searched in the matrix and determined as the radius of the first maximum inscribed circle.

5. The AI-based target tracking and detection method according to claim 1, characterized in that, The step of constructing a binary image of the perforated target based on the second maximum contour and the third maximum contour includes: Create a completely black image of the same size as the original image of the target with holes as a mask, use the second maximum contour as the boundary, and fill the inside of the second maximum contour with white to obtain the object mask; The position of the hole in the image is determined based on the third maximum contour, and a hole mask is created based on the position. The hole mask is a black circular or elliptical mask. The hole mask and the object mask are merged using an XOR operation to construct a binary image of the target with holes.

6. An AI-based target tracking and detection system, characterized in that, It includes an image processing module, a hole-free processing module, a hole-with-hole processing module, and an execution module, wherein: An image processing module is configured to acquire a target image and process the target image to distinguish between targets with holes and targets without holes. A hole-free processing module is configured to determine a first maximum contour of the hole-free target and determine a first center of the hole-free target based on the first maximum contour. A hole processing module is configured to divide the hole target into an object region and a hole region, determine the maximum inscribed circle of the object region, and use the center of the maximum inscribed circle as a second center. The execution module is configured to process the non-porous target according to the first center and to process the porous target according to the second center. Determining the maximum inscribed circle of the object region includes: Determine the second maximum contour of the object region and the third maximum contour of the hole region, construct a binary image of the target with holes based on the second maximum contour and the third maximum contour, and determine the third center of the hole region based on the third maximum contour; The first minimum bounding rectangle of the binary image is determined by a contour function. Based on the third center, the four sides of the first minimum bounding rectangle are offset to obtain four first maximum incircles. The second maximum incircle with the largest radius among the four first maximum incircles is taken as the maximum incircle. The step of offsetting the four sides of the first minimum bounding rectangle based on the third center to obtain four first maximum inscribed circles includes: A rectangular coordinate system is established with the target endpoint of the first minimum bounding rectangle as the origin, where the target endpoint is any one of the endpoints of the first minimum bounding rectangle; Determine the coordinates of the two endpoints on the target edge, and determine the equation of the first straight line based on the two endpoints. The target edge is any one of the four sides of the first minimum bounding rectangle. A new rectangle is determined based on the equation of the first straight line, the coordinates of the third center, and the coordinates of the two endpoints; Determine the overlapping area between the new rectangle and the object region, and calculate the first maximum inscribed circle of the overlapping area.

7. An electronic device, characterized in that, The device includes a processor, a memory, a user interface, and a network interface. The memory is used to store instructions. The user interface and the network interface are both used to communicate with other devices. The processor is used to execute the instructions stored in the memory to cause the electronic device to perform the method as described in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed, perform the method as described in any one of claims 1-5.