Meat quality detection model compression method and system based on edge calculation

Through multimodal neural network modeling and hybrid precision quantization methods, combined with hardware-aware pruning and end-cloud collaborative reasoning, the dynamic and resource adaptability problems of meat quality detection model in edge computing scenarios are solved, and efficient and accurate meat quality detection is achieved.

CN120409564AInactive Publication Date: 2025-08-01SHANDONG RUICHENG DATA TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510487984.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-18
Publication Date
2025-08-01
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing meat quality detection models have problems such as insufficient dynamics of model structure, poor adaptability to compression and deployment, weak hardware perception capabilities, and lack of end-cloud collaboration mechanisms in edge computing scenarios, resulting in unstable detection accuracy and waste of resources.

Method used

Multimodal neural network modeling, hybrid precision quantization, hardware-aware pruning and end-cloud collaborative reasoning mechanisms are adopted to build a fusion structure including GhostNet and lightweight Transformer, combining hardware instruction set and confidence monitoring to achieve dynamic adjustment and efficient deployment of the model.

Benefits of technology

It improves the recognition accuracy and robustness of meat quality detection, reduces the consumption of inference resources, ensures that the model operates efficiently and stably in edge devices, and improves the system's prediction stability and adaptability through the end-cloud collaboration mechanism.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120409564A_ABST
    Figure CN120409564A_ABST
Patent Text Reader

Abstract

The invention discloses a meat quality detection model compression method and system based on edge calculation, and the method comprises the following steps: S1, collecting image and spectral data, and constructing a multi-modal training data set; s2, constructing a fusion model, and training to obtain a basic model; s3, keeping the basic model as a cloud model, and copying the basic model as a to-be-compressed model; s4, performing mixing precision quantification on the to-be-compressed model; s5, hardware sensing pruning processing is executed; s6, deploying the model to an edge device, and performing model acceleration configuration; s7, the edge device conducts reasoning and monitors the confidence degree in real time; and S8, when the confidence coefficient is low, uploading the data to the cloud for re-checking. According to the invention, efficient compression and deployment of the meat quality detection model on the edge equipment are realized, and the response speed and stability of the system are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of edge computing, and particularly to a method and system for compressing a meat quality detection model based on edge computing. Background Art

[0002] With the rapid development of computer vision and spectral detection technologies, intelligent detection methods for meat quality are gradually replacing traditional sensory evaluation and laboratory physical and chemical analysis methods that rely on manual experience. In industrial production scenarios, how to quickly and accurately identify the quality grade, tissue structure, and surface state of meat products has become a key link in food processing, supply chain management, and quality control. Currently, multi-modal perception detection technologies that integrate images and spectra have gradually become the mainstream direction, which can jointly model from two levels of apparent features and internal spectral responses to improve the comprehensiveness and accuracy of recognition.

[0003] Most traditional meat quality detection methods use single-modal models for modeling, either constructing a two-dimensional convolutional neural network based on images or designing a band feature extraction model based on spectral data. Such models can achieve preliminary recognition under single information conditions, but are prone to problems such as light changes, tissue occlusion, or frequency band redundancy in complex environments, resulting in unstable model prediction results or increased misjudgment rates. To make up for the deficiencies of single-modal, some studies have begun to try to introduce multi-modal deep learning structures, fuse image information and near-infrared spectra, etc., and input them into a neural network model, and achieve information fusion through a dual-path feature extractor and a fusion layer.

[0004] Although existing multi-modal fusion models have made certain progress in recognition accuracy, they generally have the following deficiencies: First, existing models mostly adopt a static structure design, and the network depth and calculation path are exactly the same during training and inference, and cannot dynamically adjust the model structure according to the complexity of different input images, resulting in the model still needing to call the complete inference path when processing simple samples, causing waste of computing power and being unable to adapt to the actual scenario of limited resources of edge devices. Second, most model structures lack optimization for edge deployment and do not introduce model compression, pruning, and quantization technologies, resulting in a large number of network parameters and calculation overheads, and being unable to be deployed and run on low-power chips or embedded platforms.

[0005] On the other hand, most existing model pruning and compression methods discriminate the importance of channels based on global statistical features, do not combine the instruction set compatibility and operator support range of the actual deployment platform, and cannot achieve structure optimization for the hardware architecture, resulting in the situation that the pruned model cannot run on the platform or has low running efficiency. At the same time, common model quantization strategies use unified bit-width compression during execution, lack precision sensitivity and channel importance discrimination, and are prone to causing model performance fluctuations, affecting the actual detection accuracy.

[0006] In addition, in edge computing scenarios, current model deployment solutions usually lack a dynamic response mechanism. When the model encounters low-confidence or high-uncertainty samples during the inference process, it cannot trigger cloud resources in a timely manner for rechecking inference, resulting in insufficient system prediction stability. Since most system architectures regard the edge model and the cloud model as two independent systems and lack a unified end-cloud collaborative mechanism designed as a whole, it is impossible to achieve dynamic balanced scheduling between accuracy and efficiency.

[0007] To sum up, although existing meat quality detection technologies have developed towards multi-modal fusion and deep learning, there are still significant deficiencies in terms of the dynamic nature of the model structure, adaptability to compression and deployment, edge hardware perception capabilities, and end-cloud collaborative mechanisms. There is a lack of an overall solution that takes into account detection accuracy, structural lightweightness, platform deployability, and system response intelligence. In particular, there is a lack of a model construction and compression method that is oriented to edge computing scenarios, can adaptively adjust the structure, and support platform-optimized pruning strategies. Therefore, there is an urgent need to provide a meat quality detection model compression method based on edge computing to achieve comprehensive capabilities of efficient inference, deployable operation, and accurate rechecking.

[0008] Therefore, how to provide a meat quality detection model compression method and system based on edge computing is an urgent problem to be solved by those skilled in the art. Summary of the Invention

[0009] An object of the present invention is to propose a meat quality detection model compression method based on edge computing. The present invention comprehensively adopts multi-modal neural network modeling, mixed-precision quantization, hardware-aware pruning, and end-cloud collaborative inference mechanisms, and systematically solves the problems of deployment and operation of high-precision detection models in resource-constrained edge devices, and has the advantages of dynamically adjustable structure, high deployment adaptability, rapid detection response, and recheckable inference results.

[0010] The meat quality detection model compression method based on edge computing according to an embodiment of the present invention includes the following steps:

[0011] S1. Collect image data and spectral data for meat quality identification, perform preprocessing, and construct a multi-modal training dataset;

[0012] S2. Based on the multi-modal training dataset, construct a neural network model including a fusion structure of GhostNet and lightweight Transformer, train the model, and obtain a basic model with meat quality identification capabilities;

[0013] S3. Keep the basic model as a high-precision cloud model, and at the same time copy the basic model as the model to be compressed;

[0014] S4. Perform mixed-precision quantization processing on the model to be compressed;

[0015] S5. Perform hardware-aware pruning on the quantized model to be compressed. Generate an operator compatibility list based on the instruction set of the target edge computing platform, identify structural areas in the model that are incompatible with the platform and prioritize pruning them. Set the pruning threshold based on the channel weight settings, and perform secondary pruning on the remaining channels.

[0016] S6. Deploy the quantized and pruned model to be compressed to an edge computing device, configure the model for acceleration based on the target platform, and form a lightweight inference model suitable for resource-constrained devices.

[0017] S7. Execute the model inference task in the edge device and monitor the confidence value of the inference result in real time;

[0018] S8. When the confidence value is lower than the preset threshold, the original input data is automatically uploaded to the cloud server, and the cloud-based high-precision model reviews and infers the data and outputs the final recognition result.

[0019] Optionally, the S2 specifically includes:

[0020] S21. Based on the data set, a fusion neural network model is constructed. The model consists of three parts: image branch, spectral branch and fusion sub-network;

[0021] S22, in the image branch, the input feature in the modality perception Ghost module is converted into the main feature f through the standard main branch convolution structure. m , generate the Ghost feature map f through the Ghost feature generation path g ;

[0022] S23, the normalized spectral vector output by the spectral branch generates the Ghost feature modulation weight R g ;

[0023] S24. Use the reconstruction weight to modulate the Ghost feature channel by channel and fuse it with the main feature to obtain the output feature map:

[0024] f out =f m +R g ⊙f g ;

[0025] Where ⊙ represents Hadamard channel-by-channel multiplication;

[0026] S26. Calculate the image complexity based on the gradient features of the input image, and generate a path control factor based on the image complexity:

[0027]

[0028] Among them, Sigmoid(·) is the activation function, γ is the structure control factor, β is the temperature adjustment coefficient, is the gradient map of the i-th image block, N is the number of image blocks, and τ is the complexity threshold;

[0029] S27, dynamically controlling the execution path of the Ghost module structure according to the value range of γ;

[0030] S28, the image branch and the spectral branch output two feature vectors respectively, and the modal collaborative attention mechanism is executed in the fusion sub-network to calculate the fusion weight, and the features are fused according to the fusion weight to obtain the final fusion feature output vector v fuse ;

[0031] S29. Input the fused feature vector into the classification module and train to obtain the basic model M0.

[0032] Optionally, the modality-aware Ghost module in S22 includes: a main branch convolution structure, a Ghost path structure, a spectral modulation path structure, and an optionally configured residual connection module and an attention enhancement module. The above path combination is dynamically enabled under the drive of different structural control factors to achieve complexity-driven reasoning path scheduling. The Ghost path structure requirements include:

[0033] At least one path uses a standard 1×1 point-by-point convolution operation to expand the main channel features;

[0034] At least one path uses average pooling operations plus channel repetition and dimensionality increase operations to achieve spatial compression and channel restoration;

[0035] At least one path uses 3×3 depthwise separable convolution or dilated convolution to increase the receptive field;

[0036] The output features of the three Ghost path structures are aggregated through the channel splicing operation to form the final Ghost feature map f g .

[0037] Optionally, in step S24, the weight matrix R used to modulate the Ghost feature in the fusion operation g With the input spectrum vector s ′ The relationship is dynamically generated by the learnable network structure and is updated synchronously during the model training process. The weight matrix is generated as follows:

[0038] R g =σ(W r ·s ′ +b r );

[0039] Where σ(·) is the Sigmoid function, W ris a trainable weight matrix, and b r is a bias vector.

[0040] Optionally, in step S27, when the path structure configurations corresponding to different intervals of the structure control factor γ satisfy the following constraints:

[0041] When γ < 0.33, only the standard main branch convolution structure is enabled, and all Ghost generation paths and modal modulation structures are skipped;

[0042] When 0.33 ≤ γ < 0.66, the main branch and half of the Ghost path structures are enabled, and all residual connection modules are disabled;

[0043] When γ ≥ 0.66, in addition to enabling all Ghost path structures, it also includes at least one attention module and residual convolution path for cross-scale feature enhancement to adapt to the high-expression ability modeling requirements of complex regions of the image structure.

[0044] Optionally, S4 specifically includes:

[0045] S41. Split the trained model M0 to be compressed into an image branch backbone module, a Ghost path module, a spectral modulation path module, and a fusion sub-network module, and execute a mixed-precision quantization configuration strategy according to the internal structure types of each module;

[0046] S42. For the convolution layers included in the main branch convolution module and the Ghost mapping path in the image branch, use integer quantization to perform INT8 format compression; for the linear mapping layer and the attention weight calculation layer in the fusion sub-network, use half-precision floating-point quantization to perform FP16 format compression;

[0047] S43. For each layer of computing nodes, according to the dynamic range and computational density of its floating-point representation tensor, execute a dynamic bitwidth allocation strategy, and use the following bitwidth control function to calculate the hierarchical quantization bitwidth b l :

[0048]

[0049] where Δ l represents the standard deviation of the weight tensor of the l-th layer, r l represents the number of output channels of the l-th layer, θ1 is the precision-sensitive threshold, ρ is the lower limit of the channel complexity scheduling, and b l is the quantization bitwidth finally used for this layer, and the value is 8 or 16;

[0050] S44. For the weight matrix R of the channel modulation layer containing the spectral modulation path g, retain its original FP16 format, do not perform bit-width compression, and maintain the modulation stability and spectral response linearity in the cross-modal path;

[0051] S45. Perform error reconstruction simulation testing on the quantized model, and respectively evaluate the cosine similarity of the feature output vectors v fuse before and after model compression. Set the threshold ∈ = 0.98. If:

[0052]

[0053] then confirm that the model quantization is qualified, where is the output of the uncompressed model, is the output of the compressed model.

[0054] Optionally, the S5 specifically includes:

[0055] S51. Generate an operator compatibility list based on the instruction set architecture of the target edge computing platform for deployment. The list includes instruction sets of convolution classes, normalization classes, and activation function classes supported by the platform;

[0056] S52. Parse the network structure diagram of the quantized model to identify the structural regions containing incompatible operator types, and construct a set of structurally incompatible regions;

[0057] S53. For each region in the set of structurally incompatible regions, combine the path category it belongs to: main branch path, Ghost path, or modulation path, and the influence degree on the final fusion vector v fuse after path fusion, and calculate the path pruning priority index:

[0058] P i = λ1·(1 - η i ) + λ2·δ i ;

[0059] where η i is the average decrease ratio of the prediction confidence on the validation set after pruning this path, δ i = 1 indicates that it contains incompatible operators, and λ1, λ2 are weight factors;

[0060] S54. Perform structural pruning according to the path pruning priority index. For the residual channel weight tensor W l of each convolutional layer, adaptively set the pruning threshold according to the channel statistical characteristics:

[0061] θ2 = μ l - α l ·σ l ;

[0062] where μ l is the mean of the channel L1 norm, σl is the standard deviation, and α l is the module sensitivity coefficient. Set α in the main branch path l = 2.5, and set α in the Ghost path l = 1.5, and set α in the modulation path l = 3.0;

[0063] S55. Perform channel-level secondary pruning on the channels where the L1 norm of the convolution kernel of the output channel is less than θ2, record the channel index. If the subsequent model prediction accuracy drops by more than the set tolerance range, activate the structure recovery gating function to restore the reconstructed values of the channels.

[0064] Optionally, S6 specifically includes: Deploy the pruned model to the edge computing device, perform model acceleration configuration in combination with the instruction set structure of the edge platform and the supported low-level precision calculation format, complete the initialization of the inference engine, and form a lightweight inference model suitable for resource-constrained devices.

[0065] Optionally, S8 specifically includes: Compare the confidence value with a preset confidence threshold. If the confidence value is lower than the threshold, trigger the end-cloud collaborative review mechanism, upload the image input data and spectral vector corresponding to the sample to the cloud server, and input them into the trained high-precision model. The high-precision model performs inference operations in the cloud, generates a reviewed prediction result, and uses the prediction category output by the cloud as the final recognition result. When the confidence value output by the edge model is higher than or equal to the threshold, directly use the edge inference result as the final recognition result and skip the cloud review step.

[0066] The meat quality detection model compression system based on edge computing includes the following modules:

[0067] The data construction module is used to collect image and spectral data, complete preprocessing, and construct a multi-modal training dataset;

[0068] The fusion modeling and training module is used to construct and train a basic model including an image branch, a spectral branch, and a fusion sub-network;

[0069] The compression and quantization module is used to perform mixed-precision quantization processing on the basic model to generate a deployable quantized model;

[0070] The hardware-aware pruning module is used to identify incompatible structures based on the platform instruction set and perform priority pruning, and perform channel-level secondary pruning;

[0071] The lightweight deployment module is used to deploy the compressed model to the edge device, complete the inference acceleration configuration and engine initialization;

[0072] An adaptive collaborative inference module is used to monitor the confidence level during edge inference. If the confidence level is lower than the threshold, the cloud model is uploaded for rechecking and inference.

[0073] The beneficial effects of the present invention are as follows:

[0074] (1) By introducing an image and spectral bimodal fusion network structure and designing a modal-aware Ghost module and a collaborative attention mechanism inside the model, the present invention realizes the deep coupling of image information and spectral features, effectively improves the recognition accuracy and robustness of meat quality detection in complex scenarios, and makes up for the problem of insufficient expression ability of traditional single-modal models.

[0075] (2) Based on the hardware instruction set of the deployment platform, the present invention constructs an operator compatibility list, and combines the path pruning priority index and the channel weight statistical features to propose a hardware-aware pruning method that takes into account both hardware executability and channel importance. Together with the mixed-precision quantization strategy, it effectively compresses the model size, reduces the consumption of inference resources, and ensures that the compressed model can run efficiently and stably on edge devices.

[0076] (3) During the edge inference process, the present invention introduces a confidence monitoring mechanism and establishes an edge-cloud collaborative inference process in combination with the high-precision cloud model, realizing the dynamic recheck processing of uncertain edge results. It not only improves the prediction stability and controllability of the overall system, but also achieves an adaptive balance between accuracy and efficiency, and is particularly suitable for industrial detection scenarios where edge resources are limited but high accuracy is required. Description of the Drawings

[0077] The drawings are used to provide a further understanding of the present invention, and constitute a part of the specification. They are used together with the embodiments of the present invention to explain the present invention, and do not constitute a limitation to the present invention. In the drawings:

[0078] Figure 1 is the overall flowchart of the meat quality detection model compression method based on edge computing proposed by the present invention;

[0079] Figure 2 is a schematic diagram of the structure of the modal-aware Ghost module of the meat quality detection model compression method based on edge computing proposed by the present invention;

[0080] Figure 3 is a schematic diagram of the structure of the meat quality detection model compression system based on edge computing proposed by the present invention. Detailed Embodiments

[0081] Now, the present invention will be further described in detail with reference to the drawings. These drawings are all simplified schematic diagrams, only showing the basic structure of the present invention in a schematic way, so they only show the components related to the present invention.

[0082] Reference Figures 1 - 3 , a method and system for compressing a meat quality detection model based on edge computing, including the following steps:

[0083] S1. Collect image data and spectral data for meat quality recognition, perform preprocessing, and construct a multi-modal training dataset;

[0084] S2. Based on the multi-modal training dataset, construct a neural network model containing a fusion structure of GhostNet and lightweight Transformer, train the model, and obtain a basic model with the ability to recognize meat quality;

[0085] S3. Retain the basic model as a high-precision model in the cloud, and at the same time copy the basic model as the model to be compressed;

[0086] S4. Perform mixed-precision quantization processing on the model to be compressed;

[0087] S5. Perform hardware-aware pruning on the quantized model to be compressed, generate an operator compatibility list based on the instruction set of the target edge computing platform, identify the structural areas in the model that are incompatible with the platform and give priority to pruning, set the pruning threshold with reference to the channel weight setting, and perform secondary pruning on the remaining channels;

[0088] S6. Deploy the model to be compressed after quantization and pruning to an edge computing device, and perform model acceleration configuration in combination with the target platform to form a lightweight inference model suitable for resource-constrained devices;

[0089] S7. Execute the model inference task on the edge device and monitor the confidence value of the inference result in real time;

[0090] S8. When the confidence value is lower than the preset threshold, automatically upload the original input data to the cloud server, and the high-precision model in the cloud performs recheck inference on the data and outputs the final recognition result.

[0091] The present invention provides a complete method for compressing a meat quality detection model based on edge computing, covering the entire process from multi-modal data collection, model construction and training, to model compression, quantization, pruning and deployment, and then to inference and end-cloud collaboration. Compared with the existing methods that only focus on model training or single compression methods, the present invention realizes the comprehensive compression and platform adaptation deployment of the model in a systematic way, ensuring high-efficiency operation in resource-constrained devices while still maintaining detection accuracy and model stability, and is suitable for industrial sites with high requirements for both detection efficiency and accuracy.

[0092] In this embodiment, the S2 specifically includes:

[0093] S21. Based on the dataset, construct a fusion neural network model, which consists of three parts: an image branch, a spectral branch, and a fusion sub-network;

[0094] S22. In the image branch, in the modality-aware Ghost module, the input features pass through the standard main branch convolutional structure to generate the main feature f m , and the Ghost feature map f g is generated through the Ghost feature generation path;

[0095] S23. Generate the Ghost feature modulation weight R g from the normalized spectral vector output by the spectral branch;

[0096] S24. Use the reconstruction weight to modulate the Ghost feature channel by channel and fuse it with the main feature to obtain the output feature map:

[0097] f out = f m + R g ⊙ f g ;

[0098] where ⊙ represents the Hadamard channel-wise multiplication;

[0099] S26. Based on the gradient features of the input image, calculate the image complexity, and generate a path control factor according to the image complexity:

[0100]

[0101] where Sigmoid(·) is the activation function, γ is the structure control factor, β is the temperature adjustment coefficient, is the gradient map of the i-th block of the image, N is the number of image blocks, and τ is the complexity threshold;

[0102] S27. Dynamically control the execution path of the Ghost module structure according to the value range of γ;

[0103] S28. The image branch and the spectral branch respectively output two feature vectors. In the fusion sub-network, perform the modality collaborative attention mechanism to calculate the fusion weight, and perform feature fusion according to the fusion weight to obtain the final fusion feature output vector v fuse ;

[0104] S29. Input the fusion feature vector into the classification module to train and obtain the basic model M0.

[0105] The present invention realizes the deep fusion of image and spectral features in the model structure by constructing a multi-modal neural network architecture including an image branch, a spectral branch, and a fusion sub-network, and introducing a modality-aware Ghost module. This structure not only improves the feature expression ability but also provides a modular basis for subsequent model compression and structural dynamic adjustment. Compared with traditional static single-modal models, the present invention can more effectively identify the differences in meat quality under complex tissue structures and multi-spectral characteristics, significantly improving the detection accuracy and robustness.

[0106] In this embodiment, the modality-aware Ghost module in S22 includes: a main branch convolution structure, a Ghost path structure, a spectral modulation path structure, and an optional residual connection module and attention enhancement module. The above path combinations are dynamically enabled under the drive of different structure control factors to achieve complexity-driven inference path scheduling. The Ghost path structure is required to include:

[0107] At least one path uses a standard 1×1 pointwise convolution operation to expand the main channel features;

[0108] At least one path uses average pooling operation plus channel repetition and dimension increase operations to achieve spatial compression and channel restoration;

[0109] At least one path uses 3×3 depthwise separable convolution or dilated convolution operations to increase the receptive field;

[0110] The output features of the 3 Ghost path structures are aggregated through channel concatenation operation to form the final Ghost feature map f g 。

[0111] The Ghost path structure of the present invention has made a structural innovation on the basis of the original GhostNet framework, designing three types of feature generation paths with complementary functions, including combinations of operators such as pointwise convolution, pooling and dimension increase, and depthwise separable convolution. By combining different receptive fields and channel compression strategies to enhance feature diversity, the model still has excellent feature modeling ability while maintaining an extremely low number of parameters. Compared with the fixed-channel lightweight model structure, the present invention has stronger structural expression ability and compression potential.

[0112] In this embodiment, in step S24, the weight matrix R g for modulating the Ghost features in the fusion operation ′ and the input spectral vector s

[0113] R g = σ(W r ·s ′ + br ));

[0114] wherein, σ(·) is the Sigmoid function, and W r is a trainable weight matrix, and b r is a bias vector.

[0115] In the present invention, a spectral guidance mechanism is introduced in the Ghost feature modulation process, and the normalized spectral vector is used as a dynamic modulation factor to participate in the feature map channel selection and weighting, effectively enhancing the cross-modal coupling ability. The modulation weights are generated by a learnable network and updated synchronously during the training process, which can adapt to the image feature adjustment corresponding to different spectral inputs. Compared with the existing artificial weights or static fusion methods, the present invention significantly improves the flexibility and matching of modal fusion and enhances the model adaptation ability.

[0116] In this embodiment, in step S27, when the path structure configurations corresponding to different intervals of the structure control factor γ satisfy the following constraints:

[0117] When γ < 0.33, only the standard main branch convolution structure is enabled, and all Ghost generation paths and modal modulation structures are skipped;

[0118] When 0.33 ≤ γ < 0.66, the main branch and half of the Ghost path structures are enabled, and all residual connection modules are disabled;

[0119] When γ ≥ 0.66, in addition to enabling all Ghost path structures, it also includes at least one attention module and a residual convolution path for cross-scale feature enhancement to adapt to the high-expression ability modeling requirements of complex regions of the image structure.

[0120] The present invention realizes the dynamic switching of the Ghost module path through the structure control factor, and designs the path structure configuration and the image complexity linkage as an interval response mechanism, which can automatically enable different combinations of structures with different depths and complexities according to the input during the model execution process. Compared with the traditional static structure, the present invention has the ability of "inference on demand", and can dynamically allocate computing resources according to the actual input in the edge deployment environment, achieving the optimal trade-off between accuracy and performance, and improving the inference efficiency and system energy efficiency ratio.

[0121] In this embodiment, S4 specifically includes:

[0122] S41. Split the trained model M0 to be compressed into an image branch backbone module, a Ghost path module, a spectral modulation path module, and a fusion sub-network module, and execute a mixed-precision quantization configuration strategy according to the internal structure types of each module;

[0123] S42. For the convolutional layers included in the main branch convolutional module and the Ghost mapping path in the image branch, perform INT8 format compression using integer quantization; for the linear mapping layer and the attention weight calculation layer in the fusion sub-network, perform FP16 format compression using half-precision floating-point quantization;

[0124] S43. For each layer of computing nodes, according to the dynamic range and computational intensity of its floating-point representation tensor, execute the dynamic bit-width allocation strategy, and calculate the hierarchical quantization bit-width b using the following bit-width control function l :

[0125]

[0126] where, Δ l represents the standard deviation of the weight tensor of the l-th layer, r l represents the number of output channels of the l-th layer, θ1 is the precision-sensitive threshold, ρ is the lower limit of channel complexity scheduling, and b l is the quantization bit-width finally used for this layer, and its value is 8 or 16;

[0127] S44. For the weight matrix R g of the channel modulation layer containing the spectral modulation path, retain its original FP16 format, do not perform bit-width compression, and maintain the modulation stability and spectral response linearity in the cross-modal path;

[0128] S45. Perform error reconstruction simulation testing on the quantized model, and respectively evaluate the cosine similarity of the feature output vectors v fuse before and after model compression. Set the threshold ∈ = 0.98. If:

[0129]

[0130] then confirm that the model quantization is qualified, where is the output of the uncompressed model, is the output of the compressed model.

[0131] In the quantization process of the present invention, a module-aware mixed-precision quantization strategy is adopted, different bit-width settings are used for different functional structures, and at the same time, the bit-width is adaptively allocated in combination with the tensor features of each layer, effectively reducing the model precision loss. In particular, the original precision is retained for the spectral modulation path to ensure the stability of the key modal cooperation mechanism. Compared with the traditional quantization method with a unified bit-width, the present invention significantly compresses the model scale while maintaining the prediction consistency and robustness of the model in multi-modal tasks.

[0132] In this embodiment, the S5 specifically includes:

[0133] S51. Generate an operator compatibility list based on the instruction set architecture of the target edge computing platform. The list includes instruction sets of convolution classes, normalization classes, and activation function classes supported by the platform;

[0134] S52. Parse the network structure diagram of the quantized model to identify the structural regions containing incompatible operator types, and construct a set of structurally incompatible regions;

[0135] S53. For each region in the set of structurally incompatible regions, combine its path category: main branch path, Ghost path, or modulation path and the influence degree on the final fusion vector v fuse after path fusion to calculate the path pruning priority index:

[0136] P i = λ1·(1 - η i ) + λ2·δ i ;

[0137] where η i is the average decrease ratio of the prediction confidence on the validation set after pruning this path, δ i = 1 indicates the inclusion of an incompatible operator, and λ1 and λ2 are weight factors;

[0138] S54. Perform structural pruning according to the path pruning priority index. For the residual channel weight tensor W l of each convolutional layer, adaptively set the pruning threshold based on the channel statistical characteristics:

[0139] θ2 = μ l - α l ·σ l ;

[0140] where μ l is the mean of the channel L1 norm, σ l is the standard deviation, and α l is the module sensitivity coefficient. Set α l = 2.5 in the main branch path, α l = 1.5 in the Ghost path, and α l = 3.0 in the modulation path;

[0141] S55. Perform channel-level secondary pruning on the channels whose L1 norm of the convolutional kernel satisfies the output channels and is less than θ2, record the channel index. If the prediction accuracy of the subsequent model drops by more than the set tolerance range, activate the structure recovery gating function to restore the reconstructed value of the channel.

[0142] The present invention proposes a hardware-aware pruning strategy that combines platform instruction sets, which can preferentially identify and prune operator paths that are incompatible with edge platforms, ensuring that the pruned model structure is deployable. And by setting the pruning threshold through the path pruning priority index and the module sensitivity difference, differential channel pruning is realized. Compared with traditional static rules or unified standard pruning strategies, the present invention improves the model compression ratio while significantly improving the deployability and execution efficiency of the compressed model.

[0143] In this embodiment, S6 specifically includes: deploying the pruned model to an edge computing device, performing model acceleration configuration in combination with the instruction set structure of the edge platform and the supported low-level precision calculation format, completing the initialization of the inference engine, and forming a lightweight inference model suitable for resource-constrained devices.

[0144] The present invention deploys the quantized and pruned model to an edge computing device, performs model acceleration configuration in combination with the instruction set and low-precision format supported by the platform, and constructs a lightweight inference model adapted to the target hardware resources. This model not only significantly reduces the storage and computing power requirements but also realizes efficient inference initialization on the edge side. Compared with the general model deployment method, the present invention has stronger system matching ability and is particularly suitable for practical industrial field applications with limited computing power and high response time requirements.

[0145] In this embodiment, S8 specifically includes: comparing the confidence value with a preset confidence threshold. If the confidence value is lower than the threshold, a terminal-cloud collaborative review mechanism is triggered, and the image input data and spectral vector corresponding to the sample are uploaded to the cloud server and input into the trained high-precision model. The high-precision model performs inference operations in the cloud, generates a reviewed prediction result, and uses the predicted category output by the cloud as the final recognition result. When the confidence value output by the edge model is higher than or equal to the threshold, the edge inference result is directly used as the final recognition result, skipping the cloud review step.

[0146] The present invention realizes the automatic identification of low-confidence samples and the dynamic triggering of cloud review inference by introducing a confidence judgment mechanism in the edge inference process, effectively ensuring the recognition reliability of the system in uncertain scenarios. This terminal-cloud collaborative mechanism not only improves the adaptive ability of the system but also avoids the ineffective consumption of cloud resources. Compared with traditional fixed inference schemes, the present invention improves the deployment flexibility and communication efficiency while ensuring the overall detection accuracy.

[0147] A meat quality detection model compression system based on edge computing includes the following modules:

[0148] A data construction module, which is used to collect image and spectral data, complete preprocessing, and construct a multi-modal training dataset;

[0149] A fusion modeling and training module for constructing and training a basic model including an image branch, a spectral branch, and a fusion sub-network;

[0150] A compression and quantization module for performing mixed-precision quantization processing on the basic model to generate a deployable quantized model;

[0151] A hardware-aware pruning module for identifying incompatible structures based on the platform instruction set and preferentially pruning, and performing channel-level secondary pruning;

[0152] A lightweight deployment module for deploying the compressed model to edge devices, completing inference acceleration configuration and engine initialization;

[0153] An adaptive collaborative inference module for monitoring the confidence level during edge inference, and uploading the cloud model for review inference if it is lower than the threshold.

[0154] The meat quality detection model compression system based on edge computing provided by the present invention realizes the efficient compression and rapid deployment of a high-precision model on edge devices by introducing a multi-modal fusion structure, a mixed-precision quantization strategy, and a hardware-aware pruning method. The modules of the system work together, which not only ensures the operability and inference efficiency of the model under resource-constrained conditions, but also improves the overall recognition accuracy and stability through an adaptive confidence monitoring and edge-cloud collaboration mechanism. Compared with the existing model compression systems that do not have structural adjustability and platform adaptability, the present invention has the advantages of high compression ratio, flexible deployment, fast inference response, and high detection accuracy, and is suitable for various industrial field environments such as food processing and supply chain quality inspection.

[0155] Example 1:

[0156] To verify the feasibility and advantages of the present invention in an actual industrial scenario, the "meat quality detection model compression method based on edge computing" described in the present invention is applied to the cutting workshop of a large meat processing factory in Jining, Shandong. It is deployed on the near-infrared spectroscopy + image acquisition integrated detection workstation in this workshop for real-time detection of the quality grade of pork cuts. This detection workstation is equipped with a high-definition industrial camera, a near-infrared spectroscopy sensor, and an edge computing module. The single-station daily production detection sample is about 4,300 pieces, and the operating environment has high humidity and large temperature changes, which requires high inference speed, stability, and deployability of the model.

[0157] In practical applications, first, a total of 36,290 sample data were collected through the data construction module, including 18,500 RGB image samples and 17,790 corresponding near-infrared spectral sequences. The collection time spanned spring and summer, covering three working states of strong, medium, and weak light. After performing preprocessing operations such as size normalization, noise removal, and spectral normalization on the original data, a multi-modal training dataset was constructed. This dataset was divided into a training set, a validation set, and a test set in a ratio of 7:2:1, and served as the basic data for subsequent model construction and compression.

[0158] Next, the system trained a fusion neural network model on the server. The model included an image branch (with GhostNet as the backbone), a spectral branch (constructed with a lightweight Transformer), and a fusion sub-network. By introducing a modality-aware Ghost module and a collaborative attention mechanism, a basic model was finally trained. The model size was 88 MB, and the accuracy reached 93.41% on the validation set. However, the model had a large number of parameters and could not be directly deployed to run on edge devices.

[0159] To achieve efficient deployment, the present invention adopted a mixed-precision quantization strategy to compress the model. The convolutional layers of the image branch were compressed using the INT8 format, and the key fully-connected layers in the spectral branch and the fusion sub-network were compressed using the FP16 format. The size of the quantized model was reduced to 42.3 MB. Further, in combination with the operator support situation of the target device, an instruction set compatibility list was established, and the paths where 21 incompatible operators were located were identified. Structure pruning was preferentially performed. On the basis of retaining the accuracy-sensitive paths, the pruning threshold was set according to the mean of the L1 norm of the channel weights minus twice the standard deviation, and the remaining channels were secondarily cropped. Finally, the model size was reduced to 18.7 MB, and the pruning rate reached 78.7%.

[0160] After deploying the compressed model to the platform, the system dynamically enabled different structural paths through an adaptive scheduling mechanism combined with an image complexity control parameter. In actual measurements, for the segmentation sample with low image texture clarity, the combination of the main branch convolution and part of the Ghost path was automatically selected for inference; for the highly complex sample with obvious interlacing of fat and lean meat, the complete Ghost path and the spectral modulation structure were enabled to ensure the recognition accuracy of complex regions.

[0161] During the inference process, the system continuously monitored the confidence of each prediction. When the confidence was lower than the set threshold of 0.82, the system automatically uploaded the corresponding image and spectral data to the cloud model for review. During the test period, a total of 57 end-cloud collaborations were triggered, all for samples with low edge confidence. The matching rate between the cloud review results and the true labels was 98.2%, effectively improving the recognition stability of the system for uncertain samples.

[0162] After 30 days of continuous operation, the detection effects of the traditional ResNet single-image model and the method of the present invention were compared, and key performance indicators such as inference latency, average accuracy, model size, number of cloud calls, etc. were recorded. The results are shown in the following table.

[0163] Table 1: Comparison experiment results table of the system of the present invention and the existing model

[0164]

[0165] As can be seen from Table 1, the fusion + compression + collaboration system proposed by the present invention shows obvious advantages over the traditional image model in multiple key performance indicators. In terms of inference latency, the average latency of the method of the present invention on the edge device platform is only 87.2 milliseconds, significantly lower than 234.5 milliseconds of the traditional ResNet-18 model, indicating that the mixed-precision quantization and hardware-aware pruning strategies adopted by the present invention effectively reduce the computational burden of the model and have stronger real-time response capabilities.

[0166] In terms of the model deployment size, the compressed model of the method of the present invention is only 18.7MB, much smaller than 43.2MB of the traditional model, reflecting a good balance between structure compression and accuracy retention, and facilitating deployment in environments with limited edge computing resources. In terms of recognition accuracy, the present invention reaches an accuracy of 93.12% after fusing image and spectral features, which is better than 88.54% of the traditional single-image model, indicating that the modality fusion and modulation mechanism can effectively enhance the model's recognition ability for complex organizational structures.

[0167] In terms of system stability, the inference path dynamic scheduling mechanism designed by the present invention reduces the model frame drop rate to 0.34%, while the traditional model has a frame drop rate as high as 2.67% in the face of high load or complex inputs, indicating that the present invention has higher edge execution stability. At the same time, the inference energy consumption is controlled at 4.1 watts, which is more energy-efficient than 6.5 watts of the traditional model and is suitable for long-term operation.

[0168] The present invention also introduces a confidence monitoring and edge-cloud collaboration mechanism, which triggers 57 cloud rechecks during the detection process to correct the edge low-confidence inference results, while the traditional model does not have this ability and cannot handle the recognition deviation of uncertain inputs. In terms of the false detection rate, the present invention remains at 2.41%, far better than 7.85% of the traditional model, indicating that its output results are more reliable and the false alarm and miss rate are significantly reduced.

[0169] Finally, in terms of the flexibility of the model structure, the present invention supports dynamic structure combination and can switch between three inference structures: simplified path, standard path, and enhanced path according to the image complexity, while the traditional model only has a fixed inference path and lacks structural adaptability and resource awareness capabilities.

[0170] In summary, the data in the table fully verifies the feasibility and superiority of the present invention in realizing model compression and deployment on edge devices, balancing fusion accuracy and inference efficiency, and the end-cloud collaboration strategy, and has significant engineering practical value and application prospects for promotion.

[0171] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention should cover equivalent replacements or changes made according to the technical solution and inventive concept of the present invention within the protection scope of the present invention.

Claims

1. A method for compressing a meat quality detection model based on edge computing, characterized in that It includes the following steps: S1. Collect image data and spectral data for meat quality identification, perform preprocessing, and construct a multi-modal training dataset; S2. Based on the multi-modal training dataset, construct a neural network model containing a fusion structure of GhostNet and lightweight Transformer, train the model, and obtain a basic model with meat quality identification ability; S3. Retain the basic model as a high-precision cloud model, and at the same time copy the basic model as the model to be compressed; S4. Perform mixed-precision quantization processing on the model to be compressed; S5. Perform hardware-aware pruning on the quantized model to be compressed, generate an operator compatibility list based on the instruction set of the target edge computing platform, identify the structurally incompatible regions in the model and preferentially prune them, set the pruning threshold with reference to the channel weight setting, and perform secondary pruning on the remaining channels; S6. Deploy the model to be compressed after quantization and pruning to an edge computing device, perform model acceleration configuration in combination with the target platform, and form a lightweight inference model suitable for resource-constrained devices; S7. Execute the model inference task on the edge device and monitor the confidence value of the inference result in real time; S8. When the confidence value is lower than the preset threshold, automatically upload the original input data to the cloud server, and the high-precision cloud model performs recheck inference on the data and outputs the final identification result.

2. The method for compressing a meat quality detection model based on edge computing according to claim 1, wherein The specific content of S2 includes: S21. Based on the dataset, construct a fusion neural network model, which includes three parts: an image branch, a spectral branch, and a fusion sub-network; S22. In the image branch, in the modal perception Ghost module, the input features pass through the standard main branch convolution structure to generate the main feature f m , and the Ghost feature map f is generated through the Ghost feature generation path g ; S23. Generate the Ghost feature modulation weight R from the normalized spectral vectors output by the spectral branch g ; S24. Use the reconstructed weight to modulate the Ghost features channel by channel and fuse them with the main features to obtain the output feature map: f out = f m + R g ⊙ f g ; Among them, ⊙ represents Hadamard channel-wise multiplication; S26. Calculate the image complexity based on the gradient features of the input image, and generate a path control factor according to the image complexity; where Sigmoid(·) is the activation function, γ is the structure control factor, and β is the temperature adjustment coefficient, is the gradient map of the i-th block of the image, N is the number of image blocks, and τ is the complexity threshold; S27. Dynamically control the execution path of the Ghost module structure according to the value range of γ; S28. The image branch and the spectral branch respectively output two feature vectors, perform modal collaborative attention mechanism calculation on the fusion weights in the fusion sub-network, and perform feature fusion according to the fusion weights to obtain the final fusion feature output vector v fuse ; S29. Input the fusion feature vector into the classification module and train to obtain the basic model M0.

3. The method for compressing a meat quality detection model based on edge computing according to claim 2, wherein The modality-aware Ghost module in S22 includes: a main branch convolution structure, a Ghost path structure, a spectral modulation path structure, and an optional residual connection module and attention enhancement module. The above path combinations are dynamically enabled under the drive of different structure control factors to achieve complexity-driven inference path scheduling. The requirements of the Ghost path structure include: At least one path uses a standard 1×1 pointwise convolution operation to expand the main channel features; At least one path uses average pooling operation plus channel replication and upsampling operations to achieve spatial compression and channel restoration; At least one path uses 3×3 depthwise separable convolution or dilated convolution operation to increase the receptive field; The output features of the three Ghost path structures are aggregated through a channel concatenation operation to form the final Ghost feature map f g .

4. The method for compressing a meat quality detection model based on edge computing according to claim 2, wherein In the step S24, the weight matrix R used to modulate the Ghost feature in the fusion operation g and the input spectral vector s ′ The relationship of is dynamically generated by a learnable network structure and updated synchronously during the model training process. The generation method of the weight matrix is as follows: R g = σ(W r · s ′ + b r ); where, σ(·) is the Sigmoid function, W r is the trainable weight matrix, b r is the bias vector.

5. The method for compressing a meat quality detection model based on edge computing according to claim 2, wherein In step S27, when the path structure configurations corresponding to different intervals of the structure control factor γ satisfy the following constraints: When γ < 0.33, only enable the standard main branch convolution structure and skip all Ghost generation paths and modality modulation structures; When 0.33 ≤ γ < 0.66, enable the main branch and half of the Ghost path structures, and disable all residual connection modules; When γ ≥ 0.66, in addition to enabling all Ghost path structures, it also includes at least one attention module and a residual convolution path for cross-scale feature enhancement to adapt to the high-expression ability modeling requirements of complex regions of the image structure.

6. The method for compressing a meat quality detection model based on edge computing according to claim 1, wherein The specific steps of S4 are as follows: S41: Split the trained model M0 to be compressed into an image branch backbone module, a Ghost path module, a spectral modulation path module, and a fusion sub-network module, and execute a mixed-precision quantization configuration strategy according to the internal structure types of each module; S42: For the convolutional layers included in the main branch convolutional module and the Ghost mapping path in the image branch, use integer quantization to perform INT8 format compression; for the linear mapping layer and the attention weight calculation layer in the fusion sub-network, use half-precision floating-point quantization to perform FP16 format compression; S43. For each layer of computing nodes, according to the dynamic range and computing intensity of its floating-point representation tensor, execute the dynamic bit-width allocation strategy, and calculate the hierarchical quantization bit-width b using the following bit-width control function l :[[-END]] Among them, Δ l represents the standard deviation of the weight tensor of the l-th layer, r l represents the number of output channels of the l-th layer, θ1 is the precision-sensitive threshold, ρ is the lower limit of the channel complexity schedule, b l is the quantization bit width finally used for this layer, and the value is 8 or 16; S44. For the channel modulation layer weight matrix R containing the spectral modulation path g , retain its original FP16 format, do not perform bit-width compression, and maintain the modulation stability and spectral response linearity in the cross-modal path; S45. Perform an error reconstruction simulation test on the quantized model, and respectively evaluate the cosine similarity of the feature output vectors v before and after model compression. Set the threshold ∈ = 0.

98. If: fuse the cosine similarity is greater than or equal to the threshold, it indicates that the model compression has little impact on the feature extraction ability of the model, and the compressed model can be used; otherwise, the model needs to be adjusted and compressed again. Then it is confirmed that the model quantization is qualified, where is the output of the uncompressed model, is the output of the compressed model.

7. The method for compressing a meat quality detection model based on edge computing according to claim 1, wherein The specific steps of S5 are as follows: S51: Generate an operator compatibility list based on the instruction set architecture of the target edge computing platform for deployment. The list includes instruction sets of convolutional classes, normalization classes, and activation function classes supported by the platform; S52: Parse the network structure diagram of the quantized model to identify the structural regions containing incompatible operator types, and construct a set of structurally incompatible regions; S53. For each region in the set of structurally incompatible regions, combine its path category: main branch path, Ghost path, or modulation path, and calculate the path pruning priority index based on the influence degree on the final fusion vector v fuse after path fusion: P i = λ1·(1 - η i ) + λ2·δ i ; where η i is the average decrease ratio of the prediction confidence on the validation set after pruning this path, δ i = 1 indicates the inclusion of incompatible operators, and λ1, λ2 are weight factors; S54. Perform structural pruning according to the path pruning priority index. For the residual channel weight tensor W of each convolutional layer l , adaptively set the pruning threshold based on the channel statistical features: θ2 = μ l -α l ·σ l ; Among them, μ l is the mean value of the channel L1 norm, σ l is the standard deviation, α l is the module sensitivity coefficient. In the main branch path, α l is set to 2.5, in the Ghost path, α l is set to 1.5, and in the modulation path, α l is set to 3.0; S55: Perform channel-level secondary pruning on the channels whose L1 norm of the convolutional kernels satisfies the output channels is less than θ2, record the channel indices, and if the prediction accuracy of the subsequent model drops by more than the set tolerance range, activate the structure recovery gating function to restore the reconstructed values of the channels.

8. The method for compressing a meat quality detection model based on edge computing according to claim 1, wherein The specific steps of S6 are as follows: Deploy the pruned model to the edge computing device, perform model acceleration configuration in combination with the instruction set structure of the edge platform and the supported low-precision computing formats, complete the initialization of the inference engine, and form a lightweight inference model suitable for resource-constrained devices.

9. The method for compressing a meat quality detection model based on edge computing according to claim 1, wherein The specific steps of S8 are as follows: Compare the confidence value with a preset confidence threshold. If the confidence value is lower than the threshold, trigger the end-cloud collaborative review mechanism, upload the image input data and spectral vector corresponding to the sample to the cloud server, and input them into the trained high-precision model. The high-precision model performs inference operations in the cloud to generate a reviewed prediction result, and use the prediction category output by the cloud as the final recognition result. When the confidence value output by the edge model is higher than or equal to the threshold, directly use the edge inference result as the final recognition result and skip the cloud review step.

10. A meat quality detection model compression system based on edge computing, which executes the meat quality detection model compression method based on edge computing according to any one of claims 1 to 9, characterized in that It includes the following modules: A data construction module for collecting image and spectral data, completing preprocessing, and constructing a multi-modal training dataset; A fusion modeling and training module for constructing and training a basic model including an image branch, a spectral branch, and a fusion sub-network; A compression and quantization module for performing mixed-precision quantization processing on the basic model to generate a deployable quantized model; A hardware-aware pruning module for identifying incompatible structures based on the platform instruction set and preferentially pruning, and performing channel-level secondary pruning; A lightweight deployment module for deploying the compressed model to the edge device, completing inference acceleration configuration and engine initialization; An adaptive collaborative inference module for monitoring the confidence during edge inference, and uploading the cloud model for review inference if it is lower than the threshold.

Citation Information

Cited By

  • Building material quality intelligent judgment device and method fused with edge calculation

    CN121563326A

  • Flame target detection method fusing channel statistic pruning and adaptive feature pyramid

    CN122049340A