Die-cutting machine tool bit positioning method based on embedded FOMO model
By pruning and quantizing the FOMO model, combined with image processing technology, the problems of unstable positioning accuracy and high resource consumption of the die-cutting machine head were solved, achieving a low-cost and high-precision positioning effect.
Patent Information
- Application Number
- CN202511796690.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-02
- Publication Date
- 2026-02-24
AI Technical Summary
Existing die-cutting machine cutter head positioning methods suffer from unstable positioning accuracy, low efficiency, high cost, and poor adaptability, especially in low-cost embedded devices where high-precision positioning is difficult to achieve.
An embedded FOMO model is used for pruning and quantization, combined with grayscale conversion, median filtering and contrast enhancement, and a moving average filtering algorithm is used to achieve lightweight image data processing and localization, reducing resource consumption and improving localization accuracy.
High-precision and fast tool head positioning was achieved on low-cost embedded devices, which improved the system's anti-interference ability and positioning stability, and reduced equipment costs and resource consumption.
Smart Images

Figure CN121564104A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automation control technology, and specifically to a die-cutting machine cutter head positioning method based on an embedded FOMO model. Background Technology
[0002] In the fields of packaging, printing and electronic auxiliary material processing, die-cutting machines are the core equipment for achieving precise cutting of flexible materials such as paper and film. The positioning accuracy of the cutter head directly determines the product size qualification rate and production efficiency, and is a key technical indicator affecting the level of die-cutting processing technology.
[0003] Currently, die-cutting machine blade positioning primarily employs a combination of mechanical limiting and manual calibration. First, a rough cutting range is preset, and then the operator manually adjusts the blade position by visually inspecting positioning marks on the paper. However, this positioning method is highly dependent on operator experience and is easily affected by factors such as visual fatigue or changes in ambient lighting, resulting in poor positioning stability. Furthermore, the positioning time for a single sheet of paper typically exceeds 5 seconds, leading to low efficiency and difficulty in completely eliminating positioning errors, resulting in a high product scrap rate. Therefore, the existing method cannot meet the high-speed and high-precision requirements of modern production lines.
[0004] With the development of automation technology, some die-cutting machines have begun to use photoelectric sensors for assisted positioning to improve automation levels. However, photoelectric sensors can usually only recognize positioning marks of specific shapes and colors, resulting in narrow adaptability. Moreover, photoelectric sensors are extremely sensitive to interference factors such as stains, wrinkles, and minor damage on the paper surface. Once there are even minor defects in the paper, it is easy to cause the sensor to misjudge or miss, leading to a high probability of positioning failure. Existing high-precision positioning methods based on deep learning, such as the YOLO model and Faster R-CNN model, can enhance anti-interference capabilities to some extent, but these models suffer from large parameter numbers and high computational complexity. The inference process must rely on high-performance equipment such as industrial computers, making it difficult to deploy on low-cost embedded microcontrollers. This not only significantly increases equipment investment costs but also limits the development of die-cutting machines in terms of miniaturization and low power consumption, making it difficult to meet the dual requirements of economy and integration in actual industrial scenarios. Summary of the Invention
[0005] To address the shortcomings of existing technologies, the present invention aims to provide a die-cutting machine cutter head positioning method based on an embedded FOMO model. This method addresses the problems of low image data processing efficiency, high resource consumption of positioning models, susceptibility to coordinate accuracy interference, and lack of intuitive assistance in manual judgment during the traditional die-cutting machine cutter head positioning process.
[0006] To achieve the above objectives, this invention provides a die-cutting machine cutter head positioning method based on an embedded FOMO model, characterized by the following steps:
[0007] Step 1: Prune and perform 8-bit integer quantization on the standard FOMO model to generate a lightweight FOMO model binary file. Parse the lightweight FOMO model binary file and store it in the Flash memory of the embedded microcontroller built into the die-cutting machine.
[0008] Step 2: Acquire a surface image of the paper to be cut using the die-cutting machine's camera. The surface image is set to 16-bit pixel RGB565 format to reduce the storage footprint and data transmission bandwidth of the embedded microcontroller built into the die-cutting machine. During acquisition, the embedded microcontroller of the die-cutting machine calculates the average 8-bit quantized brightness of the surface image of the paper to be cut in real time. Based on the average 8-bit quantized brightness of the surface image of the paper to be cut, the exposure time of the die-cutting machine's camera is dynamically adjusted. When the average 8-bit quantized brightness of the surface image of the paper to be cut is greater than 200, the embedded microcontroller shortens the exposure time to avoid overexposure. When the average 8-bit quantized brightness of the surface image of the paper to be cut is less than 80, the embedded microcontroller extends the exposure time to improve image clarity.
[0009] Step 3: Using the embedded microcontroller built into the die-cutting machine, perform grayscale conversion, median filtering for noise reduction, and contrast enhancement on the surface image of the paper to be cut to generate standardized grayscale image data;
[0010] Step 4: The lightweight FOMO model binary file, parsed and stored in the Flash memory of the embedded microcontroller built into the die-cutting machine, is called to perform positioning marker point recognition on the standardized grayscale image data. The pixel coordinates and confidence level of the positioning marker points for the paper to be cut are output. A confidence level threshold for the positioning marker points is set based on the positioning accuracy of the die-cutting machine's cutter head. When the confidence level of the positioning marker points is greater than the confidence level threshold, the pixel coordinates of the positioning marker points are marked as valid positioning marker point coordinates and stored as historical valid positioning marker point coordinate data. When the confidence level of the positioning marker points is less than or equal to the confidence level threshold, the pixel coordinates of the positioning marker points are marked as invalid positioning marker point coordinates and are not included in the historical data storage.
[0011] Step 5: Set the pixel deviation threshold of the effective positioning mark point coordinates of the paper to be cut according to the positioning accuracy of the die-cutting machine head. Based on the historically collected effective positioning mark point coordinate data, apply the moving average filtering algorithm to the buffer area of the embedded microcontroller built into the die-cutting machine to filter the historically collected effective positioning mark point coordinate data, remove outliers and calculate the mean, and output the processed positioning mark point coordinates.
[0012] Step 6: Generate a cutting initialization command based on the coordinates of the output positioning mark points, and drive the actuator of the die-cutting machine to complete the benchmark positioning of the cutting head on the positioning mark points of the paper to be cut.
[0013] Step 1 includes: pruning and integer quantization of the standard FOMO model based on the computing power and storage resource limitations of the embedded microcontroller built into the die-cutting machine; the standard FOMO model is a floating-point model without pruning and integer quantization, and its parameters and activation values are stored in 32-bit floating-point format; compressing the standard FOMO model parameters and activation values to 8-bit integer precision, converting the floating-point value f to the integer value q, using the 8-bit integer quantization formula:
[0014] s = (max{f} - min{f}) / 255
[0015] z = round(-min{f} / s)
[0016] q = round(s × f + z)
[0017] f = (qz) / s
[0018] Where max{f} and min{f} are the maximum and minimum floating-point values of a certain layer parameter or activation value of the standard FOMO model, respectively, s is the scaling factor, z is the zero point, and round(·) indicates rounding the floating-point value to the nearest integer.
[0019] After pruning and integer quantization of the standard FOMO model, the binary file size of the generated lightweight FOMO model is compressed to one-quarter of that of the standard FOMO model, and the inference speed is increased by 2 to 3 times. Using the TensorFlow Lite Micro inference framework for edge devices, the binary file of the generated lightweight FOMO model is parsed into inferenceable model instances and stored in the Flash memory of the embedded microcontroller built into the die-cutting machine.
[0020] The surface image of the paper to be cut in step 2 includes: paper edge contour information and preset positioning mark information; the preset positioning mark information includes positioning holes and feature color blocks on the paper to be cut, paper surface texture information, and ambient light reflection information; the surface image of the paper to be cut is stored in RGB565 format, with each pixel represented by a 16-bit binary number, the high 5 bits being the red channel component R, the middle 6 bits being the green channel component G, and the low 5 bits being the blue channel component B; the red channel component R is the surface image of the paper to be cut in RGB... The pixel values stored in RGB565 format are right-shifted by 11 bits and bitwise ANDed with 0x1F. The value range of the red channel component R is 0 to 31. The green channel component G is obtained by right-shifting the pixel values of the surface image of the paper to be cut in RGB565 format by 5 bits and bitwise ANDed with 0x3F. The value range of the green channel component G is 0 to 63. The blue channel component B is obtained by bitwise ANDing the pixel values of the surface image of the paper to be cut in RGB565 format with 0x1F. The value range of the blue channel component B is 0 to 31.
[0021] Step 3 includes: reducing the dimensionality of the surface image of the paper to be cut by using grayscale processing, thereby reducing the computational load on the embedded microcontroller built into the die-cutting machine. The grayscale processing is achieved by extracting the red channel component R, the green channel component G, and the blue channel component B of the surface image of the paper to be cut and calculating a weighted average. The grayscale processing formula is as follows:
[0022] I gray (x,y)=(38×R(x,y)+75×G(x,y)+15×B(x,y))>>7
[0023] Among them, I gray (x,y) represents the grayscale value at pixel coordinates (x,y) of the surface image of the paper to be cut after grayscale processing, where x is the horizontal coordinate of the pixel coordinate of the surface image of the paper to be cut, and y is the vertical coordinate of the pixel coordinate of the surface image of the paper to be cut.
[0024] The 3×3 median filtering method is used to remove surface stains and noise interference caused by wrinkles in the paper to be cut. The median filtering formula is as follows:
[0025] I med (x,y)=Med{I gray (x+i,y+j)∣(i,j)∈{-1,0,1}×{-1,0,1}}
[0026] Among them, I med(x,y) represents the pixel grayscale value of the surface image of the paper to be cut after grayscale processing and 3×3 median filtering. i is the horizontal coordinate offset and j is the vertical coordinate offset. The values of i and j both belong to the set {-1,0,1}, which together constitute a 3×3 neighborhood range centered on the pixel coordinate (x,y). Med{·} represents taking the median of the pixel grayscale value in the neighborhood of the pixel coordinate (x,y).
[0027] Through contrast enhancement processing, the grayscale difference between the positioning markers of the paper to be cut and the background on the paper is highlighted. Standardized grayscale image data is output, and linear stretching is used to enhance the contrast. The contrast enhancement formula is as follows:
[0028] I enh (x,y)=[(I med (x,y)-I min (x,y)) / (I max (x,y)-I min (x,y))]×255
[0029] Among them, I enh (x,y) represents the pixel grayscale value of the surface image of the paper to be cut after grayscale processing, 3×3 median filtering, and contrast enhancement processing. min (x, y) represents the minimum global pixel grayscale value of the surface image of the paper to be cut after grayscale processing and 3×3 median filtering. max (x,y) represents the global maximum pixel grayscale value of the surface image of the paper to be cut after grayscale processing and 3×3 median filtering.
[0030] Step 4 includes: setting the confidence threshold of the positioning mark point of the paper to be cut between 0.7 and 0.9; when the confidence of the positioning mark point of the paper to be cut is less than or equal to the confidence threshold, the die-cutting machine camera re-acquires the surface image of the paper to be cut, and the number of re-acquisitions does not exceed 3 times to avoid falling into an infinite loop; when the confidence of the positioning mark point of the paper to be cut is greater than the confidence threshold, the pixel coordinates of the positioning mark point of the paper to be cut are marked as valid positioning mark point coordinates; the confidence of the positioning mark point of the paper to be cut is stored in the non-volatile storage area of the Flash memory of the embedded microcontroller built into the die-cutting machine and is stored independently from the binary file of the generated lightweight FOMO model to avoid data read and write conflicts.
[0031] Step 5 includes: constructing a sliding window dataset in the buffer of the embedded microcontroller built into the die-cutting machine; the sliding window dataset contains N consecutive historically acquired valid positioning marker coordinate data, where N is a positive integer determined by the positioning accuracy of the die-cutting machine cutter head; calculating the mean of all historically acquired valid positioning marker coordinate data in the sliding window dataset, and defining the mean of the historically acquired valid positioning marker coordinate data as the initial reference coordinate data; comparing the deviation of each historically acquired valid positioning marker coordinate data in the sliding window dataset with the initial reference coordinate data; if the deviation of the historically acquired valid positioning marker coordinate data from the initial reference coordinate data exceeds the pixel deviation threshold of the valid positioning marker coordinates of the paper to be cut, set according to the positioning accuracy of the die-cutting machine cutter head, it is determined as an outlier and removed; after removing outliers, recalculating the mean of the remaining historically acquired valid positioning marker coordinate data in the sliding window dataset, and using the mean of the remaining historically acquired valid positioning marker coordinate data in the sliding window dataset as the final reference coordinates; converting the final reference coordinates into the number of pulses or position command parameters required to control the movement of the actuator.
[0032] This invention deeply integrates an embedded microcontroller with a lightweight FOMO model. While ensuring that the positioning accuracy of the die-cutting machine head meets the requirements of high-precision processing, it effectively reduces the storage and computing resource consumption of the embedded microcontroller built into the die-cutting machine, improves the efficiency of image data processing and positioning decision-making, and further ensures the accuracy of the head positioning results. It can be widely applied to various scenarios requiring high-precision die-cutting processing, such as packaging, printing, and electronic auxiliary material processing.
[0033] Compared with the prior art, the present invention has the following beneficial effects through the above-described technical solutions:
[0034] (1) By using grayscale, median filtering for noise reduction and contrast enhancement, paper features are accurately extracted, the system’s anti-stain and anti-wrinkle capabilities are improved, and the defects of low precision of traditional mechanical limit and large subjective error of manual visual inspection are effectively overcome, providing high-quality image support for subsequent recognition.
[0035] (2) A lightweight FOMO model with pruning and integer quantization is adopted to ensure efficient inference of the algorithm on embedded edge devices. By using a fused moving average filtering algorithm to remove coordinate outliers and converting the optimized coordinates into motor control commands in real time, the lag phenomenon of traditional methods is effectively eliminated, and the accuracy of tool head positioning and real-time response performance are significantly improved.
[0036] (3) By establishing a confidence threshold criterion and a fault-tolerant mechanism for re-acquiring positioning images, the system can intelligently identify and effectively deal with complex working conditions such as paper surface stains and blurred markings, thereby enhancing the adaptability and operational stability of the die-cutting machine in dynamic production environments and significantly reducing the risk of production interruption or product scrap due to positioning failure. Attached Figure Description
[0037] Figure 1 This is a flowchart of a die-cutting machine cutter head positioning method based on an embedded FOMO model according to the present invention;
[0038] Figure 2 This is a schematic diagram of pruning and integer quantization of the standard FOMO model of the present invention;
[0039] Figure 3 This is a flowchart of the location marker point coordinate processing method based on the moving average filtering algorithm of the present invention. Detailed Implementation
[0040] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application. The invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0041] In this embodiment, the die-cutting machine uses an ESP32-S3 N8R16 embedded microcontroller. The ESP32-S3 N8R16 embedded microcontroller, with its integrated 8MB Flash and 16MB PSRAM, is used to store the lightweight FOMO model, positioning data, and cache images and intermediate computation results, respectively. Furthermore, with its dual-core processor running at 240MHz, support for single-precision floating-point operations, and compatibility with the TensorFlow Lite Micro inference framework, the ESP32-S3 N8R16 embedded microcontroller not only acquires the necessary edge computing capabilities but also provides rich I / O... 2 The C and GPIO interfaces provide a solid foundation for peripheral connections. In this embodiment, the image acquisition function of the die-cutting machine is implemented by the OV2640 camera, which connects via I... 2The C interface connects to the ESP32-S3N8R16 embedded microcontroller, supporting image output at 320×240 resolution and RGB565 format, and dynamic adjustment of exposure time. The actuator consists of 42 stepper motors and a TB67S109 driver module. The ESP32-S3N8R16 embedded microcontroller sends precise pulse and direction signals to the TB67S109 driver module through GPIO ports, thereby controlling the operation of the 42 stepper motors and ultimately meeting the high-precision positioning requirements of the die-cutting machine head in this embodiment.
[0042] Figure 1 This is a flowchart of a die-cutting machine cutter head positioning method based on an embedded FOMO model according to the present invention. The die-cutting machine cutter head positioning method based on an embedded FOMO model according to the present invention includes the following steps:
[0043] Step 1:
[0044] Standard FOMO models typically have about 800KB of parameters, and both the parameters and activation values are stored and calculated in 32-bit floating-point format. This makes the inference process heavily reliant on high-performance computing devices, making it difficult to deploy in resource-constrained embedded environments. Figure 2 This diagram illustrates the pruning and integer quantization of the standard FOMO model in this invention. To adapt the standard FOMO model to ESP32-S3N8R16, the TensorFlow Model Optimization Toolkit is first used to prune the standard FOMO model according to the resource constraints of ESP32-S3 N8R16, removing redundant convolutional kernels to compress the number of parameters. Subsequently, the TensorFlow Lite Converter is used to convert the standard FOMO model according to the 8-bit integer quantization formula, thereby generating a lightweight FOMO model that can run efficiently at the edge. The 8-bit integer quantization formula is:
[0045] s = (max{f} - min{f}) / 255
[0046] z = round(-min{f} / s)
[0047] q = round(s × f + z)
[0048] f = (qz) / s
[0049] Where max{f} and min{f} are the maximum and minimum floating-point values of a certain layer parameter or activation value in the standard FOMO model, respectively, s is the scaling factor, z is the zero point, and round(·) indicates rounding the floating-point value to the nearest integer.
[0050] After pruning and integer quantization of the standard FOMO model, the binary file size of the generated lightweight FOMO model is compressed to one-quarter of that of the standard FOMO model, and the inference speed is increased to 2 to 3 times that of the original model. Subsequently, using the TensorFlow Lite Micro inference framework for edge devices, the binary file of the generated lightweight FOMO model is parsed into inferenceable model instances and stored in an independent partition address segment of the Flash memory of the ESP32-S3 N8R16.
[0051] Step 2:
[0052] The OV2640 camera equipped in this embodiment captures images of the surface of the A4 paper to be cut using the die-cutting machine. The image data is output in 16-bit RGB565 format, effectively saving storage resources and data transmission bandwidth of the die-cutting machine's built-in ESP32-S3 N8R16 embedded microcontroller. Each pixel is represented by a 16-bit binary number: the high 5 bits are the red channel component R, the middle 6 bits are the green channel component G, and the low 5 bits are the blue channel component B. The red channel component R is obtained by right-shifting the pixel value of the A4 paper surface image by 11 bits and performing a bitwise AND operation with 0x1F; the value range of the red channel component R is 0 to 31. The green channel component G is obtained by right-shifting the pixel value of the A4 paper surface image by 5 bits and performing a bitwise AND operation with 0x3F; the value range of the green channel component G is 0 to 63. The blue channel component B is obtained by bitwise AND operation with the pixel value of the A4 paper surface image by 0x1F; the value range of the blue channel component B is 0 to 31. The resolution of each frame is 320×240 pixels. To reduce the burden on the internal Flash resources of the ESP32-S3N8R16, the acquired surface image data of the A4 paper to be cut is directly cached in the external PSRAM. During image acquisition, the ESP32-S3 N8R16 microcontroller accesses the image data in the PSRAM in real time, extracts the R, G, and B components of each pixel, and calculates the 8-bit quantized average brightness value of the corresponding surface image of the A4 paper to be cut based on the weighted average value.
[0053] The ESP32-S3 N8R16 microcontroller dynamically adjusts the exposure time of the OV2640 camera based on the calculated 8-bit quantized average brightness of the surface image of the A4 paper to be cut, in order to optimize image quality. When the 8-bit quantized average brightness of the surface image of the A4 paper to be cut is greater than 200, the ESP32-S3 N8R16 microcontroller, through I... 2The C interface sends commands to the OV2640 to shorten the exposure time from the default 10ms to 5ms. When the average 8-bit quantized brightness of the surface image of the A4 paper to be cut is less than 80, the exposure time is extended to 20ms. If the average 8-bit quantized brightness of the surface image of the A4 paper to be cut is between 80 and 200, the 10ms exposure time is maintained. This exposure control mechanism can significantly avoid overexposure or underexposure of the image, ensuring that the acquired image can reliably extract the paper edge contour and preset positioning mark information in subsequent processing. The preset positioning mark information includes positioning holes and feature color blocks on the A4 paper to be cut, paper surface texture information, and ambient light reflection information, thereby meeting the visual requirements of high-precision cutting and detection of the die-cutting machine.
[0054] Step 3:
[0055] The die-cutting machine in this embodiment uses the built-in ESP32-S3 N8R16 microcontroller to perform grayscale conversion, median filtering for noise reduction, and contrast enhancement on the surface image of the A4 paper to be cut, generating standardized grayscale image data.
[0056] (1) Grayscale processing
[0057] Grayscale processing is used to reduce the dimensionality of the surface image of the A4 paper to be cut, thereby reducing the computational load on the ESP32-S3N8R16 microcontroller built into the die-cutting machine. Grayscale processing is achieved by extracting the red channel component R, green channel component G, and blue channel component B of the surface image of the A4 paper to be cut and calculating a weighted average. The grayscale processing formula is as follows:
[0058] I gray (x,y)=(38×R(x,y)+75×G(x,y)+15×B(x,y))>>7
[0059] Among them, I gray (x,y) represents the grayscale value at pixel coordinates (x,y) of the surface image of the A4 paper to be cut after grayscale processing. x is the horizontal coordinate of the pixel coordinate of the surface image of the A4 paper to be cut, and y is the vertical coordinate of the pixel coordinate of the surface image of the A4 paper to be cut.
[0060] (2) Median filtering for noise reduction
[0061] To suppress noise interference introduced by factors such as stains and wrinkles on the surface of the A4 paper to be cut, a 3×3 median filtering method is used to denoise the grayscale image. The median filtering formula is:
[0062] I med (x,y)=Med{I gray (x+i,y+j)∣(i,j)∈{-1,0,1}×{-1,0,1}}
[0063] Among them, I med (x,y) represents the pixel grayscale value of the surface image of the A4 paper to be cut after grayscale processing and 3×3 median filtering. i is the horizontal coordinate offset and j is the vertical coordinate offset. The values of i and j both belong to the set {-1,0,1}, which together constitute a 3×3 neighborhood range centered on the pixel coordinate (x,y). Med{·} represents taking the median of the pixel grayscale value in the neighborhood of the pixel coordinate (x,y).
[0064] (3) Contrast enhancement operation
[0065] Through contrast enhancement processing, the grayscale difference between the positioning markers for cutting the A4 paper and the background is highlighted. Standardized grayscale image data is output, and linear stretching is used to enhance contrast. Global contrast enhancement is performed on the filtered image. The contrast enhancement formula is as follows:
[0066] I enh (x,y)=[(I med (x,y)-I min (x,y)) / (I max (x,y)-I min (x,y))]×255
[0067] Among them, I enh (x,y) represents the pixel grayscale value of the surface image of the A4 paper to be cut, after grayscale processing, 3×3 median filtering, and contrast enhancement. min (x,y) represents the minimum global pixel grayscale value of the surface image of the A4 paper to be cut after grayscale processing and 3×3 median filtering. max (x,y) represents the global maximum pixel grayscale value of the surface image of the A4 paper to be cut after grayscale processing and 3×3 median filtering. The final output standardized grayscale image is fed into a lightweight FOMO model for inference and localization analysis.
[0068] Step 4:
[0069] The binary file of the lightweight FOMO model, parsed and stored in the Flash memory of the ESP32-S3 N8R16 microcontroller built into the die-cutting machine in this embodiment, is used to identify positioning markers in the standardized grayscale image data. The pixel coordinates and corresponding confidence scores of the positioning markers for the A4 paper to be cut are output. Based on the positioning accuracy of the die-cutting machine's cutter head, a confidence threshold for the positioning markers for the A4 paper to be cut is set, providing a basis for subsequent accurate positioning. Valid positioning markers are selected based on the confidence threshold, and the confidence scores of the valid positioning markers and the generated binary file of the lightweight FOMO model are stored independently in separate partitions. A re-acquisition fault-tolerance mechanism is also introduced to ensure the accuracy and robustness of the positioning process.
[0070] The specific implementation process is as follows: The ESP32-S3 N8R16 microcontroller triggers model inference instructions through the GPIO interface, reads the binary file of the lightweight FOMO model from a dedicated partition of the Flash memory, and loads it into the PSRAM inference cache. Subsequently, the standardized grayscale image data, after grayscale conversion, 3×3 median filtering for noise reduction, and contrast enhancement, is reconstructed according to the model input requirements, converting the original two-dimensional image into a 1×320×240×1 four-dimensional tensor format. In this format, the first dimension "1" represents the number of images in a single batch of inference, the second dimension "320" represents the number of pixels horizontally, the third dimension "240" represents the number of pixels vertically, and the fourth dimension "1" represents the number of grayscale channels. This conversion ensures that the input data perfectly matches the model input layer structure.
[0071] After dimensionality adjustment, the four-dimensional tensor is input into the lightweight FOMO model for inference. The model output includes the pixel coordinates (x0, y0) of the localization marker and the confidence score c0. Here, x0 and y0 represent the horizontal and vertical coordinates of the localization marker in the 320×240 image, respectively, with values ranging from x0∈[0,319] and y0∈[0,239]. The confidence score c0∈[0,1] reflects the model's degree of confidence that the localization marker is a true localization marker; the higher the value, the stronger the confidence.
[0072] Based on the positioning accuracy requirements of the die-cutting machine head in this embodiment, a confidence threshold τ is set for the positioning mark points of the A4 paper to be cut. c =0.82. If the confidence level c0 of the positioning markers for cutting A4 paper is greater than the confidence threshold τ of the positioning markers for cutting A4 paper, then... c The positioning marker is marked as a valid positioning marker, and the pixel coordinates (x0, y0) of the positioning marker are marked as valid positioning marker coordinates and used as historical valid positioning marker coordinate data; if the confidence level c0 of the positioning marker to be cut into A4 paper is less than or equal to the confidence level threshold τ of the positioning marker to be cut into A4 paper, then the positioning marker is marked as a valid positioning marker. cIf the pixel coordinates (x0, y0) of the positioning marker are deemed invalid, they will not be included in historical data storage, and a re-acquisition mechanism will be triggered. The ESP32-S3 N8R16 microcontroller will control the OV2640 camera to re-acquire the image, with a maximum of 3 retries. If a positioning marker with a confidence score higher than 0.82 is still not obtained after 3 retries, the system will report a positioning failure and suspend the cropping process to prevent continuous invalid identification from affecting production efficiency. In addition, to ensure data read and write security, the confidence scores of all valid positioning markers are stored in the non-volatile storage area of the Flash memory, independently of the binary file of the generated lightweight FOMO model, effectively avoiding read and write conflicts caused by simultaneous access and improving system stability.
[0073] Step 5:
[0074] Based on historically collected valid positioning marker coordinate data, in this embodiment, a moving average filtering algorithm is applied to the buffer of the ESP32-S3N8R16 microcontroller built into the die-cutting machine to filter the historically collected valid positioning marker coordinate data, remove abnormal coordinate values, calculate the mean, and output stable and reliable positioning marker coordinates. Figure 3 This is a flowchart of the location marker point coordinate processing method based on the moving average filtering algorithm of this invention.
[0075] The specific implementation process is as follows:
[0076] (1) Sliding Window Construction and Data Management: Based on the positioning accuracy requirements of the 42-stepper motor driven cutter head, the actual positioning error is less than or equal to ±0.01mm. The system constructs a sliding window queue of length N in the buffer of the ESP32-S3 N8R16 microcontroller to store the pixel coordinates of valid positioning marker points for multiple consecutive frames. Considering the cycle time and stability requirements of the die-cutting machine in this embodiment, the sliding window size is set to N=5, that is, the most recent 5 valid positioning results are retained. The sliding window adopts the first-in, first-out principle. When new valid positioning marker point coordinates are generated, they are automatically added to the end of the window, while the earliest set of data at the beginning is removed to ensure that the window always maintains the latest 5 sets of valid coordinates.
[0077] (2) Outlier identification and filtering: Calculate the initial mean of all coordinate data within the sliding window as a benchmark reference.
[0078]
[0079] Based on the mechanical repeatability positioning accuracy of the die-cutting machine head and the camera calibration parameters in this embodiment, a pixel deviation threshold δ for the effective positioning mark coordinates of the A4 paper to be cut is set. p = 3 pixels, then for each positioning marker point (x) within the window i ,yi ), calculate the location marker point (x) i ,y i ) and reference coordinates (x) base ,y base The Euclidean distance of ).
[0080]
[0081] If the positioning marker point (x) i ,y i The Euclidean distance d) i >δ p , that is, d i Values greater than 3 are considered outliers and removed. After outlier removal, the mean of the remaining M valid coordinates is recalculated to obtain the final baseline coordinates (x, y). * ,y * ), where M is a positive integer and M≤N.
[0082]
[0083] (3) Coordinate transformation and control command generation: The final reference coordinates (x) are transformed into control commands. * ,y * This is converted into the number of pulses required to control the movement of the actuator. Based on the die-cutting machine cutter head positioning accuracy in this embodiment, the pixel deviation threshold δ of the effective positioning mark coordinates of the A4 paper to be cut is... p =3 pixels, corresponding to an actual deviation ≤ ±0.015mm, which means 1 pixel corresponds to an actual distance of 0.005mm, i.e., pulse equivalent δ = 0.005mm / pulse. Combining the mechanical transmission parameters of the die-cutting machine in this embodiment and the step angle resolution of the 42-stepper motor, the formula for converting coordinates to pulse count is:
[0084]
[0085] Among them, P x P represents the number of X-axis motion pulses of the die-cutting machine cutter head. y Step is the number of Y-axis motion pulses of the die-cutting machine cutter head. res The step angle resolution of the 42-stepper motor is used to calculate the final pulse number parameter, which is then retained as an integer for motor drive control.
[0086] Step 6: Encapsulate the obtained final motor pulse count parameters into a cutting initialization command, and output it to the TB67S109 driver module through the GPIO interface of the ESP32-S3N8R16 microcontroller. This will drive the 42 stepper motors to move along the preset trajectory, and drive the cutter head to accurately reach the positioning mark reference position, thus completing the cutter head positioning closed-loop control.
[0087] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the concept and scope of the present invention. Various modifications and improvements made by those skilled in the art to the technical solutions of the present invention without departing from the design scheme of the present invention should fall within the protection scope of the present invention. The technical content for which protection is sought in the present invention has been fully described in the claims.
Claims
1. A die-cutting machine cutter head positioning method based on an embedded FOMO model, characterized in that, include: Step 1: Prune and perform 8-bit integer quantization on the standard FOMO model to generate a lightweight FOMO model binary file. Parse the lightweight FOMO model binary file and store it in the Flash memory of the embedded microcontroller built into the die-cutting machine. Step 2: Acquire a surface image of the paper to be cut using the die-cutting machine's camera. The surface image is set to 16-bit pixel RGB565 format to reduce the storage footprint and data transmission bandwidth of the embedded microcontroller built into the die-cutting machine. During acquisition, the embedded microcontroller of the die-cutting machine calculates the average 8-bit quantized brightness of the surface image of the paper to be cut in real time. Based on the average 8-bit quantized brightness of the surface image of the paper to be cut, the exposure time of the die-cutting machine's camera is dynamically adjusted. When the average 8-bit quantized brightness of the surface image of the paper to be cut is greater than 200, the embedded microcontroller shortens the exposure time to avoid overexposure. When the average 8-bit quantized brightness of the surface image of the paper to be cut is less than 80, the embedded microcontroller extends the exposure time to improve image clarity. Step 3: Using the embedded microcontroller built into the die-cutting machine, perform grayscale conversion, median filtering for noise reduction, and contrast enhancement on the surface image of the paper to be cut to generate standardized grayscale image data; Step 4: The lightweight FOMO model binary file, parsed and stored in the Flash memory of the embedded microcontroller built into the die-cutting machine, is called to perform positioning marker point recognition on the standardized grayscale image data. The pixel coordinates and confidence level of the positioning marker points for the paper to be cut are output. A confidence level threshold for the positioning marker points is set based on the positioning accuracy of the die-cutting machine's cutter head. When the confidence level of the positioning marker points is greater than the confidence level threshold, the pixel coordinates of the positioning marker points are marked as valid positioning marker point coordinates and stored as historical valid positioning marker point coordinate data. When the confidence level of the positioning marker points is less than or equal to the confidence level threshold, the pixel coordinates of the positioning marker points are marked as invalid positioning marker point coordinates and are not included in the historical data storage. Step 5: Set the pixel deviation threshold of the effective positioning mark point coordinates of the paper to be cut according to the positioning accuracy of the die-cutting machine head. Based on the historically collected effective positioning mark point coordinate data, apply the moving average filtering algorithm to the buffer area of the embedded microcontroller built into the die-cutting machine to filter the historically collected effective positioning mark point coordinate data, remove outliers and calculate the mean, and output the processed positioning mark point coordinates. Step 6: Generate a cutting initialization command based on the coordinates of the output positioning mark points, and drive the actuator of the die-cutting machine to complete the benchmark positioning of the cutting head on the positioning mark points of the paper to be cut.
2. The die-cutting machine cutter head positioning method based on an embedded FOMO model according to claim 1, characterized in that, Step 1 includes: Based on the computational power and storage resource limitations of the embedded microcontroller built into the die-cutting machine, the standard FOMO model is pruned and quantized using integer quantization. The standard FOMO model is a floating-point model without pruning or integer quantization, and its parameters and activation values are stored as 32-bit floating-point numbers. The standard FOMO model parameters and activation values are compressed to 8-bit integer precision, converting the floating-point value f to the integer value q. The 8-bit integer quantization formula is as follows: s = (max{f} - min{f}) / 255 z = round(-min{f} / s) q = round(s × f + z) f = (qz) / s Where max{f} and min{f} are the maximum and minimum floating-point values of a certain layer parameter or activation value of the standard FOMO model, respectively, s is the scaling factor, z is the zero point, and round(·) indicates rounding the floating-point value to the nearest integer. After pruning and integer quantization of the standard FOMO model, the binary file size of the generated lightweight FOMO model is compressed to one-quarter of that of the standard FOMO model, and the inference speed is increased by 2 to 3 times. Using the TensorFlow Lite Micro inference framework for edge devices, the binary file of the generated lightweight FOMO model is parsed into inferenceable model instances and stored in the Flash memory of the embedded microcontroller built into the die-cutting machine.
3. The die-cutting machine cutter head positioning method based on an embedded FOMO model according to claim 1, characterized in that, The surface image of the paper to be cut in step 2 includes: The information includes paper edge contour information and preset positioning mark information; the preset positioning mark information includes positioning holes and feature color blocks on the paper to be cut, paper surface texture information, and ambient light reflection information; the surface image of the paper to be cut is stored in RGB565 format, with each pixel represented by a 16-bit binary number, the high 5 bits being the red channel component R, the middle 6 bits being the green channel component G, and the low 5 bits being the blue channel component B; the red channel component R is obtained by right-shifting the pixel value of the surface image of the paper to be cut in RGB565 format by 11 bits and performing a bitwise AND operation with 0x1F, and the value range of the red channel component R is 0 to 31; the green channel component G is obtained by right-shifting the pixel value of the surface image of the paper to be cut in RGB565 format by 5 bits and performing a bitwise AND operation with 0x3F, and the value range of the green channel component G is 0 to 63; the blue channel component B is obtained by bitwise AND operation of the pixel value of the surface image of the paper to be cut in RGB565 format with 0x1F, and the value range of the blue channel component B is 0 to 31.
4. The die-cutting machine cutter head positioning method based on the embedded FOMO model according to claim 1, characterized in that, Step 3 includes: Grayscale processing is used to reduce the dimensionality of the surface image of the paper to be cut, thereby reducing the computational load on the embedded microcontroller built into the die-cutting machine. This grayscale processing is achieved by extracting the red channel component R, the green channel component G, and the blue channel component B of the surface image of the paper to be cut and calculating a weighted average. The grayscale processing formula is as follows: Yo gray (x,y)=(38×R(x,y)+75×G(x,y)+15×B(x,y))>>7 Among them, I gray (x,y) represents the grayscale value at pixel coordinates (x,y) of the surface image of the paper to be cut after grayscale processing, where x is the horizontal coordinate of the pixel coordinate of the surface image of the paper to be cut, and y is the vertical coordinate of the pixel coordinate of the surface image of the paper to be cut. The 3×3 median filtering method is used to remove surface stains and noise interference caused by wrinkles in the paper to be cut. The median filtering formula is as follows: I med (x,y)=Med{I gray (x+i,y+j)∣(i,j)∈{-1,0,1}×{-1,0,1}} Among them, I med (x,y) represents the pixel grayscale value of the surface image of the paper to be cut after grayscale processing and 3×3 median filtering. i is the horizontal coordinate offset and j is the vertical coordinate offset. The values of i and j both belong to the set {-1,0,1}, which together constitute a 3×3 neighborhood range centered on the pixel coordinate (x,y). Med{·} represents taking the median of the pixel grayscale value in the neighborhood of the pixel coordinate (x,y). Through contrast enhancement processing, the grayscale difference between the positioning markers of the paper to be cut and the background on the paper is highlighted. Standardized grayscale image data is output, and linear stretching is used to enhance the contrast. The contrast enhancement formula is as follows: I enh (x,y)=[(I med (x,y)-I min (x,y)) / (I max (x,y)-I min (x,y))]×255 Among them, I enh (x,y) represents the pixel grayscale value of the surface image of the paper to be cut after grayscale processing, 3×3 median filtering, and contrast enhancement processing. min (x, y) represents the minimum global pixel grayscale value of the surface image of the paper to be cut after grayscale processing and 3×3 median filtering. max (x,y) represents the global maximum pixel grayscale value of the surface image of the paper to be cut after grayscale processing and 3×3 median filtering.
5. The die-cutting machine cutter head positioning method based on an embedded FOMO model according to claim 1, characterized in that, Step 4 includes: The confidence threshold for the positioning markers of the paper to be cut is set between 0.7 and 0.
9. When the confidence of the positioning markers is less than or equal to the confidence threshold, the die-cutting machine camera re-acquires the surface image of the paper to be cut, and the number of re-acquisitions does not exceed 3 times to avoid falling into an infinite loop. When the confidence of the positioning markers is greater than the confidence threshold, the pixel coordinates of the positioning markers are marked as valid positioning marker coordinates. The confidence of the positioning markers is stored in the non-volatile storage area of the Flash memory of the embedded microcontroller built into the die-cutting machine and is stored independently from the binary file of the generated lightweight FOMO model to avoid data read / write conflicts.
6. The die-cutting machine cutter head positioning method based on an embedded FOMO model according to claim 1, characterized in that, Step 5 includes: In the buffer of the embedded microcontroller built into the die-cutting machine, a sliding window dataset is constructed. This dataset contains N consecutive historically acquired valid positioning marker coordinate data, where N is a positive integer determined by the positioning accuracy of the die-cutting machine's cutter head. The mean of all historically acquired valid positioning marker coordinate data within the sliding window dataset is calculated and defined as the initial reference coordinate data. The deviation of each historically acquired valid positioning marker coordinate data within the sliding window dataset from the initial reference coordinate data is compared. If the deviation exceeds the pixel deviation threshold for the valid positioning marker coordinates of the paper to be cut, set according to the positioning accuracy of the die-cutting machine's cutter head, it is identified as an outlier and removed. After removing outliers, the mean of the remaining historically acquired valid positioning marker coordinate data within the sliding window dataset is recalculated and used as the final reference coordinates. The final reference coordinates are then converted into the number of pulses or position command parameters required to control the movement of the actuator.