Target counting method and trolley management method
By employing image segmentation and spectral analysis methods, the problem of inaccurate trolley counting in complex backgrounds of airport terminals was solved, achieving high-accuracy counting under varying lighting conditions and noise interference, and supporting automated management.
Patent Information
- Application Number
- CN202510526237.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-25
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2045-04-25
AI Technical Summary
In complex environments such as airport terminals, existing technologies struggle to accurately count handcarts, especially under varying lighting conditions and noise interference, which can easily lead to misidentification of other objects and inaccurate counting.
Image segmentation and spectral analysis are performed using an image segmentation model. The unique frequency characteristics of the target object are captured through the spectrogram, reducing the impact of illumination changes and noise interference, and improving counting accuracy.
It effectively improves the accuracy of handcart counting in complex environments, can adapt to various environmental changes, reduces the probability of false detection, and improves operational efficiency through automated supplementary scheduling.
Smart Images

Figure CN120047878B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of computer vision and image processing, and more specifically, to a target counting method and a handcart management method. Background Technology
[0002] Currently, airport terminals frequently face a shortage of trolleys, especially when large aircraft arrive, at which point trolleys are quickly used up. Typically, counting trolleys in video footage involves extracting visual features such as shape, color, or texture from video frames and using these features to determine the number of trolleys. However, in complex background scenarios with varying lighting and noise interference, objects with similar shapes, colors, or textures to trolleys, such as strollers or suitcases, may appear in the same video frame, leading to an overcount of trolleys. Therefore, current target-based counting methods are less accurate and fail to meet the requirements of complex background scenarios. Summary of the Invention
[0003] The purpose of this application is to provide a target counting method and a trolley management method to improve the problem of low accuracy in target counting.
[0004] This application provides a target counting method, comprising: using an image segmentation model to segment an image to be processed, obtaining multiple region images; for each region image in the multiple region images, performing image recognition on the region image to obtain a target region image whose recognition result is a target object; performing spectral analysis on the target region image to obtain a spectrogram; and counting the target objects in the target region image according to the spectrogram to obtain the number of target objects in the image to be processed. In the implementation of the above scheme, by first using a model to perform image segmentation and image recognition on the image to be processed, and then performing spectral analysis on the recognized target region image, the obtained spectrogram can capture the unique frequency characteristics of the target object. These characteristics are often more abstract but more distinguishable than traditional shape, color, or texture features. Therefore, using the spectrogram can understand the image content from the perspective of different frequency components. Compared with operating directly in the spatial domain, frequency domain information is usually more resistant to the influence of factors such as illumination changes and noise interference, providing a more stable and reliable feature representation. Furthermore, spectral analysis can help filter out some high-frequency noise caused by environmental factors such as reflection and shadow. After removing these high-frequency noise interference factors, the probability of densely arranged target objects being falsely detected can be effectively reduced, thus effectively improving the accuracy of target counting and meeting the requirements of scenes in complex backgrounds.
[0005] Optionally, in this embodiment, the image segmentation model includes: a cue encoder, an image encoder, and an image decoder. Using the image segmentation model to segment the image to be processed includes: acquiring segmentation cue information of the image to be processed; encoding the segmentation cue information using the cue encoder to obtain a segmentation cue vector; encoding the image to be processed using the image encoder to obtain an embedded image vector; decoding the segmentation cue vector and the embedded image vector using the image decoder to obtain a contour mask map; and using the contour mask map to perform region segmentation on the image to be processed to obtain multiple region images. In the implementation of the above scheme, image segmentation of the image to be processed is performed using the segmentation cue vector. Because the segmentation cue vector provides additional contextual information, the contour mask map generated by the image decoder is more accurate, reducing the possibility of mistaking the background or other similar objects for the target object. Therefore, it can effectively separate each object from the complex background, reducing the impact of background noise on subsequent processing steps, and effectively improving the accuracy of target counting even under conditions of lighting changes, occlusion, or significant background interference.
[0006] Optionally, in this embodiment, the image to be processed is the current video image frame, and the segmentation prompt information is the prompt detection point in the current video image frame. Obtaining the segmentation prompt information of the image to be processed includes: determining randomly generated detection points as prompt detection points; or, determining pre-set detection points as prompt detection points; or, when the target object in the current video image is occluded, determining the detection points used in historical video image frames as prompt detection points. In the implementation of the above scheme, by flexibly selecting the prompt point method (randomly generated, pre-set, or using detection points in historical frames) according to different scene requirements, the system can adapt to various complex environments. When the environment changes suddenly (such as changes in lighting conditions, movement of background objects, etc.), randomly generated detection points can help the system quickly adapt to the new situation, avoiding failures caused by fixed patterns, thereby enhancing the adaptability and flexibility of image segmentation. Furthermore, when the target object is occluded, using valid detection points from previous historical frames as cues can maintain continuous tracking and recognition of the target, reducing the problem of target loss due to temporary occlusion. By combining multiple cue point strategies, the system can select the optimal combination of detection points under different circumstances, thereby enhancing the accuracy of image segmentation.
[0007] Optionally, in this embodiment, image recognition of the region image includes: dividing the region image into multiple image blocks; inputting the multiple image blocks into a visual converter model to enable the visual converter model to identify the category of the region image; if the category of the region image is the category to which the target object belongs, then the region image is determined as the target region image. In the implementation of the above scheme, by dividing the region image into multiple image blocks, each image block can be analyzed independently, which enables the model to better capture the local detailed features of the target object. The visual converter model can not only process the information of a single image block, but also effectively fuse global contextual information from different image blocks through a self-attention mechanism. Even if some local features are not obvious, accurate classification can be achieved by combining information from other parts, thereby improving classification accuracy.
[0008] Optionally, in this embodiment, the visual converter model includes a fully connected network, a transformation encoder, and a multilayer perceptron network. After inputting multiple image patches into the visual converter model, the model further includes: embedding the multiple image patches using the fully connected network to obtain embedded patch vectors; transforming the embedded patch vectors using the transformation encoder to obtain transformed intermediate feature vectors; and performing category recognition on the transformed intermediate feature vectors using the multilayer perceptron to obtain the category of the region image. In the implementation of the above scheme, embedding each image patch using a fully connected network can transform the original pixel information into a higher-level feature representation, enabling the model to capture fine-grained features in the image, thereby increasing the accuracy of region image category recognition. Furthermore, since the transformation encoder can effectively integrate global and local information, it performs better in distinguishing similar objects. For example, in an airport environment, subtle differences between a trolley and other similar items (such as a stroller or suitcase) can be accurately captured in this way, further increasing the accuracy of region image category recognition.
[0009] Optionally, in this embodiment, the spectrum map includes: a frequency domain contour map; spectral analysis of the target region image includes: grayscale processing of the target region image to obtain a two-dimensional grayscale image; transformation of the two-dimensional grayscale image to obtain a two-dimensional frequency domain representation matrix; and calculation of the frequency domain contour map based on the two-dimensional frequency domain representation matrix. In the implementation of the above scheme, by performing spectral analysis on the target region image, the frequency characteristic differences between different target objects can be identified. This helps to more accurately classify and count similar but different objects (such as strollers and baby carriages). Compared to relying solely on spatial domain information, this method provides an additional dimension to describe target features, thereby identifying subtle structures and patterns that are difficult to detect in the spatial domain, effectively improving counting accuracy. Furthermore, since spectral analysis mainly focuses on the frequency components in the image rather than brightness values, it is insensitive to changes in illumination. This means that even images taken under different lighting conditions can maintain high accuracy.
[0010] Optionally, in this embodiment, the statistical analysis of target objects in the target region image based on the spectrogram includes: performing frequency domain signal analysis on the spectrogram to obtain multiple signal frequency values; selecting the signal frequency value with the highest signal strength from the multiple signal frequency values; and determining the signal frequency value with the highest signal strength as the number of target objects in the image to be processed. In the implementation of the above scheme, by performing frequency domain signal analysis on the spectrogram and selecting the signal frequency value with the highest signal strength from the obtained multiple signal frequency values, it is possible to discover a certain correlation between specific frequency components and the presence or quantity of target objects. For example, the wheels, frame, and other structures of a handcart may generate specific frequency patterns. Therefore, this frequency domain analysis method can explore features that are difficult to capture in the spatial domain. For example, handcarts of different sizes may exhibit different frequency distribution characteristics in the spectrogram, thereby improving the counting accuracy in complex backgrounds or other similar objects.
[0011] This application also provides a trolley management method, including: using an image segmentation model to segment an image to be processed, obtaining multiple region images; for each region image in the multiple region images, performing image recognition on the region image to obtain a target region image whose recognition result is a trolley; performing spectral analysis on the target region image to obtain a spectrum diagram; counting the trolleys in the target region image according to the spectrum diagram to obtain the number of trolleys in the image to be processed; if the number of trolleys in the image to be processed is less than a preset threshold, then supplementing and / or issuing a quantity alarm for the trolleys. In the implementation of the above scheme, by detecting that the number of trolleys is lower than the preset threshold, the system can trigger an automated supplementing and scheduling process, notifying staff to replenish trolleys in a timely manner, avoiding service interruptions or passenger inconvenience caused by insufficient trolleys. Especially in key areas or during peak periods, the real-time alarm function can remind managers to take action, thereby effectively improving the operational efficiency of the airport terminal.
[0012] This application also provides a target counting device, comprising: an image region segmentation module for segmenting an image to be processed using an image segmentation model to obtain multiple region images; a region image recognition module for performing image recognition on each of the multiple region images to obtain a target region image whose recognition result is a target object; an image spectrum analysis module for performing spectrum analysis on the target region image to obtain a spectrum diagram; and a target object statistics module for counting the target objects in the target region image based on the spectrum diagram to obtain the number of target objects in the image to be processed.
[0013] Optionally, in this embodiment, the image segmentation model includes: a cue encoder, an image encoder, and an image decoder; the image region segmentation module includes: a cue information acquisition submodule, used to acquire segmentation cue information of the image to be processed; a cue vector acquisition submodule, used to encode the segmentation cue information using the cue encoder to obtain a segmentation cue vector; an image vector encoding submodule, used to encode the image to be processed using the image encoder to obtain an embedded image vector; an image vector decoding submodule, used to decode the segmentation cue vector and the embedded image vector using the image decoder to obtain a contour mask map; and an image region segmentation submodule, used to perform region segmentation on the image to be processed using the contour mask map to obtain multiple region images.
[0014] Optionally, in this embodiment, the image to be processed is the current video image frame, and the segmentation prompt information is the prompt detection point in the current video image frame; the prompt information acquisition submodule includes: a first detection point determination unit, used to determine randomly generated detection points as prompt detection points; or, a second detection point determination unit, used to determine pre-set detection points as prompt detection points; or, a third detection point determination unit, used to determine the detection points used in historical video image frames as prompt detection points when the target object in the current video image is occluded.
[0015] Optionally, in this embodiment of the application, the region image recognition module includes: a region image segmentation submodule, used to segment the region image into multiple image blocks; an image category recognition submodule, used to input the multiple image blocks into a visual converter model so that the visual converter model can identify the category of the region image; and a target image recognition submodule, used to determine the region image as a target region image if the category of the region image is the category to which the target object belongs.
[0016] Optionally, in this embodiment, the visual converter model includes: a fully connected network, a transformation encoder, and a multilayer perceptron network; the region image recognition module further includes: a patch vector embedding submodule, used to embed multiple image patches using the fully connected network to obtain embedded patch vectors; a vector transformation processing submodule, used to transform the embedded patch vectors using the transformation encoder to obtain transformed intermediate feature vectors; and a vector category recognition submodule, used to perform category recognition on the transformed intermediate feature vectors using the multilayer perceptron to obtain the category of the region image.
[0017] Optionally, in this embodiment of the application, the spectrum map includes: a frequency domain contour map; the image spectrum analysis module includes: an image grayscale processing submodule, used to perform grayscale processing on the target area image to obtain a two-dimensional grayscale image; an image transformation submodule, used to transform the two-dimensional grayscale image to obtain a two-dimensional frequency domain representation matrix; and a contour map obtaining submodule, used to calculate the frequency domain contour map based on the two-dimensional frequency domain representation matrix.
[0018] Optionally, in this embodiment of the application, the target object statistics module includes: a frequency domain signal analysis submodule, used to perform frequency domain signal analysis on the spectrum to obtain multiple signal frequency values; a signal frequency filtering submodule, used to filter out the signal frequency value with the largest signal strength from the multiple signal frequency values; and a target quantity determination submodule, used to determine the signal frequency value with the largest signal strength as the quantity of target objects in the image to be processed.
[0019] This application also provides a handcart management device, including: an image region segmentation module, used to segment an image to be processed using an image segmentation model to obtain multiple region images; a region image recognition module, used to perform image recognition on each region image among the multiple region images to obtain a target region image whose recognition result is a handcart; an image spectrum analysis module, used to perform spectrum analysis on the target region image to obtain a spectrum diagram; a target object statistics module, used to count the handcarts in the target region image according to the spectrum diagram to obtain the number of handcarts in the image to be processed; and a handcart scheduling alarm module, used to perform supplementary scheduling and / or quantity alarm for handcarts if the number of handcarts in the image to be processed is less than a preset threshold.
[0020] This application also provides an electronic device, including a processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the machine-readable instructions are executed by the processor to perform the methods described above.
[0021] This application also provides a computer-readable storage medium storing a computer program, which is executed by a processor to perform the methods described above.
[0022] This application also provides a computer program product, including: a computer program or computer instructions, which are executed by a processor to perform the method described above. Attached Figure Description
[0023] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 The flowchart shown is a schematic diagram of the target counting method provided in an embodiment of this application;
[0025] Figure 2 The diagram shown is a schematic representation of the overall processing procedure for the image to be processed provided in an embodiment of this application.
[0026] Figure 3 The diagram shown is a schematic representation of the network structure of the image segmentation model provided in an embodiment of this application.
[0027] Figure 4 The diagram shown is a schematic representation of the network structure of the visual converter model provided in an embodiment of this application.
[0028] Figure 5 The illustration shown is a schematic diagram of one type of frequency domain contour map provided in an embodiment of this application;
[0029] Figure 6 The illustration shows a flowchart of a handcart management method provided in an embodiment of this application;
[0030] Figure 7 The diagram shown is a schematic flowchart of the target counting device provided in an embodiment of this application. Detailed Implementation
[0031] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the accompanying drawings in the embodiments of this application are for illustrative and descriptive purposes only and are not intended to limit the protection scope of the embodiments of this application. Furthermore, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in the embodiments of this application illustrate operations implemented according to some embodiments of this application. It should be understood that the operations in the flowcharts may not be implemented in sequence, and steps without logical contextual relationships may be reversed or implemented simultaneously. In addition, those skilled in the art, guided by the content of the embodiments of this application, may add one or more other operations to the flowcharts, or remove one or more operations from the flowcharts.
[0032] Furthermore, the described embodiments are merely a part of the embodiments of this application, and not all of them. The components of the embodiments of this application described and illustrated herein can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed embodiments of this application, but merely to illustrate selected embodiments of this application.
[0033] It is understood that the terms "first" and "second" in the embodiments of this application are used to distinguish similar objects. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and that "first" and "second" do not necessarily imply that they are different. In the description of the embodiments of this application, the term "and / or" is merely a description of the association relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship. The term "multiple" refers to two or more (including two), and similarly, "multiple groups" refers to two or more groups (including two groups).
[0034] It should be noted that the target counting method provided in this application embodiment can be executed by an electronic device. Here, electronic device refers to a device terminal or server with the function of executing computer programs. Device terminals include, for example, smartphones, personal computers, tablets, personal digital assistants, or mobile internet devices. Servers refer to devices that provide computing services through a network. Servers include x86 servers and non-x86 servers. Non-x86 servers include mainframes, minicomputers, and UNIX servers.
[0035] In related technologies, handcart counting is typically based on visual image features extracted from video frames. For example, convolutional neural networks are used to extract visual image features such as shape, color, or texture, and the number of handcarts is counted based on these features. However, in practice, this method has many limitations. It requires the handcarts to be placed in locations with good lighting and visibility, such as near windows where they can be directly filmed by a camera, and the camera cannot be too far from the handcarts. Therefore, this method of counting handcarts based on visual image features extracted from video frames is only suitable for handcarts placed in fixed locations and cannot handle handcarts placed in non-fixed locations. This increases management difficulty and reduces system flexibility.
[0036] Existing solutions require specialized planning and adjustment of camera positions and angles to achieve good detection results. Management personnel also need to place trolleys according to specific rules to ensure they are within the detection range, placing additional demands on daily operations. However, solutions based on visual image features are highly sensitive to changes in lighting. Differences in lighting conditions at different times or under different weather conditions, the placement angle of the trolley, and the distance between the camera and the trolley can directly lead to a decrease in counting accuracy. Furthermore, in complex background environments, other objects (such as strollers or suitcases) may resemble trolleys. When these similar objects appear in the same video frame as the trolley, they are easily misidentified as trolleys, resulting in inaccurate statistical results. Therefore, these lighting variations and noise interference from other objects also reduce the accuracy of trolley counting from images.
[0037] For the above issues, please refer to Figure 1The illustrated flowchart shows a target counting method provided in this application embodiment. The main idea of this target counting method is to first perform image segmentation and image recognition using a model, and then perform spectral analysis on the identified target region image. Since the obtained spectrogram can capture the unique frequency characteristics of the target object, these characteristics are often more abstract but more discriminative than traditional shape, color, or texture features. Therefore, using the spectrogram allows for understanding the image content from the perspective of different frequency components. Compared to operating directly in the spatial domain, frequency domain information is generally more resistant to the influence of factors such as illumination changes and noise interference. Furthermore, spectral analysis can help filter out some high-frequency noise caused by environmental factors such as reflection and shadows. Removing these high-frequency noise interference factors can effectively reduce the probability of densely packed target objects being falsely detected, thus effectively improving the accuracy of target counting. The implementation of the above target counting method may include:
[0038] Step S110: Use an image segmentation model to segment the image to be processed to obtain multiple region images.
[0039] The image to be processed refers to the image for which the target counting needs to be achieved. It can be a raw video frame extracted from a video stream captured by a surveillance camera, or a single image acquired during debugging and testing. The video stream can be transmitted via the Real-Time Streaming Protocol (RTSP).
[0040] An image segmentation model is a neural network model used to segment images. This model can divide a complete image into multiple small regions with different semantic meanings. The image segmentation model here can generally be a machine learning or deep learning algorithm, such as the Segment-Anything Model (SAM) or the Segment-Anything2 model. Both of these models can separate the trolley and other objects (such as screens, luggage, or turntables) from the background, thus generating region images containing the trolley and other objects. Furthermore, the image segmentation model mentioned above can also employ models such as U-Net or Mask R-CNN to effectively separate the target object from complex backgrounds, reducing the impact of background noise on subsequent processing steps. The aforementioned region images are small image fragments obtained after image segmentation; each fragment represents a part of the original image and usually corresponds to a specific object.
[0041] Step S120: For each region image in the multiple region images, perform image recognition on the region image to obtain the target region image of the target object.
[0042] The target object refers to the specific item that needs to be counted in the current application scenario. For example, in the scenario of an airport terminal, the target object could be a trolley.
[0043] The target region image is an image of the region that has been confirmed to contain the target object (such as a handcart) after image recognition. For example, after image recognition confirmation, those region images that actually contain the handcart are selected separately for subsequent analysis.
[0044] Step S130: Perform spectral analysis on the target region image to obtain a spectrogram.
[0045] Spectral analysis is a transform analysis algorithm that converts an image from the spatial domain to the frequency domain to reveal hidden periodic structures and texture features. Common algorithms include Fourier transform and wavelet transform. Understandably, compared to simple image recognition, spectral analysis can capture more subtle structural information, helping to more accurately identify and distinguish similar objects. Therefore, the aforementioned spectral analysis can reveal hidden structures and periodic features in an image. For example, significant frequency components may exist in the wheels and frame of a handcart, and these features can be clearly displayed through a spectrogram.
[0046] A spectrogram is an image representation generated by spectral analysis, showing the intensity distribution of the original image at different frequencies. The spectrogram can be a two-dimensional spectrogram or a frequency domain contour map, etc.
[0047] Step S140: Statistically analyze the target objects in the target region image based on the spectrogram to obtain the number of target objects in the image to be processed.
[0048] Please see Figure 2 The diagram illustrates the overall processing procedure of the image to be processed according to an embodiment of this application. It is understood that the above scheme uses an image segmentation model to perform image segmentation, image recognition, and spectral analysis on the image to be processed. Therefore, it can directly utilize the cameras already installed and deployed in the airport terminal, without needing to adjust the camera's position and angle to achieve better detection results. This fully utilizes the existing camera resources in the terminal, making it suitable not only for fixed-point trolley placement but also for handling randomly distributed trolleys in dynamic environments. The number of target objects in the image to be processed is the final output of the target counting method, indicating how many target objects (such as trolleys) are present in the entire original input image.
[0049] In the implementation of the above scheme, the model is first used to perform image segmentation and image recognition on the image to be processed. Then, spectral analysis is performed on the identified target region image. The obtained spectrogram can capture the unique frequency characteristics of the target object. These characteristics are often more abstract but more discriminative than traditional shape, color, or texture features. Therefore, using the spectrogram allows for understanding the image content from the perspective of different frequency components. Compared to operating directly in the spatial domain, frequency domain information is usually more resistant to the influence of factors such as illumination changes and noise interference, providing a more stable and reliable feature representation. Furthermore, spectral analysis can help filter out some high-frequency noise caused by environmental factors such as reflection and shadows. After removing these high-frequency noise interference factors, the probability of densely arranged target objects being falsely detected can be effectively reduced, thus effectively improving the accuracy of target counting and meeting the requirements of scenes in complex backgrounds.
[0050] As an optional implementation of step S110 above, the image segmentation model may include: a cue encoder, an image encoder, and an image decoder; the implementation of using the image segmentation model to segment the image to be processed may include:
[0051] Step S111: Obtain segmentation prompts for the image to be processed.
[0052] Segmentation prompt information refers to the prompt information used as an image segmentation model. Theoretically, there are many types of segmentation prompt information, including: points, boxes, text, and / or object masks.
[0053] Step S112: Encode the segmentation cue information using a cue encoder to obtain a segmentation cue vector.
[0054] Please see Figure 3The diagram shows a network structure of the image segmentation model provided in this application embodiment. For example, in implementing step S112, object masks, detection points, cue boxes, and / or text can be used as segmentation prompts. Object masks, detection points, and cue boxes can guide the image segmentation model to segment information about the image regions containing various objects. While text cannot guide the segmentation of image regions containing objects, it can theoretically be used as semantically relevant prompts input to the image segmentation model. Therefore, the segmentation prompts can be input to the prompt encoder of the image segmentation model (e.g., the SAM model) to encode the prompts and obtain segmentation prompt vectors (Prompt tokens). It is understood that if the image segmentation model uses the SAM model, since the SAM model is already trained, it can be used directly without retraining, effectively saving model training time and improving the overall efficiency of the object counting function.
[0055] Step S113: Use an image encoder to encode the image to be processed to obtain an embedded image vector.
[0056] For example, the above step S113 can be implemented by inputting the image to be processed into the image encoder of the image segmentation model (e.g., the SAM model) so that the image encoder encodes the image to be processed, thereby obtaining the image embedding vector output by the image encoder. Here, the image embedding vector is actually a feature matrix vector that is dynamically updated with the calculation process.
[0057] Step S114: Use an image decoder to decode the segmentation cue vector and the embedded image vector to obtain a contour mask map.
[0058] An example implementation of step S114 above involves inputting the segmentation cue vector and the embedded image vector together into the image encoder of an image segmentation model (e.g., a SAM model), so that the image decoder can decode the segmentation cue vector and the embedded image vector to obtain a contour mask image. The contour mask image is a binary or grayscale image, in which the area containing the target object is marked as white (or high brightness), while the background and other non-target areas are marked as black (or low brightness).
[0059] Optionally, while the image decoder outputs the contour mask map after decoding the segmentation cue vector and the embedded image vector, it can also output the Intersection over Union (IOU) confidence score at the same time. In other words, after decoding the segmentation cue vector and the embedded image vector, the image decoder can output the contour mask map and the IOU confidence score simultaneously.
[0060] Step S115: Use the contour mask map to segment the image to be processed into regions and obtain multiple region images.
[0061] For example, in implementing step S115 above: if the image decoder outputs a contour mask image and an IOU confidence score, the contour mask image can be used to segment the image to be processed only if the IOU confidence score is greater than a preset confidence threshold. If the image decoder does not output an IOU confidence score, the contour mask image is directly used to segment the image to be processed. That is, the contour mask image is used as a mask, and the contour mask image is multiplied pixel by pixel with the image to be processed. Only pixels in the original image that are marked as at least one target region in the contour mask image are retained; the rest are set to zero (i.e., black), thereby achieving the effect of segmenting the image to be processed and finally obtaining multiple region images. It can be understood that if there are multiple target objects in the image, the contour mask image contains multiple unconnected regions, which means that each region corresponds to an independent target object.
[0062] As an optional implementation of step S111 above, the image to be processed can be the current video image frame, and the segmentation prompt information can be a prompt detection point in the current video image frame; the implementation of obtaining the segmentation prompt information of the image to be processed can include:
[0063] Step S111a: Determine the randomly generated detection points as prompt detection points.
[0064] An example implementation of step S111a above is as follows: If the image segmentation model lacks prior knowledge of the image, such as video frames within a certain duration at the beginning of a video (e.g., the first frame of the video), an executable program written in a preset programming language can be used to randomly generate some detection points for each video frame, and these randomly generated detection points are determined as cue detection points. The purpose of the randomly generated detection points is to serve as segmentation cue information for the image segmentation model, so that the image segmentation model can segment the various objects in the image to be processed. In practical applications, in scenarios where the position of the trolley is not fixed and changes frequently, the randomly generated detection points can be evenly distributed across the entire image plane; alternatively, in scenarios where the position of the trolley does not change frequently, they can be distributed in the region of interest according to pre-set rules.
[0065] Alternatively, the above-described implementation of obtaining segmentation prompt information for the image to be processed may include:
[0066] Step S111b: Determine the pre-set detection point as the prompt detection point.
[0067] For example, in scenarios where the position of the handcart does not change frequently, a set of fixed detection points can be pre-set. These points may be the locations most likely to provide useful information, determined based on experience or analysis. These detection points can be determined during the algorithm design phase, and then the pre-set detection points can be designated as prompt detection points.
[0068] Alternatively, the above-described implementation of obtaining segmentation prompt information for the image to be processed may include:
[0069] Step S111c: When the target object in the current video image is occluded, the detection points used in the historical video image frames are determined as cue detection points.
[0070] For example, if the target object in the current frame is partially occluded, the detection points used in previous frames (historical frames) can be used as cue detection points. That is, the detection points used in historical video image frames are determined as cue detection points. This method can take advantage of the continuity and similarity in the time series, and can continue to perform image segmentation on the image to be processed even when the target is occluded.
[0071] As an optional implementation of step S120 above, the above-described implementation of image recognition of the region image may include:
[0072] Step S121: Divide the image of the region into multiple image blocks.
[0073] For example, the above-mentioned step S121 can be implemented by dividing the region image into multiple image patches using an executable program written in a preset programming language.
[0074] Step S122: Input multiple image patches into the visual converter model so that the visual converter model can identify the category of the image in that region.
[0075] Understandably, because the network structure of the Vision Transformer (ViT or VIT) model is quite complex, the specific process by which the Vision Transformer model processes multiple image patches and identifies the category of the region image will be described in detail below.
[0076] Alternatively, to improve the image classification accuracy of the ViT model, it can be trained before use. For example, the ViT model can be trained using a dataset of 1000 images plus image categories, thereby effectively improving the image classification accuracy of the ViT model.
[0077] Step S123: If the category of the region image is the same as the category to which the target object belongs, then the region image is determined as the target region image.
[0078] The implementation of step S123 above is as follows: Since the last layer of the ViT model is a Softmax classification network layer, the multilayer perceptron can calculate multiple class probabilities of the region image and determine the class corresponding to the highest probability value among the multiple class probabilities as the class of the region image. For example, the multiple classes include: 0 represents a trolley, 1 represents a person, and 2 represents luggage. Assuming that the target object belongs to the class 0, trolley, and if one of the output results of the multilayer perceptron is [0.9, 0.05, 0.05], it means that the class index corresponding to the highest probability value (i.e., 90%) among the multiple class probabilities is also 0. This indicates that the class of the region image is the class to which the target object (trolley) belongs. Therefore, the region image can be determined as the target region image.
[0079] Please see Figure 4 The diagram shows a network structure of the visual converter model provided in this application embodiment. As an optional implementation of step S122 above, the visual converter model includes: a fully connected network, a transformation encoder, and a multilayer perceptron network. After inputting multiple image patches into the visual converter model, the model can also identify the category of the image in that region. This implementation may include:
[0080] Step S122a: Use a fully connected network to embed multiple image patches to obtain embedded patch vectors.
[0081] For example, the above-mentioned step S122a can be implemented by inputting multiple image patches into the fully connected network of the visual converter model, so that the fully connected network in the visual converter model can perform embedding processing on the multiple image patches, thereby converting the multiple image patches into fixed-dimensional embedded patch vectors (i.e., Embedded Patched Vector).
[0082] Step S122b: Use a transformation encoder to transform the embedded tile vector to obtain the transformed intermediate feature vector.
[0083] For example, the implementation of step S122b described above involves inputting the embedded tile vector into the Transformer Encoder of the visual converter model, so that the Transformer Encoder in the visual converter model performs transformation processing on the embedded tile vector, that is, using a self-attention mechanism to capture global dependencies in the image to generate the transformed intermediate feature vector.
[0084] Step S122c: Use a multilayer perceptron to perform category recognition on the transformed intermediate feature vector to obtain the category of the region image.
[0085] The implementation of step S122c above is as follows: The transformed intermediate feature vector is input into the multilayer perceptron of the visual converter model, so that the multilayer perceptron of the visual converter model can perform category recognition on the transformed intermediate feature vector. Since the last layer of the multilayer perceptron is a Softmax classification network layer, the multilayer perceptron can calculate multiple category probabilities of the region image, and determine the category corresponding to the maximum probability value among the multiple category probabilities as the category of the region image. For example, the multiple categories include: 0 represents a handcart, 1 represents a person, and 2 represents luggage. Assuming that one of the output results of the multilayer perceptron is [0.9, 0.05, 0.05], it means that the maximum probability value (i.e., 90%) among the multiple category probabilities corresponds to the category of a handcart.
[0086] As an optional implementation of step S130 above, the spectrum diagram may include: a frequency domain contour map; the implementation of performing spectrum analysis on the target region image may include:
[0087] Step S131: Perform grayscale processing on the target region image to obtain a two-dimensional grayscale image.
[0088] An example implementation of step S131 above is as follows: the color information of each pixel in the target region image is simplified to its brightness value, usually represented by an integer between 0 and 255, thus completing the grayscale processing of the target region image and finally obtaining a two-dimensional grayscale image. It is understood that this grayscale image reduces the amount of data while retaining the main structural information of the image, facilitating subsequent processing such as spectral analysis.
[0089] Step S132: Transform the two-dimensional grayscale image to obtain a two-dimensional frequency domain representation matrix.
[0090] The implementation of step S132 above includes, for example, performing a Fast Fourier Transform (FFT), Discrete Cosine Transform (DCT), or wavelet transform on the two-dimensional grayscale image to convert the two-dimensional grayscale image from the spatial domain to the frequency domain, thereby obtaining a two-dimensional frequency domain representation matrix. The Fourier transform can employ a Fast Fourier Transform or a double Fast Fourier Transform, resulting in a two-dimensional frequency domain representation matrix where each element is a complex number. This transformation converts a two-dimensional image signal into a two-dimensional signal, which helps identify periodic patterns and structural features in the image. These periodic patterns and structural features are often difficult to detect using only spatial domain processing. For example, the periodic pattern of a stroller wheel is particularly prominent in the spectrogram, helping to distinguish the stroller from other similar objects (such as a baby carriage or a suitcase).
[0091] Step S133: Calculate the frequency domain contour map based on the two-dimensional frequency domain representation matrix.
[0092] Please see Figure 5 The illustration shows one schematic diagram of a frequency domain contour map provided in an embodiment of this application. The implementation of step S133 is as follows: assuming a Fourier transform (FFT) is used to obtain a two-dimensional frequency domain representation matrix, since the two-dimensional frequency domain representation matrix is a complex matrix, the amplitude (i.e., the membrane) of each element in the matrix can be calculated as a spectral value. Because the dynamic range of the spectral values may be relatively large, the logarithm of the spectral values can be taken first, and then the absolute value can be taken to enhance contrast and highlight details. Finally, the spectral values are scaled to a specific range (e.g., 0 to 255) to facilitate the generation of a frequency domain contour map. This is a method for visualizing spectral features, where the spectral contour lines in the frequency domain contour map can be a two-dimensional array obtained after spectral transformation of a region image of a handcart.
[0093] As an optional implementation of step S140 above, the implementation of statistically analyzing the target objects in the target region image based on the spectrogram may include:
[0094] Step S141: Perform frequency domain signal analysis on the spectrum to obtain multiple signal frequency values.
[0095] For example, the implementation of step S141 above can be described as follows: assuming that the spectrum is obtained by using a frequency domain contour map, that is, by obtaining a frequency domain contour map through the above steps, the frequency domain contour map can be analyzed to extract frequency components, such as calculating the intensity or amplitude of each frequency component.
[0096] Step S142: Select the signal frequency value with the highest signal strength from multiple signal frequency values.
[0097] Step S143: Determine the frequency value of the signal with the strongest signal strength as the number of target objects in the image to be processed.
[0098] For example, the implementation of steps S142 to S143 above involves traversing all frequency components in a frequency domain contour map and identifying the signal frequency value with the highest intensity among all frequency components. Then, the signal frequency value with the highest signal intensity is directly determined as the number of target objects in the image to be processed.
[0099] Optionally, frequency domain signal analysis can be performed on the spectrogram to identify all local maxima (i.e., significant frequency peaks). This involves using a local maximum detection algorithm (such as Non-maximum Suppression, NMS) to identify all significant peaks in the spectrogram. Then, neighboring frequency peaks are clustered, assuming each cluster corresponds to a target object. Clustering algorithms (such as DBSCAN, K-means, etc.) can be used to group them based on the distance and similarity between frequency peaks. Finally, the number of clusters is counted as the number of target objects; each cluster is considered an independent target object, therefore the total number of clusters represents the number of target objects. In the implementation of the above scheme, by performing peak detection on the spectrogram and using clustering algorithms to group neighboring peaks together, the existence of each target object can be estimated more accurately, thereby improving counting accuracy.
[0100] Please see Figure 6 The illustration shows a flowchart of a trolley management method provided in an embodiment of this application; this application provides a trolley management method, including:
[0101] Step S210: Use an image segmentation model to segment the image to be processed to obtain multiple region images.
[0102] Step S220: For each region image in the multiple region images, perform image recognition on the region image to obtain the recognition result as the target region image of the handcart.
[0103] Step S230: Perform spectral analysis on the target region image to obtain a spectrogram.
[0104] Step S240: Count the number of handcarts in the target region image based on the spectrogram to obtain the number of handcarts in the image to be processed.
[0105] The implementation methods of steps S210 to S240 are similar to those of steps S110 to S140. If there are any unclear points, please refer to the description of the implementation methods of steps S110 to S140 above, so they will not be repeated here.
[0106] In the implementation of the above solution, images captured by cameras already installed and deployed in the airport terminal can be used as images to be processed, and the number of handcarts in the images to be processed can be counted by region, thereby enabling real-time detection of the number of handcarts in the areas captured by the cameras.
[0107] Step S250: If the number of handcarts in the image to be processed is less than a preset threshold, then supplementary scheduling of handcarts and / or quantity alarms are performed.
[0108] For example, after obtaining the number of trolleys in the image to be processed, the number of trolleys can be monitored, scheduled, and alarmed by an executable program. For example, if the number of trolleys is less than a preset threshold (such as 10, 20, or 30), a supplementary reminder message can be sent to the administrator via a POST request so that the administrator can supplement the scheduling of trolleys according to the number of trolleys after seeing the reminder message, and / or send a quantity alarm message to a preset terminal so that the terminal maintenance personnel can promptly schedule the trolleys after seeing the quantity alarm message, or the terminal maintenance personnel can promptly forward the alarm message, for example, by forwarding the alarm message to the administrator so that the administrator can promptly schedule the trolleys.
[0109] In the implementation of the above solution, when the number of trolleys is detected to be lower than a preset threshold, the system can trigger an automated replenishment scheduling process to notify staff to replenish trolleys in a timely manner, thus avoiding service interruptions or passenger inconvenience caused by insufficient trolleys. Especially in key areas or during peak periods, the system can remind managers to take action through the real-time alarm function, thereby effectively improving the operational efficiency of the airport terminal.
[0110] Please see Figure 7 The illustration shows a schematic flowchart of a target counting device provided in an embodiment of this application; this application provides a target counting device 300, including:
[0111] The image region segmentation module 310 is used to segment the image to be processed using an image segmentation model to obtain multiple region images.
[0112] The region image recognition module 320 is used to perform image recognition on each region image among multiple region images to obtain the target region image of the target object.
[0113] The image spectrum analysis module 330 is used to perform spectrum analysis on the target area image to obtain a spectrum map.
[0114] The target object statistics module 340 is used to count the target objects in the target region image based on the spectrogram, and obtain the number of target objects in the image to be processed.
[0115] As an optional implementation of the above-mentioned device, the image segmentation model includes: a cue encoder, an image encoder, and an image decoder; the image region segmentation module includes:
[0116] The prompt information acquisition submodule is used to acquire segmentation prompt information for the image to be processed.
[0117] The cue vector acquisition submodule is used to encode the segmentation cue information using the cue encoder to obtain the segmentation cue vector.
[0118] The image vector encoding submodule is used to encode the image to be processed using an image encoder to obtain an embedded image vector.
[0119] The image vector decoding submodule is used to decode the segmentation cue vector and the embedded image vector using an image decoder to obtain a contour mask map.
[0120] The image region segmentation submodule is used to segment the image to be processed using a contour mask map to obtain multiple region images.
[0121] As an optional implementation of the above-mentioned device, the image to be processed is the current video image frame, and the segmented prompt information is the prompt detection point in the current video image frame; the prompt information acquisition submodule includes:
[0122] The first detection point determination unit is used to determine the randomly generated detection points as prompt detection points.
[0123] Alternatively, the second detection point determination unit is used to determine a pre-set detection point as a prompt detection point.
[0124] Alternatively, the third detection point determination unit is used to determine the detection points used in historical video image frames as prompt detection points when the target object in the current video image is occluded.
[0125] As an optional implementation of the above-mentioned device, the region image recognition module includes:
[0126] The region image segmentation submodule is used to divide the region image into multiple image blocks.
[0127] The image category recognition submodule is used to input multiple image patches into the visual converter model so that the visual converter model can identify the category of the image in that region.
[0128] The target image recognition submodule is used to identify the image of the region as the target region image if the category of the image of the region is the same as the category to which the target object belongs.
[0129] As an optional implementation of the above-mentioned device, the visual converter model includes: a fully connected network, a transformation encoder, and a multilayer perceptron network; the region image recognition module further includes: a tile vector embedding submodule, used to embed multiple image tiles using the fully connected network to obtain embedded tile vectors.
[0130] The vector transformation processing submodule is used to transform the embedded tile vectors using a transformation encoder to obtain the transformed intermediate feature vectors.
[0131] The vector category recognition submodule is used to perform category recognition on the transformed intermediate feature vectors using a multilayer perceptron to obtain the category of the region image.
[0132] As an optional implementation of the above-mentioned device, the spectrum map includes: a frequency domain contour map; the image spectrum analysis module includes:
[0133] The image grayscale processing submodule is used to perform grayscale processing on the target area image to obtain a two-dimensional grayscale image.
[0134] The grayscale image transformation submodule is used to transform a two-dimensional grayscale image to obtain a two-dimensional frequency domain representation matrix.
[0135] The contour map acquisition submodule is used to calculate the frequency domain contour map based on the two-dimensional frequency domain representation matrix.
[0136] As an optional implementation of the above-mentioned device, the target object statistics module includes:
[0137] The frequency domain signal analysis submodule is used to perform frequency domain signal analysis on the spectrogram to obtain multiple signal frequency values.
[0138] The signal frequency filtering submodule is used to filter out the signal frequency value with the highest signal strength from multiple signal frequency values.
[0139] The target quantity determination submodule is used to determine the frequency value of the signal with the strongest signal strength as the quantity of the target object in the image to be processed.
[0140] This application also provides a handcart management device, including:
[0141] The image region segmentation module is used to segment the image to be processed using an image segmentation model to obtain multiple region images.
[0142] The region image recognition module is used to perform image recognition on each of the multiple region images to obtain the target region image of the handcart.
[0143] The image spectrum analysis module is used to perform spectrum analysis on the target area image to obtain a spectrum map.
[0144] The target object statistics module is used to count the number of handcarts in the target area image based on the spectrogram, and obtain the number of handcarts in the image to be processed.
[0145] The trolley scheduling alarm module is used to supplement the trolley scheduling and / or issue a quantity alarm if the number of trolleys in the image to be processed is less than a preset threshold.
[0146] It should be understood that this device corresponds to the target counting method embodiment described above and is capable of performing the various steps involved in the above method embodiment. The specific functions of this device can be found in the description above, and detailed descriptions are appropriately omitted here. The device includes at least one software functional module that can be stored in memory or embedded in the device's operating system (OS) in the form of software or firmware.
[0147] This application also provides an electronic device, including a processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the machine-readable instructions, when executed by the processor, perform the method described above.
[0148] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the method described above. The computer-readable storage medium can be implemented using any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0149] This application also provides a computer program product, including: a computer program or computer instructions, which are executed by a processor to perform the method described above.
[0150] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For apparatus embodiments, since they are basically similar to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0151] It should be understood that the disclosed apparatus and methods can also be implemented in other ways, as provided in the embodiments of this application. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in the flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the accompanying drawings. For example, two consecutive blocks may actually be executed substantially in parallel, or they may sometimes be executed in reverse order, depending primarily on the functions involved.
[0152] Furthermore, the functional modules of each embodiment in this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part. In addition, in the description of this specification, the reference to terms such as "one embodiment," "some embodiments," "example," "specific example," "some examples," etc., means that the specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples. Furthermore, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification and the features of different embodiments or examples.
[0153] The above description is only an optional implementation of the embodiments of this application, but the protection scope of the embodiments of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the embodiments of this application should be covered within the protection scope of the embodiments of this application.
Claims
1. A target counting method, characterized in that, include: An image segmentation model is used to segment the image to be processed, resulting in multiple region images. For each of the multiple region images, image recognition is performed on that region image to obtain a target region image that is identified as the target object. Spectral analysis is performed on the target region image to obtain a spectrogram; The number of target objects in the target region image is obtained by statistically analyzing the spectrogram; The image segmentation model employs a pre-trained SAM model, which includes a cue encoder, an image encoder, and an image decoder. The process of segmenting the image to be processed using the image segmentation model includes: acquiring segmentation cue information of the image to be processed; encoding the segmentation cue information using the cue encoder to obtain a segmentation cue vector; encoding the image to be processed using the image encoder to obtain an embedded image vector; decoding the segmentation cue vector and the embedded image vector using the image decoder to obtain a contour mask map; and using the contour mask map to perform region segmentation on the image to be processed to obtain multiple region images. The image recognition of the region image includes: dividing the region image into multiple image blocks; inputting the multiple image blocks into a Vision Transformer (ViT) model, so that the ViT model can identify the category of the region image; if the category of the region image is the category to which the target object belongs, then the region image is determined as the target region image; the spectrum map includes: a frequency domain contour map; the spectrum analysis of the target region image includes: performing grayscale processing on the target region image to obtain a two-dimensional grayscale image; transforming the two-dimensional grayscale image to obtain a two-dimensional frequency domain representation matrix, the two-dimensional... The frequency domain representation matrix is a complex matrix, which is used to calculate the amplitude of each element in the matrix as a spectral value. The frequency domain contour map is calculated based on the spectral values in the two-dimensional frequency domain representation matrix. The step of statistically analyzing the target objects in the target region image based on the spectral map includes: performing frequency domain signal analysis on the spectral map to obtain multiple signal frequency values; using a local maximum detection algorithm to identify all significant frequency peaks in the spectral map; clustering neighboring frequency peaks, with each cluster corresponding to a target object; and counting the number of clusters as the number of target objects in the image to be processed.
2. The method according to claim 1, characterized in that, The image to be processed is the current video image frame, and the segmentation prompt information is the prompt detection point in the current video image frame; The step of obtaining the segmentation prompt information of the image to be processed includes: The randomly generated detection points are determined as the prompt detection points; Alternatively, a pre-set detection point can be designated as the prompt detection point; Alternatively, if the target object in the current video image is occluded, the detection point used in the historical video image frame is determined as the prompt detection point.
3. The method according to claim 1, characterized in that, The visual converter model includes: a fully connected network, a transformation encoder, and a multilayer perceptron network; after inputting the multiple image patches into the visual converter model, it further includes: The fully connected network is used to embed the multiple image patches to obtain embedded patch vectors; The embedded tile vector is transformed using the transformation encoder to obtain the transformed intermediate feature vector; The multilayer perceptron is used to perform category recognition on the transformed intermediate feature vector to obtain the category of the region image.
4. A method for managing handcarts, characterized in that, include: An image segmentation model is used to segment the image to be processed, resulting in multiple region images. For each of the multiple region images, image recognition is performed on that region image to obtain the target region image of the handcart as the recognition result; Spectral analysis is performed on the target region image to obtain a spectrogram; Based on the spectrogram, the number of handcarts in the target region image is counted to obtain the number of handcarts in the image to be processed. If the number of the handcarts in the image to be processed is less than a preset threshold, then the handcarts will be supplemented and / or a quantity alarm will be issued. The image segmentation model employs a pre-trained SAM model, which includes a cue encoder, an image encoder, and an image decoder. The process of segmenting the image to be processed using the image segmentation model includes: acquiring segmentation cue information of the image to be processed; encoding the segmentation cue information using the cue encoder to obtain a segmentation cue vector; encoding the image to be processed using the image encoder to obtain an embedded image vector; decoding the segmentation cue vector and the embedded image vector using the image decoder to obtain a contour mask map; and using the contour mask map to perform region segmentation on the image to be processed to obtain multiple region images. The image recognition of the region image includes: dividing the region image into multiple image blocks; inputting the multiple image blocks into a Vision Transformer (ViT) model, so that the ViT model can identify the category of the region image; if the category of the region image is the category to which the target object belongs, then the region image is determined as the target region image; the spectrum map includes: a frequency domain contour map; the spectrum analysis of the target region image includes: performing grayscale processing on the target region image to obtain a two-dimensional grayscale image; transforming the two-dimensional grayscale image to obtain a two-dimensional frequency domain representation matrix, the two... The two-dimensional frequency domain representation matrix is a complex matrix, which is used to calculate the amplitude of each element in the matrix as a spectral value. The frequency domain contour map is calculated based on the spectral values in the two-dimensional frequency domain representation matrix. The step of statistically analyzing the handcarts in the target area image based on the spectral map includes: performing frequency domain signal analysis on the spectral map to obtain multiple signal frequency values; using a local maximum detection algorithm to identify all significant frequency peaks in the spectral map; clustering neighboring frequency peaks, with each cluster corresponding to one handcart; and counting the number of clusters as the number of handcarts in the image to be processed.
5. A target counting device, characterized in that, include: The image region segmentation module is used to segment the image to be processed using an image segmentation model to obtain multiple region images. The region image recognition module is used to perform image recognition on each of the plurality of region images to obtain a target region image that is identified as the target object. The image spectrum analysis module is used to perform spectrum analysis on the target region image to obtain a spectrum map; The target object statistics module is used to count the target objects in the target region image based on the spectrogram, and obtain the number of the target objects in the image to be processed; The image segmentation model employs a pre-trained SAM model, which includes a cue encoder, an image encoder, and an image decoder. The process of segmenting the image to be processed using the image segmentation model includes: acquiring segmentation cue information of the image to be processed; encoding the segmentation cue information using the cue encoder to obtain a segmentation cue vector; encoding the image to be processed using the image encoder to obtain an embedded image vector; decoding the segmentation cue vector and the embedded image vector using the image decoder to obtain a contour mask map; and using the contour mask map to perform region segmentation on the image to be processed to obtain multiple region images. The image recognition of the region image includes: dividing the region image into multiple image blocks; inputting the multiple image blocks into a Vision Transformer (ViT) model, so that the ViT model can identify the category of the region image; if the category of the region image is the category to which the target object belongs, then the region image is determined as the target region image; the spectrum map includes: a frequency domain contour map; the spectrum analysis of the target region image includes: performing grayscale processing on the target region image to obtain a two-dimensional grayscale image; transforming the two-dimensional grayscale image to obtain a two-dimensional frequency domain representation matrix, the two-dimensional... The frequency domain representation matrix is a complex matrix, which is used to calculate the amplitude of each element in the matrix as a spectral value. The frequency domain contour map is calculated based on the spectral values in the two-dimensional frequency domain representation matrix. The step of statistically analyzing the target objects in the target region image based on the spectral map includes: performing frequency domain signal analysis on the spectral map to obtain multiple signal frequency values; using a local maximum detection algorithm to identify all significant frequency peaks in the spectral map; clustering neighboring frequency peaks, with each cluster corresponding to a target object; and counting the number of clusters as the number of target objects in the image to be processed.
6. An electronic device based on a target counting method or a trolley management method, characterized in that, include: A processor and a memory, the memory storing machine-readable instructions executable by the processor, the machine-readable instructions being executed by the processor to perform the method of any one of claims 1 to 4.
7. A computer-readable storage medium based on a target counting method or a trolley management method, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the method according to any one of claims 1 to 4.
8. A computer program product based on a target counting method or a handcart management method, characterized in that, include: A computer program or computer instructions that, when executed by a processor, perform the method described in any one of claims 1 to 4.
Citation Information
Patent Citations
Insulator chain disc segmentation positioning and state analysis method in infrared image
CN116503470A
Wire abnormity identification method and device, electronic equipment and storage medium
CN118736223A