A method for sensing urban garbage capacity

By installing sensors in urban trash cans and utilizing 5G networks and Transformer models, the problem of low garbage volume sensing efficiency and insufficient accuracy in traditional technology is solved, achieving real-time, accurate monitoring and accurate prediction of garbage capacity, and supporting intelligent garbage management. .

CN118503622BActive Publication Date: 2024-10-01北京长河数智科技有限责任公司 +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410545723.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-06
Publication Date
2024-10-01
Estimated Expiration
2044-05-06

AI Technical Summary

Technical Problem

Traditional urban waste capacity sensing technology has low processing efficiency and low data accuracy, and cannot achieve real-time monitoring and accurate prediction, leading to challenges in urban waste management.

Method used

Install ultrasonic sensors and weight sensors in urban trash cans, use 5G networks to transmit data to edge computing nodes in real time, perform data preprocessing and feature extraction, and combine with the Transformer model to predict garbage capacity.

Benefits of technology

It achieves real-time, accurate collection and efficient transmission of garbage capacity data, improves the timeliness and accuracy of garbage capacity perception, can accurately predict the saturation state of garbage bins, and supports intelligent garbage management decisions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118503622B_ABST
    Figure CN118503622B_ABST
Patent Text Reader

Abstract

The present application discloses a method for sensing urban garbage capacity, which relates to the field of garbage disposal technology, including: setting sensors in urban garbage bins to collect garbage capacity data; using 5G network to transmit the collected garbage capacity data to edge computing nodes; preprocessing the garbage capacity data on the edge computing nodes, and extracting feature data of the preprocessed garbage capacity using a matching pursuit transformation algorithm; using 5G network to transmit the extracted feature data to a cloud server; on the cloud server, based on the received feature data, using a pre-trained Transformer model based on a sparse self-attention mechanism to predict the garbage capacity. In view of the problem of low efficiency in the sensing and processing of urban garbage capacity in the prior art, the present application provides a method for using 5G network to transmit garbage capacity data collected by sensors to edge computing nodes in real time, thereby improving the processing efficiency of urban garbage capacity sensing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of garbage disposal, and in particular to a method for sensing urban garbage capacity. Background Art

[0002] With the continuous acceleration of urbanization, urban waste management has become an important challenge. Effectively managing the capacity of urban waste is crucial to maintaining urban environmental sanitation and improving the quality of life of urban residents. However, traditional waste capacity sensing technology has problems such as low processing efficiency and low data accuracy, which limits the real-time monitoring and accurate prediction of urban waste capacity.

[0003] Traditional urban garbage capacity sensing technology mainly relies on manual inspection or simple sensor data collection, which has the problems of low efficiency and low accuracy. For example, manual inspection requires a lot of manpower and material resources, and cannot achieve real-time monitoring; and some sensor data collection methods may be affected by factors such as environmental noise, resulting in inaccurate data. Therefore, there is an urgent need for an urban garbage capacity sensing method that can achieve efficient data collection, accurate data processing and precise prediction to meet the challenges in urban garbage management.

[0004] In the related art, for example, Chinese patent document CN110458372B provides a method for sharing smart city garbage disposal data based on cloud computing, including: when the garbage can is emptied, start timing, and set the time from this garbage emptying to the next garbage emptying as the first time range; continuously obtain the angle value of the rotation angle of the garbage can lid with the horizontal plane as the reference; within the first time range, compare the angle value with a preset angle threshold, and the angle threshold is used to determine whether the garbage can is full. When the angle value is greater than the angle threshold and remains unchanged for a certain period of time, the garbage can is full, and the overflow time from the start time of timing to the time when the garbage can is full is recorded. When the angle value is less than the angle threshold, , then the trash can is not full; within the second time range that includes at least two first time ranges, count the number of overflows of the trash can; determine whether the number of overflows is greater than the preset overflow number threshold, if so, enter S6, if not, select the next second time range to return; determine whether the overflow duration is lower than the overflow duration threshold when the trash can is full, and count the number of advance times when the overflow duration is lower than the overflow duration threshold; calculate the advance percentage of the advance number of overflows, determine whether the advance percentage is greater than the preset percentage threshold, if so, enter step S8, if not, select the next second time range to return; send the first notification information, the first notification information is used to inform the relevant personnel to expand the volume of the trash can. However, this solution is based on detecting the rotation angle of the trash can lid to indirectly determine the garbage capacity. It needs to wait for the overflow times to accumulate to a certain extent before determining that the capacity needs to be expanded, and the response is not timely.

[0005] In response to the problem of low efficiency in urban garbage capacity perception and processing in the prior art, the present application provides an urban garbage capacity perception method, which uses the 5G network to transmit garbage capacity data collected by sensors to edge computing nodes in real time, thereby improving the processing efficiency of urban garbage capacity perception.

[0006] The purpose of this application is achieved through the following technical solutions.

[0007] This specification provides a method for sensing urban garbage capacity, including: data collection: installing ultrasonic sensors and weight sensors inside urban garbage bins. The ultrasonic sensor calculates the filling height of garbage in the garbage bin according to the time difference of the echo by emitting ultrasonic waves and receiving reflected echoes. The weight sensor obtains the weight data of the garbage in the garbage bin by measuring the weight change of the garbage bin. The collected filling height data and weight data are used as garbage capacity data. Data transmission: utilizing the high speed and low latency characteristics of the 5G network, the garbage capacity data collected by the garbage bin is transmitted to the nearest edge computing node in real time. The 5G network provides a reliable wireless transmission channel to ensure fast and stable data transmission. Data preprocessing: preprocessing the received garbage capacity data at the edge computing node, including the following steps: filtering: using a hyperbolic wavelet transform algorithm to filter the filling height data to remove high-frequency noise interference. By performing a hyperbolic transform on the scale function and wavelet function of the wavelet basis function, a wavelet transform matrix is ​​constructed, and the filling height data is mapped to the wavelet domain to achieve effective noise suppression. Denoising: denoising the filtered filling height data, using a threshold method based on wavelet packet energy and entropy. The data is decomposed into different frequency bands through wavelet packet decomposition, and the energy and entropy values ​​of each frequency band are calculated. According to the preset threshold, the high-frequency components with smaller energy and entropy values ​​are set to zero to further remove the noise. Normalization: The denoised filling height data is normalized using the kernel function smoothing normalization method. Select a suitable kernel function (such as a Gaussian kernel function), and map the filling height data to the [0, 1] interval through the smoothing characteristics of the kernel function to achieve standardized representation of the data. Analog-to-digital conversion: Perform analog-to-digital conversion on the weight data collected by the weight sensor, and convert the analog quantity into a digital quantity. By setting the appropriate sampling frequency and quantization bit number, the continuous weight data is discretized to facilitate subsequent digital signal processing.

[0008] Feature extraction: The matching pursuit transform algorithm is used at the edge computing node to extract the features of the preprocessed garbage capacity data. By performing time-frequency analysis on the filling height data and weight data, the energy distribution features and entropy features of the data in the time domain and frequency domain are extracted. The energy feature reflects the energy distribution of the garbage capacity data, and the entropy feature reflects the complexity and uncertainty of the data. The extracted features are used as the feature representation of the garbage capacity. Feature transmission: The garbage capacity feature data extracted by the edge computing node is transmitted to the cloud server via the 5G network. The large bandwidth and low latency characteristics of the 5G network ensure the fast and reliable transmission of feature data.

[0009] Garbage capacity prediction: On the cloud server, the pre-trained Transformer model based on the self-attention mechanism is used to predict the garbage capacity. The Transformer model uses the self-attention mechanism to model the long-range dependency relationship between features and can capture the time series characteristics of garbage capacity data. The received garbage capacity feature data is input into the Transformer model, and the model generates the corresponding garbage capacity prediction value through self-attention calculation and forward propagation. According to the error between the predicted value and the actual value, the model is fine-tuned and optimized through the back-propagation algorithm to continuously improve the prediction accuracy.

[0010] Furthermore, a hyperbolic wavelet transform algorithm is used to filter the filling height data, including: selecting a wavelet basis function: using a biorthogonal scaled Db4 wavelet as a wavelet basis function. The Db4 wavelet is a commonly used biorthogonal wavelet basis function with compact support, symmetry and vanishing moment characteristics, and can effectively perform time-frequency localization analysis on the signal. Constructing a wavelet transform matrix: constructing a wavelet transform matrix based on the scale function and wavelet function of the Db4 wavelet basis function. The wavelet transform matrix includes a forward transform matrix and an inverse transform matrix. Forward transform matrix: constructing a forward transform matrix through a linear combination of the scale function and the wavelet function of the Db4 wavelet basis function. The matrix maps the original signal from the time domain to the wavelet domain to achieve multi-scale decomposition. Inverse transform matrix: constructing an inverse transform matrix through the transposition of the scale function and the wavelet function of the Db4 wavelet basis function. The matrix reconstructs the coefficients of the wavelet domain back to the time domain of the original signal. Wavelet forward transform: The collected filling height signal is input into the constructed forward transform matrix, and the forward transform result of the filling height signal under the Db4 wavelet basis is obtained through matrix multiplication, which is called wavelet coefficient. Wavelet coefficient represents the decomposition coefficient of the filling height signal at different scales, reflecting the characteristics of the signal in different frequency bands. Threshold processing: Threshold processing is performed on the wavelet coefficients obtained by wavelet forward transform. A threshold is set, and the wavelet coefficients less than the threshold are set to zero, and the coefficients greater than or equal to the threshold are retained. The selection of the threshold can be adjusted according to the characteristics of the signal and the noise level. Through threshold processing, the low-amplitude noise components in the wavelet coefficients are removed, and the main characteristics of the signal are retained. Inverse wavelet transform: The inverse transform matrix of the Db4 wavelet basis is used to inversely transform the wavelet coefficients after threshold processing. Through matrix multiplication, the processed wavelet coefficients are mapped from the wavelet domain back to the time domain, and the filtered filling height data is reconstructed. The inverse transform process converts the retained wavelet coefficients into time domain signals, removes noise interference, and obtains smooth filling height data. The biorthogonal scale Db4 wavelet basis function has good time-frequency localization characteristics, can perform multi-scale analysis on the signal, and effectively extract the local characteristics of the signal. By constructing the forward transformation matrix and the inverse transformation matrix, the conversion of the signal between the time domain and the wavelet domain is realized, which is convenient for processing the wavelet coefficients. The threshold processing can be adjusted according to actual needs, and the degree of noise removal can be flexibly controlled to adapt to different signal characteristics and noise levels. The inverse wavelet transform can reconstruct the processed wavelet coefficients back to the time domain to obtain smooth filling height data, effectively removing noise interference.

[0011] Furthermore, a detailed technical solution for normalizing the denoised filling height data using the kernel function smoothing normalization method is provided, with the focus on using the cubic sparse Gauss kernel function as the normalized kernel function: The cubic sparse Gauss kernel function is used as the normalized kernel function. The cubic sparse Gauss kernel function is a commonly used kernel function with good smoothing characteristics and local support. Its mathematical expression is: Among them, x and y are input vectors, σ is the bandwidth parameter of the kernel function, which controls the smoothness of the kernel function. According to the denoised filling height data, the kernel matrix is ​​constructed. Assume that there are n samples of filling height data, each sample is represented by x i (i=1, 2, ..., n). Calculate the Euclidean distance matrix D between samples, where D(i, j) represents sample x i and x j According to the expression of the cubic sparse Gauss kernel function, the kernel matrix K is calculated, where K(i, j) represents the sample x i and x j The kernel function value between . The kernel matrix is ​​sparsely processed to reduce the computational complexity and memory usage. A sparsity threshold ε is set, and the elements in the kernel matrix K that are less than ε are set to zero to obtain the sparse kernel matrix K_sparse. Sparse processing can significantly reduce the number of non-zero elements and improve computational efficiency. The filling height data is normalized using the sparse kernel matrix. Each row of the sparse kernel matrix K_sparse is normalized so that the sum of the elements in each row is 1. The normalized sparse kernel matrix K_normalized is obtained. The filling height data is transformed, and each sample x_i is represented as the i-th row of the normalized sparse kernel matrix K_normalized. The data range is mapped to the [0, 1] interval, realizing the standardized representation of the data, which is convenient for subsequent feature extraction and model training. Through the smoothing characteristics of the kernel function, the local structure and features of the filling height data are retained, which helps to capture the intrinsic pattern of the data. Sparse processing reduces the number of non-zero elements in the kernel matrix, reduces computational complexity and memory usage, and improves the efficiency of the algorithm. Normalization processing makes the representation of each sample have the same scale, eliminating the scale difference between the data, which is conducive to subsequent feature comparison and analysis. The Gauss kernel function has good smoothing properties and can effectively capture the local structure and characteristics of the data. The cubic sparse Gauss kernel function reduces the number of non-zero elements in the kernel matrix through sparse processing, improving computational efficiency and memory utilization.

[0012] Furthermore, the process of obtaining the characteristic data includes: performing frame segmentation on the pre-processed filling height data and weight data, and using the orthogonalized Hanning window as the segmentation window function. The frame length L and the frame shift M are set, and the filling height data and the weight data are divided into multiple frames respectively. The orthogonalized Hanning window is applied to each frame for windowing processing to reduce spectrum leakage and improve frequency resolution. The mathematical expression of the orthogonalized Hanning window is: Where n is the sample index in the window and L is the frame length. Through frame segmentation and windowing, multiple frames of filling height signals and weight signals are obtained, and the length of each frame signal is L. Stockwell transform is performed on each frame of filling height signal and weight signal to obtain time-frequency representation. For each frame signal x(t), its Stockwell transform can be expressed as: S(τ,f)=∫x(t)×w(t-τ,f)×e -j2πftdt, where τ is the time translation factor, f is the frequency, and w(t-τ,f) is the Gauss window function for localized time-frequency representation. Through Stockwell transform, each frame signal is mapped from the time domain to the time-frequency domain to obtain the time-frequency representation S(τ,f) of the filling height signal and the weight signal. In order to represent the time-frequency distribution diagram, a time-frequency plane coordinate system is constructed. The time domain coordinate is the signal time t, and the value range of t is 0 to the duration T of the corresponding frame signal, that is, t∈[0,T]. The frequency domain coordinate is the signal frequency f, and the value range of frequency f is 0 to the maximum frequency value f_max of the corresponding frame time-frequency distribution diagram, that is, f∈[0,f_max]. On the constructed time-frequency plane coordinate system of each frame, the short-time Fourier transform value at each moment t is calculated by sliding and expanding the Gaussian window. Set the window length and standard deviation of the Gaussian window, slide the Gaussian window on the time-frequency plane, and adjust the scale of the window according to the change of frequency f. For each time t, the Fourier transform of the product of the filling height signal and the weight signal and the Gaussian window is calculated to obtain the spectrum information at that time. The short-time Fourier transform can capture the local frequency characteristics of the signal at different times and provide a localized representation of the signal in time and frequency. According to the calculated short-time Fourier transform values, the time-frequency distribution diagram of each frame of the filling height signal and the weight signal is constructed respectively. The spectrum information at each time t is mapped to the corresponding position on the time-frequency plane coordinate system to form a time-frequency distribution diagram. The time-frequency distribution diagram takes time t as the horizontal axis and frequency f as the vertical axis. The value of each pixel represents the energy intensity at the corresponding time and frequency. Through the time-frequency distribution diagram, the energy distribution of the signal at different times and frequencies can be intuitively observed to capture the time-frequency characteristics of the signal. Multiple frames of filling height signals and weight signals, each frame of the signal is windowed by an orthogonalized Hanning window. The Stockwell transform result of each frame of the signal represents the representation of the signal in the time-frequency domain. The time-frequency distribution diagram of each frame of the signal shows the energy distribution of the signal at different times and frequencies. The obtained time-frequency feature data can be used for subsequent feature extraction and analysis, such as extracting energy features, entropy features, etc., to characterize the time-frequency domain characteristics of garbage capacity data. The time-frequency feature data provides rich information, which helps to capture the dynamic changes and frequency components of garbage capacity data and provide effective feature representation for garbage capacity prediction. The time-frequency feature extraction of garbage capacity data is achieved by using orthogonalized Hanning window for frame segmentation, Stockwell transform for time-frequency representation, short-time Fourier transform for calculating local spectrum information, and constructing time-frequency distribution diagrams.

[0013] Furthermore, the process of obtaining characteristic data also includes: extracting energy features according to the time-frequency distribution diagram of the filling height signal and the weight signal of each frame. For the time-frequency distribution diagram of the filling height signal, extract the energy features E at each time t and frequency f. H(t,f). The energy feature represents the energy intensity of the signal at a specific time and frequency, which can be obtained by calculating the pixel value at the corresponding position in the time-frequency distribution diagram. For the time-frequency distribution diagram of the weight signal, the energy feature E at each time t and frequency f is extracted. W (t,f). Similar to the filling height signal, the energy characteristics of the weight signal are obtained by calculating the pixel values ​​at the corresponding positions in the time-frequency distribution diagram. The energy characteristics reflect the energy distribution of the signal at different times and frequencies, and capture the time-frequency domain characteristics of the signal. According to the time-frequency distribution diagram of the filling height signal and the weight signal in each frame, the entropy characteristics are extracted. The time-frequency distribution diagram is divided into N frequency bands, and each frequency band corresponds to a certain frequency range. The division of frequency bands can be determined according to the frequency characteristics of the signal and the analysis requirements. For the time-frequency distribution diagram of the filling height signal, the entropy feature H is calculated in each frequency band. H The entropy feature measures the degree of chaos and uncertainty of the signal in a specific frequency band, which can be obtained by calculating the entropy value of the energy distribution in the frequency band. For the time-frequency distribution of the weight signal, the entropy feature H is calculated in each frequency band. W Similar to the filling height signal, the entropy feature of the weight signal is obtained by calculating the entropy value of the energy distribution in the frequency band. The entropy feature reflects the complexity and uncertainty of the signal in different frequency bands and provides the statistical characteristics of the signal frequency domain. The extracted energy feature and entropy feature are combined into feature data. For the filling height signal, the energy feature E H (t,f) and entropy characteristics H H (band) is combined into the characteristic data of the filling height signal. The energy feature represents the energy distribution of the signal at each time and frequency point, and the entropy feature represents the complexity and uncertainty of the signal in each frequency band. For the weight signal, the energy feature E W (t,f) and entropy characteristics H W (band) is combined into the characteristic data of the weight signal. Similar to the filling height signal, the energy feature and entropy feature represent the characteristics of the weight signal in the time-frequency domain and frequency domain respectively. The characteristic data contains the time-frequency domain and frequency-domain features of the filling height signal and the weight signal, providing a comprehensive signal representation, which is helpful for subsequent feature analysis and garbage capacity prediction. Through the above steps, the characteristic data of the filling height signal and the weight signal are obtained, including: the energy feature E of the filling height signal H (t,f), represents the energy distribution of the signal at each time t and frequency f. The entropy feature H of the filling height signal H (band), indicating the complexity and uncertainty of the signal in each frequency band. The energy characteristic E of the weight signal W (t,f), represents the energy distribution of the signal at each time t and frequency f. The entropy characteristic H of the weight signal W(band), indicating the complexity and uncertainty of the signal within each frequency band. The obtained feature data comprehensively considers the characteristics of the filling height signal and the weight signal in the time-frequency domain and the frequency domain, and provides rich information representation. The energy feature captures the energy distribution of the signal in the time-frequency domain, reflecting the intensity changes of the signal at different times and frequencies. The entropy feature measures the complexity and uncertainty of the signal in different frequency bands, and provides statistical characteristics in the frequency domain. By extracting energy features and entropy features, a multi-dimensional feature representation of the filling height signal and the weight signal is realized, providing rich information for subsequent feature analysis and garbage capacity prediction. These feature data can be used to train machine learning models, such as support vector machines, neural networks, etc., to achieve accurate prediction and analysis of garbage capacity.

[0014] Furthermore, edge computing nodes use Ceph distributed storage.

[0015] Furthermore, the edge computing nodes adopt the implementation of Ceph distributed storage: Ceph is a highly scalable, reliable and open source distributed storage system suitable for the data storage needs of edge computing nodes. Ceph adopts an object storage model to store data in a distributed environment in the form of objects. Each data object has a unique identifier, called an object ID. Ceph divides data objects into fixed-size data blocks (usually called object fragments) and distributes these fragments to different storage nodes to achieve distributed storage and parallel access of data. Ceph uses the CRUSH (Controlled Replication Under Scalable Hashing) algorithm to calculate the distribution of data object fragments. The CRUSH algorithm maps data objects to different storage nodes based on the topology of the storage cluster and predefined rules. The CRUSH algorithm uses a hash function to map the object ID to a pseudo-random number, and then maps the pseudo-random number to the storage node based on the topology and rules of the cluster. The CRUSH algorithm takes into account factors such as the capacity, performance, and fault domain of the storage node to ensure that the data object fragments are evenly distributed in the cluster to achieve load balancing and data reliability. Ceph adopts a data replication strategy to ensure data reliability and availability. The data copy strategy defines the number of copies that need to be created for each data object and the placement rules of the copies. Common data copy strategies include replication and erasure coding. The replication strategy stores multiple copies of each data object on different storage nodes, and ensures data reliability through the redundancy of the copies. For example, setting the number of copies to 3 means that each data object will store 3 copies in the cluster. The erasure coding strategy encodes data objects into data blocks and check blocks and distributes them on different storage nodes. When a storage node fails, the lost data can be reconstructed based on the data blocks and check blocks on other nodes. According to the data object fragment distribution calculated by the CRUSH algorithm and the data copy strategy, Ceph maps the object fragments to different storage nodes. For each data object, Ceph calculates a set of storage nodes based on the object ID and the CRUSH algorithm to store the fragments of the object. According to the data copy strategy, Ceph copies the object fragments to different storage nodes to ensure that the distribution of the replicas meets the policy requirements. By mapping the object fragments to different storage nodes, Ceph realizes distributed storage and parallel access of data, improving the performance and scalability of the storage system. When an application needs to access a data object, Ceph quickly locates the node that stores the object fragment based on the object ID and the CRUSH algorithm. The Ceph client sends the data request to the storage node, which reads the corresponding object fragment and returns it to the client.If a storage node fails, Ceph will automatically detect the failure and obtain object fragments from other nodes according to the data replication strategy to ensure data availability. Ceph uses data replication and reconstruction mechanisms to ensure that data can still be accessed and recovered in the event of a node failure.

[0016] Furthermore, the process of using the Transformer model to predict garbage capacity is as follows: the extracted feature data is used as input and input into the pre-trained Transformer model. The feature data includes energy features and entropy features of the filling height signal and weight signal, as well as other related features. The pre-trained Transformer model is a deep learning model based on the self-attention mechanism, which has powerful sequence modeling and feature learning capabilities. The position encoding algorithm is used to embed the position information of the input feature data. The position encoding algorithm maps the time step information in the feature data to a position vector to capture the position information in the sequence. Common position encoding algorithms include sinusoidal position encoding and learning position encoding. Sinusoidal position encoding uses a sine function to generate a position vector, and learning position encoding generates a position vector through learnable parameters. The position vector is superimposed with the corresponding feature data to form the feature data after position embedding as the input sequence. The input sequence is linearly transformed to generate a query vector, a key vector, and a value vector. The input sequence is converted into three vectors through linear transformation: a query vector (Query), a key vector (Key), and a value vector (Value). Linear transformation is usually implemented using a fully connected layer or a convolutional layer to map the input sequence to different feature spaces. Multiple attention heads are calculated in parallel, and each attention head calculates the attention weight based on the query vector, key vector, and value vector. The multi-head attention mechanism splits the attention calculation into multiple parallel attention heads, and each attention head calculates the attention weight independently. For each attention head, the attention weight is calculated based on the query vector and key vector to represent the relevance and importance between different positions. The value vector is weighted summed based on the attention weight to obtain the output vector of each attention head. The output vectors of multiple attention heads are spliced ​​into a single vector as the fused feature vector. The output vectors generated by multiple attention heads are spliced ​​together to form a high-dimensional feature vector.

[0017] The concatenated feature vector contains different aspects of feature information captured by multiple attention heads. The multi-head self-attention mechanism is used to enhance the features of the fused feature vector. The multi-head self-attention mechanism is used to further learn and enhance the features of the fused feature vector. The multi-head self-attention mechanism can capture the long-distance dependencies between features and enhance the representation ability of features. Combined with the historical data of garbage capacity, the predicted value of garbage capacity at the prediction time step is generated by autoregression. The autoregression capability of the Transformer model is used to generate the predicted value of garbage capacity at the future time step based on the historical garbage capacity data. The autoregression prediction recursively generates the predicted value of the next time step by taking the predicted result of the previous time step as input. According to the predicted value of garbage capacity and the preset threshold, the saturation state of the garbage bin is judged. The generated garbage capacity prediction value is compared with the preset saturation threshold to determine whether the garbage bin is in a saturated state. If the predicted value exceeds the saturation threshold, the garbage bin is considered to be saturated; otherwise, the garbage bin is considered to be unsaturated. The judgment result of the saturation state of the garbage bin and the predicted value of garbage capacity are output. The saturation state judgment result and the predicted value of garbage capacity are provided as the output of the model to the subsequent decision and control modules. The saturation status judgment results can be used to trigger the cleaning and maintenance operations of the garbage bin, and the predicted values ​​can be used to optimize garbage collection routes and resource scheduling.

[0018] By using the Transformer model for garbage capacity prediction, combined with technologies such as position encoding, multi-head attention mechanism and autoregressive prediction, the time series characteristics and long-distance dependencies of garbage capacity data can be effectively captured, improving the accuracy and reliability of prediction. The position encoding algorithm embeds time step information into feature data, enhancing the model's ability to perceive sequence positions. The multi-head attention mechanism captures the relationship between features from different angles by calculating multiple attention heads in parallel, enhancing the representation ability of features. Autoregressive prediction uses historical data to generate future prediction values, which is suitable for data with time series dependencies such as garbage capacity.

[0019] Furthermore, the process of generating the predicted value of garbage capacity at the prediction time step by autoregression is as follows: Position encoding of garbage capacity historical data: The garbage capacity historical data is embedded with position information by the position encoding algorithm. The position encoding algorithm maps the time step information in the garbage capacity historical data into a position vector. Common position encoding algorithms include sinusoidal position encoding and learned position encoding. Sinusoidal position encoding uses a sine function to generate a position vector, and learned position encoding generates a position vector by learnable parameters. The position vector is superimposed with the corresponding garbage capacity historical data to generate the garbage capacity historical data after position embedding. In the first sublayer of the decoder, the masked multi-head self-attention mechanism is used to extract features from the garbage capacity historical data after position embedding. The masked multi-head self-attention mechanism prevents the decoder from noticing future information when generating the predicted value of the current time step by setting a mask matrix. The mask matrix is ​​usually an upper triangular matrix with 1 at the diagonal and below and 0 at the rest of the positions. This ensures that when generating the predicted value of the current time step, only historical information is paid attention to to avoid information leakage. Through the masked multi-head self-attention mechanism, the decoder can learn the internal dependencies and feature representations of the garbage capacity historical data. Generate the first sub-layer output vector as the input of the next sub-layer. Input the first sub-layer output vector and the fused feature vector output by the encoder into the second sub-layer of the decoder. The fused feature vector output by the encoder contains the contextual information and feature representation of the input sequence. Use the multi-head attention mechanism to perform feature interaction and fusion on the first sub-layer output vector and the fused feature vector. The multi-head attention mechanism captures the correlation and relevance between the two input vectors by calculating the attention weights between them. Generate the second sub-layer output vector as the input of the next sub-layer.

[0020] The second sublayer output vector is input into the third sublayer of the decoder. The second sublayer output vector is nonlinearly transformed by a feedforward neural network to extract high-level features. A feedforward neural network usually consists of multiple fully connected layers and nonlinear activation functions, such as ReLU. The output of the feedforward neural network is residually connected to the second sublayer output vector, that is, the two vectors are added. Residual connections can help the back propagation of gradients, alleviate the problem of gradient vanishing, and promote model training and convergence. The results of the residual connection are layer normalized to obtain the final output vector of the decoder. The final output vector of the decoder is processed by linear transformation and softmax activation function. The linear transformation maps the final output vector of the decoder to the category space of garbage capacity.

[0021] The result of the linear transformation is converted into a probability distribution through the softmax activation function, which represents the predicted probability of each garbage capacity category. The garbage capacity with the largest probability value is selected from the predicted probability distribution as the garbage capacity prediction value of the current time step. The garbage capacity with the largest probability value represents the most likely garbage capacity result predicted by the model. The garbage capacity value predicted at the current time step is added to the end of the historical data sequence as the input of the next time step. By adding the predicted value to the historical data sequence, the model can use the previous prediction results to generate the predicted value of the next time step. The garbage capacity prediction values ​​of subsequent time steps are iteratively generated until the target time range of the prediction is reached. The garbage capacity prediction value of the predicted time step is generated by autoregression, and the multi-layer structure and attention mechanism of the Transformer model decoder are utilized. Position encoding embeds the time step information into the garbage capacity historical data, and the masked multi-head self-attention mechanism and multi-head attention mechanism capture the internal dependency of the historical data and the interactive information with the encoder output respectively. The feedforward neural network and residual connection further enhance the feature representation ability. The predicted probability distribution is generated through softmax activation, and the most likely garbage capacity is selected as the predicted value. The iterative prediction process utilizes the autoregressive properties of historical data and prediction results to generate a continuous sequence of garbage capacity predictions.

[0022] Furthermore, a Transformer model based on the sparse self-attention mechanism is adopted, and the sparsity value range is set to 0.4 to 0.6: In the traditional Transformer model, the self-attention mechanism calculates the attention weights between each position and all other positions, resulting in high computational complexity. The sparse self-attention mechanism reduces the amount of attention weight calculation by introducing sparsity and improves the computational efficiency of the model. The core idea of ​​the sparse self-attention mechanism is to only calculate the attention weights between each position and a part of its most relevant positions, while ignoring other irrelevant positions. By setting the sparsity parameter, the sparsity of the attention weights is controlled, that is, each position only pays attention to a certain proportion of its most relevant positions.

[0023] In the Transformer model based on the sparse self-attention mechanism, the sparsity value range is set to 0.4 to 0.6. Sparsity indicates the proportion of other positions that each position pays attention to, and the value range is 0 to 1. A sparsity of 0 indicates a fully dense self-attention mechanism, that is, each position pays attention to all other positions; a sparsity of 1 indicates a fully sparse self-attention mechanism, that is, each position only pays attention to itself. Setting the sparsity value range to 0.4 to 0.6 means that each position pays attention to the most relevant 40% to 60% of the positions and ignores the rest.

[0024] In the Transformer model based on the sparse self-attention mechanism, the calculation process of the sparse self-attention weight is as follows: For each position, calculate the correlation score between it and other positions, usually using dot product or other similarity measurement methods. According to the correlation score, select the top k most relevant positions for each position, where k is determined by the sparsity parameter. For example, if the sequence length is 100 and the sparsity is 0.5, each position selects its 50 most relevant positions. Calculate the attention weights for the selected k positions, and use the softmax function to convert the correlation score into a normalized attention weight. For unselected positions, set their attention weights to 0 to achieve sparsity.

[0025] The Transformer model based on sparse self-attention mechanism has the following advantages: Reduce computational complexity: By only calculating the attention weight between each position and its most relevant position, calculations with all positions are avoided, reducing computational complexity. Improve computational efficiency: The sparse self-attention mechanism reduces unnecessary calculations, accelerates the training and reasoning process of the model, and improves computational efficiency. Capture local dependencies: By focusing on the most relevant position of each position, the sparse self-attention mechanism can effectively capture local dependencies and contextual information. Adapt to long sequence inputs: The sparse self-attention mechanism has advantages in processing long sequence inputs. By reducing the calculation of irrelevant positions, the computational burden of attention weights is alleviated. The value range of sparsity is 0.4 to 0.6: Balance computational efficiency and representation ability: Too low sparsity may lead to ignoring important position information, and too high sparsity may lead to excessive computation. Adapt to different tasks and data characteristics: Different tasks and data sets may have different optimal values ​​for sparsity, which need to be adjusted and experimented according to specific circumstances. A sparsity range of 0.4 to 0.6 usually achieves good performance in practice, balancing computational efficiency and model representation capabilities.

[0026] Compared with the prior art, the advantages of this application are:

[0027] By installing ultrasonic sensors and weight sensors in urban trash cans and using 5G networks for data transmission, real-time collection and efficient transmission of garbage capacity data are achieved, improving the timeliness and accuracy of garbage capacity perception.

[0028] The hyperbolic wavelet transform algorithm is used to filter the filling height data, and the threshold method based on wavelet packet energy and entropy is used for denoising, which effectively eliminates the noise interference in the filling height data and improves the data quality. At the same time, by constructing a wavelet transform matrix containing a forward transform matrix and an inverse transform matrix, the accurate reconstruction of the signal is achieved, ensuring the reversibility of the filtering process.

[0029] The kernel function smoothing normalization method is used to normalize the denoised filling height data. The cubic sparse Gauss kernel function is used as the normalized kernel function to effectively smooth the data curve and make the data distribution more uniform, which is convenient for subsequent feature extraction and analysis.

[0030] By performing frame segmentation on the preprocessed filling height data and weight data and performing Stockwell transform on each frame signal, a time-frequency plane coordinate system was constructed to extract the time-frequency domain features of the garbage capacity data. The short-time Fourier transform value was calculated using a sliding Gaussian window on the time-frequency plane to obtain the spectrum information at each moment, and the time-frequency distribution diagram of the filling height signal and weight signal was generated, providing rich information for subsequent feature extraction.

[0031] Energy features and entropy features were extracted from the time-frequency distribution diagram of filling height signal and weight signal, which fully utilized the time-frequency domain information to describe the energy distribution and complexity characteristics of garbage capacity data, providing an effective feature representation for garbage capacity prediction.

[0032] Ceph distributed storage is used in edge computing nodes, and the CRUSH algorithm is used to implement distributed storage and multi-copy fault tolerance of data object fragments, which improves the reliability and scalability of data storage and reduces the storage pressure of cloud servers.

[0033] The pre-trained Transformer model based on the self-attention mechanism is used to predict garbage capacity. The time step information is embedded into the feature data through the position encoding algorithm. The multi-head self-attention mechanism is used to achieve parallel calculation and fusion of features, which improves the feature extraction and representation capabilities of the model. The masked multi-head self-attention mechanism is introduced in the decoder to prevent future information from being noticed, thus improving the accuracy of the prediction.

[0034] The autoregressive method is used to generate the garbage capacity prediction value. By adding the predicted garbage capacity value to the historical data sequence, the correlation between the predicted value and the historical data is achieved, which improves the continuity and stability of the prediction.

[0035] Using the Transformer model based on the sparse self-attention mechanism, by setting the sparsity, the complexity of attention calculation is reduced, the computational efficiency of the model is improved, and good prediction performance is maintained. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] This specification will be further described in the form of exemplary embodiments, which will be described in detail by the accompanying drawings. These embodiments are not restrictive, and in these embodiments, the same number represents the same structure, wherein:

[0037] Figure 1is an exemplary flow chart of a method for sensing urban garbage capacity according to some embodiments of this specification;

[0038] Figure 2 is an exemplary flow chart of preprocessing according to some embodiments of this specification;

[0039] Figure 3 is an exemplary flow chart of extracting feature data according to some embodiments of this specification;

[0040] Figure 4 This is an exemplary flow chart for predicting garbage capacity according to some embodiments of this specification. DETAILED DESCRIPTION

[0041] The method and system provided in the embodiments of this specification are described in detail below with reference to the accompanying drawings.

[0042] Figure 1 This is an exemplary flow chart of a method for sensing urban garbage capacity according to some embodiments of the present specification; sensors are set in urban garbage bins to collect garbage capacity data; a 5G network is used to transmit the collected garbage capacity data to an edge computing node; on the edge computing node, the garbage capacity data is preprocessed, and a matching pursuit transform algorithm is used to extract feature data of the preprocessed garbage capacity; a 5G network is used to transmit the extracted feature data to a cloud server; on the cloud server, based on the received feature data, a pre-trained Transformer model based on a sparse self-attention mechanism is used to predict the garbage capacity.

[0043] Ultrasonic sensors and weight sensors are set in urban garbage bins to collect the filling height data and weight data of the garbage bins in real time. The garbage capacity data includes: the filling height data and weight data of the garbage bin; the sensors include: ultrasonic sensors, which calculate the filling height data of the garbage bin according to the echo; weight sensors, which collect the weight data of the garbage bin. Ultrasonic sensor: It is installed above the garbage bin to emit ultrasonic waves downward and receive echo signals. The HC-SR04 module is used, which contains ultrasonic transmitting and receiving chips with a ranging range of 2cm to 4m. The ultrasonic frequency is usually 40KHz. The height of the garbage distance sensor is calculated according to the echo time. The garbage filling height data in the garbage bin is obtained. Weight sensor: A pressure weight sensor is installed at the bottom of the garbage bin. Four piezoresistive strain gauges are used to form a Wheatstone bridge circuit. The resistance change is detected according to the pressure change and converted into a voltage signal. The analog signal is collected through the ADC chip to obtain digital quantized weight data. The HX711 chip is used with 24-bit AD accuracy and can detect 2g changes. Microcontroller: Use STM32 microcontroller to read the data of the two sensors. The data is transmitted to the edge computing node through the 5G module. At the same time, consider reducing the amount of transmitted data and saving communication resources.

[0044] Figure 2 This is an exemplary flow chart of preprocessing according to some embodiments of this specification, using db4 wavelet for hyperbolic wavelet transform, decomposed into multiple layers of detail coefficients and approximate coefficients. Input signal: fill height collected data signal, set as sequence X(n). Wavelet basis function: select Db4 as the orthogonal wavelet basis function. Db4 is a 4th-order orthogonal wavelet of the Daubechies series. Double parabola transform: First, perform a primary decomposition on the signal X(n) and decompose it into approximate coefficient cA1 and detail coefficient cD1. Decompose cA1 again to obtain cA2 and cD2. Repeat the decomposition K times. Finally, K levels of approximate coefficient sets {cA1, cA2, ..., cAK} and detail coefficient sets {cD1, cD2, ..., cDK} are obtained. The Mallat algorithm is used to achieve fast double parabola transform. The signal is decomposed and reconstructed by a recursive pyramid algorithm. The wavelet transform module of tools such as Matlab is used to call the db4 wavelet transform function. The number of decomposition layers K is controlled, generally 3-5 layers.

[0045] The original filling height signal collected has a length of N sampling points. Db4 orthogonal wavelet is selected for wavelet transform W(a, b). The approximate coefficient of the signal in the low-frequency part is extracted and expressed as cA1. cA1 reflects the trend and contour information of the signal. The detail coefficient of the signal in the high-frequency part is extracted and expressed as cD1. cD1 reflects the steep change and high-frequency information of the signal. X(n)=cA1+cD1, the input signal is decomposed into low-frequency approximation and high-frequency details. Use wavelet decomposition algorithm, such as Mallat algorithm. Languages ​​such as Matlab / Python have wavelet transform modules that can be called directly. Take the first-level approximate coefficient cA1 as the input signal and perform wavelet decomposition again to obtain: second-level approximate coefficient cA2, second-level detail coefficient cD2. Take the second-level approximate coefficient cA2 as input and decompose to obtain: third-level approximate coefficient cA3, third-level detail coefficient cD3. Repeat the above operation K times, K-level approximate coefficient: cAK, K-level detail coefficient: cDK. Finally, a set of approximate coefficients and detail coefficients of K levels are obtained, which contain the characteristics of the input signal in different frequency bands. The K value is generally controlled at 3-5 levels. The larger K is, the more detailed the frequency band decomposition is. The approximate coefficients of the K layer include: cA1, cA2, ..., cAK, which represent the approximate components of the input signal after step-by-step low-pass filtering, reflecting the trend and contour information of the signal. The detail coefficients of the K layer include: cD1, cD2, ..., cDK, which represent the detail components of the input signal after step-by-step high-pass filtering, reflecting the steep change and high-frequency information of the signal. cA1 and cD1 are one layer, cA2 and cD2 are two layers, and so on to the K layer. The detail coefficients of the jth layer reflect the original signal 2 j-1 to 2 j The original signal can be reconstructed by superposition of all approximate and detail coefficients, X(n) = cA1+cD1+cD2+,......,+cDK.

[0046] Calculate the energy and entropy of each layer of wavelet coefficients as the threshold to suppress the noise coefficient. The j-th layer wavelet coefficients are decomposed by wavelet to obtain the j-th layer wavelet coefficient matrix cj. The matrix size is M×N, with a total of M×N coefficients. The k-th wavelet coefficient in the matrix cj is represented by cj,k, where k ranges from 1 to M×N. The sum operation is performed, and the square of each coefficient is traversed from 1 to M×N. 2 , and sum them up to get the wavelet coefficient energy Ej. The physical meaning of energy is that Ej reflects the total energy of all wavelet coefficients in the jth layer, which can be considered as the effective signal energy of the wavelet component of this layer.

[0047] The j-th layer wavelet coefficients are decomposed by wavelet to obtain the j-th layer wavelet coefficient matrix cj. The matrix size is M×N, with a total of M×N coefficients and probability distribution pj,k. Each coefficient cj,k of the j-th layer is regarded as a random variable, and its probability distribution pj,k is fitted. The sum operation is performed, and the information entropy term -pj,klogpj,k of each coefficient is calculated from 1 to M×N. The sum is obtained to obtain the entropy Hj of the whole layer wavelet coefficients. The physical meaning of entropy, Hj, reflects the random uncertainty of the j-th layer wavelet coefficients, and can be used as a distinguisher to distinguish signals from noise. The threshold of the layer can be set according to Hj, and the layer with larger entropy can be suppressed to reduce noise.

[0048] The wavelet coefficient energy Ej reflects the effective signal power of the wavelet coefficients of this layer, and the wavelet coefficient entropy Hj reflects the randomness of the wavelet coefficients of this layer. Combining Ej and Hj, λj=k×Ej×Hj, k is the empirical weight constant, usually 0.3-0.5, to determine the threshold λj. If Ej is large and Hj is small, it means it is more like a signal, so a larger λj is taken. If Ej is small and Hj is large, it means it is more like noise, so a smaller λj is taken. The adaptive threshold λj can be adaptive to the signal-to-noise ratio of different layers, effectively retaining the signal and suppressing the noise. Traverse each wavelet decomposition layer, calculate Ej and Hj, and finally get λj, and perform threshold processing on the wavelet coefficients.

[0049] Loop through the wavelet coefficient matrix cj of each layer, take out each wavelet coefficient cj,k in the matrix cj in turn, calculate the absolute value of the current wavelet coefficient |cj,k|, compare |cj,k| with the threshold λj of the layer, and if |cj,k|<λj| holds, set the value of |cj,k| to 0. Otherwise, keep the value of |cj,k| unchanged, repeat until all coefficients in the matrix cj are traversed, repeat for the wavelet coefficient matrices cj of other layers, and finally obtain the denoised wavelet coefficient matrices of each layer, and use the denoised wavelet coefficient matrices for signal reconstruction.

[0050] Noise presents high-frequency random characteristics in the wavelet domain, and the corresponding wavelet coefficients have small amplitudes and are irregular. The threshold suppresses noise, sets a suitable threshold, suppresses the corresponding wavelet coefficients of noise, effectively removes the noise component, and retains the main signal. The main signal presents low-frequency clustering characteristics in the wavelet domain, and the corresponding wavelet coefficients have large amplitudes and are regular, which can be retained through threshold processing. The denoised wavelet coefficient matrix is ​​obtained after threshold processing of each layer, forming a denoised wavelet coefficient matrix, and the inverse wavelet transform is reconstructed. The denoised wavelet coefficients are used as input, and the denoised signal is reconstructed through the inverse wavelet transform algorithm. Wavelet transform and threshold filtering can be implemented in languages ​​such as Python, and the inverse wavelet transform function can be called directly from the Transform library. Calculate the signal-to-noise ratio (SNR) of the output signal, compare it with the SNR of the original noise signal, and evaluate the degree of denoising improvement.

[0051] Wiener filtering obtains the main part of the signal to achieve filtering and denoising. Construct a time domain signal x(n), where x(n) is a time domain sampling sequence with a filling height, n=0, 1, 2, ..., N-1, with a total of N sampling points. The FFT algorithm process is represented as a butterfly graph, and the operation relationship is expressed through the butterfly process between the input and output. Each layer of the butterfly process divides the time domain signal into two sub-intervals for separate processing. The divide-and-conquer of the butterfly structure reduces the number of complex multiplications and the computational complexity of FFT. The calculation results of the previous layer can be reused in the butterfly structure of the next layer to avoid repeated calculations and improve efficiency. The nodes of the same layer in the butterfly structure can be calculated in parallel to improve the calculation speed. Through the butterfly graph process, FFT reduces the complexity of the original O(N^2) to the O(NlogN) level.

[0052] Time domain signal x(n), a time series signal of length N, representing time domain sampling of the filling height, complex exponential basis The complex exponential basis function used in FFT transformation, n is the time domain sample index, and k is the frequency domain sample index. Inner product operation, FFT obtains the frequency domain coordinate X(k) by performing the inner product of x(n) with each basis function, that is, the coordinate expression of x(n) under the complex exponential basis. Frequency domain conversion, the inner product operation actually realizes the conversion from time domain to frequency domain, and x(n) is converted to its expression X(k) in the frequency domain. Fourier transform, this process is equivalent to performing Fourier transform on x(n), and FFT realizes fast Fourier transform through efficient inner product. Language implementation, FFT inner product operation can be concisely implemented in languages ​​such as Python. Time-frequency conversion can be completed using ready-made functions.

[0053] Input signal x(n), a time domain sampling sequence of length N, represents the data of filling height. Perform FFT, apply fast Fourier transform to x(n), realize the conversion from time domain to frequency domain, frequency domain signal X(k), obtain frequency domain signal of length N, represented as X(k), k ranges from 0 to N-1. Meaning, X(k) represents the coordinate expression of x(n) in the frequency domain, containing the frequency component information of x(n) signal. Amplitude information, |X(k)| represents the amplitude of each frequency component, reflecting the frequency characteristics of x(n). Storage, store the frequency domain signal X(k) in the processor memory as the input of subsequent digital filtering.

[0054] Analyze the spectrum distribution, obtain the spectrum of the filling height signal X(k) through FFT, observe the distribution of the main frequency components, and determine the cutoff frequency. The main energy of the statistical signal is concentrated in the low frequency band, such as below f_cutoff = 15Hz. Construct a filter, according to the determined f_cutoff = 15Hz, construct an ideal low-pass filter, and design the transfer function, H(k) = 1, for k corresponding to the frequency less than 15Hz, H(k) = 0, for k corresponding to the frequency greater than 15Hz. Use FIR to design a finite impulse response filter, and use a rectangular window to simplify the filter implementation. Store the FIR filter coefficients of H(k) in the processor as a filter for frequency domain filtering. The input signal X(k), the frequency domain signal obtained after FFT of the filling height signal, contains the frequency components of the signal and noise. Filter H(k), the designed low-pass FIR filter, the transfer function sets the cutoff frequency according to the signal characteristics. Frequency domain product, dot multiplication of X(k) and H(k), Y(k) = X(k) × H(k), to achieve frequency domain filtering. Filter out high-frequency noise. The low-pass characteristic of H(k) can filter out the high-frequency noise in X(k), and Y(k) obtains the frequency domain signal with high-frequency noise removed.

[0055] The frequency domain filtered signal Y(k) is obtained by low-pass filtering the original signal X(k), which contains the signal components after high-frequency noise is removed. Inverse FFT, apply inverse fast Fourier transform to Y(k), convert the frequency domain signal to time domain, and output y(n) in time domain filtering to obtain the time domain signal y(n), which has the same length as the input x(n). y(n) is the filling height signal after high-frequency noise is removed. Save the result, store the time domain filtering output y(n) in the processor memory as the denoised filling height signal, analyze the filtering effect, and compare the time domain waveforms of y(n) and x(n) to verify the denoising effect.

[0056] The cubic sparse Gaussian kernel function is applied to smooth and normalize the denoised signal. The cubic polynomial is used as the basic model of the kernel function, in the form of: K(x) = a + bx + cx 2 +dx 3 . Set σ = 1.5 to control the smoothing range of the kernel function. The larger σ is, the smoother the kernel function is. Map the polynomial kernel to a Gaussian distribution, that is, K(x) ~ N(0,σ 2), calculate the weight K(x) of the kernel function sample point x according to the Gaussian distribution CDF. Reduce the sampling density, for example, the sampling interval is 3, which greatly reduces the number of sampling points of the kernel function, thereby reducing the computational complexity of subsequent convolution operations. Use OpenCV or Numpy to build a custom sparse kernel function, adjust the σ value and sampling sparsity, and optimize the smoothing effect. The filling height signal is represented as a one-dimensional time domain sequence x(n), n=0, 1,..., N-1, and the time domain sequence of the filling height acquisition is N in length, represented as x(n), n=0, 1, 2,..., N-1. The pre-constructed M-point sparse Gaussian kernel, with a symmetric center, is represented as K(m), m=-M / 2,..., M / 2. y(n)=∑K(m)×x(nm), the length of the convolution output signal y(n) is N+M-1, m scans the kernel function length, and n scans the signal length. The input signal x(n) needs to be padded and expanded to achieve convolution. The padding mode is configurable: zero padding, symmetric padding, etc. Use the convolution function of libraries such as Numpy to implement acceleration: use FFT to perform frequency domain convolution operations.

[0057] The Gaussian kernel function is symmetric about the center point, that is, K(m) = K(-m), which makes it have the characteristics of low-pass filtering. Convolving the input signal x(n) with the symmetric kernel K(m) is equivalent to convolving x(n) with a low-pass filter, which can smooth the signal and filter out high-frequency noise. The smoothing characteristics of the Gaussian kernel can be used to reduce the random fluctuations of the signal. The convolution operation is equivalent to low-pass filtering, which effectively suppresses high-frequency noise components, and the output signal retains the main outline of the input signal. The degree of smoothing can be adjusted by the standard deviation of the Gaussian kernel. The larger the standard deviation, the better the smoothing effect.

[0058] Use the mean and standard deviation to normalize the signal and calculate the mean of the input signal, mean = ∑x(n) / N, where x(n) is the input signal and N is the signal length. Calculate the standard deviation std of the input signal. A statistic that describes the dispersion of the signal. Normalization function, Where x(n) is the original signal. This function can normalize the signal to a mean of 0 and a standard deviation of 1. After this normalization, the value distribution of the signal y(n) is mapped to the standard normal distribution, with mean = 0 and std = 1. The statistical functions of libraries such as Numpy are used to calculate mean and std, and the normalization formula is vectorized to accelerate the calculation.

[0059] The standard deviation σ controls the smoothness of the kernel function. Here, σ=1.5 is set as an empirical value. The larger σ is, the smoother the kernel function is. The effective range of the Gaussian kernel function is called the kernel function radius, that is, the kernel function decays from the center symmetrically to a very small range. Here, the kernel function radius is set to 3, that is, the kernel function is effective when sampled in the interval [-3, 3]. Considering the characteristics and noise of the filling height signal, the kernel function radius is generally set to 2-5 times the signal feature scale, and the standard deviation σ is set to 0.5-1 times the kernel radius. Through repeated experiments, the denoising effect is evaluated. The larger the kernel radius, the more it can cover the signal characteristics. The larger σ is, the better the smoothing effect is, but there is a risk of over-smoothing. Define σ and the kernel function sampling interval in the algorithm code to control the smoothing degree and achieve the ideal denoising effect.

[0060] Weight data preprocessing: Use HX711ADC module with 24-bit accuracy and 80Hz sampling frequency. Digital filter eliminates DC bias and improves sampling accuracy. Piecewise linear mapping maps the sampled data to a standard numerical range. Realize the conversion of analog weight signal to digital quantization. Use HX711 analog-to-digital conversion chip, 24-bit ADC, 80Hz sampling frequency to ensure that the sampling accuracy and rate meet the requirements. Design digital FIR or IIR filter to filter ADC sampled data, eliminate the influence of sensor DC bias, and improve sampling accuracy. According to the sensor range, design piecewise linear function to linearly map the original sampled data to a standardized numerical range, such as 0-5V or 0-5000 numerical quantization. After the above digital filtering and mapping processing, the conversion of analog weight signal to digital quantization data is realized. The embedded system collects data, implements digital filtering and mapping on the MCU, and optimizes the algorithm to ensure that real-time processing requirements are met.

[0061] Edge nodes: Implement preprocessing algorithms on the Open Edge Computing platform. Develop preprocessing microservices using languages ​​such as Python or Java. Containerize and orchestrate using Kubernetes. Optimize algorithms to ensure that edge node computing power meets real-time preprocessing requirements. Use Python to develop preprocessing algorithms such as image denoising and enhancement, implement functions such as denoising and image distortion correction, and optimize algorithms to ensure computing efficiency. Encapsulate preprocessing algorithms as image preprocessing microservices, define service interfaces, and implement RESTful APIs for services. Use Docker to containerize preprocessing microservices and generate Docker images for preprocessing services. Deploy Kubernetes clusters on edge nodes, load preprocessing service images to edge nodes, and orchestrate and manage services through Kubernetes. Simulate image processing requests of different scales, test the response time of preprocessing services on edge nodes, and evaluate their ability to meet real-time processing requirements. The preprocessing microservice is launched to provide image preprocessing support for other algorithms, collaborate with the edge platform, and implement intelligent video analysis.

[0062] Figure 3 This is an exemplary flow chart for extracting feature data according to some embodiments of this specification. Extracting feature data includes: using a height sensor and a weight sensor to collect the raw data of filling height and weight in real time, setting the sampling frequency of the sensor, such as 50Hz, and converting the collected analog signal into a digital signal by A / D conversion. The digital signal is encapsulated into a data frame, which contains information such as timestamps and data values. The data frame is sent to the subsequent preprocessing module via the UDP or TCP network protocol. The data frame is received from the acquisition module, the original signal is cached and reconstructed in the order of timestamps, the signal is preprocessed by filtering, eliminating DC components, etc., the valid information is extracted, and redundant data is discarded. Finally, the preprocessed standard filling height and weight digital signals are output and sent to the subsequent feature extraction module for processing.

[0063] Get the filling height signal x(n) with a sampling frequency Fs of 50Hz from the preprocessing module, n=0, 1, ..., N-1, set the length of each signal frame to L=160 sampling points according to Fs and requirements, and create an orthogonal Hanning window w(n), whose length is also 160 points. Initialize the frame counter k=0. Start looping to process the signal x(n): take out the kth signal segment of length L: xk(n)=x(n+k×L), n=0, 1, ..., L-1. Multiply xk(n) by the Hanning window w(n) to get: xk'(n)=xk(n)×w(n), n=0, 1, ..., L-1. Add the signal frame xk'(n) to the output frame sequence. k=k+1, repeat until the signal x(n) is completely segmented to obtain a non-overlapping signal frame sequence {x1'(n), x2'(n), ..., xk'(n)}, and send the segmented frame sequence to the subsequent Stockwell transform module.

[0064] Input signal frame xk(n), k represents the kth frame, perform fast Fourier transform on xk(n) to obtain its frequency domain signal Xk(f). Initialize the time-frequency analysis window: Where σt and σf control the window size. On the time-frequency plane, with each point (t, f) as the center, move and expand the window g(t, f), calculate the inner product of the time domain signal xk(t) in the window and the complex exponential basis, and get the transformation value: Sk(t, f) = ∫xk(τ)g(τ-t, f)e j2πfτ dτ, input signal frame data xk(n), length is 160 samples, set the time domain and frequency domain parameters of time-frequency conversion: time domain interval: t=0, 1, ..., 159, frequency domain interval: f=0, 1, ..., 79. Initialize a 160*80 two-dimensional array S to store the time-frequency plane, enter a double loop: the outer loop traverses the time domain t: the inner loop traverses the frequency domain f: calculate the Stockwell transform value corresponding to time t and frequency point f: Sk(t,f)=∫xk(τ)g(τ-t,f)e j2πfτ dτ, and store it in S(t,f). After the two-layer loop is completed, a time-frequency plane matrix S of size 160*80 is obtained. Each point g(t,f) in the matrix S represents the Stockwell transformation value at time t and frequency point f. The output time-frequency plane S is sent to the subsequent module to extract features, and all points (t,f) on the time-frequency plane are repeatedly traversed.

[0065] Input the time-frequency plane matrix S(t,f), whose size is 160×80, initialize a one-dimensional array P

[160] to store the spectrum at each time, enter the loop, and traverse the time t: Input the time-frequency plane S(t,f), extract the column data at time t=100: S_col(f)=S(100,f), f=0,......,79. Perform 80-point inverse fast Fourier transform on S_col(f) to obtain the time domain waveform: s(n)=IFFT(S_col(f)), N=0,......,79. Calculate the power spectrum of the time domain waveform s(n): define the Hamming window w(n) with a length of 80, and define the array P

[80] to store the power spectrum result. Loop: for n=0,......,79: p(n)=s(n)×w(n), for f=0,......,79: P(f)=|IFFT(p(n))| 2 . Get the short-time Fourier transform power spectrum P(f) at time 100. Store the result P(f) in the array P

[100] and repeat the above process to get the short-time Fourier transform power spectrum at all times. The loop ends and an array P[t] of size 160 is obtained, where P[t] represents the short-time Fourier transform spectrum at time t. The output array P[t] is sent to the subsequent module to draw the time-frequency distribution diagram.

[0066] Input the short-time Fourier transform results P[t] of all moments, t=0, ..., 159, initialize a 160×80 two-dimensional array G to store the time-frequency distribution map, traverse the time t: for each t: take out the power spectrum P[t] at that moment, traverse the frequency f: G[t][f]=P[t][f], get the time-frequency distribution map G of size 160×80, draw G as a heat map: set the color mapping relationship. Traverse each point G[t][f] in G, set the color of the corresponding pixel according to its power value, draw the time t axis and the frequency f axis on the coordinate system, save and display the drawn time-frequency distribution map heat map, output the time-frequency distribution map G, and pass it to the subsequent feature extraction module.

[0067] Input the time-frequency distribution matrix G(t,f), t=0,……,159,f=0,……,79, initialize the feature matrix E(t,f) and H(band). Traverse the time t and frequency f: E(t,f)=G(t,f), directly take the value in the figure as the energy feature. Calculate the frequency band entropy feature: divide the frequency into M frequency bands, such as M=8. For each frequency band m=1,……,M: take out the data Gm(t,f) of the frequency band. Calculate the entropy of Gm: H(m)=-∑Gm(t,f)×log(Gm(t,f)), get H(1,……,8). Normalize the feature matrices E and H, store the extracted energy feature matrix E(t,f) and entropy feature H(band), and send the output to the feature fusion module. Input the energy feature matrix E1HK of K signal frames. Initialize the matrices EF and HF for storing fusion features. Traverse each frame k: Ek is the energy feature matrix of the kth frame, Hk is the entropy feature vector of the kth frame. EF+=Ek, accumulate energy features, HF+=Hk, accumulate entropy features. Normalize the matrix EF and the vector HF. Get the final fusion energy feature matrix EF(t,f). And the entropy feature vector HF(band). Combine EF and HF in series to form the final feature data, store and output the final fusion features, and pass the feature data to the model training module for garbage filling amount prediction.

[0068] Install CentOS system on three edge physical servers and configure storage resources, such as mounting a 1TB hard disk for Ceph storage. Install Ceph software on three edge servers, configure ceph.conf, and specify Monitor and OSD nodes. Deploy CephMonitor on one server to provide monitoring and configure data storage mapping information. Deploy CephOSD service on the other two servers to provide disk space for Ceph storage cluster. Use Ceph command line tool to create storage pool, specify parameters such as the number of copies of the pool and data distribution rules. Verify that the edge Ceph cluster can work properly. The feature extraction module develops a client based on libcephfs, initializes the Ceph cluster connection, specifies the Monitor address, creates a storage object, fills in the extracted feature data, and calls ceph_put() API to write the object. The API encapsulates the object data as a Ceph protocol request. The client sends the request to the Monitor through TCP. The Monitor receives the request, parses the object name and storage mapping, and calls the ceph_object_map() function to find the OSDMapper. Monitor forwards the request to OSDMapper. Mapper receives the request and allocates a storage location for the object. Mapper returns a response containing the OSD mapping. Monitor sends the mapping response to the client. Based on the response, the client stores the object shards on the OSD.

[0069] Mapper receives the client write request and object name, calculates the data fingerprint fingerprint based on the object name hash, obtains the storage pool parameters: number of replicas, OSD weight, etc., and inputs the fingerprint and pool parameters to the CRUSH function. Input object fingerprint fingerprint = 10011010, the number of storage pool replicas is 2, and the OSD nodes are osd1, osd2, and osd3. Reverse the 3rd, 5th, and 7th bits of the fingerprint and map it to the initial osd1. According to the number of replicas 2, it is necessary to select another OSD, osd1 weight 5, osd2 weight 7, and osd3 weight 6. According to the weight ratio, osd3 is randomly selected as the second storage node, and the replica distribution is calculated: the first replica is stored in osd1, and the second replica is stored in osd3. osd1 and osd3 are on different servers to improve reliability. Mapper returns a response containing the [osd1, osd3] mapping. Client stores the two replicas in osd1 and osd3 respectively according to the mapping. The final output contains the object mapping of all replica OSDs. According to the CRUSH results, different replicas are stored on each OSD. The Mapper returns the mapping results to the Monitor, and the Client stores the object shards on the specified OSD according to the mapping. The Mapper calculates the object storage mapping based on CRUSH: [osd1, osd3], which is encapsulated as a PutObject request, including object data, pool name, and storage mapping. The Mapper sends a Put request to the Client through the librados interface. The Client receives the request and parses osd1 and osd3. The Client divides the object into multiple shards according to size. The Client sends a write request to osd1 to store some shards on osd1, and sends a write request to osd3 to store other shards on osd3. Osd1 and osd3 store the received object shards on their local disks, so that two complete copies of the object are stored in the Ceph pool. The training module uses librados to obtain objects from the pool, reads all shards from osd1 and osd3, reconstructs the object, and obtains complete feature data.

[0070] Figure 4This is an exemplary flow chart for predicting garbage capacity according to some embodiments of this specification, and predicting garbage capacity includes: inputting feature matrix A, inputting sequence X, shape is (batch_size, seq_len, model_dim), multi-head self-attention module: mapping X to Q, K, V matrices, each of size is (batch_size, seq_len, model_dim / n_heads), dividing Q, K, V into n_heads heads, each of size is (batch_size, seq_len, model_dim / n_heads), calculating Attention (Q, K, V) for each head, and obtaining output of (batch_size, seq_len, model_dim / n_heads), splicing the outputs of each head to obtain multi-head self-attention output (batch_size, seq_len, model_dim). Feedforward fully connected network: the first linear layer, the input and output size is (batch_size, seq_len, model_dim). ReLU activation, the second linear layer, the input and output are also (batch_size, seq_len, model_dim). The output is the encoder layer output. Input feature matrix A, size is (batch_size, seq_len, feature_dim), the first encoder layer, input A, output B1, size is (batch_size, seq_len, model_dim), the second encoder layer, input B1, output B2, size is (batch_size, seq_len, model_dim), the third encoder layer, input B2, output B3, size is (batch_size, seq_len, model_dim), the fourth encoder layer, input B3, output B4, size is (batch_size, seq_len, model_dim), the fifth encoder layer, input B4, output B5, size is (batch_size, seq_len, model_dim), the sixth encoder layer, input B5, output encoded feature matrix B, size is (batch_size, seq_len, model_dim). In this way, by stacking 6 identical encoder layers, we can learn the multi-layer abstract representation of the input feature matrix and output the final encoded feature B.

[0071] Input encoding feature B, shape is (batch_size, seq_len, model_dim), multi-head self-attention module: map B to Q, K, V matrices, split into 4 heads for attention calculation, output shape is (batch_size, pred_len, model_dim). Sparse self-attention module: calculate the attention weight matrix W, shape = (pred_len, seq_len), set 50% of the elements of W to 0, get the sparse matrix Ws, use Ws for sparse attention, output shape is (batch_size, pred_len, model_dim). Feedforward fully connected network: two linear layers, ReLU activation, output shape is (batch_size, pred_len, model_dim). In this way, each layer of decoder realizes the decoding conversion of the encoding feature and outputs the prediction result. Input encoded feature B, size is (batch_size, seq_len, model_dim), the first decoder layer, input B, output C1, size is (batch_size, pred_len, model_dim), the second decoder layer, input C1, output C2, size is (batch_size, pred_len, model_dim), the third decoder layer, input C2, output C3, size is (batch_size, pred_len, model_dim), the fourth decoder layer, input C3, output C4, size is (batch_size, pred_len, model_dim), the fifth decoder layer, input C4, output C5, size is (batch_size, pred_len, model_dim), the sixth decoder layer, input C5, output prediction result C, size is (batch_size, pred_len, model_dim), by stacking 6 identical decoder layers, the final prediction result C can be gradually decoded and output.

[0072] The invention of the present application and its implementation methods are described schematically above. The description is not restrictive. Without departing from the spirit or basic features of the present application, the present application can be implemented in other specific forms. What is shown in the accompanying drawings is only one of the implementation methods of the invention of the present application. The actual structure is not limited to this, and any figure mark in the claims should not limit the claims involved. Therefore, if ordinary technicians in this field are inspired by it, without departing from the purpose of the present invention, they can creatively design structural methods and embodiments similar to the technical solution, which should all belong to the scope of protection of the present application. In addition, the word "including" does not exclude other elements or steps, and the word "one" before the element does not exclude the inclusion of "multiple" elements. The multiple elements stated in the product claim can also be implemented by one element through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any specific order.

Claims

1. A method for sensing urban garbage capacity, comprising: Ultrasonic sensors and weight sensors are set in urban garbage bins. The ultrasonic sensors calculate the filling height data of the garbage bins according to the echoes, and the weight sensors collect the weight data of the garbage bins to obtain the garbage capacity data. Using 5G networks, the collected garbage capacity data is transmitted to edge computing nodes; At the edge computing node, the collected garbage capacity data is preprocessed. The preprocessing includes: The filling height data is filtered by using the hyperbolic wavelet transform algorithm; the filtered filling height data is denoised by using the threshold method based on wavelet packet energy and entropy; the denoised filling height data is normalized by using the kernel function smoothing normalization method; and the collected weight data is converted into analog digital form; At the edge computing node, the matching pursuit transform algorithm is used to extract the features of the pre-processed garbage capacity data to obtain feature data; the features include the energy features and entropy features of the data; Using 5G network, the extracted feature data is transmitted from the edge computing node to the cloud server; On the cloud server, the garbage capacity is predicted using a pre-trained Transformer model based on the self-attention mechanism.

2. The method for sensing urban garbage capacity according to claim 1, characterized in that: The fill height data is filtered using a hyperbolic wavelet transform algorithm, including: The biorthogonal scaled Db4 wavelet is used as the wavelet basis function, and the wavelet transform matrix is ​​constructed according to the scale function and wavelet function of the wavelet basis function. The wavelet transform matrix includes a forward transform matrix and an inverse transform matrix. The collected filling height signal is input into the constructed forward transformation matrix, and the forward transformation result of the filling height signal under the Db4 wavelet basis is obtained as the wavelet coefficient through matrix multiplication operation; Set the wavelet coefficients smaller than the threshold to zero to obtain the wavelet coefficients after threshold processing; The inverse transformation matrix of the Db4 wavelet basis is used to inversely transform the wavelet coefficients after threshold processing, and the filtered filling height data is reconstructed.

3. The method for sensing urban garbage capacity according to claim 2, characterized in that: The kernel function smoothing normalization method is used to normalize the denoised filling height data, including: The cubic sparse Gauss kernel function is used as the normalized kernel function.

4. The method for sensing urban garbage capacity according to claim 3, characterized in that: Get feature data, including: The pre-processed filling height data and weight data are frame segmented using an orthogonalized Hanning window to obtain multi-frame filling height signals and weight signals; For each frame of filling height signal and weight signal, Stockwell transformation is performed respectively, and a time-frequency plane coordinate system is constructed; wherein the time domain coordinate is the signal time t, and the value range of t is 0 to the duration of the corresponding frame signal; the frequency domain coordinate is the signal frequency f, and the value range of frequency f is 0 to the maximum frequency value of the corresponding frame time-frequency distribution diagram; By sliding and expanding the Gaussian window on the constructed time-frequency plane coordinate system of each frame, the short-time Fourier transform value at each time t is calculated to obtain the spectrum information of the filling height signal and the weight signal of each frame at each time t; According to the calculated short-time Fourier transform values, the time-frequency distribution diagram of the filling height signal of each frame and the time-frequency distribution diagram of the weight signal of each frame are constructed respectively.

5. The method for sensing urban garbage capacity according to claim 4, characterized in that: Get feature data, including: According to the time-frequency distribution diagram of the filling height signal of each frame, the energy characteristics E of the filling height signal at each time t and frequency f are extracted. H (t,f), and the entropy characteristics H of the filling height signal in each frequency band H (band), where band represents the frequency band number, ranging from 1 to the total number of frequency bands N; According to the time-frequency distribution diagram of each frame weight signal, the energy characteristics E of the weight signal at each time t and frequency f are extracted. W (t,f) and the entropy characteristics H of the weight signal in each frequency band W (band); The energy characteristic E of the fill height signal H (t,f) and entropy characteristics H H (band), and the energy characteristic E of the weight signal W (t,f) and entropy characteristics H W (band) as feature data.

6. The method for sensing urban garbage capacity according to any one of claims 1 to 5, characterized in that: Edge computing nodes use Ceph distributed storage.

7. The method for sensing urban garbage capacity according to claim 6, characterized in that: Ceph distributed storage uses the CRUSH algorithm to calculate the distribution of storage data object fragments and maps the object fragments to different storage nodes according to the data replication strategy.

8. The method for sensing urban garbage capacity according to claim 5, characterized in that: Forecasting of waste volume, including: The extracted feature data is used as input into the pre-trained Transformer model; The position encoding algorithm is used to embed the position information of the input feature data, the time step information in the feature data is mapped to a position vector, and the position vector is superimposed with the corresponding feature data to form the feature data after position embedding as the input sequence; Perform a linear transformation on the input sequence to generate query vectors, key vectors, and value vectors; Multiple attention heads are calculated in parallel. Each attention head calculates the attention weight according to the query vector, key vector and value vector, and performs weighted summation on the value vector based on the attention weight to obtain the output vector of multiple attention heads. Concatenate the output vectors of multiple attention heads into a single vector as the fused feature vector; The multi-head self-attention mechanism is used to enhance the features of the fused feature vector, and the garbage capacity prediction value of the prediction time step is generated through autoregression in combination with the historical data of garbage capacity. According to the predicted value of garbage capacity and the preset threshold, the saturation state of the garbage bin is judged, and the saturation state judgment result and the predicted value of garbage capacity are output.

9. The method for sensing urban garbage capacity according to claim 8, characterized in that: The predicted garbage capacity value for the predicted time step is generated by autoregression, including: The garbage capacity historical data is embedded with position information through a position encoding algorithm to generate the position-embedded garbage capacity historical data, which is then input into the decoder of the Transformer model. In the first sub-layer of the decoder, the masked multi-head self-attention mechanism is used to extract features from the historical data of garbage capacity after position embedding to generate the first sub-layer output vector; the masked multi-head self-attention mechanism sets a mask matrix to prevent the decoder from noticing future information when generating the current time step pre-treatment value; The output vector of the first sub-layer and the fused feature vector output by the encoder are input into the second sub-layer of the decoder. The multi-head attention mechanism is used to perform feature interaction and fusion on the two input vectors to generate the output vector of the second sub-layer. The second sub-layer output vector is input into the third sub-layer of the decoder, nonlinearly transformed through the feed-forward neural network, and residually connected with the second sub-layer output vector, and then normalized by the layer to obtain the final output vector of the decoder; The final output vector of the decoder is transformed linearly and activated with softmax to generate the predicted probability distribution of garbage capacity at the current time step. Select the garbage capacity with the largest probability value from the predicted probability distribution as the predicted value of the garbage capacity at the current time step; The garbage capacity value predicted at the current time step is added to the end of the historical data sequence as the input for the next time step.

10. The method for sensing urban garbage capacity according to claim 9, characterized in that: The Transformer model based on the self-attention mechanism adopts the Transformer model based on the sparse self-attention mechanism, wherein the sparsity of the sparse self-attention mechanism ranges from 0.4 to 0.6.