Lightweight model-based chain bearing spacing real-time measurement method and system

By configuring a binocular vision system and the lightweight YOLOv8 network GEDYS for chain bearing segmentation and feature extraction, and combining the triangulation principle, the problems of high computational resources and insufficient detection accuracy in the existing technology are solved, and low-cost, high-efficiency real-time measurement of chain bearing spacing is realized.

CN121363922APending Publication Date: 2026-01-20SHANGHAI UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410958267.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-17
Publication Date
2026-01-20

AI Technical Summary

Technical Problem

Existing methods for measuring chain bearing spacing suffer from high computational costs, insufficient detection accuracy, and high equipment costs, making it difficult to meet the real-time detection requirements in industrial environments.

Method used

A lightweight model-based real-time measurement method for chain bearing spacing is proposed. By configuring a binocular vision system, the lightweight variant of the YOLOv8 network, GEDYS, is used for bearing segmentation and feature extraction. The bearing spacing is calculated by combining the triangulation principle, which reduces computational complexity and improves detection accuracy.

Benefits of technology

It enables efficient, real-time, and low-cost measurement of chain bearing spacing in harsh industrial environments, reducing hardware dependence and user training and maintenance costs, and improving measurement accuracy and system usability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121363922A_ABST
    Figure CN121363922A_ABST
Patent Text Reader

Abstract

The invention provides a chain bearing spacing real-time measurement method and system based on a lightweight model, and the method comprises the steps: installing hardware equipment, and collecting a chain bearing image; marking a bearing mask on the chain image, and performing data set construction and data enhancement; building a network framework, and training the framework by using the training data set to obtain a chain bearing segmentation model; inputting a chain image acquired in real time into the model to obtain a segmentation mask and a category of each bearing, and calculating a pixel coordinate of a center point of the bearing; the extracted pixel coordinates are corrected, and three-dimensional reconstruction and interval calculation are carried out; and carrying out human-computer interaction interface development. The industrial camera is configured to transmit the specific area of the image, so that the imaging size is effectively reduced, and the relative proportion of useful information is increased.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of chain spacing measurement, in particular to a chain bearing spacing real-time measurement method and system based on a lightweight model. BACKGROUND

[0002] Chain drive is one of the three major transmission methods in the mechanical industry, and it is also an important link in China's basic industry. Wear is one of the most sensitive and easily detectable technical indicators of chain products. During operation, the metal layer on the surface of the chain may be worn due to heavy load or friction, forming grooves or flat areas. The humid or corrosive environment of the industrial conveying site can cause the metal on the surface of the chain bearing to be corroded, thereby reducing its durability. These phenomena indicate that the chain bearing will produce various irreversible wear as the use time increases, causing the bearing spacing to shift and causing the bearings on both sides of the same position to form an angle with the standard shaft direction. When the spacing of the chain is stretched to a certain extent, it may cause chain jumping or chain breaking failures, which requires a lot of time and manpower for maintenance, seriously affecting production efficiency and economic benefits. Therefore, the industrial conveyor chain needs to be regularly shut down for maintenance to prevent the chain from breaking due to severe bearing wear.

[0003] In the past, conveyor chain working condition monitoring generally used manual observation methods. This measurement method is not only inefficient, but also wastes labor costs. Using machine vision equipment to replace traditional manual work methods can improve production efficiency and production quality.

[0004] The key step in the measurement process is the feature extraction of the chain bearing end face center point. Due to the harsh industrial environment of activated carbon conveying chains, there is a lot of dust in the field that affects visibility, resulting in a lot of noise in the chain image. Moreover, chain bearings of different ages are used, and many devices have been in use for a long time. There are a lot of steel slag on the track and even the edge of the bearing, and most bearings are worn and corroded, with uneven end face profiles. There is a lot of noise in the chain images collected on site, and the effective edge chain cannot be obtained from the target image, so the traditional visual method of fitting the bearing profile as an ellipse cannot be used to obtain the end face center.

[0005] Chinese patent "CN116625258 Chain spacing measurement system and chain spacing measurement method" provides a chain spacing measurement system realized by using a four-eye vision system, including a calibration unit and a measurement unit. The calibration steps are: stereotarget design; decoding the ID of the coded marker point; single target calibration; multi-eye system calibration under non-overlapping field of view; and obtaining the coordinate system to global coordinate system conversion matrix of all cameras. The measurement steps are: the four-eye vision system collects chain images at intervals; automatically measuring the chain shaft center in the image based on the Faster R-CNN ellipse regression network; and automatically calculating the spacing of two chain bearings in three-dimensional space.

[0006] The existing method takes the Faster R-CNN base model as the front-end network structure, introduces an ellipse regression module on the basis of boundary box regression, and is used for identifying and positioning the position of the ellipse contour edge. The Faster R-CNN uses a two-stage detector, that is, candidate regions are generated first, and then target classification and boundary box regression are performed in these regions. The architecture of this method is relatively complex, and is usually slower than a single-stage detector, so it requires higher computing resources when processing high-resolution images collected by industrial cameras, and it is difficult to meet the demand of real-time detection. Moreover, the detection accuracy of the ellipse regression network still has a large room for improvement, and there is a certain rate of missed detection and false detection when detecting chain bearing images in harsh industrial environments.

[0007] The Chinese patent "CN116424802 scraper conveyor chain working condition monitoring system and monitoring method" provides a scraper conveyor chain working condition monitoring system and method, which can monitor the working condition of the scraper conveyor chain in real time and reduce downtime losses. The specific steps include: building a standard model library in the self-learning system when the system is started for the first time; comparing the real-time collected image information with the related information in the standard model library to identify the defect characteristics of the chain, scraper and scraper screw; grading the identified defect characteristics, and storing and recording them; after conversion and processing, the segmented images and different graded warning information are displayed according to the monitoring characteristics of the chain, scraper and scraper screw; and the operator performs corresponding maintenance and processing on the scraper conveyor according to the warning level prompted on the explosion-proof computer.

[0008] The existing method monitors the pitch change through a 3D laser camera, measures the chain flat ring diameter, vertical ring diameter, vertical ring contour length, chain flat ring and vertical ring spacing, and compares the measured pitch value between the flat ring and the vertical ring with the standard pitch through an explosion-proof computer. Once the pitch elongation of the chain flat ring and the vertical ring exceeds the standard elongation, the system will issue a warning. The 3D laser camera directly measures the three-dimensional structure of an object using a laser beam, thereby providing higher distance and depth measurement accuracy. However, the cost of the 3D laser camera is relatively high, and the operation and maintenance of the equipment are relatively complex, requiring professional technical support. The data processing and analysis time is also relatively long. SUMMARY

[0009] In view of the defects in the prior art, the purpose of the present application is to provide a chain bearing pitch real-time measurement method and system based on a lightweight model.

[0010] According to the chain bearing pitch real-time measurement method based on a lightweight model provided by the present application, the method comprises the following steps:

[0011] Step S1: Install the hardware device and collect the chain bearing image;

[0012] Step S2: Label the bearing mask on the chain image, and perform data set construction and data enhancement;

[0013] Step S3: Build a network framework, train the framework with the training data set, and obtain a chain bearing segmentation model;

[0014] Step S4: Input the real-time collected chain image into the model to obtain the segmentation mask and category of each bearing, and calculate the bearing center pixel coordinates;

[0015] Step S5: Correct the extracted pixel coordinates, perform three-dimensional reconstruction and distance calculation;

[0016] Step S6: Develop a human-computer interaction interface.

[0017] Preferably, in the step S1:

[0018] Hardware device installation: The configuration includes two industrial cameras, a bar-shaped direct light source, a tripod, and a customized arc-shaped base. The arc-shaped base is fixed on the tripod, and the two industrial cameras and the bar-shaped direct light source are installed on the base in order to build a binocular vision system. The entire device is placed at a predetermined distance from the chain to be measured;

[0019] Collecting chain bearing images: Use two industrial cameras to image the running chain, store and model the collected images, and display them on the user end. When using industrial cameras to collect images, the image of a specific area is transmitted by setting the region of interest function. The parameters include the horizontal offset, vertical offset, width, and height of the output area.

[0020] The camera reads image data from the specified area of the sensor into the cache and transmits it to the host end. The images in other areas of the sensor are discarded. During the collection process, the height of the image ROI is reduced to discard unnecessary information and improve the maximum allowed frame rate of the camera.

[0021] Preferably, in the step S2:

[0022] Use the collected data to build a training data set of chain bearing images. The training data set includes chain bearing images under different working conditions and lighting conditions, as well as some images with motion blur. The target image has a mask labeled for two types of bearings.

[0023] In the data enhancement process, data enhancement techniques are introduced. The specific enhancement methods include random rotation, scaling, cropping, translation, color jitter, and adding noise. Through the combination of MixUp and Mosaic enhancement techniques, training samples are generated.

[0024] Preferably, in the step S3:

[0025] Based on the YOLOv8 network, a lightweight network GEDYS for chain bearing segmentation is proposed, which is composed of a backbone network, a neck network and a head network. The C2f module in YOLOv8 in the backbone network and the neck network is replaced by the C3Ghost module, and the CBS module is replaced by the GhostConv module. In the neck network, the attention mechanism module EMA is configured after the last three C3Ghost modules, and the standard upsampler is replaced by the dynamic upsampler DySample module in the neck network. The mask segmentation head of the single-stage instance segmentation network YOLACT is used in the head network part;

[0026] The GEDYS network is trained and optimized using the training data set of chain bearing images. In the training period, the network weight parameters with the best performance are selected as the final chain bearing segmentation model. By using the tracking method, all operations of the model are automatically recorded, thereby generating a TorchScript model and saving it. TorchScript is the intermediate representation of PyTorch, which optimizes and serializes the PyTorch model. The TorchScript model is then loaded in the C++ application using the libtorch library. After loading the model, the output data of the model is post-processed. libtorch is the C++ version of PyTorch;

[0027] The specific process of constructing the GhostConv module is as follows: a standard convolution is used to expand the input feature map to a higher channel number, and the expanded feature map is divided into two parts by a split layer: one part is the main channel, and the other part is the auxiliary channel. A lightweight convolution layer is applied to process the main channel; a standard convolution is used to process the auxiliary channel. The processed two parts of feature maps are merged to form the final output;

[0028] The specific process of constructing the C3Ghost module is as follows: the split concept of the cross-stage local network CSPNet and the design concept of the residual structure are combined with the GhostConv technology to form the GhostBottleneck to replace the bottleneck layer. The GhostBottleneck is composed of two series of GhostConv modules;

[0029] The EMA module has three parallel processing routes. This mechanism extracts the attention weight descriptor of the feature map through two 1x1 convolution and a 3x3 convolution branch;

[0030] The DySample module processes the input feature map X by a sampling point generator, which generates a dynamic sampling set S according to an up-sampling scale factor s and the coordinate dimension 2g of the original feature map, and uses the sampling points to effectively up-sample the input feature map X to the output feature map X' by a DySample up-sampler;

[0031] The design of the mask segmentation head is to split the instance segmentation task into two parallel sub-tasks: one is to generate a non-local prototype mask dictionary in the whole image range; and the other is to predict a set of linear combination coefficients for each detected instance, and obtain the instance mask by linearly combining the prototype masks and the corresponding mask coefficients, and then crop the instance mask using the predicted bounding box.

[0032] Preferably, the GhostConv module:

[0033] The CBS convolution block in the YOLOv8n network is composed of a convolution layer, batch normalization and an activation function; the standard convolution process is represented by formula 1, and the calculation amount is formula 2:

[0034] Y = X * f + b (1)

[0035] FLOP s = n h' w' c k k (2)

[0036] In the formula, * represents convolution operation, X R c×h×w represents an input feature map with c input channels, height h and width w, Y R n×h′×w′ represents n output feature maps with height h' and width w', f R n×c×k×k represents n convolution kernels with size k x k, and b is a bias term.

[0037] The Ghost convolution uses a standard convolution layer to expand the input feature map to a higher number of channels, divides the expanded feature map into a main channel and an auxiliary channel, applies a lightweight convolution layer to the main channel, applies a standard convolution layer to the auxiliary channel, and combines the two parts of the feature map. The Ghost convolution is represented by formula 3, and the calculation amount is formula 4:

[0038]

[0039] FLOP G = m h' w' c k k + (n-m) h' w' d d (4)

[0040] In the formula, f' R m×c×k×k represents m convolution kernels with size k x k, Y' R n×h′×w′ represents m intrinsic feature maps output by ordinary convolution on the input feature map, y iYi is the feature map of the i-th channel in Y, which is transformed by a series of linear transformations Φ of size d x d i,j m(s-1) Ghost feature maps y are generated ij , and

[0041] The ratio of the calculation amount of the standard convolution to the Ghost convolution is formula 5:

[0042]

[0043] C3Ghost module:

[0044] The C3Ghost module replaces the Bottleneck in the C3 module with a GhostBottleneck module; the GhostBottleneck module is constructed based on the GhostConv module, increases the number of input feature map channels through the first expansion layer GhostConv module, and reduces the number of output feature map channels through the second GhostConv module, so that it matches the shortcut path in the network, and finally adds and fuses the features with the residual edge after deep convolution.

[0045] Preferably, in the step S4:

[0046] The multi-threading technology is used to ensure the synchronization of the binocular camera acquisition chain image, the real-time acquired left and right view images are respectively input into the chain bearing segmentation model in the sub-thread, the segmentation mask and bearing category of each bearing in the measured chain image are obtained, the second bearing is discarded, the bearing contour is extracted by using the segmentation mask predicted by the model, and the bearing contour is subjected to elliptical fitting to obtain the elliptical center point coordinates as the feature extraction result of the bearing center.

[0047] Preferably, in the step S5:

[0048] The two first-class bearings in the chain image are defined as bearing A and bearing B, and the calculation process of the distance between the bearings is as follows: the center point pixel coordinates of bearing A and bearing B are obtained in the left and right views, the center point pixel coordinates are restored to the coordinates on the original image size, the extracted pixel coordinates are corrected to eliminate the error caused by the camera lens distortion, and the pixel coordinates are ensured to reflect the actual visual information, the three-dimensional coordinates of the feature points are calculated according to the corrected coordinates through the triangulation relationship, and the Euclidean distance between the two feature points in the three-dimensional space is further calculated to obtain the actual distance between the center points of bearing A and bearing B;

[0049] The conversion principle of two-dimensional pixel coordinates to three-dimensional coordinates, and the space distance solving method between the two bearing center points are as follows:

[0050] The left camera coordinate system is taken as a reference world coordinate system O of the binocular vision measurement system w -X w Y w Z w For a set of matching points in the left and right views, the homogeneous coordinates thereof in different image coordinate systems are (u1, v1, 1) and (u2, v2, 1) respectively, and the homogeneous coordinates thereof in the reference world coordinate system are P = [X w , Y w , Z w , 1] T ,

[0051] According to the camera imaging model, formula 6 and formula 7 are obtained:

[0052]

[0053]

[0054] In the above formula, ξ1 and ξ2 are proportional coefficients, A l and A r are left and right camera intrinsic matrices respectively, R l and T l are composed of a unit matrix and a zero matrix, R r and T r are a rotation matrix R 12 and a translation matrix t 12 from the right camera coordinate system to the left camera coordinate system, is an element of the projection matrix M, i = 1, 2, 3, j = 1, 2, 3, 4, k = 1, 2;

[0055] The formula 8 is obtained by simultaneously solving and eliminating the proportional coefficients:

[0056]

[0057] The least square method is used for solving, and formula 8 is rewritten into a matrix form AP = b, that is, then the three-dimensional coordinate calculation of the P point is expressed as formula 9:

[0058] P = (A T A) -1 A T b (9)

[0059] In the formula,

[0060] The spatial distance between the two bearing center points is solved by formula 10:

[0061]

[0062] In the formula, Pi = [X wi , Y wi , Z wi ] is the three-dimensional coordinate of the center point of the i-th bearing, P i+1 = [X w(i+1) , Y w(i+1) , Z w(i+1) ] is the three-dimensional coordinate of the center point of the i+1-th bearing, d i(i+1) is the spatial distance between the center points of the two bearings.

[0063] Preferably, in the step S6:

[0064] A real-time measurement system for chain bearing spacing is built using the Qt framework, and through a comprehensive human-computer interaction interface, multiple functional modules are integrated, including:

[0065] Spacing measurement module: processes the chain image collected by the camera and calculates the distance between the chain bearings;

[0066] Binocular camera calibration module: responsible for the internal and external parameter calibration of the binocular camera used;

[0067] Camera parameter configuration module: allows users to customize the exposure time and gain parameters of the camera to adapt to different measurement environments and needs;

[0068] Real-time video monitoring module: displays the real-time video stream captured by the camera and the result image of real-time measurement;

[0069] Result visualization module: displays the measurement results in the form of a line chart;

[0070] Real-time measurement can support real-time measurement of chain bearing spacing on both sides of the conveyor, i.e., two sets of binocular vision systems work simultaneously.

[0071] According to the chain bearing spacing real-time measurement system based on a lightweight model provided by the application, comprising:

[0072] Module M1: install hardware devices to collect chain bearing images;

[0073] Module M2: annotate bearing masks on chain images, and perform data set construction and data enhancement;

[0074] Module M3: build a network framework, train the framework using a training data set, and obtain a chain bearing segmentation model;

[0075] Module M4: input real-time collected chain images into the model to obtain the segmentation mask and category of each bearing, and calculate the bearing center point pixel coordinates;

[0076] Module M5: Correct the extracted pixel coordinates, perform three-dimensional reconstruction and distance calculation;

[0077] Module M6: Develop human-computer interaction interface.

[0078] Preferably, in the module M1:

[0079] Hardware device installation: The configuration includes two industrial cameras, a bar-shaped direct light source, a tripod, and a custom arc-shaped base. The arc-shaped base is fixed on the tripod, and the two industrial cameras and the bar-shaped direct light source are installed on the base in order to build a binocular vision system. The entire device is placed at a predetermined distance from the chain to be measured.

[0080] Collecting chain bearing images: Use two industrial cameras to image the running chain, store and model the collected images, and display them on the user end. When collecting images using industrial cameras, set the region of interest function to transmit specific areas of the image. The parameters include horizontal offset, vertical offset, width, and height of the output area.

[0081] The camera reads image data from the specified area of the sensor into the cache and transmits it to the host end. The images in other areas of the sensor are discarded. During the collection process, the height of the image ROI is reduced to discard unnecessary information and improve the maximum allowed frame rate of the camera.

[0082] In the module M2:

[0083] Use the collected data to build a training dataset for chain bearing images. The training dataset includes chain bearing images under different working conditions and lighting conditions, as well as some images with motion blur. The target image has a mask labeled for two types of bearings.

[0084] Introduce data augmentation techniques during data augmentation. The specific enhancement methods include random rotation, scaling, cropping, translation, color jitter, and adding noise. Use MixUp and Mosaic combined enhancement techniques to generate training samples.

[0085] In the module M3:

[0086] Based on YOLOv8 network, a lightweight network GEDYS for chain bearing segmentation is proposed, which is composed of a backbone network, a neck network and a head network. The C2f module in YOLOv8 in the backbone network and the neck network is replaced by the C3Ghost module, and the CBS module is replaced by the GhostConv module. In the neck network, the attention mechanism module EMA is configured after the last three C3Ghost modules, and the standard upsampler is replaced by the dynamic upsampler DySample module in the neck network. The mask segmentation head of the single-stage instance segmentation network YOLACT is used in the head network part;

[0087] The GEDYS network is trained and optimized by using the training data set of chain bearing images. In the training period, the network weight parameters with the best performance are selected as the final chain bearing segmentation model. By using the tracking method, all operations of the model are automatically recorded, so as to generate a TorchScript model and save it. TorchScript is the intermediate representation of PyTorch, which makes the PyTorch model optimized and serialized. The TorchScript model is then loaded in the C++ application using the libtorch library. After loading the model, the output data of the model is post-processed. Libtorch is the C++ version of PyTorch;

[0088] The specific process of constructing the GhostConv module is as follows: a standard convolution is used to expand the input feature map to a higher channel number, and the expanded feature map is divided into two parts by a split layer: one part is the main channel, and the other part is the auxiliary channel. A lightweight convolution layer is applied to process the main channel; a standard convolution is used to process the auxiliary channel. The processed two parts of feature maps are merged to form the final output.

[0089] The specific process of constructing the C3Ghost module is as follows: the split concept of the cross-stage local network CSPNet and the design concept of the residual structure are combined with the GhostConv technology to form the GhostBottleneck to replace the bottleneck layer. The GhostBottleneck is composed of two series of GhostConv modules.

[0090] The EMA module has three parallel processing routes. This mechanism extracts the attention weight descriptor of the feature map through two 1x1 convolution and a 3x3 convolution branch.

[0091] The DySample module processes the input feature map X by a sampling point generator, which generates a dynamic sampling set S according to an up-sampling scale factor s and the coordinate dimension 2g of the original feature map, and uses the sampling points to effectively up-sample the input feature map X to the output feature map X' by a DySample up-sampler;

[0092] The design of the mask segmentation head is to split the instance segmentation task into two parallel sub-tasks: one is to generate a non-local prototype mask dictionary in the whole image range; and the other is to predict a set of linear combination coefficients for each detected instance, and obtain the instance mask by linearly combining the prototype masks and the corresponding mask coefficients, and then crop the instance mask using the predicted bounding box;

[0093] The GhostConv module:

[0094] The CBS convolution block in the YOLOv8n network is composed of a convolution layer, a batch normalization and an activation function; the standard convolution process is represented by formula 1, and the calculation amount is formula 2:

[0095] Y = X * f + b (1)

[0096] FLOP s = n h' w' c k k (2)

[0097] In the formula, * represents convolution operation, X R c×h×w represents an input feature map with c input channels, height h and width w, Y R n×h′×w′ represents n output feature maps with height h' and width w', f R n×c×k×k represents n convolution kernels with size k x k, and b is a bias term;

[0098] The Ghost convolution uses a standard convolution layer to expand the input feature map to a higher number of channels, divides the expanded feature map into a main channel and an auxiliary channel, applies a lightweight convolution layer to the main channel, applies a standard convolution layer to the auxiliary channel, and combines the two parts of the feature map. The Ghost convolution is represented by formula 3, and the calculation amount is formula 4:

[0099]

[0100] FLOP G = m h' w' c k k + (n-m) h' w' d d (4)

[0101] In the formula, f' R m×c×k×k represents m convolution kernels with size k x k, Y' R n×h′×w′ represents m intrinsic feature maps output by ordinary convolution on the input feature map, y iYi is the feature map of the i-th channel in Y, which is transformed by a series of linear transformations Φ of size d x d i,j Generate m(s-1) Ghost feature maps y ij , and

[0102] The ratio of the calculation amount of the standard convolution to the Ghost convolution is formula 5:

[0103]

[0104] C3Ghost module:

[0105] The C3Ghost module replaces the Bottleneck in the C3 module with a GhostBottleneck module; the GhostBottleneck module is constructed based on the GhostConv module, increases the number of channels of the input feature map through the first expansion layer GhostConv module, and then reduces the number of channels of the output feature map through the second GhostConv module to match the shortcut path in the network, and finally adds and fuses the features with the residual edge after deep convolution;

[0106] In the module M4:

[0107] The multi-threading technology is used to ensure the synchronization of the image acquisition chain of the binocular camera, the real-time acquired left and right view images are input into the chain bearing segmentation model in the sub-thread, and the segmentation mask and bearing class of each bearing in the measured chain image are obtained; the first type of bearing is retained and the second type of bearing is discarded; the bearing contour is extracted using the segmentation mask predicted by the model, and the bearing contour is fitted with an ellipse to obtain the elliptical center point coordinates as the feature extraction result of the bearing center;

[0108] In the module M5:

[0109] The two first-class bearings in the chain image are defined as bearing A and bearing B, and the calculation process of the distance between the bearings is as follows: the center point pixel coordinates of bearing A and bearing B are obtained in the left and right views, respectively, the center point pixel coordinates are restored to the coordinates on the original image size, the extracted pixel coordinates are corrected to eliminate the error caused by the camera lens distortion, and the pixel coordinates are ensured to reflect the actual visual information, the three-dimensional coordinates of the feature points are calculated according to the corrected coordinates through the triangulation relationship, and the Euclidean distance between the two feature points in the three-dimensional space is further calculated to obtain the actual distance between the center points of bearing A and bearing B;

[0110] The conversion principle of two-dimensional pixel coordinates to three-dimensional coordinates, and the spatial distance solving method between the two bearing center points are as follows:

[0111] The left camera coordinate system is taken as a reference world coordinate system O of the binocular vision measurement system w -X w Y w Z w For a set of matching points in the left and right views, the homogeneous coordinates in different image coordinate systems are (u1, v1, 1) and (u2, v2, 1) respectively, and the homogeneous coordinates in the reference world coordinate system are P = [X w Y w Z w , 1] T ,

[0112] According to the camera imaging model, formulas 6 and 7 are obtained:

[0113]

[0114]

[0115] In the above formula, ξ1 and ξ2 are proportional coefficients, A l and A r are left and right camera intrinsic matrices respectively, R l and T l are composed of unit matrices and zero matrices, R r and T r are composed of a rotation matrix R 12 and a translation matrix t 12 , is an element of the projection matrix M, i = 1, 2, 3, j = 1, 2, 3, 4, k = 1, 2;

[0116] Simultaneous equations are obtained by eliminating the proportional coefficients, and formula 8 is obtained:

[0117]

[0118] The least square method is used for solving, and formula 8 is rewritten as a matrix form AP = b, that is Then the three-dimensional coordinate calculation of the P point is expressed as formula 9:

[0119] P = (A T A) -1 A T b (9)

[0120] In the formula,

[0121] The spatial distance between the two bearing center points is solved by formula 10:

[0122]

[0123] In the formula, P i = [Xwi Y wi Z wi ] is the three-dimensional coordinate of the center point of the i th bearing, P i+1 = [X w(i+1) Y w(i+1) Z w(i+1) ] is the three-dimensional coordinate of the center point of the i+1 th bearing, d i(i+1) is the spatial distance between the center points of the two bearings.

[0124] In the module M6:

[0125] The real-time measurement system for the spacing of chain bearings is built with the Qt framework, and through a comprehensive human-computer interaction interface, multiple functional modules are integrated, including:

[0126] Spacing measurement module: processes the chain images collected by the camera and calculates the distance between the chain bearings;

[0127] Binocular camera calibration module: responsible for the internal and external parameter calibration of the binocular camera used;

[0128] Camera parameter configuration module: allows users to customize the exposure time and gain parameters of the camera to adapt to different measurement environments and needs;

[0129] Real-time video monitoring module: displays the real-time video stream captured by the camera and the result images of real-time measurement;

[0130] Result visualization module: displays the measurement results in the form of a line chart;

[0131] Real-time measurement can support real-time measurement of the spacing of chain bearings on both sides of the conveyor, i.e., two sets of binocular vision systems work simultaneously.

[0132] Compared with the prior art, the present application has the following beneficial effects:

[0133] 1. The present application effectively reduces the imaging size by configuring the industrial camera to transmit a specific area of the image, thereby increasing the relative proportion of useful information.

[0134] 2. The present application first applies the YOLOv8 network to feature extraction of chain bearing centers. By replacing the C2f module with the C3Ghost module in the Backbone and Neck of the YOLOv8 network, and replacing the CBS module with the GhostConv module. This improvement significantly reduces the parameter quantity and computational complexity of the model, thereby reducing the memory requirement and hardware dependence, improving the usability of the model, while ensuring the real-time processing capability of the entire system for high frame rate image streams.

[0135] 3、The application effectively realizes the conversion of bearing center point from two-dimensional coordinates to three-dimensional coordinates through the principle of triangulation, ensures the measurement accuracy, does not need complex and high-cost hardware support, has high cost-effectiveness in the application of industrial scenes, and is especially suitable for production line environments that need high precision and high efficiency.

[0136] 4、The application constructs a real-time measurement system of chain bearing spacing through the development of a human-computer interaction interface, so that the user experience and operation efficiency of the whole measurement system are significantly improved. BRIEF DESCRIPTION OF DRAWINGS

[0137] Other features, objects and advantages of the present application will become more apparent from the following detailed description of non-limiting embodiments, read in conjunction with the accompanying drawings:

[0138] Figure 1 is a flow chart;

[0139] Figure 2 is a schematic diagram of a chain bearing spacing measurement system;

[0140] Figure 3 is a GEDYS network structure diagram;

[0141] Figure 4 is a chain bearing segmentation model prediction result diagram;

[0142] Figure 5 is a human-computer interaction interface sample diagram. DETAILED DESCRIPTION

[0143] The application will be described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present application, but do not limit the present application in any form. It should be noted that those skilled in the art can make several changes and improvements without departing from the concept of the present application. These all belong to the protection scope of the present application.

[0144] Example 1:

[0145] The application aims to provide a chain bearing spacing real-time measurement system based on a lightweight model. The high efficiency of the lightweight model allows real-time processing of image data under the running state of the chain, ensuring fast response and real-time monitoring and early warning. First, a large number of field images are collected to make a chain bearing dataset. Then, a lightweight bearing end face segmentation model is trained. The lightweight model can efficiently run in a resource-limited environment. Next, the real-time collected chain bearing images are segmented, and their contours are fitted into ellipses to obtain the image coordinates of the bearing center points. Finally, the distance between adjacent bearings is calculated by the triangulation method of binocular stereo vision combined with the pose relationship of the binocular camera.

[0146] According to the chain bearing spacing real-time measurement method based on a lightweight model provided by the application, as shown in Figures 1-5 , comprising:

[0147] Step S1: Install hardware devices to collect chain bearing images;

[0148] Specifically, in the step S1:

[0149] Hardware device installation: configure a double-vision system including two industrial cameras, a bar-shaped direct light source, a tripod, and a customized arc-shaped base. Fix the arc-shaped base on the tripod, and install the two industrial cameras and the bar-shaped direct light source on the base in sequence to build a double-vision system. Place the entire set of devices at a predetermined distance from the chain to be measured.

[0150] Collecting chain bearing images: use the two industrial cameras to image the running chain, store and model predict the collected images, and display them on the user end. When collecting images using the industrial cameras, set the region of interest function to transmit the specific area of the image. The parameters include the horizontal offset, vertical offset, width, and height of the output area.

[0151] The camera reads the image data from the specified area of the sensor into the cache and transmits it to the host end. The images in other areas of the sensor are discarded. During the collection process, reduce the height of the image ROI to discard useless information and improve the maximum allowed frame rate of the camera.

[0152] Step S2: Label the bearing mask on the chain image, and perform dataset construction and data enhancement;

[0153] Specifically, in the step S2:

[0154] Use the collected data to construct a training dataset of chain bearing images. The training dataset includes chain bearing images under different working conditions and lighting conditions, as well as some images with motion blur. The target image has a mask labeled for two types of bearings.

[0155] Data augmentation techniques are introduced in the data augmentation process, and specific enhancement methods include random rotation, scaling, cropping, translation, color jittering, and adding noise, and training samples are generated by combining MixUp and Mosaic enhancement techniques.

[0156] Step S3: Building a network framework, training the framework with the training data set to obtain a chain bearing segmentation model;

[0157] Specifically, in the step S3:

[0158] Based on the YOLOv8 network, a lightweight network GEDYS for chain bearing segmentation is proposed, which consists of a backbone network, a neck network and a head network. The C2f module in YOLOv8 in the backbone network and the neck network is replaced by the C3Ghost module, and the CBS module is replaced by the GhostConv module. In the neck network, the attention mechanism module EMA is configured after the last three C3Ghost modules, and the standard up-sampler is replaced by the dynamic up-sampler DySample module in the neck network, and the mask segmentation head of the single-stage instance segmentation network YOLACT is used in the head network part;

[0159] The training and optimization of the GEDYS network are carried out by using the training data set of the chain bearing image. In the training period, the network weight parameter with the best performance is selected as the final chain bearing segmentation model. By using the tracking method, all operations of the model are automatically recorded, so as to generate a TorchScript model and save it. TorchScript is the intermediate representation of PyTorch, which makes the PyTorch model optimized and serialized. The TorchScript model is then loaded in the C++ application using the libtorch library. After loading the model, the output data of the model is post-processed. libtorch is the C++ version of PyTorch;

[0160] The specific process of constructing the GhostConv module is as follows: a standard convolution is used to expand the input feature map to a higher channel number, and a split layer is used to divide the expanded feature map into two parts: one part is the main channel, and the other part is the auxiliary channel. In the main channel, a lightweight convolution layer is applied for processing; in the auxiliary channel, a standard convolution is used for processing. The processed two parts of feature maps are merged to form the final output.

[0161] The specific process of constructing the C3Ghost module is: combining the shunting concept of the cross-stage local network CSPNet and the design concept of the residual structure with the GhostConv technology to form a GhostBottleneck to replace the bottleneck layer, and the GhostBottleneck is composed of two series of GhostConv modules;

[0162] The EMA module processes through three parallel processing routes. This mechanism extracts the attention weight descriptors of the feature map through two 1x1 convolution and one 3x3 convolution branch;

[0163] The DySample module processes the input feature map X through a sampling point generator. The generator generates a dynamic sampling set S according to the upsampling scale factor s and the coordinate dimension 2g of the original feature map. Using these sampling points, the DySample upsampler effectively upsamples the input feature map X to the output feature map X'.

[0164] The design of the mask segmentation head is to split the instance segmentation task into two parallel sub-tasks: one is to generate a non-local prototype mask dictionary in the entire image range; the other is to predict a set of linear combination coefficients for each detected instance. The instance mask is obtained by linearly combining these prototype masks with the corresponding mask coefficients, and then the predicted bounding box is cropped.

[0165] Specifically, the GhostConv module:

[0166] The CBS convolution block in the YOLOv8n network is composed of a convolution layer, a batch normalization and an activation function. The standard convolution process is represented by formula 1, and the calculation amount is formula 2:

[0167] Y = X * f + b (1)

[0168] FLOP s = n·h'·w'·c·k·k (2)

[0169] In the formula, * represents convolution operation, X ∈ R c×h×w represents an input feature map with c input channels, height h and width w, Y ∈ R n×h′×w′ represents n output feature maps with height h' and width w', f ∈ R n×c×k×k represents n convolution kernels with size k x k, and b is the bias term.

[0170] The Ghost convolution uses a standard convolution layer to expand the input feature map to a higher number of channels, divides the expanded feature map into a main channel and an auxiliary channel, applies a lightweight convolution layer to the main channel, and applies a standard convolution layer to the auxiliary channel. The two parts of the feature map are merged. The Ghost convolution is represented by formula 3, and the calculation amount is formula 4:

[0171]

[0172] FLOP G = m · h' · w' · c · k · k + (n - m) · h' · w' · d · d (4)

[0173] where f' ∈ R m×c×k×k represents m convolution kernels with the size of k x k, Y' ∈ R n×h′×w′ represents m intrinsic feature maps output after ordinary convolution on the input feature map, y i is the feature map of the i-th channel in Y', which is generated by a series of linear transformations Φ i,j with the size of d x d, m(s-1) Ghost feature maps y ij are generated, and

[0174] The ratio of the calculation amount of the standard convolution to the Ghost convolution is formula 5:

[0175]

[0176] C3Ghost module:

[0177] The C3Ghost module replaces the Bottleneck in the C3 module with a GhostBottleneck module. The GhostBottleneck module is constructed based on the GhostConv module. The first expansion layer GhostConv module increases the number of channels of the input feature map, and the second GhostConv module reduces the dimension and reduces the number of channels of the output feature map, so as to match the shortcut path in the network. Finally, the features are fused by adding the residual edge after deep convolution.

[0178] Step S4: input the real-time collected chain image into the model to obtain the segmentation mask and category of each bearing, and calculate the bearing center pixel coordinates;

[0179] Specifically, in the step S4:

[0180] The multi-threading technology is used to ensure the synchronization of the binocular camera in collecting the chain image. The left and right views collected in real time are respectively input into the chain bearing segmentation model in the sub-thread to obtain the segmentation mask and the bearing category of each bearing in the measured chain image. The second type of bearing is discarded. The segmentation mask obtained by the model prediction is used to extract the bearing contour, and the bearing contour is fitted with an ellipse to obtain the ellipse center point coordinates as the feature extraction result of the bearing center.

[0181] Step S5: correcting the extracted pixel coordinates, performing three-dimensional reconstruction and distance calculation;

[0182] Specifically, in the step S5:

[0183] The two bearings in the chain image are defined as bearing A and bearing B. The calculation process of the distance between the bearings is as follows: the center point pixel coordinates of bearing A and bearing B are obtained in the left and right views respectively, the center point pixel coordinates are restored to the coordinates on the original image size, the extracted pixel coordinates are corrected to eliminate the errors caused by the camera lens distortion, the pixel coordinates are ensured to reflect the actual visual information, the three-dimensional coordinates of the feature points are calculated according to the corrected coordinates through the triangulation relationship, and the Euclidean distance between the two feature points in the three-dimensional space is further calculated to obtain the actual distance between the center points of bearing A and bearing B.

[0184] The conversion principle of two-dimensional pixel coordinates to three-dimensional coordinates and the spatial distance solving method between the center points of the two bearings are as follows:

[0185] The left camera coordinate system is taken as the reference world coordinate system O w -X w Y w Z w of the binocular vision measurement system w , w w T ,

[0186] According to the camera imaging model, the following formulas 6 and 7 are obtained:

[0187]

[0188]

[0189] In the above formulas, ξ1 and ξ2 are proportional coefficients, A l and A r are the left and right camera intrinsic matrices respectively, R l and T l are composed of unit matrix and zero matrix, R r and T r are the rotation matrix R 12 and the translation matrix t 12 from the right camera coordinate system to the left camera coordinate system, is an element of the projection matrix M, i=1,2,3, j=1,2,3,4, k=1,2; ​​

[0190] Substitute and eliminate the proportional coefficient to obtain formula 8:

[0191]

[0192] Solve by least square method, rewrite formula 8 into matrix form AP=b, that is Then the three-dimensional coordinate calculation of P point is expressed as formula 9:

[0193] P=(A T A) -1 A T b (9)

[0194] In the formula,

[0195] Solve the space distance between the center points of two bearings by formula 10:

[0196]

[0197] In the formula, P i =[X wi ,Y wi ,Z wi ] is the three-dimensional coordinate of the center point of the i bearing, P i+1 =[X w(i+1) ,Y w(i+1) ,Z w(i+1) ] is the three-dimensional coordinate of the center point of the i+1 bearing, and d i(i+1) is the space distance between the center points of two bearings.

[0198] Step S6: Develop human-computer interaction interface.

[0199] Specifically, in the step S6:

[0200] The real-time measurement system of chain bearing spacing is built by using Qt framework, and multiple function modules are integrated through a comprehensive human-computer interaction interface. The specific modules include:

[0201] Spacing measurement module: process the chain image collected by the camera and calculate the distance between the chain bearings;

[0202] Binocular camera calibration module: responsible for the internal and external parameter calibration of the used binocular camera;

[0203] Camera parameter configuration module: allows users to customize the exposure time and gain parameters of the camera to adapt to different measurement environments and needs;

[0204] Real-time video monitoring module: display real-time video stream captured by the camera and real-time measurement result image;

[0205] Result visualization module: the measurement results are displayed in the form of a line chart;

[0206] Real-time measurement can support real-time measurement of the chain bearing spacing of the double sides of the conveyor, that is, two binocular vision systems work simultaneously.

[0207] Embodiment 2

[0208] Embodiment 2 is a preferred example of Embodiment 1, which more specifically illustrates the present application.

[0209] The present application also provides a chain bearing spacing real-time measurement system based on a lightweight model, which can be realized by performing the process steps of the chain bearing spacing real-time measurement method based on a lightweight model, that is, the chain bearing spacing real-time measurement method based on a lightweight model can be understood by those skilled in the art as a preferred embodiment of the chain bearing spacing real-time measurement system based on a lightweight model.

[0210] According to the chain bearing spacing real-time measurement system based on a lightweight model provided by the present application, the system comprises:

[0211] Module M1: install hardware equipment, collect chain bearing images;

[0212] Specifically, in the module M1:

[0213] Hardware equipment installation: configure two industrial cameras, a bar-shaped direct light source, a tripod, and a customized arc-shaped base, fix the arc-shaped base on the tripod, install the two industrial cameras and the bar-shaped direct light source on the base in order, build a binocular vision system, and place the entire set of equipment at a predetermined distance from the chain to be measured;

[0214] Collecting chain bearing images: use two industrial cameras to image the running chain, store and model predict the collected images, and display them on the user end, when collecting images using industrial cameras, set the region of interest function to transmit the specific area of the image, and set parameters including the horizontal offset, vertical offset, width, and height of the output area;

[0215] The camera reads image data from the designated area of the sensor into the cache and transmits it to the host end, and the images in other areas of the sensor are discarded, during the collection process, by reducing the height of the image ROI, discarding useless information, and improving the maximum allowed frame rate of the camera;

[0216] Module M2: label bearing masks on chain images, build data sets, and perform data enhancement;

[0217] In the module M2:

[0218] constructing a training data set of chain bearing images by using the collected data, the training data set including chain bearing images under different working conditions and lighting conditions, and some images with motion blur; the target image is labeled with a mask of two types of bearings;

[0219] In the data augmentation process, data augmentation techniques are introduced, and the specific enhancement methods include random rotation, scaling, cropping, translation, color jittering and adding noise, and the training samples are generated by combining MixUp and Mosaic enhancement techniques;

[0220] Module M3: building a network framework, training the framework using the training data set to obtain a chain bearing segmentation model;

[0221] In the module M3:

[0222] Based on the YOLOv8 network, a lightweight network GEDYS for chain bearing segmentation is proposed, which consists of a backbone network, a neck network and a head network. The C2f module in YOLOv8 in the backbone network and the neck network is replaced by the C3Ghost module, and the CBS module is replaced by the GhostConv module. In the neck network, the attention mechanism module EMA is configured after the last three C3Ghost modules, and the standard up-sampler is replaced by the dynamic up-sampler DySample module in the neck network, and the mask segmentation head of the single-stage instance segmentation network YOLACT is used in the head network part;

[0223] The training data set of chain bearing images is used to train and optimize the GEDYS network. In the training period, the network weight parameters with the best performance are selected as the final chain bearing segmentation model. By using the tracking method, all operations of the model are automatically recorded, so as to generate a TorchScript model and save it. TorchScript is the intermediate representation of PyTorch, which makes the PyTorch model optimized and serialized. The TorchScript model is then loaded in the C++ application using the libtorch library. After loading the model, the output data of the model is post-processed. libtorch is the C++ version of PyTorch;

[0224] The specific process of constructing the GhostConv module is as follows: a standard convolution is used to expand the input feature map to a higher channel number, and a split layer is used to divide the expanded feature map into two parts: one part is the main channel, and the other part is the auxiliary channel. In the main channel, a lightweight convolution layer is applied for processing; in the auxiliary channel, a standard convolution is used for processing, and the processed two parts of feature maps are combined to form the final output.

[0225] The specific process of the C3Ghost module construction is to combine the shunting concept of the cross-stage local network CSPNet and the design concept of the residual structure with the GhostConv technology to form a GhostBottleneck to replace the bottleneck layer, and the GhostBottleneck is composed of two series-connected GhostConv modules;

[0226] The EMA module has three parallel processing routes, and this mechanism extracts the attention weight descriptors of the feature map through two 1x1 convolution and one 3x3 convolution branch;

[0227] The DySample module processes the input feature map X through a sampling point generator, which generates a dynamic sampling set S according to the up-sampling scale factor s and the coordinate dimension 2g of the original feature map. Using these sampling points, the DySample up-sampler effectively up-samples the input feature map X to the output feature map X';

[0228] The design of the mask segmentation head is to split the instance segmentation task into two parallel sub-tasks: one is to generate a non-local prototype mask dictionary in the entire image range; the other is to predict a set of linear combination coefficients for each detected instance, and the instance mask is obtained by linearly combining these prototype masks and the corresponding mask coefficients, and then the predicted bounding box is used for cropping;

[0229] GhostConv module:

[0230] The CBS convolution block in the YOLOv8n network is composed of a convolution layer, batch normalization and an activation function. The standard convolution process is represented by formula 1, and the calculation amount is formula 2:

[0231] Y = X * f + b (1)

[0232] FLOP s = n·h'·w'·c·k·k (2)

[0233] In the formula, * represents convolution operation, X ∈ R c×h×w represents an input feature map with c input channels, height h and width w, Y ∈ R n×h′×w′ represents n output feature maps with height h' and width w', f ∈ R n×c×k×k represents n convolution kernels with size k x k, and b is the bias term.

[0234] The Ghost convolution uses a standard convolution layer to expand the input feature map to a higher number of channels, divides the expanded feature map into a main channel and an auxiliary channel, applies a lightweight convolution layer to the main channel, applies a standard convolution layer to the auxiliary channel, and combines the two parts of the feature map; the Ghost convolution is represented by formula 3, and the calculation amount is formula 4:

[0235]

[0236] FLOP G = m·h'·w'·c·k·k + (n-m)·h'·w'·d·d (4)

[0237] In the formula, f'∈R m×c×k×k represents m convolution kernels with a size of k×k, Y'∈R n×h′×w′ represents m intrinsic feature maps output after ordinary convolution on the input feature map, y i is the i-th channel feature map in Y', which is generated by a series of linear transformations Φ i,j of size d×d, m(s-1) Ghost feature maps y ij are generated, and

[0238] The calculation amount ratio of the standard convolution to the Ghost convolution is formula 5:

[0239]

[0240] C3Ghost module:

[0241] The C3Ghost module replaces the Bottleneck in the C3 module with a GhostBottleneck module; the GhostBottleneck module is constructed based on the GhostConv module, increases the number of channels of the input feature map through the first expansion layer GhostConv module, and then reduces the number of channels of the output feature map through the second GhostConv module to match the shortcut path in the network, and finally adds and fuses the features with the residual edge that has undergone deep convolution;

[0242] Module M4: input the real-time collected chain image into the model to obtain the segmentation mask and category of each bearing, and calculate the bearing center point pixel coordinates;

[0243] In the module M4:

[0244] The multi-threading technology is used to ensure the synchronization of the binocular camera in collecting the chain image. The left and right views collected in real time are respectively input into the chain bearing segmentation model in the sub-thread to obtain the segmentation mask and the bearing type of each bearing in the chain image to be measured. The bearings of one type are reserved and the bearings of the other type are discarded. The bearing profile is extracted by using the segmentation mask predicted by the model, and the bearing profile is fitted by an ellipse to obtain the coordinates of the center point of the ellipse as the feature extraction result of the bearing center.

[0245] Module M5: correcting the extracted pixel coordinates, performing three-dimensional reconstruction and distance calculation;

[0246] In the module M5:

[0247] The two bearings of one type in the chain image are defined as bearing A and bearing B. The calculation process of the distance between the bearings is as follows: the center point pixel coordinates of bearing A and bearing B are obtained in the left and right views, respectively. The center point pixel coordinates are restored to the coordinates on the original image size. The extracted pixel coordinates are corrected to eliminate the error caused by the camera lens distortion, ensure that the pixel coordinates reflect the actual visual information, calculate the three-dimensional coordinates of the feature points according to the corrected coordinates by the triangulation relationship, and further calculate the Euclidean distance between the two feature points in the three-dimensional space to obtain the actual distance between the center points of bearing A and bearing B.

[0248] The conversion principle of two-dimensional pixel coordinates to three-dimensional coordinates and the space distance solving method between the two bearing center points are as follows:

[0249] The left camera coordinate system is taken as the reference world coordinate system O w -X w Y w Z w , of which the homogeneous coordinates in the different image coordinate systems are (u1, v1, 1) and (u2, v2, 1), respectively, and the homogeneous coordinates in the reference world coordinate system are P = [X w ,Y w ,Z w ,1] T ,

[0250] According to the camera imaging model, equations 6 and 7 are obtained:

[0251]

[0252]

[0253] In the above equation, ξ1 and ξ2 are proportional coefficients, A l and A r are left and right camera intrinsic matrices, respectively, R l , Tl R is composed of a unit matrix and a zero matrix r T r R is a rotation matrix from the right camera coordinate system to the left camera coordinate system 12 T 12 m ij k is an element of the projection matrix M, i = 1, 2, 3, j = 1, 2, 3, 4, k = 1, 2;

[0254] Simultaneous equations and eliminate the proportion coefficient to get equation 8:

[0255]

[0256] Solve by least squares method, equation 8 is rewritten as matrix form AP = b, that is Then the three-dimensional coordinates of point P are calculated as equation 9:

[0257] P = (A T A) -1 A T b (9)

[0258] In the formula,

[0259] Solve the spatial distance between the center points of the two bearings by equation 10:

[0260]

[0261] In the formula, P i = [X wi , Y wi , Z wi ] is the three-dimensional coordinates of the center point of the i bearing, P i+1 = [X w(i+1) , Y w(i+1) , Z w(i+1) ] is the three-dimensional coordinates of the center point of the i+1 bearing, and d i(i+1) is the spatial distance between the center points of the two bearings.

[0262] Module M6: Develop human-computer interaction interface.

[0263] In the module M6:

[0264] Build a real-time measurement system for chain bearing spacing using Qt framework, integrate multiple function modules through a comprehensive human-computer interaction interface, specific modules include:

[0265] Spacing measurement module: process the chain image collected by the camera and calculate the distance between the chain bearings;

[0266] Binocular camera calibration module: responsible for the internal and external parameter calibration of the binocular camera used;

[0267] Camera parameter configuration module: allows users to customize the exposure time and gain parameters of the camera to adapt to different measurement environments and requirements;

[0268] Real-time video monitoring module: displays real-time video streams captured by the camera and real-time measurement result images;

[0269] Result visualization module: displays measurement results in the form of a line chart;

[0270] Real-time measurement can support real-time measurement of the chain bearing spacing on both sides of the conveyor, i.e., two binocular vision systems work simultaneously.

[0271] Embodiment 3:

[0272] Embodiment 3 is a preferred example of Embodiment 1, which more specifically illustrates the present application.

[0273] As shown in Figure 1 , the present example provides a chain bearing spacing measurement method based on a lightweight model, including the following steps:

[0274] 1. Assemble the hardware equipment and place the complete binocular vision system at a distance of 50 centimeters from the chain to be measured. As shown in Figure 2 , the hardware equipment configuration required for one set of binocular vision system is shown, which is used to measure the chain on one side of the conveyor. The system can support real-time measurement of the chain bearing spacing on both sides of the conveyor.

[0275] The present application provides a complete hardware equipment configuration for measuring the chain on one side of the conveyor. This configuration includes two industrial cameras, a strip straight light source, a tripod, and a custom arc-shaped base. First, fix the arc-shaped base on the tripod, then install the two industrial cameras and the strip straight light source on the base in order to build a binocular vision system. This layout ensures uniform and sufficient lighting during measurement, thereby improving the accuracy and efficiency of the measurement. Finally, place the entire equipment at a distance of 50 centimeters from the chain to be measured.

[0276] 2. Set the camera parameters through the human-computer interaction interface and control the camera to capture chain images. Users can set the exposure time and gain of the camera to adapt to different lighting conditions in the measurement field. After starting the measurement view, the system will increase the maximum image acquisition frame rate of the camera to more than 150 frames per second by reducing the height of the image ROI, effectively reducing image blur caused by chain movement, thereby ensuring high-quality images.

[0277] Two industrial cameras are used to image the running chain, the collected images are stored and model predicted, and displayed on the user end. When collecting images with an industrial camera, the ROI (Region of Interest) function can be used to transmit only the specific area of the image, and the parameters include the horizontal offset, vertical offset, width and height of the output area. The camera only reads the image data from the specified area of the sensor into the cache and transmits it to the host end, while the image of other areas of the sensor will be discarded. Considering that the target object occupies a small proportion in the chain image, during the collection process, by reducing the height of the image ROI, the useless information can be discarded to a certain extent, so that the maximum allowed collection frame rate of the camera can be increased to more than 150 frames per second, so as to reduce the influence of motion blur and ensure the quality of the collected image.

[0278] 3. Label two types of bearing masks on the chain image to construct a training data set. The training data set covers chain images under various working conditions and lighting conditions. Some of these images are affected by poor lighting conditions, which are manifested as overexposure or reflection of the bearings; some images are affected by interference factors such as steel slag and activated carbon powder. Label the bearing mask in each chain image and crop it to a small image containing only a single bearing instance to form the training data set. The data set contains 13,077 chain bearing images, covering two types of bearing targets. In order to train and verify the model performance, the data set is divided into training set, validation set and test set according to the ratio of 8:1:1, so as to ensure that the model can be robustly trained under diversified environmental conditions.

[0279] A training data set of chain bearing images is constructed using the data collected in the early stage, which includes chain bearing images under different working conditions and lighting conditions, and some images with motion blur. The target image is labeled with two types of bearing masks.

[0280] To further improve the diversity of the data set and the robustness of the model, the data augmentation technique is introduced in the data augmentation process. The specific enhancement methods include random rotation, scaling, cropping, translation, color jittering and adding noise, etc. These enhancement methods can simulate chain bearing images under different environmental conditions, effectively improving the adaptability of the model to actual complex environments. At the same time, through the combination of MixUp and Mosaic and other combined enhancement techniques, more complex and diverse training samples are generated, thereby improving the generalization ability of the model in different scenarios. These enhancement measures are applied one by one in the data set construction process, ensuring that the model can still maintain high and accurate segmentation performance when facing challenges such as dust, noise, lighting changes and motion blur.

[0281] 4. Build the GEDYS network framework, train it using the training dataset to obtain the chain bearing segmentation model, and deploy it into a C++ application. For example... Figure 3 As shown, the specific steps for building the GEDYS network in this process are as follows: A. Replace the C2f module in the YOLOv8n network with the C3Ghost module; B. Replace the CBS module with the GhostConv module; C. Introduce an EMA attention mechanism module after the C3Ghost module in the neck network; D. Replace the standard upsampler with the DySample module; E. Replace the target detection head with the mask segmentation head of the YOLACT network.

[0282] Based on the YOLOv8 network, a lightweight network, GEDYS, for chain bearing segmentation is proposed through a series of improvements. Specifically, GEDYS consists of three key parts: a backbone network, a neck network, and a head network. First, the C2f modules in the backbone and neck are replaced with C3Ghost modules, and the CBS module is replaced with the lighter GhostConv module. Then, in the neck network, the EMA attention mechanism module is strategically configured after the last three C3Ghost modules. Next, the standard upsampler in the neck network is replaced with the DySample module. Finally, the head part adopts the masked segmentation head of the single-stage instance segmentation network YOLACT.

[0283] The GEDYS network was trained and optimized using a training dataset of chain bearing images. During multiple training epochs, the best-performing network weight parameters were selected as the final chain bearing segmentation model. All model operations were automatically recorded using a tracing method, generating and saving a TorchScript model. This TorchScript model was then loaded into a C++ application using the libtorch library. After loading the model, necessary post-processing was performed on the output data to ensure accurate segmentation results, completing the model deployment process.

[0284] The GhostConv module is constructed as follows: First, a standard convolution is used to expand the input feature map to a higher number of channels. Next, a split layer divides the expanded feature map into two parts: a backbone channel and an auxiliary channel. A lightweight convolutional layer is applied to the backbone channel, while a standard convolution is used on the auxiliary channel. Finally, the two processed feature maps are merged to form the final output. This design effectively reduces computational complexity and model parameters while maintaining high processing accuracy.

[0285] The specific process of the C3Ghost module construction is to combine the shunt concept of CSPNet and the design concept of residual structure with GhostConv technology to form GhostBottleneck to replace the traditional bottleneck layer (Bottleneck). The GhostBottleneck mainly consists of two serial GhostConv modules. The first module serves to increase the number of channels to enhance the network's information capturing ability; the second module is responsible for reducing the number of channels to facilitate matching with the shortcut path, ensuring effective information transmission and integration, thereby improving the efficiency and performance of the entire network.

[0286] The EMA module enhances the model's perception of key features in images through its unique three parallel processing routes. This mechanism effectively captures information across channels and spatial dimensions by extracting attention weight descriptors from feature maps through two 1x1 convolution and one 3x3 convolution branch. This parallel structure avoids the limitations of sequential processing, reduces depth dependency, and achieves richer feature fusion through the aggregation of cross-spatial information. Not only does it maintain the integrity of the channel dimension, but it also improves computational efficiency and the model's generalization ability, overcoming the shortcomings of traditional attention mechanisms that rely on channel dimension reduction.

[0287] The DySample module processes the input feature map X through a unique sample point generator, which generates a dynamic sampling set S based on the upsampling scale factor s and the coordinate dimensions of the original feature map 2g (x and y coordinates). Using these sampling points, the DySample upsampler can effectively upsample the input feature map X to the output feature map X'.

[0288] The design of the mask segmentation head splits the instance segmentation task into two parallel subtasks: one is to generate a non-local prototype mask dictionary for the entire image range, and the other is to predict a set of linear combination coefficients for each detected instance. By linearly combining these prototype masks with the corresponding mask coefficients, the instance mask is obtained, and then the predicted bounding box is used for cropping. Since the mask generation process does not involve re-pooling, it can fully utilize the entire spatial information of the image, avoiding the loss of mask quality and significantly improving the accuracy and clarity of the final mask.

[0289] 5. Input the real-time collected chain image into the model to obtain the segmentation mask and category of each bearing. Extract the bearing contour through the segmentation mask and perform ellipse fitting to obtain the bearing center pixel coordinates. As shown in Figure 4 the real-time collected chain image after prediction by the chain bearing segmentation model, including the detection box position, instance mask, and category of each bearing.

[0290] The synchronization of the binocular camera acquisition chain image is ensured by using multi-thread technology. The real-time acquired left and right views are input into the chain bearing segmentation model in the sub-thread, respectively, to obtain the segmentation mask and bearing class of each bearing in the measured chain image. The one-class bearing is retained, and the two-class bearing is discarded. The bearing profile is extracted by using the segmentation mask predicted by the model, and the elliptical fitting is performed on the bearing profile to obtain the elliptical center point coordinates as the feature extraction result of the bearing center.

[0291] 6. The extracted pixel coordinates are corrected, and the three-dimensional coordinates are converted by the principle of triangulation, and the spatial distance between the two center points is solved.

[0292] Due to the limitation of camera view, there are usually only two one-class bearings in an effective chain image, which are defined as bearing A and bearing B. The calculation process of the bearing spacing is as follows: 1. The center point pixel coordinates of bearing A and bearing B are obtained in the left and right views by the method. 2. Considering that the ROI size of the camera acquisition image is not adjusted when the binocular vision system acquires the calibration plate image, the center point pixel coordinates need to be restored to the coordinates on the original image size. 3. The extracted pixel coordinates are corrected to eliminate the error caused by the camera lens distortion, and the pixel coordinates are more accurately reflected. 4. The three-dimensional coordinates of the feature points are calculated according to the corrected coordinates by the principle of triangulation, and the Euclidean distance between the two feature points in the three-dimensional space is further calculated to obtain the actual distance between the center points of bearing A and bearing B.

[0293] 7. The measurement results are visualized through the human-computer interaction interface, as shown in Figure 5 , which shows the running state of the human-computer interaction interface after the user starts the measurement.

[0294] The real-time measurement system of chain bearing spacing is built by using Qt framework. The system integrates multiple key function modules through a comprehensive human-computer interaction interface, and the specific modules include: 1. Spacing measurement module: the chain image acquired by the camera is processed by the method and the distance between the chain bearings is calculated. 2. Binocular camera calibration module: responsible for the internal and external parameter calibration of the used binocular camera to ensure the measurement accuracy. 3. Camera parameter configuration module: allows users to customize camera exposure time, gain and other parameters to adapt to different measurement environments and needs. 4. Real-time video monitoring module: used to display the real-time video stream captured by the camera and the result image of real-time measurement, to ensure that the user can intuitively observe and analyze the measurement process. 5. Result visualization module: the measurement results are displayed in the form of line chart, making data interpretation more intuitive and easier to understand.

[0295] The system can support real-time measurement of the chain bearing spacing of the conveyor on both sides at most, that is, two binocular vision systems work at the same time. The following describes the GhostConv module in step 4 of the GEDYS network:

[0296] As shown in Figure 3 , there are many CBS convolution blocks in the basic YOLOv8n network, which are composed of convolution layers (Convolution), batch normalization (Batch Normalization), and activation functions (Sigmoid-weighted Linear Unit, SiLU). Standard convolution layers usually result in a large number of network parameters and some redundancy in the output feature map. The standard convolution process can be represented as formula 1, and the calculation amount is formula 2:

[0297] Y=X*f+b (1)

[0298] FLOP s =n·h′·w′·c·k·k (2)

[0299] In the formula, * represents convolution operation, X∈R c×h×w represents an input feature map with c input channels, height h, and width w, Y∈R n×h′×w′ represents n output feature maps with height h′ and width w′, f∈R n×c×k×k represents n convolution kernels with size k×k, and b is the bias term. The Ghost convolution is proposed to solve the problem of large network parameter quantity and calculation amount, and the specific steps are as follows: 1. Use the standard convolution layer to expand the input feature map to a higher channel number. 2. Divide the expanded feature map into main channels and auxiliary channels. 3. Apply a lightweight convolution layer to the main channel and a standard convolution layer to the auxiliary channel. 4. Merge the two feature maps. The Ghost convolution can be represented as formula 3, and the calculation amount is formula 4:

[0300]

[0301] FLOP G =m·h′·w′·c·k·k+(n-m)·h′·w′·d·d (4)

[0302] In the formula, f′∈R m×c×k×k represents m convolution kernels with size k×k, Y′∈R n×h′×w′ represents m intrinsic feature maps output after ordinary convolution on the input feature map, y i ′ is the i-th channel feature map in Y′, which is generated by a series of inexpensive linear transformations Φ i,j of size d×d to generate m(s-1) Ghost feature maps y ij .

[0303] The ratio of the calculation amount of the standard convolution to the Ghost convolution is formula 5:

[0304]

[0305] Compared with directly using the CBS convolution block, the calculation amount of the GhostConv module is greatly reduced, and most of the feature information can be generated through a simple linear transformation.

[0306] The C3Ghost module in step 4 of the GEDYS network is introduced as follows:

[0307] The C3Ghost module replaces the traditional bottleneck in the C3 module with a reusable GhostBottleneck module. The GhostBottleneck module is based on the GhostConv module, which increases the number of input feature channels through the first expansion layer GhostConv module, and then reduces the number of output feature channels through the second GhostConv module, so that it matches the shortcut path in the network, and finally adds and fuses the features with the residual edge after deep convolution. The whole module reduces most of the traditional convolution in the original structure, compresses the model and reduces the calculation amount.

[0308] The conversion principle of two-dimensional pixel coordinates to three-dimensional coordinates and the space distance solving method between the center points of the two bearings in step 6 are introduced as follows:

[0309] The left camera coordinate system is taken as the reference world coordinate system O w -X w Y w Z w For a set of matching points in the left and right views, let their three-dimensional coordinates in the reference world coordinate system be P = [X w ,Y w ,Z w ,1] T According to the camera imaging model, formulas 6 and 7 can be obtained:

[0310]

[0311]

[0312] In the above formula, ξ1 and ξ2 are proportional coefficients, A l , A r are left and right camera intrinsic matrices, R l , T l are composed of unit matrices and zero matrices, R r , Tr Rotation matrix R from the right camera coordinate system to the left camera coordinate system 12 And translation matrix t 12 , m ij k Is the element of the projection matrix M, i=1,2,3, j=1,2,3,4, k=1,2.

[0313] Simultaneous and eliminate the proportion coefficient can get formula 8:

[0314]

[0315] Adopt least square method to solve, change the above formula into matrix form AP=b, then the three-dimensional coordinate calculation of P point can be expressed as formula 9:

[0316] P=(A T A) -1 A T b (9)

[0317] Finally, the spatial distance between the two bearing center points is solved by formula 10:

[0318]

[0319] The application provides a chain bearing spacing measurement method based on a lightweight model, and through development of a man-machine interactive interface, real-time and synchronous monitoring of chain bearing spacing in operation is realized, and the following beneficial effects are possessed:

[0320] 1. The application effectively reduces the imaging size by configuring an industrial camera to transmit a specific area of the image, thereby increasing the relative proportion of useful information. This strategy has double advantages: first, it significantly improves the frame rate of the camera, thereby reducing the influence of motion blur on image quality; second, by reducing the image size of the target to be measured, the inference speed of the deep learning model is significantly accelerated. These improvements significantly improve the efficiency and performance of the entire image processing process, thereby greatly ensuring the feasibility of real-time processing.

[0321] 2. The application first applies YOLOv8 network to feature extraction of chain bearing center. By replacing C2f module with C3Ghost module in Backbone and Neck of YOLOv8 network, and replacing CBS module with GhostConv module. This improvement significantly reduces the parameter quantity and computational complexity of the model, thereby reducing the memory requirement and hardware dependence, improving the usability of the model, while ensuring the real-time processing capability of the entire system for high frame rate image stream. By introducing EMA attention mechanism module in the neck network, the fine processing and focusing ability of the model on features is enhanced. DySample module is used instead of standard up-sampler to further reduce the parameter quantity and resource consumption of the model. In the Head part of the model, by using the single-stage instance segmentation technology of YOLACT network, high-quality masks and class information are effectively generated for each bearing instance, which facilitates accurate identification of the target bearing and extraction of the center point. Compared with the basic YOLOv8n network, the GEDYS network proposed in the application reduces the parameter quantity from 3,258,454 to 1,900,738 while maintaining the segmentation accuracy basically unchanged, and the computational complexity (GFLOPs) is also reduced from 12.0 to 9.3. Such improvement not only reduces resource consumption, but also ensures that the segmentation accuracy of the model maintains at a high level. Compared with the two-stage detector used in the prior art, the GEDYS network proposed in the application has significant improvement in the prediction accuracy of bearing center point and the inference speed of the model, which is sufficient to meet the higher real-time requirement. Moreover, since the network is improved based on YOLOv8, its deployment difficulty in C++ environment is lower, further enhancing its usability.

[0322] 3. The application effectively realizes the conversion of bearing center point from two-dimensional coordinates to three-dimensional coordinates through the principle of triangulation, ensures the measurement accuracy, and does not require complex and high-cost hardware support, making it have high cost-effectiveness in industrial scene applications, especially suitable for production line environments that require high precision and high efficiency.

[0323] 4. The application constructs a real-time measurement system for chain bearing spacing through the development of human-computer interaction interface, which significantly improves the user experience and operation efficiency of the entire measurement system. Not only reduces the user training and maintenance cost, but also enables users to monitor the real-time measurement process.

[0324] The server environment configuration for training and testing the GEDYS network for chain bearing segmentation is as follows: the processor is Intel(R) Core(TM) i7-7800K CPU with a frequency of 3.50 GHz, and is equipped with 32 GB of memory. The server is installed with an NVIDIA GeForce RTX 3090 graphics card, which supports cuDNN acceleration. The operating system uses Ubuntu 18.04. The network environment is configured as PyTorch 1.11.0 and Python 3.9.0.

[0325] Table 1 Ablation experiment

[0326] Network architecture mAP50 mAP50:95 Parameter amount GFLOPs YOLOv8-seg 0.994 0.866 3,258,454 12.0 YOLOv8-seg-ghost 0.994 0.856 1,966,882 8.9 GEDYS (the network) 0.994 0.858 1,900,738 9.3

[0327] Those skilled in the art know that, in addition to implementing the system provided by the present application and each device, module, unit thereof in the form of pure computer readable program code, the system provided by the present application and each device, module, unit thereof can also be implemented in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers and embedded microcontrollers, etc. by logically programming the method steps to achieve the same functions. Therefore, the system provided by the present application and each device, module, unit thereof can be considered as a hardware component, and the devices, modules, units included therein for implementing various functions can also be considered as structures within the hardware component; the devices, modules, units for implementing various functions can also be considered as both software modules implementing methods and structures within hardware components.

[0328] The specific embodiments of the present application are described above. It should be understood that the present application is not limited to the specific embodiments described above, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essential content of the present application. In the case of no conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.

Claims

1. A method for real-time measurement of chain bearing spacing based on a lightweight model, characterized in that, include: Step S1: Install hardware equipment and acquire images of the chain bearing; Step S2: Label the bearing mask on the chain image to construct the dataset and perform data augmentation; Step S3: Build the network framework and train the framework using the training dataset to obtain the chain bearing segmentation model; Step S4: Input the real-time acquired chain image into the model to obtain the segmentation mask and category of each bearing, and calculate the pixel coordinates of the bearing center point; Step S5: Correct the extracted pixel coordinates, perform 3D reconstruction and spacing calculation; Step S6: Develop the human-computer interaction interface.

2. The method for real-time measurement of chain bearing spacing based on a lightweight model according to claim 1, characterized in that, In step S1: Hardware installation: The configuration includes two industrial cameras, a strip light source, a tripod, and a custom curved base. Fix the curved base to the tripod, and install the two industrial cameras and the strip light source in sequence on the base to build a binocular vision system. Place the entire set of equipment at a preset distance from the chain to be tested. Acquiring Chain Bearing Images: Two industrial cameras are used to image the running chain. The acquired images are stored and used for model prediction, and then displayed on the user end. When acquiring images using industrial cameras, a specific area of ​​the image is transmitted by setting the region of interest function. The parameters set include the horizontal offset, vertical offset, width, and height of the output area. The camera reads image data from a designated area of ​​the sensor into a buffer and transmits it to the host. Images from other areas of the sensor are discarded. During the acquisition process, by reducing the height of the image ROI and discarding useless information, the maximum allowable acquisition frame rate of the camera is increased.

3. The real-time measurement method for chain bearing spacing based on a lightweight model according to claim 1, characterized in that, In step S2: A training dataset of chain bearing images was constructed using the collected data. The training dataset included chain bearing images under different working conditions and lighting conditions, as well as some images with motion blur. The target images were labeled with masks for two types of bearings. Data augmentation techniques are introduced during the data augmentation process. Specific augmentation methods include random rotation, scaling, cropping, translation, color jittering, and adding noise. Training samples are generated by combining MixUp and Mosaic augmentation techniques.

4. The method for real-time measurement of chain bearing spacing based on a lightweight model according to claim 1, characterized in that, In step S3: Based on the YOLOv8 network, a lightweight network GEDYS for chain bearing segmentation is proposed. GEDYS consists of three parts: a backbone network, a neck network, and a head network. The C2f module in the YOLOv8 network of the backbone and neck network is replaced with the C3Ghost module, and the CBS module is replaced with the GhostConv module. In the neck network, the attention mechanism module EMA is configured after the last three C3Ghost modules. The standard upsampler is replaced with the dynamic upsampler DySample module in the neck network. The mask segmentation head of the single-stage instance segmentation network YOLACT is adopted in the head network. The GEDYS network was trained and optimized using a training dataset of chain bearing images. During the training cycle, the network weight parameters with the best performance were selected as the final chain bearing segmentation model. A tracking method was used to automatically record all model operations, thereby generating and saving a TorchScript model. TorchScript is an intermediate representation of PyTorch, enabling the PyTorch model to be optimized and serialized. The TorchScript model was then loaded into a C++ application using the libtorch library. After loading the model, post-processing was performed on the model's output data. libtorch is the C++ version of PyTorch. The GhostConv module is constructed as follows: a standard convolution is used to expand the input feature map to a higher number of channels. A split layer is used to divide the expanded feature map into two parts: one part is the backbone channel and the other part is the auxiliary channel. A lightweight convolutional layer is applied to the backbone channel for processing. A standard convolution is applied to the auxiliary channel for processing. The two parts of the feature map are then merged to form the final output. The specific process of building the C3Ghost module is as follows: the concept of traffic splitting and the design philosophy of residual structure of cross-stage local network CSPNet are combined with GhostConv technology to form GhostBottleneck to replace the bottleneck layer. GhostBottleneck consists of two GhostConv modules connected in series. The EMA module uses three parallel processing paths. This mechanism extracts attention weight descriptors from feature maps through two 1x1 convolutions and one 3x3 convolution branch. The DySample module processes the input feature map X through a sampling point generator. This generator produces a dynamic sampling set S based on the upsampling scaling factor s and the coordinate dimension 2g of the original feature map. Using these sampling points, the DySample upsampler effectively upsamples the input feature map X to the output feature map X'. The mask segmentation head is designed to split the instance segmentation task into two parallel subtasks: one is to generate a non-local prototype mask dictionary across the entire image; the other is to predict a set of linear combination coefficients for each detected instance, obtain the instance mask by linearly combining these prototype masks with the corresponding mask coefficients, and then crop the instance mask using the predicted bounding box.

5. The method for real-time measurement of chain bearing spacing based on a lightweight model according to claim 4, characterized in that: GhostConv module: In the YOLOv8n network, the CBS convolutional block consists of a convolutional layer, batch normalization, and an activation function; the standard convolution process is expressed as Equation 1, and the computational complexity is Equation 2: Y = X * f + b (1) FLOP s =n·h′·w′·c·k·k (2) In the formula, * represents the convolution operation, X∈R c×h×w This represents a feature map with c input channels, h height, and w width, where Y ∈ R. n ×h′×w′ This means outputting n feature maps with height h′ and width w′, where f∈R n×c×k×k This represents n convolution kernels of size k×k, where b is the bias term; Ghost convolution expands the input feature map to a higher number of channels using standard convolutional layers. The expanded feature map is divided into a main channel and auxiliary channels. Lightweight convolutional layers are applied to the main channels, while standard convolutional layers are applied to the auxiliary channels. The two feature maps are then merged. The Ghost convolution is expressed as Equation 3, and its computational complexity is Equation 4. FLOP G =m·h′·w′·c·k·k+(n-m)·h′·w′·d·d (4) In the formula, f′∈R m×c×k×k Let Y′ represent m convolution kernels of size k×k, where Y′∈R n×h′×w′ Let y represent the m intrinsic feature maps output after performing a regular convolution on the input feature map. i Let ' be the feature map of the i-th channel in Y', and Φ be transformed by a series of linear transformations of size d×d. i,j Generate m(s-1) Ghost feature maps y ij ,and The computational cost ratio of standard convolution to Ghost convolution is given by Equation 5: C3Ghost module: The C3Ghost module replaces Bottleneck in the C3 module with the GhostBotleneck module. The GhostBotleneck module is built on the GhostConv module. It increases the number of channels in the input feature map through the first extension layer GhostConv module, and then reduces the number of channels in the output feature map through the second GhostConv module to match the shortcut path in the network. Finally, it is added to the residual edge after depthwise convolution to fuse the features.

6. The real-time measurement method for chain bearing spacing based on a lightweight model according to claim 1, characterized in that, In step S4: Multi-threading technology is used to ensure the synchronization of chain image acquisition by binocular cameras. In a sub-thread, the real-time acquired left and right views are input into the chain bearing segmentation model to obtain the segmentation mask and bearing category of each bearing in the chain image under test. One type of bearing is retained and the other type of bearing is discarded. The bearing contour is extracted using the segmentation mask predicted by the model, and the bearing contour is fitted with an ellipse. The coordinates of the center point of the ellipse are used as the feature extraction result of the bearing center.

7. The method for real-time measurement of chain bearing spacing based on a lightweight model according to claim 1, characterized in that, In step S5: In the chain image, two bearings of class I are defined as bearing A and bearing B. The calculation process for the spacing between these bearings is as follows: Obtain the center point pixel coordinates of bearing A and bearing B in the left and right views respectively. The center point pixel coordinates are restored to coordinates on the original image size. The extracted pixel coordinates are corrected to eliminate errors caused by camera lens distortion and ensure that the pixel coordinates reflect the actual visual information. The three-dimensional coordinates of the feature points are calculated based on these corrected coordinates through triangulation. The Euclidean distance between the two feature points in three-dimensional space is further calculated to obtain the actual distance between the center points of bearing A and bearing B. The principle of converting two-dimensional pixel coordinates to three-dimensional solid coordinates, and the specific method for solving the spatial distance between the center points of two bearings are as follows: The left camera coordinate system is used as the reference world coordinate system O for the binocular vision measurement system. w -X w Y w Z w For a set of matching points in the left and right views, their homogeneous coordinates in different image coordinate systems are (u1, v1, 1) and (u2, v2, 1), respectively, and their homogeneous coordinates in the reference world coordinate system are P = [X]. w ,Y w Z w ,1] T , Equations 6 and 7 are derived from the camera imaging model: In the above formula, ξ1 and ξ2 are proportionality coefficients, A l A r These are the intrinsic parameter matrices for the left and right cameras, respectively, R. l T l R consists of an identity matrix and a zero matrix. r T r Rotation matrix R from the right camera coordinate system to the left camera coordinate system 12 Translation matrix t 12 , These are elements of the projection matrix M, i = 1, 2, 3, j = 1, 2, 3, 4, k = 1, 2; By combining the equations and eliminating the proportionality coefficient, we obtain equation 8: Solving using the least squares method, Equation 8 is rewritten in matrix form as AP = b, i.e. The three-dimensional coordinates of point P are then expressed as Equation 9: P=(A T A) -1 A T b (9) In the formula, The spatial distance between the center points of the two bearings can be solved using Equation 10: In the formula, P i =[X wi ,Y wi Z wi [P] represents the three-dimensional coordinates of the center point of the i-th bearing. i+1 =[X w(i+1) ,Y w(i+1) Z w(i+1) ] represents the three-dimensional coordinates of the center point of the (i+1)th bearing, d i(i+1) This is the spatial distance between the center points of the two bearings.

8. The method for real-time measurement of chain bearing spacing based on a lightweight model according to claim 1, characterized in that, In step S6: A real-time measurement system for chain bearing spacing was built using the Qt framework. Through a comprehensive human-computer interaction interface, multiple functional modules were integrated, including: Spacing measurement module: processes chain images captured by the camera and calculates the distance between chain bearings; Binocular camera calibration module: responsible for calibrating the intrinsic and extrinsic parameters of the binocular camera in use; Camera parameter configuration module: Allows users to customize the camera's exposure time and gain parameters to adapt to different measurement environments and needs; Real-time video monitoring module: Displays real-time video streams captured by the camera and images of real-time measurement results; Results visualization module: Displays measurement results using a line chart; Real-time measurement can support real-time measurement of the distance between the chain bearings on both sides of the conveyor, that is, two sets of binocular vision systems working simultaneously.

9. A real-time measurement system for chain bearing spacing based on a lightweight model, characterized in that, include: Module M1: Installs hardware devices to acquire images of chain bearings; Module M2: Annotates bearing masks on chain images to construct datasets and perform data augmentation; Module M3: Build the network framework and train the framework using the training dataset to obtain the chain bearing segmentation model; Module M4: Input the real-time acquired chain images into the model to obtain the segmentation mask and category of each bearing, and calculate the pixel coordinates of the bearing center point; Module M5: Corrects the extracted pixel coordinates, performs 3D reconstruction and spacing calculation; Module M6: Develop human-computer interaction interfaces.

10. The real-time measurement system for chain bearing spacing based on a lightweight model according to claim 9, characterized in that: In module M1: Hardware installation: The configuration includes two industrial cameras, a strip light source, a tripod, and a custom curved base. Fix the curved base to the tripod, and install the two industrial cameras and the strip light source in sequence on the base to build a binocular vision system. Place the entire set of equipment at a preset distance from the chain to be tested. Acquiring Chain Bearing Images: Two industrial cameras are used to image the running chain. The acquired images are stored and used for model prediction, and then displayed on the user end. When acquiring images using industrial cameras, a specific area of ​​the image is transmitted by setting the region of interest function. The parameters set include the horizontal offset, vertical offset, width, and height of the output area. The camera reads image data from a designated area of ​​the sensor into a buffer and transmits it to the host. Images from other areas of the sensor are discarded. During the acquisition process, by reducing the height of the image ROI and discarding useless information, the maximum allowable acquisition frame rate of the camera is increased. In module M2: A training dataset of chain bearing images was constructed using the collected data. The training dataset included chain bearing images under different working conditions and lighting conditions, as well as some images with motion blur. The target images were labeled with masks for two types of bearings. Data augmentation techniques are introduced during the data augmentation process. Specific augmentation methods include random rotation, scaling, cropping, translation, color jittering, and adding noise. Training samples are generated by combining MixUp and Mosaic augmentation techniques. In module M3: Based on the YOLOv8 network, a lightweight network GEDYS for chain bearing segmentation is proposed. GEDYS consists of three parts: a backbone network, a neck network, and a head network. The C2f module in the YOLOv8 network of the backbone and neck network is replaced with the C3Ghost module, and the CBS module is replaced with the GhostConv module. In the neck network, the attention mechanism module EMA is configured after the last three C3Ghost modules. The standard upsampler is replaced with the dynamic upsampler DySample module in the neck network. The mask segmentation head of the single-stage instance segmentation network YOLACT is adopted in the head network. The GEDYS network was trained and optimized using a training dataset of chain bearing images. During the training cycle, the network weight parameters with the best performance were selected as the final chain bearing segmentation model. A tracking method was used to automatically record all model operations, thereby generating and saving a TorchScript model. TorchScript is an intermediate representation of PyTorch, enabling the PyTorch model to be optimized and serialized. The TorchScript model was then loaded into a C++ application using the libtorch library. After loading the model, post-processing was performed on the model's output data. libtorch is the C++ version of PyTorch. The GhostConv module is constructed as follows: a standard convolution is used to expand the input feature map to a higher number of channels. A split layer is used to divide the expanded feature map into two parts: one part is the backbone channel and the other part is the auxiliary channel. A lightweight convolutional layer is applied to the backbone channel for processing. A standard convolution is applied to the auxiliary channel for processing. The two parts of the feature map are then merged to form the final output. The specific process of building the C3Ghost module is as follows: the concept of traffic splitting and the design philosophy of residual structure of cross-stage local network CSPNet are combined with GhostConv technology to form GhostBottleneck to replace the bottleneck layer. GhostBottleneck consists of two GhostConv modules connected in series. The EMA module uses three parallel processing paths. This mechanism extracts attention weight descriptors from feature maps through two 1x1 convolutions and one 3x3 convolution branch. The DySample module processes the input feature map X through a sampling point generator. This generator produces a dynamic sampling set S based on the upsampling scaling factor s and the coordinate dimension 2g of the original feature map. Using these sampling points, the DySample upsampler effectively upsamples the input feature map X to the output feature map X'. The mask segmentation head is designed to split the instance segmentation task into two parallel subtasks: one is to generate a non-local prototype mask dictionary across the entire image; the other is to predict a set of linear combination coefficients for each detected instance, obtain the instance mask by linearly combining these prototype masks with the corresponding mask coefficients, and then crop it using the predicted bounding box. GhostConv module: In the YOLOv8n network, the CBS convolutional block consists of a convolutional layer, batch normalization, and an activation function; the standard convolution process is expressed as Equation 1, and the computational complexity is Equation 2: Y = X * f + b (1) FLOP s =n·h′·w′·c·k·k (2) In the formula, * represents the convolution operation, X∈R c×h×w This represents a feature map with c input channels, h height, and w width, where Y ∈ R. n ×h′×w′ This means outputting n feature maps with height h′ and width w′, where f∈R n×c×k×k This represents n convolution kernels of size k×k, where b is the bias term; Ghost convolution expands the input feature map to a higher number of channels using standard convolutional layers. The expanded feature map is divided into a main channel and auxiliary channels. Lightweight convolutional layers are applied to the main channels, while standard convolutional layers are applied to the auxiliary channels. The two feature maps are then merged. The Ghost convolution is expressed as Equation 3, and its computational complexity is Equation 4. FLOP G =m·h′·w′·c·k·k+(n-m)·h′·w′·d·d (4) In the formula, f′∈R m×c×k×k Let Y′ represent m convolution kernels of size k×k, where Y′∈R n×h′×w′ Let y represent the m intrinsic feature maps output after performing a regular convolution on the input feature map. i Let ' be the feature map of the i-th channel in Y', and Φ be transformed by a series of linear transformations of size d×d. i,j Generate m(s-1) Ghost feature maps y ij ,and The computational cost ratio of standard convolution to Ghost convolution is given by Equation 5: C3Ghost module: The C3Ghost module replaces Bottleneck in the C3 module with the GhostBotleneck module. The GhostBotleneck module is based on the GhostConv module. It increases the number of channels in the input feature map through the first extension layer GhostConv module, and then reduces the number of channels in the output feature map through the second GhostConv module to match the shortcut path in the network. Finally, it is added to the residual edge after depthwise convolution to fuse the features. In module M4: Multi-threading technology is used to ensure the synchronization of chain image acquisition by binocular cameras. In the sub-thread, the real-time acquired left and right views are input into the chain bearing segmentation model to obtain the segmentation mask and bearing category of each bearing in the chain image under test. Bearings of category 1 are retained and bearings of category 2 are discarded. The bearing contour is extracted using the segmentation mask predicted by the model, and the bearing contour is fitted with an ellipse. The coordinates of the center point of the ellipse are used as the feature extraction result of the bearing center. In module M5: In the chain image, two bearings of class I are defined as bearing A and bearing B. The calculation process for the spacing between these bearings is as follows: Obtain the center point pixel coordinates of bearing A and bearing B in the left and right views respectively. The center point pixel coordinates are restored to coordinates on the original image size. The extracted pixel coordinates are corrected to eliminate errors caused by camera lens distortion and ensure that the pixel coordinates reflect the actual visual information. The three-dimensional coordinates of the feature points are calculated based on these corrected coordinates through triangulation. The Euclidean distance between the two feature points in three-dimensional space is further calculated to obtain the actual distance between the center points of bearing A and bearing B. The principle of converting two-dimensional pixel coordinates to three-dimensional solid coordinates, and the specific method for solving the spatial distance between the center points of two bearings are as follows: The left camera coordinate system is used as the reference world coordinate system O for the binocular vision measurement system. w -X w Y w Z w For a set of matching points in the left and right views, their homogeneous coordinates in different image coordinate systems are (u1, v1, 1) and (u2, v2, 1), respectively, and their homogeneous coordinates in the reference world coordinate system are P = [X]. w ,Y w Z w ,1] T , Equations 6 and 7 are derived from the camera imaging model: In the above formula, ξ1 and ξ2 are proportionality coefficients, A l A r These are the intrinsic parameter matrices for the left and right cameras, respectively, R. l T l R consists of an identity matrix and a zero matrix. r T r Rotation matrix R from the right camera coordinate system to the left camera coordinate system 12 Translation matrix t 12 , These are elements of the projection matrix M, i = 1, 2, 3, j = 1, 2, 3, 4, k = 1, 2; By combining the equations and eliminating the proportionality coefficient, we obtain equation 8: Solving using the least squares method, Equation 8 is rewritten in matrix form as AP = b, i.e. The three-dimensional coordinates of point P are then expressed as Equation 9: P=(A T A) -1 A T b (9) In the formula, The spatial distance between the center points of the two bearings can be solved using Equation 10: In the formula, P i =[X wi ,Y wi Z wi [P] represents the three-dimensional coordinates of the center point of the i-th bearing. i+1 =[X w(i+1) ,Y w(i+1) Z w(i+1) ] represents the three-dimensional coordinates of the center point of the (i+1)th bearing, d i(i+1) This is the spatial distance between the center points of the two bearings; In module M6: A real-time measurement system for chain bearing spacing was built using the Qt framework. Through a comprehensive human-computer interaction interface, multiple functional modules were integrated, including: Spacing measurement module: processes chain images captured by the camera and calculates the distance between chain bearings; Binocular camera calibration module: responsible for calibrating the intrinsic and extrinsic parameters of the binocular camera in use; Camera parameter configuration module: Allows users to customize the camera's exposure time and gain parameters to adapt to different measurement environments and needs; Real-time video monitoring module: Displays real-time video streams captured by the camera and images of real-time measurement results; Results visualization module: Displays measurement results using a line chart; Real-time measurement can support real-time measurement of the distance between the chain bearings on both sides of the conveyor, that is, two sets of binocular vision systems working simultaneously.

Citation Information

Cited By

  • A method and system for dynamic motion simulation of scraper conveyor chain based on 3D modeling

    CN122310845A