Data processing and analysis method and system based on edge computing
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-29
- Publication Date
- 2026-08-11
AI Technical Summary
[0003]现有技术存在以下不足:在边缘计算节点与云端分析中心之间的通信链路存在不可预测的丢包和拥塞时,如何确保从边缘节点提取的、具有稀疏分布的中间特征表示能够以低冗余开销的方式实现高可靠传输,从而避免因单一数据流丢失而导致整个分析任务失效
[0047] (1) By combining frequency domain sparse compression with adaptive random projection, the amount of data transmitted from edge nodes to the analysis center is reduced, which effectively alleviates the uplink bandwidth pressure in large-scale video surveillance scenarios.
Smart Images

Figure CN122554058A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of edge computing technology, and more specifically to data processing and analysis methods and systems based on edge computing. Background Technology
[0002] With the advancement of smart city construction, the coverage of video surveillance in public places (such as shopping malls, train stations, and subway stations) is constantly expanding. To analyze crowd density in real time and prevent safety incidents such as stampedes, edge computing nodes are typically deployed near surveillance cameras to perform preliminary processing of the video streams before uploading the analysis results or intermediate data to the cloud analysis center. Edge computing, by offloading computing tasks to the network edge closer to the data source, can reduce data transmission latency and alleviate cloud load.
[0003] The existing technology has the following shortcomings: when there is unpredictable packet loss and congestion in the communication link between edge computing nodes and cloud analysis centers, how can we ensure that the sparsely distributed intermediate feature representation extracted from edge nodes can be transmitted with high reliability in a low-redundancy manner, so as to avoid the failure of the entire analysis task due to the loss of a single data stream? Summary of the Invention
[0004] The purpose of this invention is to provide a data processing and analysis method and system based on edge computing to solve the problems mentioned above.
[0005] The objective of this invention can be achieved through the following technical solutions:
[0006] Data processing and analysis methods based on edge computing include the following steps:
[0007] S1: Collect video streams from the monitored area, and perform primary feature extraction on the video frames by edge computing nodes to obtain intermediate feature representations with sparse distribution;
[0008] S2: Transform the intermediate feature representation to the frequency domain, retain the preset proportion frequency domain coefficient with the largest amplitude and its corresponding position index, discard the remaining frequency domain coefficients, and generate the first compressed data;
[0009] S3: Linear projection of the intermediate feature representation using a random measurement matrix is used to obtain a sequence of measurement values. The sequence of measurement values is then entropy-encoded to generate a second redundant data with a smaller data volume than the intermediate feature representation.
[0010] S4: Interleave and encapsulate the first compressed data and the second redundant data according to the synchronization timestamp to generate a composite transmission frame, and send the composite transmission frame to the analysis center through the communication link;
[0011] S5: The analysis center prioritizes using the first compressed data to perform inverse frequency domain transformation to reconstruct intermediate features. If the first compressed data is lost or damaged, iterative matching of the second redundant data with the preset sparse basis is used to reconstruct intermediate features, and the reconstructed intermediate features are input into subsequent analysis tasks.
[0012] As a further aspect of the present invention: S1 specifically includes:
[0013] The video frames are subjected to adjustable filtering in multiple directions to obtain edge response maps in each direction;
[0014] For each spatial location, only the direction with the largest response value and its response amplitude are retained, while the response amplitudes of the other directions are set to zero, resulting in a sparsed multi-directional edge response as an intermediate feature representation.
[0015] As a further aspect of the present invention: S2 specifically includes:
[0016] After transforming the intermediate feature representation to the frequency domain, multiple frequency band regions are divided according to frequency from low to high. All frequency domain coefficients are retained for the lowest frequency band region, and the mean amplitude of the coefficients in each of the other high frequency band regions is calculated. Only coefficients with amplitudes greater than the mean amplitude and their position indices are retained, while the rest of the coefficients are discarded.
[0017] As a further aspect of the present invention: the generation of the first compressed data specifically includes:
[0018] For the frequency domain coefficients retained in each high frequency band region, sort them from largest to smallest amplitude, calculate the amplitude difference between the current coefficient and the previous coefficient in turn, and perform exponential Golomb coding on the amplitude difference.
[0019] The position indices corresponding to the retained frequency domain coefficients are encoded using run-length encoding according to the frequency domain scanning order. The encoded difference sequence and the run-length sequence are then alternately arranged to form the first compressed data.
[0020] As a further aspect of the present invention: S3 specifically includes:
[0021] The intermediate feature representation is divided into multiple non-overlapping spatial blocks, and the local gradient energy of the response value in each spatial block is calculated.
[0022] Based on the local gradient energy, the corresponding sub-matrix is selected from multiple pre-generated random measurement sub-matrixes of different dimensions, and linear projection is performed on each spatial block to obtain the measurement sub-sequence of the corresponding length.
[0023] All measurement subsequences are spliced together in block order to form a measurement value sequence.
[0024] As a further aspect of the present invention: the process of acquiring the second redundant data is as follows:
[0025] Subtracting each adjacent measurement value in the measurement value sequence sequentially yields the difference sequence;
[0026] The run length of zero values in the statistical difference sequence is calculated, and the run length of zero values is encoded using unary code.
[0027] The encoded run-length codeword and the difference codeword are alternately arranged in the original order, and a fixed end codeword is added to the end of the sequence to form a second redundant data.
[0028] As a further aspect of the present invention: S4 specifically includes:
[0029] Using the synchronization timestamp as the initial seed, a set of pseudo-random interleaved position indices is generated;
[0030] The first compressed data is decomposed into a first data segment sequence, and the second redundant data is decomposed into a second data segment sequence;
[0031] According to the pseudo-random interleaving position index, the first data segment and the second data segment are alternately arranged in the composite transmission frame, and the generation parameters of the synchronization timestamp and the pseudo-random interleaving position index are written at the beginning position of the composite transmission frame.
[0032] As a further aspect of the present invention: the step of generating a set of pseudo-random interleaving position indices using the synchronization timestamp as the initial seed specifically includes:
[0033] The synchronization timestamp is split into a high-order bit group and a low-order bit group. The high-order bit group is loaded into a linear feedback shift register as the initial state, and the low-order bit group is mapped to a feedback tap mask.
[0034] The linear feedback shift register is driven to perform multiple shift operations, each shift outputting a pseudo-random bit, and the continuous outputs form a pseudo-random bit stream;
[0035] The pseudo-random bitstream is segmented according to a preset interleaving length. After numerical conversion of each bitstream segment, the modulus is taken to obtain the pseudo-random interleaving position index.
[0036] As a further aspect of the present invention: S5 specifically includes:
[0037] The second redundant data is used as the observation vector. The inner product of the observation vector and each basis vector in the preset sparse basis is calculated. The basis vector with the largest absolute value of the inner product is selected and added to the support set.
[0038] Update the current reconstructed vector using the basis vectors in the support set, and compute the residual vector;
[0039] The residual vector is used to replace the observation vector, and the selection and update process is repeated until the energy of the residual vector is lower than the preset threshold. The final reconstructed vector is then reconstructed as an intermediate feature.
[0040] Data processing and analysis systems based on edge computing include:
[0041] Data acquisition and extraction module: Acquires video streams from the monitored area, and performs primary feature extraction on the video frames by edge computing nodes to obtain intermediate feature representations with sparse distribution;
[0042] Frequency domain compression module: Transforms the intermediate feature representation to the frequency domain, retains the preset proportion frequency domain coefficient with the largest amplitude and its corresponding position index, discards the remaining frequency domain coefficients, and generates the first compressed data;
[0043] Projection coding module: The intermediate feature representation is linearly projected using a random measurement matrix to obtain a sequence of measurement values, and the sequence of measurement values is entropy encoded to generate second redundant data with a smaller data volume than the intermediate feature representation;
[0044] Interleaving and transmission module: interleaving and encapsulating the first compressed data and the second redundant data according to the synchronization timestamp to generate a composite transmission frame, and sending the composite transmission frame to the analysis center through the communication link;
[0045] Reconstruction Analysis Module: The analysis center prioritizes using the first compressed data to perform inverse frequency domain transformation to reconstruct intermediate features. If the first compressed data is lost or damaged, iterative matching is performed using the second redundant data and a preset sparse basis to reconstruct intermediate features, and the reconstructed intermediate features are input into subsequent analysis tasks.
[0046] The beneficial effects of this invention are:
[0047] (1) By combining frequency domain sparse compression with adaptive random projection, the amount of data transmitted from edge nodes to the analysis center is reduced, which effectively alleviates the uplink bandwidth pressure in large-scale video surveillance scenarios.
[0048] (2) A dual-redundant transmission mechanism is adopted. When the compressed data of the main path is lost or damaged due to network fluctuations, the intermediate features can be reconstructed immediately by using the second redundant data through iterative matching. This avoids the interruption of analysis caused by data loss and improves the robustness and availability of the early warning system. Attached Figure Description
[0049] The invention will now be further described with reference to the accompanying drawings.
[0050] Figure 1 This is a flowchart of the method of the present invention;
[0051] Figure 2 This is a system block diagram of the present invention. Detailed Implementation
[0052] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0053] Please see Figure 1 As shown, this invention is a data processing and analysis method based on edge computing, comprising the following steps:
[0054] S1: Collect video streams from the monitored area, and perform primary feature extraction on the video frames by edge computing nodes to obtain intermediate feature representations with sparse distribution;
[0055] S2: Transform the intermediate feature representation to the frequency domain, retain the preset proportion frequency domain coefficient with the largest amplitude and its corresponding position index, discard the remaining frequency domain coefficients, and generate the first compressed data;
[0056] S3: Linear projection of the intermediate feature representation using a random measurement matrix is used to obtain a sequence of measurement values. The sequence of measurement values is then entropy-encoded to generate a second redundant data with a smaller data volume than the intermediate feature representation.
[0057] S4: Interleave and encapsulate the first compressed data and the second redundant data according to the synchronization timestamp to generate a composite transmission frame, and send the composite transmission frame to the analysis center through the communication link;
[0058] S5: The analysis center prioritizes using the first compressed data to perform inverse frequency domain transformation to reconstruct intermediate features. If the first compressed data is lost or damaged, iterative matching of the second redundant data with the preset sparse basis is used to reconstruct intermediate features, and the reconstructed intermediate features are input into subsequent analysis tasks.
[0059] In S1, video streams of the monitored area are acquired, and edge computing nodes perform primary feature extraction on the video frames to obtain intermediate feature representations with sparse distribution, specifically including:
[0060] In an edge computing node, a digital camera first captures video streams of the monitored area. The edge computing node is an embedded processing unit containing a central processing unit with a clock frequency of 1.5 GHz and 2 gigabytes of memory. This embedded processing unit receives each frame of raw image data transmitted from the camera via a mobile industrial processor interface.
[0061] For each video frame, the edge computing node performs primary feature extraction. The first step of primary feature extraction is to perform adjustable filtering on the video frame in multiple different directions. Specifically, eight different directional angles are pre-set: 0 degrees, 22.5 degrees, 45 degrees, 67.5 degrees, 90 degrees, 112.5 degrees, 135 degrees, and 157.5 degrees. For each directional angle, a two-dimensional adjustable filter kernel is constructed. This filter kernel uses the first-order partial derivative of a Gaussian function, where the standard deviation of the Gaussian function is set to 1.5 pixels. The size of the filter kernel is set to 7 pixels by 7 pixels. The directional angle of the filter kernel is achieved through coordinate rotation transformation: the original coordinates of each pixel in the filter kernel are rotated according to the current directional angle, and then the first-order partial derivative of the Gaussian function at the rotated coordinates is calculated. For each directional angle, the constructed 7-pixel by 7-pixel filter kernel is convolved with the video frame in two dimensions. During the convolution operation, the center of the filter kernel is aligned with each pixel position in the video frame, and the sum of the products of the filter kernel coefficients and the corresponding pixel values is calculated to obtain the edge response value of that pixel position in that direction. For the boundary pixels of the video frame, a symmetrical padding method is used, that is, the boundary pixel values are copied outward to expand the image. After convolution in 8 directions, for each pixel position in the video frame, a response vector containing 8 values is obtained, each value corresponding to the edge response intensity of the pixel position in one direction.
[0062] The second step in the initial feature extraction is sparsification. For each spatial location (i.e., each pixel coordinate) in the video frame, the absolute values of the edge response values in the eight directions corresponding to that location are compared. The response value with the largest absolute value is found, and the direction angle corresponding to this maximum value is recorded. Then, among all eight response values at that location, only the response value in the direction recorded as the maximum value retains its original value, while the response values in the other seven directions are all set to zero. This operation is performed independently for each pixel location in the video frame. After the above processing, the original video frame is converted into a multi-directional edge response map. This response map has the same number of horizontal and vertical pixels as the original video frame, but each pixel location no longer stores the original grayscale or color value. Instead, it stores a sparse vector containing eight elements, in which only one non-zero element (i.e., the retained maximum edge response value) is stored, and the other seven elements are all zero. This multi-directional edge response map is the intermediate feature representation with a sparse distribution, serving as input data for subsequent steps. In this intermediate feature representation, the total number of non-zero elements does not exceed 8 times the total number of pixels in the video frame. However, since only one directional response is retained at each pixel position, the actual storage can be further compressed by using coordinate index and numerical pairs. For example, the directional number and response magnitude retained at each pixel position can be recorded, without storing the zero values of all 8 directions.
[0063] In S2, the intermediate feature representation is transformed to the frequency domain, retaining the frequency domain coefficients with the largest amplitude at a preset ratio and their corresponding position indices, while discarding the remaining frequency domain coefficients to generate the first compressed data, specifically including:
[0064] First, the intermediate feature representation is transformed from the spatial domain to the frequency domain. The intermediate feature representation is a two-dimensional data array, with its horizontal dimension denoted as width and its vertical dimension as height. Each data point represents the unique non-zero amplitude retained in the multi-directional edge response at a spatial location. A two-dimensional discrete cosine transform (DCT) is then performed on this two-dimensional data array. Specifically, for each frequency coordinate in the transformed frequency domain, the sum of the products of all spatial coordinates in the original data array and their corresponding cosine functions is calculated. The parameters of the cosine function are determined by the product of the spatial coordinates and the frequency coordinates, as well as a normalization factor. After the transformation, a frequency domain coefficient array with the same size as the original data array is obtained. Each coefficient in this array corresponds to a specific horizontal and vertical frequency, and the magnitude of the coefficient reflects the energy strength of that frequency component in the original intermediate feature representation. The coefficients located in the upper left corner of the array correspond to the lowest frequency components, with the frequencies gradually increasing towards the right and downward sides.
[0065] Secondly, the frequency domain coefficient array is divided into frequency band regions. The array is divided into multiple frequency band regions according to frequency from low to high. Specifically, a frequency radius parameter is set, with a positive integer value. For each coefficient in the frequency domain coefficient array, the sum of the squares of its horizontal and vertical frequency indices is calculated, and the square root is taken to obtain the frequency radius of that coefficient. Coefficients with a frequency radius in the interval [0, 2] are assigned to the lowest frequency band region; coefficients with a frequency radius in the interval [2, 4] are assigned to the first high-frequency band region; coefficients with a frequency radius in the interval [4, 6] are assigned to the second high-frequency band region; and so on, until the entire frequency radius range is covered. Within the lowest frequency band region, all frequency domain coefficients within that region are retained without any discarding. For each high-frequency band region (i.e., the first high-frequency band region, the second high-frequency band region, etc.), the following processing is performed: the absolute values of all frequency domain coefficients within that high-frequency band region are calculated, and the arithmetic mean of these absolute values is obtained. This mean is used as the amplitude mean threshold for that region. Then, each frequency domain coefficient within the high-frequency band is scanned, and the absolute value of the coefficient is compared with the mean amplitude threshold of the region. If the absolute value is greater than the threshold, the coefficient and its position index in the frequency domain are retained; if the absolute value is less than or equal to the threshold, the coefficient is discarded. The position index is represented by both the horizontal and vertical frequency values.
[0066] After completing the above coefficient retention and discarding, the retained frequency domain coefficients and their position indices need to be encoded into the first compressed data. First, for each high-frequency band region, the retained frequency domain coefficients are sorted in descending order of their absolute values. After sorting, a coefficient value sequence is obtained, denoted as sequence A. For the first coefficient in sequence A, its original value is directly retained. For each coefficient from the second to the next in sequence A, the difference between the current coefficient and the previous coefficient is calculated; this difference is a signed value. Then, exponential Golomb coding is performed on each difference. The specific process of exponential Golomb coding is as follows: add 1 to the absolute value of the difference, then calculate the number of bits in its binary representation, subtract 1 from this number, and use it as a prefix in unary code form. Then, use the binary representation of the difference (excluding the highest bit) as a suffix, and finally append a sign bit to the end depending on the sign of the difference. For the first coefficient in sequence A, its absolute value is directly added by 1, processed using exponential Golomb coding, and a sign bit is appended to the end.
[0067] Simultaneously, for all retained frequency domain coefficients (including all coefficients in the lowest frequency band and coefficients retained in each high frequency band), their position indices are extracted according to the frequency domain scanning order. The frequency domain scanning order adopts a zigzag scan, that is, starting from the upper left corner of the frequency domain coefficient array, moving alternately along the diagonal direction, traversing all frequency coordinates in sequence. After scanning, a position index sequence is obtained, and each position index is represented by a pair of integers (horizontal frequency value, vertical frequency value). Run-length encoding is performed on this position index sequence: traversing the sequence, whenever a consecutive identical horizontal frequency difference or vertical frequency difference is encountered, the number of repetitions of the identical value (i.e., the run length) is recorded, and this number of repetitions is represented in binary form. Finally, the encoded difference sequence and the encoded run-length sequence are alternately arranged in the original order, that is, the first difference codeword is placed first, then the first run-length codeword is placed, then the second difference codeword is placed, then the second run-length codeword is placed, and so on, until all data is arranged, forming the first compressed data. This first compressed data can be directly stored or transmitted.
[0068] In S3, a random measurement matrix is used to linearly project the intermediate feature representation to obtain a sequence of measurement values. This sequence is then entropy-encoded to generate second redundant data with a smaller data volume than the intermediate feature representation. Specifically, this includes:
[0069] First, the intermediate feature representation is divided into multiple non-overlapping spatial blocks in the spatial domain. The intermediate feature representation is a two-dimensional array, with its horizontal dimension denoted as width and its vertical dimension as height. A fixed block size is set, which is a positive integer, for example, 16 pixels by 16 pixels. Starting from the top left corner of the two-dimensional array, it is cut into several complete blocks in 16-pixel increments horizontally and vertically. If the array edge has less than 16 pixels, it is padded by copying the edge pixel values to reach the complete block size. Each spatial block contains 256 pixel positions, and each pixel position stores a value, which is the non-zero magnitude retained in the multi-directional edge response at that position.
[0070] For each spatial block, calculate the local gradient energy of all response values within that block. The specific calculation method is as follows: For each pixel within the block, its horizontal and vertical gradients need to be calculated. The horizontal gradient is obtained by subtracting the value of the left neighboring pixel from the value of the pixel to the right of the current pixel, and then dividing by 2. The vertical gradient is obtained by subtracting the value of the pixel above the current pixel from the value of the pixel below the current pixel, and then dividing by 2. For pixels on the block boundaries, virtual pixel values are supplemented using a symmetrical copying method. Let the horizontal gradient value of the current pixel be... The gradient value in the vertical direction is The gradient energy contribution value of this pixel is then... Then, the gradient energy contributions of all 256 pixels within the block are summed to obtain the local gradient energy of that block. .Right now:
[0071] ;
[0072] in, This indicates the index of the pixel within the block, with a value ranging from 1 to 256; Indicates the first The horizontal gradient value of each pixel; Indicates the first The vertical gradient value of each pixel. This local gradient energy. The energy value is a non-negative real number that reflects the intensity of local texture in the response value within the block: the larger the energy value, the more drastic the edge response changes within the block, and more measurement information needs to be retained; the smaller the energy value, the flatter the response value within the block, and fewer measurements can be used to represent it.
[0073] Before deploying edge computing nodes, multiple random measurement sub-matrices of different dimensions are generated offline in advance. Specifically, based on the block size (256 values) of the intermediate feature representation, a set of measurement length values is preset, for example, four different measurement length values: 32, 64, 128, and 256. The measurement length value represents the number of measurement values obtained after linear projection. For each measurement length value, a random measurement sub-matrix is constructed, with the number of rows equal to the measurement length value and the number of columns equal to the total number of pixels in the block, 256. Each element in the sub-matrix is independently randomly sampled from a standard normal distribution. After sampling, each column is normalized so that the magnitude of each column vector equals 1. After the above processing, four random measurement sub-matrices are obtained, denoted as the first sub-matrix, the second sub-matrix, the third sub-matrix, and the fourth sub-matrix, with the number of rows being 32, 64, 128, and 256 respectively, and the number of columns being 256 for each.
[0074] Simultaneously, a pre-defined correspondence between local gradient energy E and measurement length values is established. A large number of intermediate feature representation samples from historical scenarios are collected, and the local gradient energy of each block is calculated. The energy distribution range is statistically analyzed, and the energy values are divided into four intervals from smallest to largest: the first interval corresponds to energy values less than or equal to 100, the second interval corresponds to energy values greater than 100 and less than or equal to 400, the third interval corresponds to energy values greater than 400 and less than or equal to 1600, and the fourth interval corresponds to energy values greater than 1600. The first interval is associated with a random measurement submatrix with 32 rows, the second interval with a submatrix with 64 rows, the third interval with a submatrix with 128 rows, and the fourth interval with a submatrix with 256 rows.
[0075] For the currently processed spatial block, its local gradient energy E is compared with the four intervals mentioned above to determine the interval to which the block belongs, and thus the corresponding random measurement submatrix is selected. For example, if E is calculated to be 250, it falls into the second interval, and a random measurement submatrix with 64 rows is selected.
[0076] Expand the 256 response values within the current spatial block into a column vector in row-major order, denoted as . The length of this vector is 256. Let A be the selected random measurement submatrix, with m rows (32, 64, 128, or 256) and 256 columns. The linear projection process is then achieved through matrix-vector multiplication, yielding a measurement subsequence y with a length of mm. Specifically, the first... element The following formula is used to calculate: representing the th element in the block expansion vector.
[0077] ;
[0078] in, The value range is from 1 to m; The value range is from 1 to 256; Indicates the first random measurement submatrix selected from the selected random measurement submatrix. Line number Column elements; Represents the first element in the block expansion vector. Each element. The calculation process sequentially calculates each element. This yields a measurement subsequence of length m. The above process is repeated for each spatial block to obtain a corresponding set of measurement subsequences.
[0079] All spatial blocks are processed sequentially according to their original spatial arrangement (from left to right, from top to bottom). The measurement sub-sequences generated by each block are then concatenated in order to form a complete measurement value sequence. The total length of this measurement value sequence is equal to the sum of the lengths of all block measurement sub-sequences. The numerical range of the values in this measurement value sequence depends on the amplitude of the original response value and the element distribution of the random measurement sub-matrix, and is typically a floating-point number.
[0080] Entropy encoding is performed on the measured value sequence to further compress the data volume and generate a second redundant data. The specific steps are as follows.
[0081] The first step is to subtract each adjacent measurement value in the measurement value sequence sequentially to obtain the difference sequence. Specific steps: Let the measurement value sequence be... , where L is the total length of the measurement value sequence. Then the first element of the difference sequence is set to... The original value (i.e., retaining the original value) is equal to the t-th difference (t≥2). This results in a sequence of differences of length L, where most differences are likely close to zero, especially when the original measurements change gradually.
[0082] The second step is to count the run lengths of zero values in the difference sequence. Traverse the difference sequence, recording each non-zero value encountered; and recording the number of repetitions (i.e., run length) of consecutive zero values encountered. For example, in the difference sequence 5,0,0,−3,0,0,0,15,0,0,−3,0,0,0,1, the extracted non-zero differences are 5, -3, and 1, respectively, with corresponding zero run lengths of 0 (no zeros before 5), 2 (two zeros between 5 and -3), and 3 (three zeros between -3 and 1). Finally, record the run length of the last zero value (0 in this example). During encoding, pair the run length with the immediately following non-zero difference value.
[0083] The third step is to use Columbus exponential encoding for non-zero differences. The specific rules of Columbus exponential encoding are as follows: Let the absolute value of the non-zero difference be d. First, calculate the binary representation of d+1, and let its binary number of bits be b. Then, the encoding prefix consists of b-1 consecutive 1 bits followed by a 0 bit, and the suffix is the remaining bits after removing the highest bit from the binary representation of d+1. Then, depending on the sign of the original difference, append a sign bit to the end of the encoding: 0 for positive numbers and 1 for negative numbers. For example, if the difference is 3, then d=3, d+1=4, which is 100 in binary. The number of bits b=3, the prefix is two 1s followed by a 0 ("110"), the suffix is "00", the sign bit is 0, and the final encoding is "110000".
[0084] The fourth step is to encode the zero-value run length using unary codes. The rule for unary code encoding is: if the run length is r (r is a non-negative integer), the code consists of r consecutive 1 bits followed by a 0 bit. For example, if the run length is 2, the code is "110"; if the run length is 0, the code is "0".
[0085] The fifth step involves alternating the encoded run-length codewords and difference codewords in their original order. Specifically, the unary code for the first run-length is output first, followed by the Columbus exponent code for the first non-zero difference, then the unary code for the second run-length, then the Columbus exponent code for the second non-zero difference, and so on. If a zero-value run exists at the end of the difference sequence (i.e., consecutive zeros after the last non-zero difference), the unary code for that final run-length is output after the last non-zero difference codeword. Finally, a fixed end codeword is added to the end of the entire bitstream. This end codeword uses three consecutive 0 bits (i.e., "000") as a separator to identify the end of data during decoding. The resulting binary bit string is the second redundant data. The amount of this second redundant data is typically much smaller than the amount of data in the original measurement sequence, thus achieving compression.
[0086] In S4, the first compressed data and the second redundant data are interleaved and encapsulated according to the synchronization timestamp to generate a composite transmission frame, and the composite transmission frame is sent to the analysis center through the communication link. Specifically, this includes:
[0087] First, obtain the synchronization timestamp of the current processing moment. This synchronization timestamp is a 64-bit unsigned integer. Split this 64-bit integer into a high-order bit group and a low-order bit group: take the first 32 bits as the high-order bit group and the last 32 bits as the low-order bit group.
[0088] Then, a 32-bit linear feedback shift register is constructed. The 32-bit value of the high-order bits is directly loaded into the 32 memory locations of this register as its initial state. The 32-bit value of the low-order bits is mapped to a feedback tap mask: specifically, the first bit (least significant bit) of the low-order bits corresponds to the first tap position of the register, the second bit corresponds to the second tap position, and so on, with the 32nd bit corresponding to the 32nd tap position. If the value of a bit is 1, the tap corresponding to that bit participates in the feedback calculation; if it is 0, it does not participate.
[0089] The linear feedback shift register is driven to perform shift operations. Each shift operation includes the following steps: First, the tap positions involved in the feedback calculation are determined according to the feedback tap mask. The current bit values at these tap positions are XORed (i.e., modulo-2 addition) to obtain the feedback bit. Then, all bits in the register are shifted one bit to the right, with the highest bit filled with the feedback bit and the lowest bit shifted out. The shifted-out lowest bit is a pseudo-random bit output in this shift operation. The above shift operation is repeated, outputting one pseudo-random bit each time, until a pseudo-random bit stream of sufficient length is obtained. The length of the required bit stream is determined by the number of indices required for the subsequent interleaving process. Let N be the total number of fragments after the first compressed data and the second redundant data are decomposed. Each index requires an integer, usually represented by a 16-bit binary number. Therefore, N times 16 pseudo-random bits need to be output.
[0090] The obtained pseudo-random bitstream is segmented according to a preset interleaving length. The interleaving length is equal to the sum of the number of the first compressed data segments and the number of the second redundant data segments, denoted as the total number of segments N. Every 16 consecutive pseudo-random bits are grouped together, and the group is numerically converted: these 16 bits are treated as a binary integer, and its corresponding decimal value is calculated, ranging from 0 to 65535. Then, the modulus of this value is taken, with the modulus being the total number of segments N. The result is a pseudo-random interleaving position index, ranging from 0 to N-1. The above process is repeated for each 16-bit group to generate a pseudo-random interleaving position index sequence of length N. Each index value in this sequence indicates the source of the data segment (first compressed data segment or second redundant data segment) that should be placed at the corresponding position in the composite transmission frame.
[0091] The first compressed data is treated as a continuous binary bit string and decomposed into a first data segment sequence of fixed length. The fixed length is 512 bits, meaning each first data segment contains 512 bits. If the remaining bits are less than 512, they are padded with binary 0s to reach 512 bits. Similarly, the second redundant data is treated as a continuous binary bit string and decomposed into a second data segment sequence of the same fixed length of 512 bits. The total number of first data segments is denoted as P, and the total number of second data segments is denoted as Q.
[0092] Based on the pseudo-random interleaving position index sequence generated above, the data segment to be filled at each position in the composite transmission frame is determined sequentially. Specifically, for the i-th index value in the index sequence (i starts from 0), if the index value is less than the total number P of the first data segments, then the (index value + 1)-th segment of the first data segment sequence is filled at that position; if the index value is greater than or equal to P, then P is subtracted from the index value to obtain a new value, denoted as j; if j is less than the total number Q of the second data segments, then the (j + 1)-th segment of the second data segment sequence is filled at that position. In this way, the first and second data segments are alternately arranged to form the data payload part of the composite transmission frame.
[0093] The frame header information is written at the beginning of the composite transmission frame (i.e., before the first byte). The frame header information contains the following in sequence: first, the original synchronization timestamp (64-bit integer); then, the value of the low-order bit group (32 bits), which is one of the parameters for generating the pseudo-random interleaving position index; and finally, the total number P of the first data segment and the total number Q of the second data segment (each represented by a 16-bit integer). The total length of the frame header information is 64 + 32 + 16 + 16 = 128 bits.
[0094] The completed composite transmission frame (containing a frame header and data payload) is sent to the analysis center via a communication link. The communication link uses the User Datagram Protocol (UDP), with each composite transmission frame sent as an independent UDP datagram. During transmission, the edge computing node writes the binary data of the composite transmission frame into the transmission buffer of the network interface, which is then modulated by the physical layer before being sent. Upon receiving the composite transmission frame, the analysis center first parses the frame header to obtain the synchronization timestamp and generation parameters. Then, it uses the same linear feedback shift register to generate the same pseudo-random interleaved position index sequence, thereby recovering the original first compressed data and second redundant data by reversing the process.
[0095] In S5, the analysis center prioritizes using the first compressed data for inverse frequency domain transformation to reconstruct intermediate features. If the first compressed data is lost or corrupted, iterative matching of the second redundant data with a preset sparse basis is used to reconstruct intermediate features. The reconstructed intermediate features are then input into subsequent analysis tasks, specifically including:
[0096] After the analysis center receives the composite transmission frame and successfully decapsulates it to obtain the first compressed data and the second redundant data, it performs intermediate feature reconstruction. The analysis center prioritizes using the first compressed data for reconstruction. If the first compressed data is complete and verifiable, it performs an inverse frequency domain transform: decoding the first compressed data to recover the frequency domain coefficients and their position indices, setting the untransmitted frequency domain coefficients to zero, and then performing a two-dimensional inverse discrete cosine transform to obtain the reconstructed intermediate features. If the first compressed data is lost during transmission or verification fails, the second redundant data is used for reconstruction.
[0097] The specific process of reconstructing intermediate features using the second redundant data is as follows. The analysis center pre-stores a sparse basis. This sparse basis is constructed as follows: During the offline phase, a large number of intermediate feature representation samples from historical scenarios are collected. Each sample is a two-dimensional array, which is then expanded into a one-dimensional vector. All sample vectors constitute a training set. Principal component analysis is used to extract the first 256 principal components, each serving as a basis vector, resulting in a total of 256 basis vectors. The length of each basis vector is equal to the dimension of the expanded intermediate feature representation. These 256 basis vectors are arranged column-wise to form a matrix, which is the pre-set sparse basis. Each basis vector in the sparse basis is normalized to a magnitude of 1.
[0098] The reconstruction process employs an iterative matching pursuit algorithm. First, the second redundant data is decoded to recover the measurement sequence, which is taken as an observation vector with length M. An empty set is initialized as the support set to record the indices of the selected basis vectors. A reconstruction vector is initialized with all elements initially set to zero; its length is the same as the dimension of the expanded intermediate features. A residual vector is initialized with initial values equal to the observation vector.
[0099] Then, the iterative process is executed. In each iteration, the inner product of the current residual vector and each basis vector in the sparse basis is calculated. The inner product is calculated by multiplying the values at corresponding positions of the residual vector and basis vectors, and then summing all the products to obtain the inner product value. The absolute values of all inner products are recorded, and the inner product with the largest absolute value is selected. The index of the basis vector corresponding to this inner product is added to the support set. Next, using all the basis vectors in the support set, the reconstructed vector is updated using the least squares method: a set of coefficients is solved to minimize the sum of squared errors between the linear combination of basis vectors in the support set and the observed vector, and these coefficients are assigned to the corresponding index positions in the reconstructed vector. Then, the residual vector is recalculated: the observed vector is subtracted from the result of the linear combination of basis vectors in the support set according to the updated coefficients to obtain the new residual vector. The energy of the new residual vector is calculated, which is equal to the sum of squares of all elements in the residual vector. The energy of the residual vector is compared with a preset threshold, which is one-thousandth of the energy of the observed vector. If the energy of the residual vector is greater than or equal to the threshold, the next iteration continues; if it is less than the threshold, the iteration stops.
[0100] After the iteration, the final reconstructed vectors are rearranged according to the original two-dimensional array dimensions (height and width) to restore the two-dimensional intermediate feature representation. This reconstructed intermediate feature can then be input into subsequent crowd density analysis tasks, such as calculating crowd density maps or outputting early warning signals.
[0101] Please see Figure 2 As shown, the data processing and analysis system based on edge computing includes:
[0102] Data acquisition and extraction module: Acquires video streams from the monitored area, and performs primary feature extraction on the video frames by edge computing nodes to obtain intermediate feature representations with sparse distribution;
[0103] Frequency domain compression module: Transforms the intermediate feature representation to the frequency domain, retains the preset proportion frequency domain coefficient with the largest amplitude and its corresponding position index, discards the remaining frequency domain coefficients, and generates the first compressed data;
[0104] Projection coding module: The intermediate feature representation is linearly projected using a random measurement matrix to obtain a sequence of measurement values, and the sequence of measurement values is entropy encoded to generate second redundant data with a smaller data volume than the intermediate feature representation;
[0105] Interleaving and transmission module: interleaving and encapsulating the first compressed data and the second redundant data according to the synchronization timestamp to generate a composite transmission frame, and sending the composite transmission frame to the analysis center through the communication link;
[0106] Reconstruction Analysis Module: The analysis center prioritizes using the first compressed data to perform inverse frequency domain transformation to reconstruct intermediate features. If the first compressed data is lost or damaged, iterative matching is performed using the second redundant data and a preset sparse basis to reconstruct intermediate features, and the reconstructed intermediate features are input into subsequent analysis tasks.
[0107] The working principle of this invention is as follows: By acquiring video streams from a monitored area, edge computing nodes perform adjustable filtering on the video frames in multiple directions. Only the direction with the largest response value and its amplitude are retained at each pixel location, while the remaining directions are set to zero, resulting in an intermediate feature representation with a sparse distribution. This intermediate feature representation is then transformed to the frequency domain, dividing the frequency bands from low to high. All coefficients are retained for the lowest frequency band, and coefficients with amplitudes greater than the band average and their position indices are retained for each high-frequency band. The retained coefficients are then subjected to difference encoding, and the position indices are subjected to run-length encoding to generate the first compressed data. Simultaneously, the intermediate feature representation is divided into non-overlapping spatial blocks. The sum of the squares of the horizontal and vertical gradient energies of the pixels within each block is calculated as the local gradient energy. Based on this energy, corresponding sub-matrices are selected from pre-generated random measurement sub-matrices of different dimensions. Linear projection is performed on each block to obtain measurement sub-sequences, which are then concatenated into a measurement value sequence. The measurement value sequence is then subjected to adjacent difference, zero-value run-length statistics, Columbus exponential encoding for non-zero differences, and unary code encoding for run-length, generating the first compressed data. Two redundant data sets are used. The current synchronization timestamp is split into high-order and low-order bit groups. The high-order bits are loaded into a linear feedback shift register as the initial state, and the low-order bits are mapped to a feedback tap mask. The drive register outputs a pseudo-random bit stream and obtains a pseudo-random interleaving position index by segmenting and moduloing. The first compressed data and the second redundant data are decomposed into data segments of fixed length. The segments are arranged alternately according to the index and a frame header containing timestamps and generation parameters is added to form a composite transmission frame sent to the analysis center. The analysis center first decodes the first compressed data and performs inverse frequency domain transformation to reconstruct intermediate features. If the first compressed data is lost or damaged, the second redundant data is decoded to restore the observation vector. Iterative matching and tracking are performed using a preset sparse basis (obtained from principal component analysis of historical samples): the inner product of the observation vector and each basis vector is calculated, the basis vector with the largest absolute value is selected and added to the support set, the reconstructed vector is updated by least squares and the residual energy is calculated, and this process is repeated until the residual energy is less than one-thousandth of the energy of the observation vector. The final reconstructed vector is restored to the intermediate features for use in subsequent population density analysis tasks.
[0108] The foregoing has provided a detailed description of one embodiment of the present invention, but this description is merely a preferred embodiment and should not be construed as limiting the scope of the invention. All equivalent variations and modifications made within the scope of the claims of this invention should still fall within the patent coverage of this invention.
Claims
1. A method for data processing and analysis based on edge computing, characterized in that, Includes the following steps: S1: Collect video streams from the monitored area, and perform primary feature extraction on the video frames by edge computing nodes to obtain intermediate feature representations with sparse distribution; S2: Transform the intermediate feature representation to the frequency domain, retain the preset proportion frequency domain coefficient with the largest amplitude and its corresponding position index, discard the remaining frequency domain coefficients, and generate the first compressed data; S3: Linear projection of the intermediate feature representation using a random measurement matrix is used to obtain a sequence of measurement values. The sequence of measurement values is then entropy-encoded to generate a second redundant data with a smaller data volume than the intermediate feature representation. S4: Interleave and encapsulate the first compressed data and the second redundant data according to the synchronization timestamp to generate a composite transmission frame, and send the composite transmission frame to the analysis center through the communication link; S5: The analysis center prioritizes using the first compressed data to perform inverse frequency domain transformation to reconstruct intermediate features. If the first compressed data is lost or damaged, iterative matching of the second redundant data with the preset sparse basis is used to reconstruct intermediate features, and the reconstructed intermediate features are input into subsequent analysis tasks.
2. The data processing and analysis method based on edge computing according to claim 1, characterized in that, S1 specifically includes: The video frames are subjected to adjustable filtering in multiple directions to obtain edge response maps in each direction; For each spatial location, only the direction with the largest response value and its response amplitude are retained, while the response amplitudes of the other directions are set to zero, resulting in a sparsed multi-directional edge response as an intermediate feature representation.
3. The data processing and analysis method based on edge computing according to claim 1, characterized in that, S2 specifically includes: After transforming the intermediate feature representation to the frequency domain, multiple frequency band regions are divided according to frequency from low to high. All frequency domain coefficients are retained for the lowest frequency band region, and the mean amplitude of the coefficients in each of the other high frequency band regions is calculated. Only coefficients with amplitudes greater than the mean amplitude and their position indices are retained, while the rest of the coefficients are discarded. 4.The edge computing based data processing and analysis method of claim 1, wherein, The generation of the first compressed data specifically includes: For the frequency domain coefficients retained in each high frequency band region, sort them from largest to smallest amplitude, calculate the amplitude difference between the current coefficient and the previous coefficient in turn, and perform exponential Golomb coding on the amplitude difference. The position indices corresponding to the retained frequency domain coefficients are encoded using run-length encoding according to the frequency domain scanning order. The encoded difference sequence and the run-length sequence are then alternately arranged to form the first compressed data.
5. The edge computing based data processing and analysis method of claim 1, wherein, S3 specifically includes: The intermediate feature representation is divided into multiple non-overlapping spatial blocks, and the local gradient energy of the response value in each spatial block is calculated. Based on the local gradient energy, the corresponding sub-matrix is selected from multiple pre-generated random measurement sub-matrixes of different dimensions, and linear projection is performed on each spatial block to obtain the measurement sub-sequence of the corresponding length. All measurement subsequences are spliced together in block order to form a measurement value sequence.
6. The edge computing based data processing and analysis method of claim 1, wherein, The process of obtaining the second redundant data is as follows: Subtracting each adjacent measurement value in the measurement value sequence sequentially yields the difference sequence; The run length of zero values in the statistical difference sequence is calculated, and the run length of zero values is encoded using unary code. The encoded run-length codeword and the difference codeword are alternately arranged in the original order, and a fixed end codeword is added to the end of the sequence to form a second redundant data. 7.The edge computing based data processing and analysis method according to claim 1, characterized in that, S4 specifically includes: Using the synchronization timestamp as the initial seed, a set of pseudo-random interleaved position indices is generated; The first compressed data is decomposed into a first data segment sequence, and the second redundant data is decomposed into a second data segment sequence; According to the pseudo-random interleaving position index, the first data segment and the second data segment are alternately arranged in the composite transmission frame, and the generation parameters of the synchronization timestamp and the pseudo-random interleaving position index are written at the beginning position of the composite transmission frame. 8.The edge computing based data processing and analyzing method according to claim 7, characterized in that, The process of generating a set of pseudo-random interleaving position indices using the synchronization timestamp as the initial seed specifically includes: The synchronization timestamp is split into a high-order bit group and a low-order bit group. The high-order bit group is loaded into a linear feedback shift register as the initial state, and the low-order bit group is mapped to a feedback tap mask. The linear feedback shift register is driven to perform multiple shift operations, each shift outputting a pseudo-random bit, and the continuous outputs form a pseudo-random bit stream; The pseudo-random bitstream is segmented according to a preset interleaving length. After numerical conversion of each bitstream segment, the modulus is taken to obtain the pseudo-random interleaving position index. 9.The edge computing based data processing and analysis method of claim 1, wherein, S5 specifically includes: The second redundant data is used as the observation vector. The inner product of the observation vector and each basis vector in the preset sparse basis is calculated. The basis vector with the largest absolute value of the inner product is selected and added to the support set. Update the current reconstructed vector using the basis vectors in the support set, and compute the residual vector; The residual vector is used to replace the observation vector, and the selection and update process is repeated until the energy of the residual vector is lower than the preset threshold. The final reconstructed vector is then reconstructed as an intermediate feature.
10. A data processing and analysis system based on edge computing, characterized by, The data processing and analysis method based on edge computing according to any one of claims 1-9 includes: Data acquisition and extraction module: Acquires video streams from the monitored area, and performs primary feature extraction on the video frames by edge computing nodes to obtain intermediate feature representations with sparse distribution; Frequency domain compression module: Transforms the intermediate feature representation to the frequency domain, retains the preset proportion frequency domain coefficient with the largest amplitude and its corresponding position index, discards the remaining frequency domain coefficients, and generates the first compressed data; Projection coding module: The intermediate feature representation is linearly projected using a random measurement matrix to obtain a sequence of measurement values, and the sequence of measurement values is entropy encoded to generate second redundant data with a smaller data volume than the intermediate feature representation; Interleaving and transmission module: interleaving and encapsulating the first compressed data and the second redundant data according to the synchronization timestamp to generate a composite transmission frame, and sending the composite transmission frame to the analysis center through the communication link; Reconstruction Analysis Module: The analysis center prioritizes using the first compressed data to perform inverse frequency domain transformation to reconstruct intermediate features. If the first compressed data is lost or damaged, iterative matching is performed using the second redundant data and a preset sparse basis to reconstruct intermediate features, and the reconstructed intermediate features are input into subsequent analysis tasks.