Method and device for detecting curvature radius of optical jumper
By automatically detecting the curvature radius of optical jumpers using a convolutional neural network model based on mask areas, the problems of low efficiency and poor accuracy in the existing technology are solved, and fast and accurate detection of the curvature radius of optical jumpers is achieved.
Patent Information
- Application Number
- CN202510796872.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-13
- Publication Date
- 2025-09-23
AI Technical Summary
Existing methods for detecting the curvature radius of optical jumpers rely on manual observation or tool measurement, which has problems of low efficiency and poor accuracy. In particular, it is difficult to quickly and accurately detect the curvature radius of a large number of optical jumpers in complex environments.
A convolutional neural network model based on mask regions is used to detect the curvature radius of light jumpers. The target image of the light jumper is segmented from the image through an instance segmentation model. A smooth curve is fitted and the curvature radius is calculated. The pre-trained model is used to improve the robustness of detection in complex backgrounds.
It realizes automatic, fast and high-precision detection of the curvature radius of optical jumpers, improves detection efficiency and accuracy, and is suitable for optical jumper detection in complex backgrounds.
Smart Images

Figure CN120689393A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of optical fiber transmission management, and in particular to a method and device for detecting the curvature radius of an optical jumper. Background Art
[0002] In the construction and maintenance of current fiber-optic communication networks, optical patch cables, as key components connecting different fiber devices, are crucial for ensuring network performance and signal transmission quality. Existing methods for detecting the curvature radius of optical patch cables rely primarily on visual inspection by technicians or the use of specialized measurement tools. However, both methods have limitations and shortcomings, especially in large-scale fiber optic cabling scenarios.
[0003] Traditional manual detection methods are easily affected by human factors, such as the observer's experience, lighting conditions, and viewing angle, resulting in highly subjective and low-precision curvature radius assessment results, and are unable to provide quantitative measurement data. In complex environments such as data centers or network rooms, with cluttered backgrounds and changeable lighting conditions, traditional detection methods have difficulty effectively distinguishing optical patch cords from other lines or facilities, let alone accurately measuring their curvature radius. Some optical patch cords are located at remote locations, such as the top of a rack or at the bend of a channel. These locations are difficult to directly access, making detection with traditional manual measurement tools difficult and inefficient. Current detection methods lack automation and intelligent means, and are unable to quickly and efficiently detect and evaluate the curvature radius of a large number of optical patch cords. This has become a time-consuming and labor-intensive bottleneck, especially in project acceptance and network maintenance.
[0004] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention
[0005] The embodiments of the present application provide a method and apparatus for detecting the curvature radius of an optical jumper, so as to at least solve the technical problem of low efficiency and poor accuracy of traditional manual detection of the curvature radius of an optical jumper through visual inspection or tools.
[0006] According to one aspect of an embodiment of the present application, a method for detecting the curvature radius of an optical jumper is provided, comprising: acquiring a first image, wherein the first image includes a target optical jumper to be detected and a background; using a pre-trained instance segmentation model to segment a target image corresponding to the target optical jumper from the first image, and determining a target contour corresponding to the target optical jumper, wherein the instance segmentation model is a convolutional neural network model based on a mask region, and the target contour includes multiple discrete points; fitting the multiple discrete points into a smooth curve, determining a first curvature of each discrete point on the smooth curve, and determining a second curvature of the smooth curve based on the first curvatures of the multiple discrete points; and determining the curvature radius of the target optical jumper based on the second curvature.
[0007] Optionally, the training process of the instance segmentation model includes: constructing an instance segmentation model, wherein the instance segmentation model includes at least: a backbone network, a region candidate network, a region of interest adjustment network and a prediction head network; obtaining multiple second images including light jumpers collected under various environments, and annotating each second image, taking each second image as a training sample, and using the corresponding annotation information as a sample label, wherein the annotation information at least includes: each detection frame corresponding to the second image, the category label corresponding to each detection frame, and the segmentation mask; in the iterative training process, using the instance segmentation model to analyze each training sample separately to obtain the prediction result of the training sample, and constructing a target loss function based on the prediction result and the sample label corresponding to the training sample, wherein the prediction result includes at least: the predicted detection frame, the category label corresponding to each predicted detection frame, and the segmentation mask; using the back propagation mechanism and the target loss function to adjust the model parameters of the instance segmentation model.
[0008] Optionally, each training sample is analyzed separately using an instance segmentation model to obtain a prediction result of the training sample, including: for each training sample, using a backbone network to extract an image feature map in the training sample; using a region candidate network to perform a convolution operation on the image feature map according to a convolution kernel of a preset size to obtain multiple anchor frames, and determining the confidence that each anchor frame includes a light jump line, determining the anchor frame with a confidence higher than a first preset threshold as a candidate frame, and removing overlapping candidate frames through a non-maximum suppression method; using a region of interest adjustment network to map the obtained candidate frames to the image feature map, and obtaining a feature representation of a preset size corresponding to each candidate frame; using a prediction head network to analyze the feature representation corresponding to each candidate frame, and predicting multiple detection frames, a category label corresponding to each detection frame, and a segmentation mask.
[0009] Optionally, constructing a target loss function based on the prediction results and the sample labels corresponding to the training samples includes: constructing a classification loss function using the following formula:
[0010]
[0011] Where, L cls Represents the classification loss function, N represents the total number of detection boxes predicted in the same training batch, and C represents the total number of categories of detection boxes. Indicates the probability of predicting the nth detection box as the cth category, y nc Indicates the category unique encoding of the nth detection box. When the predicted category is the same as the actual category, y nc =1, when the predicted category is different from the actual category, y nc =0; use the following formula to construct the bounding box regression loss function:
[0012]
[0013] Where, L bbox represents the bounding box regression loss function, i represents the detection box parameters, {x, y, w, h} represents the horizontal coordinate of the center point of the detection box, the vertical coordinate of the center point, the width, and the height, respectively. Represents the parameters of the predicted n-th detection box, t ni Represents the actual parameters of the nth detection box, Represents smooth L1 loss; the mask loss function is constructed using the following formula:
[0014]
[0015] Where, L bbox represents the mask loss function, M×M represents the resolution of the segmentation mask corresponding to the detection box, represents the mask probability of the jth pixel of the predicted nth detection box, y nj Represents the actual mask value of the jth pixel of the nth detection box. The actual mask value of the foreground pixel is 1, and the actual mask value of the background pixel is 0. The classification loss function, the bounding box regression loss function, and the mask loss function are weighted and summed using the preset weight coefficient to obtain the target loss function.
[0016] Optionally, a pre-trained instance segmentation model is used to segment a target image corresponding to the target light jumper from the first image, and determine a target contour corresponding to the target light jumper, including: using the instance segmentation model to analyze the first image to obtain at least one predicted detection frame and a target segmentation mask corresponding to each detection frame; for each detection frame, determining the contour of the detection target in the detection frame based on the segmentation mask corresponding to the detection frame, and when the parameters of the contour match the preset contour parameter conditions, determining the area image corresponding to the detection frame as the target image, determining the detection target in the detection frame as the target light jumper, and determining the target contour of the target light jumper, wherein the parameters of the contour include at least one of the following: area, perimeter, center point, and contour point.
[0017] Optionally, the outline of the detection target in the detection frame is determined based on the segmentation mask corresponding to the detection frame, including: segmenting the regional image of the detection target from the segmentation mask based on a preset grayscale threshold; determining the edge of the detection target from the regional image using an edge detection algorithm; and smoothing the edge of the detection target to obtain the outline of the detection target.
[0018] Optionally, fitting the plurality of discrete points into a smooth curve and determining the first curvature of each discrete point on the smooth curve includes: fitting the plurality of discrete points using a polynomial to obtain a smooth curve; and calculating the first curvature of each discrete point on the smooth curve according to the following formula:
[0019]
[0020] Where k i represents the first curvature of the i-th discrete point, y ′ i Represents the slope of the smooth curve at the i-th discrete point, y ″ i Represents the slope change rate of the smooth curve at the i-th discrete point, y ′ i and y ″ i The values of are:
[0021]
[0022] In the formula, (x i ,y i )、(x i-1 ,y i-1 )、(x i+1 ,y i+1 ) represent the coordinates of the i-th, i-1-th, and i+1-th discrete points respectively.
[0023] Optionally, determining the second curvature of the smooth curve based on the first curvatures of multiple discrete points includes: determining an average value of the first curvatures of the multiple discrete points as the second curvature of the smooth curve; or determining a maximum value among the first curvatures of the multiple discrete points as the second curvature of the smooth curve.
[0024] Optionally, determining the curvature radius of the target optical jumper based on the second curvature includes: determining the reciprocal of the second curvature as the curvature radius of the target optical jumper.
[0025] Optionally, after determining the curvature radius of the target optical jumper based on the second curvature, the above method further includes: determining the type of the target optical jumper and obtaining a curvature radius threshold corresponding to the type; determining the standard deviation of the first curvature of multiple discrete points; determining that the target optical jumper is normal when the curvature radius of the target optical jumper is not less than the curvature radius threshold and the standard deviation is not greater than a preset standard deviation threshold; determining that the target optical jumper is abnormal when the curvature radius of the target optical jumper is less than the curvature radius threshold, or the standard deviation is greater than the preset standard deviation threshold.
[0026] According to another aspect of an embodiment of the present application, a device for detecting the curvature radius of an optical jumper is also provided, including: an acquisition module for acquiring a first image, wherein the first image includes a target optical jumper to be detected and a background; a contour determination module for using a pre-trained instance segmentation model to segment a target image corresponding to the target optical jumper from the first image, and determine a target contour corresponding to the target optical jumper, wherein the instance segmentation model is a convolutional neural network model based on a mask area, and the target contour includes multiple discrete points; a curvature determination module for fitting the multiple discrete points into a smooth curve, determining a first curvature of each discrete point on the smooth curve, and determining a second curvature of the smooth curve based on the first curvatures of the multiple discrete points; and a curvature radius determination module for determining the curvature radius of the target optical jumper based on the second curvature.
[0027] According to another aspect of an embodiment of the present application, a computer program product is further provided. The computer program product includes: a computer program, wherein when the computer program is executed by a processor, the above-mentioned method for detecting the curvature radius of an optical jumper is implemented.
[0028] According to another aspect of an embodiment of the present application, an electronic device is provided, comprising: a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the above-mentioned method for detecting the curvature radius of the optical jumper through the computer program.
[0029] In an embodiment of the present application, a first image is obtained, wherein the first image includes a target light jumper to be detected and a background; a pre-trained instance segmentation model is used to segment a target image corresponding to the target light jumper from the first image, and a target contour corresponding to the target light jumper is determined, wherein the instance segmentation model is a convolutional neural network model based on a mask area, and the target contour includes multiple discrete points; the multiple discrete points are fitted into a smooth curve, a first curvature of each discrete point on the smooth curve is determined, and a second curvature of the smooth curve is determined based on the first curvatures of the multiple discrete points; a curvature radius of the target light jumper is determined based on the second curvature, wherein the use of the convolutional neural network model based on the mask area as the pre-trained instance segmentation model can not only effectively segment the target image under simple backgrounds and accurately extract the light jumper contour, but also realize light jumper detection under complex backgrounds, thereby improving the robustness of detection. The entire process can quickly process a large number of images through automated detection, thereby solving the technical problems of low efficiency and poor accuracy of traditional manual detection of the curvature radius of light jumpers by visual inspection or tools. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0031] Figure 1 1 is a flow chart of an optional method for detecting the curvature radius of an optical jumper according to an embodiment of the present application;
[0032] Figure 2 is a schematic structural diagram of an optional mask region-based convolutional neural network model according to an embodiment of the present application;
[0033] Figure 3 is a schematic diagram of an optional original optical jumper to be tested according to an embodiment of the present application;
[0034] Figure 4 is a schematic diagram of an optional split optical jumper according to an embodiment of the present application;
[0035] Figure 5 is a schematic diagram of an optional optical jumper edge detection according to an embodiment of the present application;
[0036] Figure 6 is a schematic diagram of an optional optical jumper endpoint according to an embodiment of the present application;
[0037] Figure 7 1 is a schematic structural diagram of an optional device for detecting the curvature radius of an optical jumper according to an embodiment of the present application;
[0038] Figure 8 It is a schematic structural diagram of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0039] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0040] It should be noted that the terms "first", "second", etc. in the specification, claims, and drawings of the present application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.
[0041] In order to better understand the embodiments of the present application, some nouns or terms that appear in the description of the embodiments of the present application are first translated and explained as follows:
[0042] Mask Region-based Convolutional Neural Network model: Mask Region-based Convolutional Neural Network model, referred to as Mask R-CNN model, is an advanced computer vision model designed for target detection and instance segmentation tasks. It is the latest version of the region-based convolutional neural network R-CNN (Region-based Convolutional Neural Network) family, proposed by Ross Girshick et al. in 2017. It was initially demonstrated on the COCO dataset, demonstrating its excellent performance in instance segmentation. Its core idea is to combine target detection and instance segmentation to not only identify objects in the image, but also accurately segment the region of each object and generate a pixel-level mask for each instance. This enables the model to distinguish between multiple identical objects that overlap or are adjacent in the image, and provide independent segmentation results for each object.
[0043] Example 1
[0044] According to an embodiment of the present application, a method for detecting the curvature radius of an optical jumper is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0045] Figure 1 FIG. 1 is a flow chart of a method for detecting the curvature radius of an optical jumper provided in accordance with an embodiment of the present application, such as Figure 1 As shown, the method includes the following steps:
[0046] Step S102, acquiring a first image, wherein the first image includes the target light jumper to be detected and the background;
[0047] Step S104: Segmenting a target image corresponding to the target light jumper from the first image using a pre-trained instance segmentation model, and determining a target contour corresponding to the target light jumper. The instance segmentation model is a Mask Region-based Convolutional Neural Network (often referred to as Mask R-CNN) model, and the target contour includes multiple discrete points.
[0048] Step S106, fitting the plurality of discrete points into a smooth curve, determining a first curvature of each discrete point on the smooth curve, and determining a second curvature of the smooth curve based on the first curvatures of the plurality of discrete points;
[0049] Step S108 : determining a curvature radius of the target optical patch cord based on the second curvature.
[0050] The following describes the steps of the method for detecting the curvature radius of an optical patch cord in conjunction with a specific implementation process.
[0051] As a tool for accurately detecting and segmenting jump lines, the instance segmentation model provides a basis for subsequent curvature radius calculation. Therefore, it is crucial to pre-train the instance segmentation model to obtain a mature and complete model.
[0052] As an optional implementation, the training process of the instance segmentation model can be achieved in the following manner: constructing an instance segmentation model, wherein the instance segmentation model includes at least: a backbone network, a region candidate network, a region of interest adjustment network and a prediction head network; obtaining multiple second images including optical jumpers collected under various environments, and annotating each second image, taking each second image as a training sample, and using the corresponding annotation information as a sample label, wherein the annotation information includes at least: each detection box corresponding to the second image, the category label corresponding to each detection box, and the segmentation mask; in the iterative training process, using the instance segmentation model to analyze each training sample separately, obtain the prediction result of the training sample, and construct a target loss function based on the prediction result and the sample label corresponding to the training sample, wherein the prediction result includes at least: the predicted detection box, the category label corresponding to each predicted detection box, and the segmentation mask; using the back propagation mechanism and the target loss function to adjust the model parameters of the instance segmentation model.
[0053] Specifically, the training process of the strength example segmentation model is as follows:
[0054] Step S1: Build an instance segmentation model.
[0055] Among them, the instance segmentation model is a convolutional neural network model based on the mask area. Figure 2 Figure 2 shows a structural diagram of a convolutional neural network model based on a mask region. Figure 2 It can be seen that the convolutional neural network model specifically includes the following parts: Backbone Network, Region Proposal Network (RPN), Region of Interest Alignment Network (ROIAlign), Residual Network (ResNet), Feature Pyramid Network (Feature Pyramid Network), Fully Convolutional Networks (FCNs), Prediction Heads Network and Fully Connected Layers (FC layers). The following is an explanation of some of these modules:
[0056] Backbone network: Choose an appropriate feature extraction network, such as Residual Network (ResNet). ResNet is a key component of Mask R-CNN, responsible for extracting multi-layer, multi-level features from the input image.
[0057] Region Candidate Network: Designed to generate a series of candidate regions on the network's feature map, that is, regions that may contain target objects. The RPN network generates a set of anchor boxes through convolution operations, and classifies and regresses these anchor boxes through bounding box regression (bbox Reg) to determine which ones may be the locations of light jumpers. The convolution operation can be performed in layers, and different layers can select different or the same convolution kernel sizes. Common convolution kernel sizes can be selected from specifications such as 3×3 and 1×1. Anchor box classification can be achieved through the softmax activation function, and bounding box regression can be performed on the anchor boxes.
[0058] Residual Networks: The output of each layer is the sum of the input of the previous layer and the input of the current layer. This design allows the network to learn the "residual transformation"—the difference between input and output—rather than learning the input-output mapping from scratch. Residual connections effectively alleviate the degradation problem of deep networks, allowing them to be trained at greater depths.
[0059] Region of Interest Adjustment Network: It is used to accurately align the candidate regions generated by RPN on the feature map, ensuring accurate positioning and segmentation of the target even after scaling or cropping operations.
[0060] Prediction Heads: This consists of multiple branches for final classification, bounding box regression, and segmentation mask prediction. These branches are responsible for predicting the category of the candidate region, the accurate location of the bounding box, and the pixel-level segmentation mask of the light jump line.
[0061] Step S2: Obtain training samples.
[0062] Images containing optical patch cords are collected as multiple second images in a variety of environments, including but not limited to fiber optic cabling locations such as data centers, local area networks, and metropolitan area networks. This ensures that the model can effectively detect optical patch cords under various lighting, backgrounds, and shooting angles. Each second image is annotated with information including, but not limited to, a detection box (bounding box location) corresponding to the optical patch cord in the image, a category label (confirming that it is an optical patch cord and not another object), and a segmentation mask (accurately depicting the outline of the optical patch cord). This annotation information serves as sample labels and is used to train the model to correctly identify and segment optical patch cords.
[0063] Step S3, iterative training process.
[0064] Analysis and prediction: In each iteration, the current version of the instance segmentation model is used to analyze each training example and output a prediction result. The prediction result contains at least the predicted detection box, the corresponding class label for each detection box, and the segmentation mask.
[0065] Constructing a target loss function: Based on the difference between the prediction result and the sample label, a target loss function is constructed. Loss functions typically include classification loss, bounding box regression loss, and segmentation mask loss, which together measure the accuracy of the model prediction and the segmentation effect.
[0066] Model parameter adjustment: Through the back-propagation mechanism, the parameters of the instance segmentation model are adjusted in real time according to the gradient of the target loss function. This process is repeated until the model reaches the predetermined performance standard or converges.
[0067] As an optional implementation, each training sample is analyzed separately using an instance segmentation model to obtain a prediction result of the training sample, which can be achieved in the following way: for each training sample, the backbone network is used to extract the image feature map in the training sample; the region candidate network is used to perform a convolution operation on the image feature map according to a convolution kernel of a preset size to obtain multiple anchor frames, and the confidence of each anchor frame including the light jump line is determined, the anchor frame with a confidence higher than a first preset threshold is determined as the candidate frame, and the overlapping candidate frames are removed by the non-maximum suppression method; the region of interest adjustment network is used to map the obtained candidate frames to the image feature map to obtain a feature representation of a preset size corresponding to each candidate frame; the prediction head network is used to analyze the feature representation corresponding to each candidate frame to predict multiple detection frames, the category label corresponding to each detection frame, and the segmentation mask.
[0068] Specifically, the instance segmentation model is used to perform deep analysis on each training sample image to obtain the prediction results of the training image. The specific steps include:
[0069] Step S1, feature extraction.
[0070] First, a backbone network (such as a residual network) is used to extract multi-level features from the training image. Through a series of convolutional, pooling, and activation layers, the backbone network transforms the original image into an image feature map rich in detail. The goal of this step is to capture the underlying features of the light jumpers from the image, laying the foundation for subsequent processing.
[0071] Step S2: Generate anchor boxes and confidence evaluation.
[0072] Next, the region proposal network performs a convolution operation on the image feature map obtained above, generating a series of rectangular boxes of preset sizes and proportions—anchor boxes. For each anchor box, the RPN evaluates whether a light jump exists within it, calculating the likelihood of the anchor box covering the light jump—the confidence score. By setting a threshold, anchor boxes with high confidence scores are selected as candidate boxes. These candidate boxes are considered to be regions that may contain light jumps. Non-maximum suppression is then used to remove highly overlapping candidate boxes, ensuring that each light jump is accurately covered by only one candidate box, thereby avoiding detection redundancy.
[0073] Step S3: regional feature alignment.
[0074] The remaining candidate boxes are then aligned using a region-of-interest adjustment network. The essence of this technique lies in its ability to precisely resize the representation of the candidate boxes on the feature map to a uniform size. This eliminates information distortion caused by varying box sizes and ensures that each candidate box receives optimal feature representation, thereby improving the accuracy of subsequent segmentation.
[0075] Step S4, segmentation result prediction: Based on the aligned features, the prediction head network further analyzes and predicts the specific outline of the light jumper contained in each candidate box and its category. The prediction head network generates a detailed segmentation map, namely a segmentation mask, for each candidate box through full convolution. This mask can finely distinguish which pixels belong to the light jumper and which pixels belong to the background, achieving pixel-level distinction between light jumpers and background. In addition, the prediction head network also estimates the precise location of each candidate box - the bounding box, and the probability that the light jumper belongs to a certain category - the classification score. The classification score reflects the model's confidence in the light jumper category judgment, and the bounding box provides the exact length, width and position information of the light jumper in the original image.
[0076] Step S5: Result Integration and Output. Finally, the model integrates all predictions and outputs the bounding box coordinates, classification score, and segmentation mask for each identified light jump line. These outputs not only define the light jump line's location and category within the image but also precisely delineate its contours, providing detailed data support for subsequent curvature radius calculations.
[0077] The above process details how to use the Mask R-CNN model for instance segmentation of optical patch cables, covering everything from image feature extraction, candidate region generation, feature alignment, to final optical patch cable outline prediction and classification. Each step strictly adheres to the framework of the patent claims, ensuring the integrity and effectiveness of the technical solution. Through this series of steps, the model can output the precise location, classification, and segmentation outline of the optical patch cable, providing key information for subsequent curvature radius calculation, thus playing a core role in ensuring the compliance of optical patch cable wiring.
[0078] As an optional implementation, constructing a target loss function based on the prediction results and the sample labels corresponding to the training samples can be achieved in the following way: constructing a classification loss function using the following formula:
[0079]
[0080] Where, L cls Represents the classification loss function, N represents the total number of detection boxes predicted in the same training batch, and C represents the total number of categories of detection boxes. Indicates the probability of predicting the nth detection box as the cth category, y nc Indicates the category unique encoding of the nth detection box. When the predicted category is the same as the actual category, y nc =1, when the predicted category is different from the actual category, y nc =0; use the following formula to construct the bounding box regression loss function:
[0081]
[0082] Where, L bbox represents the bounding box regression loss function, i represents the detection box parameters, {x, y, w, h} represents the horizontal coordinate of the center point of the detection box, the vertical coordinate of the center point, the width, and the height, respectively. Represents the parameters of the predicted n-th detection box, t ni Represents the actual parameters of the nth detection box, Represents smooth L1 loss; the mask loss function is constructed using the following formula:
[0083]
[0084] Where, L bbox represents the mask loss function, M×M represents the resolution of the segmentation mask corresponding to the detection box, represents the mask probability of the jth pixel of the predicted nth detection box, y nj Represents the actual mask value of the jth pixel of the nth detection box. The actual mask value of the foreground pixel is 1, and the actual mask value of the background pixel is 0. The classification loss function, the bounding box regression loss function, and the mask loss function are weighted and summed using the preset weight coefficient to obtain the target loss function.
[0085] Specifically, the classification loss function is used to measure the model's prediction accuracy in identifying the category of light jumpers. This formula actually calculates the cross-entropy loss between the model's prediction and the actual label, that is, the gap between the probability distribution predicted by the model and the actual distribution. By minimizing the classification loss function, the model will learn how to predict the category of light jumpers more accurately; the bounding box regression loss function is used to evaluate the deviation between the detection box position predicted by the model and the actual position. By minimizing the bounding box regression loss function, the model can learn how to locate the bounding box of the light jumper more accurately. Among them, the bounding box regression loss function involves a smooth L1 loss function, marked as Smooth L1 (x), Smooth L1 The loss function (x) is a composite loss function that uses squared loss within a small error range and absolute loss within a large error range to balance the loss function's sensitivity to small errors and robustness to large errors. The mask loss function is used to evaluate the model's pixel-level segmentation accuracy for light jumps. The mask loss function is actually an extension of the binary cross-entropy loss function, which compares the difference between the model's predicted segmentation mask and the actual segmentation mask. By minimizing L_mask, the model can learn how to more accurately segment light jumps at the pixel level.
[0086] To fully optimize model performance, the classification loss function, bounding box regression loss function, and mask loss function need to be combined to form a target loss function. This combination is usually achieved through a weighted summation, that is, each loss is assigned a weight coefficient α, β, and γ, representing the importance of classification loss, bounding box regression loss, and mask loss, respectively. Therefore, the target loss function is expressed as:
[0087] L=α·L cls +β·L bbox +γ·L mask
[0088] In practice, these weighting coefficients can be fine-tuned based on task requirements and dataset characteristics. For example, in certain situations where classification accuracy is a higher priority, the value of α can be appropriately increased; whereas, if segmentation accuracy is emphasized, the weight of γ can be increased accordingly. By minimizing the objective loss function L, the model learns how to simultaneously improve the accuracy of light-jump line classification, bounding box localization, and pixel-level segmentation.
[0089] Constructing the target loss function is a core step in the entire model training process. It combines the classification, location, and segmentation accuracy assessment of optical patch cords, and updates network parameters through a backpropagation algorithm to optimize model performance. This process not only strengthens the model's ability to identify optical patch cords but also improves segmentation accuracy in complex backgrounds, laying a solid foundation for the subsequent precise calculation of curvature radius.
[0090] As an optional implementation, using a pre-trained instance segmentation model to segment the target image corresponding to the target light jumper from the first image and determine the target contour corresponding to the target light jumper can be achieved in the following way: using the instance segmentation model to analyze the first image to obtain at least one predicted detection frame and a target segmentation mask corresponding to each detection frame; for each detection frame, determining the contour of the detection target in the detection frame based on the segmentation mask corresponding to the detection frame, and when the parameters of the contour match the preset contour parameter conditions, determining the area image corresponding to the detection frame as the target image, determining the detection target in the detection frame as the target light jumper, and determining the target contour of the target light jumper, wherein the parameters of the contour include at least one of the following: area, perimeter, center point, and contour point.
[0091] Specifically, determining the target profile corresponding to the target optical jumper may include the following process.
[0092] Step S1: Use the pre-trained model to perform target segmentation.
[0093] We apply the pre-trained instance segmentation model to the first image to be detected, Figure 3The figure shows a schematic diagram of a raw light jump to be detected. The model uses a deep neural network to predict a bounding box (detection box) for each potential target in the image and also generates a segmentation mask corresponding to the bounding box. This segmentation mask is an image of the same size as the bounding box and consists of 0s and 1s, where 1s represent pixels belonging to the light jump and 0s represent background pixels or pixels that are not light jumps.
[0094] Step S2: extracting the contour within the bounding box.
[0095] For each predicted bounding box, we identify and extract the light jump line's outline based on the segmentation mask within the bounding box. This process involves edge detection on the segmentation mask to locate the boundary between the light jump line and the background. By finding the edges of the 1-connected regions in the mask, we can obtain the light jump line's outline information, namely the coordinates of each pixel on the outline.
[0096] Step S3: contour feature analysis and screening.
[0097] Next, we analyze the light jumper outline within each detection frame using a series of geometric features, including but not limited to the outline's area, perimeter, center point coordinates, and the set of contour points. These features help distinguish true light jumper outlines from other possible interference contours, which is particularly important for images with complex shapes or cluttered backgrounds. Contour parameters primarily include area, perimeter, center point coordinates, and contour point coordinates. Area (the number of pixels covered by the outline, reflecting the size of the light jumper); perimeter (the length of the outline's edge, providing information about the length of the light jumper's boundary); center point coordinates (the geometric center of the outline, used to determine the approximate location of the light jumper within the image); and contour points (the coordinates of the pixels that comprise the outline, providing data support for subsequent curve fitting and curvature calculations). By comparing these features with pre-set thresholds or conditions, we can identify and determine which contours truly represent the target light jumper and eliminate those false contours caused by occlusion, noise, or other factors.
[0098] Step S4: determining the target optical jumper and its outline.
[0099] Once the outline within a detection box is confirmed to be the actual light jumper outline, we can determine that the area image within the bounding box is the target image and the outline is the target outline of the target light jumper. This process, based on the previous feature analysis, ensures that the identified target light jumper meets specific conditions. That is, its area, perimeter, center point coordinates, and outline points match the preset standards.
[0100] As an optional implementation, determining the outline of the detection target in the detection frame based on the segmentation mask corresponding to the detection frame can be achieved in the following way: segmenting the regional image of the detection target from the segmentation mask based on a preset grayscale threshold; determining the edge of the detection target from the regional image using an edge detection algorithm; and smoothing the edge of the detection target to obtain the outline of the detection target.
[0101] Determining the outline of the detection target in the detection frame based on the segmentation mask may include the following process.
[0102] First, based on the segmentation mask, we use a grayscale thresholding technique to accurately separate the light jump line region from the background. This process is equivalent to binarizing the segmentation mask. All pixels above a preset grayscale threshold are marked as foreground—part of the light jump line. Pixels below this threshold are considered background and assigned a value of 0. Figure 4 A schematic diagram of a segmented optical jumper is shown. In this way, the area of the optical jumper is clearly highlighted, creating favorable conditions for subsequent edge detection and contour analysis. The above operations can be defined as:
[0103]
[0104] Through this formula, we can quickly and effectively extract the area of light jump lines from complex images, such as Figure 4 The light jumper segmentation image shown clearly demonstrates this effect.
[0105] Next, we can use an edge detection algorithm to locate the boundary between the light jumper and the background in the image of the separated light jumper area. Edge detection algorithms can identify areas in the image where grayscale values change dramatically, and these areas typically correspond to the actual boundaries of the light jumper. Edge detection allows us to obtain clear edges of the light jumper, providing accurate positioning information for subsequent contour extraction. Figure 5 A schematic diagram of optical jumper edge detection is shown, from which the specific effect of optical jumper edge detection can be seen. The clear presentation of the edge lays the foundation for subsequent contour analysis.
[0106] Finally, contour smoothing is performed to reduce noise. Figure 6 A schematic diagram of an optical patch cord endpoint is shown. To improve the accuracy and reliability of the outline, we smooth the detected edge endpoints. This step aims to reduce the impact of image noise on the outline, making it smoother and more coherent. Smoothing can be achieved using various algorithms, such as mean filtering, median filtering, or Gaussian filtering, to ensure that the final outline closely matches the actual shape of the optical patch cord.
[0107] As an optional implementation, fitting multiple discrete points into a smooth curve and determining the first curvature of each discrete point on the smooth curve includes: fitting the multiple discrete points using a polynomial to obtain a smooth curve; and calculating the first curvature of each discrete point on the smooth curve according to the following formula:
[0108]
[0109] Where k i represents the first curvature of the i-th discrete point, y ′ i Represents the slope of the smooth curve at the i-th discrete point, y ″ i Represents the slope change rate of the smooth curve at the i-th discrete point, y ′ i and y ″ i The values of are:
[0110]
[0111] In the formula, (x i ,y i )、(x i-1 ,y i-1 )、(x i+1 ,y i+1 ) represent the coordinates of the i-th, i-1-th, and i+1-th discrete points respectively.
[0112] To determine the smooth curve, we can select an appropriate polynomial order and perform a polynomial fit on multiple discrete points on the detected optical patch cord profile. This polynomial model will determine the best-fit curve by minimizing the error between the discrete points and the model curve. Once the fit is complete, we obtain a smooth curve that approximates the actual path of the optical patch cord. This curve not only smoothes the noise in the original data but also preserves the key curvature characteristics of the optical patch cord.
[0113] Then, for each discrete point on this smooth curve, we estimate its curvature value according to the calculation formula of the first curvature. i Describes the point (x i ,y i ) is the degree of curvature of the curve. Specifically, k i The calculation involves the rate of change of the slope of the smooth curve at that point, which is done by the following steps:
[0114] First-order derivative solution: At point (x i ,y i ) is the slope of the curve y ′ i, we use the ratio of the difference between the y coordinates of the two points before and after to the difference between the x coordinates to approximate, that is:
[0115]
[0116] This approximation is based on the finite difference principle, which takes the curve at x i The slope at is considered to pass through the point (x i-1 ,y i-1 ) and point (x i+1 ,y i+1 )The slope of the line connecting two points.
[0117] Second-order derivative solution: At point (x i ,y i ) is the rate of change of slope y ″ i , we also use the finite difference approximation, specifically:
[0118]
[0119] y ″ i The calculation process shows that the curve is i The degree of concavity of a point, that is, the rate of change of the curvature of the curve.
[0120] First curvature calculation: Finally, substitute the slope and slope change rate calculated above into the formula for the first curvature:
[0121]
[0122] k i The calculation formula reflects the point (x i ,y i ) is the curvature of the curve. By calculating k i ,We are able to evaluate the bending state of the optical patch cord at each inspection point, which is crucial for analyzing whether the curvature radius of the optical patch cord is compliant.
[0123] Through the above process, not only is a smooth curve that can accurately represent the shape of the optical jumper generated, but the first curvature of each point on the curve is also calculated. This series of operations provides crucial data support for the subsequent calculation of the curvature radius of the optical jumper.
[0124] As an optional implementation, determining the second curvature of a smooth curve based on the first curvatures of multiple discrete points can be achieved in the following manner: determining the average value of the first curvatures of multiple discrete points as the second curvature of the smooth curve; or determining the maximum value among the first curvatures of multiple discrete points as the second curvature of the smooth curve. The above two second curvatures can also be calculated simultaneously.
[0125] Curvature assessment is a comprehensive method for calculating the overall curvature of a curve. In the context of calculating curvature of optical patch cables, we typically focus on the curvature of the entire path, rather than the curvature at a single local point. Therefore, it is necessary to evaluate the average curvature of the entire path or other statistical indicators to characterize the overall curvature of the optical patch cable.
[0126] The overall curvature can be evaluated in a variety of ways, common methods include mean curvature and maximum curvature.
[0127] We can use the average curvature or the maximum curvature as the second curvature of the smooth curve after smoothing. Specifically, the calculation process of two common second curvatures is as follows.
[0128] The average curvature is the most commonly used indicator for evaluating overall curvature. It represents the average value of the curvature of all points along the optical patch cord path and can be calculated using the following formula:
[0129]
[0130] Among them, k i represents the curvature of the i-th discrete point, and n is the number of discrete points.
[0131] The maximum curvature represents the point on the optical patch cable path where the curvature is the largest. This is often used to identify the most curved portion of the path and can be calculated using the following formula:
[0132] k max =max(k1, k2, k3, ..., k n )
[0133] Among them, k1~k n The curvature of the 1st to nth discrete points can be represented by the maximum value of the curvature of these discrete points as the second curvature.
[0134] As an optional implementation, determining the curvature radius of the target optical jumper based on the second curvature can be achieved in the following manner: determining the reciprocal of the second curvature as the curvature radius of the target optical jumper.
[0135] According to the relationship between curvature and radius, it can be concluded that By solving the curvature radius, it can be determined whether the target jumper meets the requirements.
[0136] When the second curvature is obtained by calculating the average curvature, the average curvature radius can be calculated accordingly. When the second curvature is obtained by calculating the maximum curvature, the minimum curvature radius can be calculated accordingly.
[0137] As an optional embodiment, after determining the curvature radius of the target optical jumper based on the second curvature, the above method also includes: determining the type of the target optical jumper and obtaining a curvature radius threshold corresponding to the type; determining the standard deviation of the first curvature of multiple discrete points; determining that the target optical jumper is normal when the curvature radius of the target optical jumper is not less than the curvature radius threshold and the standard deviation is not greater than the preset standard deviation threshold; determining that the target optical jumper is abnormal when the curvature radius of the target optical jumper is less than the curvature radius threshold, or the standard deviation is greater than the preset standard deviation threshold.
[0138] After completing the detection of the curvature radius of the optical patch cord, this application further proposes an optional implementation method to scientifically evaluate the health status of the optical patch cord and guide communication project acceptance and network maintenance work. The specific implementation plan is as follows:
[0139] Step S1: Determine the type of the optical jumper and the curvature radius threshold.
[0140] First, based on the specific type of optical patch cord (single-mode or multi-mode), we consult the corresponding engineering specifications to determine the curvature radius threshold of the optical patch cord. Specifically:
[0141] Single-mode optical fiber: The recommended minimum curvature radius ranges from 30mm to 40mm, which means that during cabling, the optical fiber bending radius should not be lower than this range to prevent signal attenuation and optical fiber damage.
[0142] Multimode fiber: Its minimum curvature radius range is relaxed to 25mm to 30mm. Taking into account the larger core diameter of multimode fiber, its bending radius requirement is more relaxed than that of single-mode fiber.
[0143] Step S2, standard deviation calculation.
[0144] Next, we calculated the standard deviation of the first curvature along the entire path of the optical patch cable to assess the uniformity of the curvature variation. The standard deviation provides a statistical description of the curvature variation of the optical patch cable. A large standard deviation indicates that the curvature radius fluctuates significantly along the path, indicating that there may be abnormal stress on the optical patch cable in certain areas or potential signal transmission issues.
[0145] Step S3: curvature radius compliance and volatility evaluation.
[0146] Based on the above information, we evaluate the compliance and fluctuation of the curvature radius of the optical patch cord:
[0147] Compliance: Verify that the curvature radius of the target optical patch cable is not less than the obtained curvature radius threshold. For example, for a single-mode optical fiber, the curvature radius should be greater than or equal to 40 mm.
[0148] Fluctuation: Evaluate whether the standard deviation of the first curvature is below the preset standard deviation threshold to determine whether the curvature change is stable. The preset standard deviation threshold should be set based on practical experience and statistical data in communications engineering. Generally, a lower standard deviation means that the curvature of the optical patch cord changes more smoothly and the signal transmission quality is more reliable.
[0149] Step S4: Status determination and subsequent actions.
[0150] Based on the above evaluation results, we can determine the condition of the target optical patch cord: If the curvature radius of the target optical patch cord is no less than the curvature radius threshold, and the standard deviation of the first curvature is no greater than the preset standard deviation threshold, then we can determine that the target optical patch cord is in normal condition, its wiring and bending comply with engineering specifications, and no special treatment is required. Conversely, if the curvature radius of the target optical patch cord is less than the curvature radius threshold, or the standard deviation of the first curvature is greater than the preset standard deviation threshold, this indicates that the optical patch cord may have an abnormality, such as excessive bending or uneven bending. In this case, the test results should be promptly fed back to network construction and maintenance personnel, who should be instructed to conduct a detailed inspection of the relevant areas and, if necessary, make adjustments or replacements to eliminate potential risks of signal attenuation or fiber damage, thereby ensuring network stability and reliability.
[0151] Through the above steps, the pre-trained instance segmentation model is used to segment the target image corresponding to the target light jumper from the first image, and determine the target contour corresponding to the target light jumper. The instance segmentation model is a convolutional neural network model based on the mask area. It can not only effectively segment the target image and accurately extract the light jumper contour under simple backgrounds, but also realize light jumper detection under complex backgrounds, thereby improving the robustness of detection. Subsequently, combined with curve fitting and data calculation, the calculation of the curvature radius of the target light jumper is realized. The entire process can quickly process a large number of images through automated detection, thereby solving the technical problems of low efficiency and poor accuracy of traditional manual detection of the curvature radius of light jumpers through visual inspection or tools.
[0152] Example 2
[0153] According to an embodiment of the present application, a device for detecting the curvature radius of an optical jumper for implementing the method for detecting the curvature radius of an optical jumper in embodiment 1 is also provided. Figure 7 As shown, the curvature radius detection device of the optical jumper at least includes: an acquisition module 71, a contour determination module 72, a curvature determination module 73 and a curvature radius determination module 74, wherein:
[0154] An acquisition module 71 may acquire a first image, wherein the first image includes a target light jumper to be detected and a background;
[0155] The contour determination module 72 can use a pre-trained instance segmentation model to segment the target image corresponding to the target light jumper from the first image and determine the target contour corresponding to the target light jumper, wherein the instance segmentation model is a convolutional neural network model based on a mask region, and the target contour includes multiple discrete points;
[0156] a curvature determination module 73 that can fit the plurality of discrete points into a smooth curve, determine a first curvature of each discrete point on the smooth curve, and determine a second curvature of the smooth curve based on the first curvatures of the plurality of discrete points;
[0157] The curvature radius determination module 74 may determine the curvature radius of the target optical jumper based on the second curvature.
[0158] The functions of each module of the curvature radius detection device for optical patch cords are described below in conjunction with a specific implementation process.
[0159] As an optional embodiment, the curvature radius detection device of the optical jumper may further include a training module, and the training process of the instance segmentation model by the training module may be implemented in the following manner: constructing an instance segmentation model, wherein the instance segmentation model includes at least: a backbone network, a region candidate network, a region of interest adjustment network and a prediction head network; obtaining multiple second images including optical jumpers collected under various environments, and annotating each second image, taking each second image as a training sample, and using the corresponding annotation information as a sample label, wherein the annotation information includes at least: each detection frame corresponding to the second image, the category label corresponding to each detection frame, and the segmentation mask; in the iterative training process, using the instance segmentation model to analyze each training sample separately, obtain the prediction result of the training sample, and construct a target loss function based on the prediction result and the sample label corresponding to the training sample, wherein the prediction result includes at least: the predicted detection frame, the category label corresponding to each predicted detection frame, and the segmentation mask; using the back propagation mechanism and the target loss function to adjust the model parameters of the instance segmentation model based on the target loss function.
[0160] As an optional implementation, the training module uses an instance segmentation model to analyze each training sample separately to obtain a prediction result of the training sample, which can be achieved in the following way: for each training sample, the backbone network is used to extract the image feature map in the training sample; the region candidate network is used to perform a convolution operation on the image feature map according to a convolution kernel of a preset size to obtain multiple anchor frames, and the confidence of each anchor frame including the light jump line is determined, the anchor frame with a confidence higher than a first preset threshold is determined as the candidate frame, and the overlapping candidate frames are removed by the non-maximum suppression method; the region of interest adjustment network is used to map the obtained candidate frames to the image feature map to obtain a feature representation of a preset size corresponding to each candidate frame; the prediction head network is used to analyze the feature representation corresponding to each candidate frame to predict multiple detection frames, the category label corresponding to each detection frame, and the segmentation mask.
[0161] As an optional implementation, the training module constructs a target loss function based on the prediction results and the sample labels corresponding to the training samples. This can be achieved by constructing a classification loss function using the following formula:
[0162]
[0163] Where, L cls Represents the classification loss function, N represents the total number of detection boxes predicted in the same training batch, and C represents the total number of categories of detection boxes. Indicates the probability of predicting the nth detection box as the cth category, y nc Indicates the category unique encoding of the nth detection box. When the predicted category is the same as the actual category, y nc =1, when the predicted category is different from the actual category, y nc =0; use the following formula to construct the bounding box regression loss function:
[0164]
[0165] Where, L bbox represents the bounding box regression loss function, i represents the detection box parameters, {x, y, w, h} represents the horizontal coordinate of the center point of the detection box, the vertical coordinate of the center point, the width, and the height, respectively. Represents the parameters of the predicted n-th detection box, t ni Represents the actual parameters of the nth detection box, Represents smooth L1 loss; the mask loss function is constructed using the following formula:
[0166]
[0167] Where, L bbox represents the mask loss function, M×M represents the resolution of the segmentation mask corresponding to the detection box, represents the mask probability of the jth pixel of the predicted nth detection box, y nj Represents the actual mask value of the jth pixel of the nth detection box. The actual mask value of the foreground pixel is 1, and the actual mask value of the background pixel is 0. The classification loss function, the bounding box regression loss function, and the mask loss function are weighted and summed using the preset weight coefficient to obtain the target loss function.
[0168] As an optional implementation, the contour determination module uses a pre-trained instance segmentation model to segment the target image corresponding to the target light jumper from the first image and determine the target contour corresponding to the target light jumper. This can be achieved in the following way: using the instance segmentation model to analyze the first image to obtain at least one predicted detection frame and a target segmentation mask corresponding to each detection frame; for each detection frame, determining the contour of the detection target in the detection frame based on the segmentation mask corresponding to the detection frame, and when the parameters of the contour match the preset contour parameter conditions, determining the area image corresponding to the detection frame as the target image, determining the detection target in the detection frame as the target light jumper, and determining the target contour of the target light jumper, wherein the parameters of the contour include at least one of the following: area, perimeter, center point, and contour point.
[0169] As an optional implementation, the contour determination module determines the contour of the detection target in the detection frame based on the segmentation mask corresponding to the detection frame, which can be achieved in the following ways: segmenting the regional image of the detection target from the segmentation mask based on a preset grayscale threshold; using the edge detection algorithm to determine the edge of the detection target from the regional image; and smoothing the edge of the detection target to obtain the contour of the detection target.
[0170] As an optional implementation, the curvature determination module fits multiple discrete points into a smooth curve and determines the first curvature of each discrete point on the smooth curve, including: fitting the multiple discrete points using a polynomial to obtain a smooth curve; and calculating the first curvature of each discrete point on the smooth curve according to the following formula:
[0171]
[0172] Where k i represents the first curvature of the i-th discrete point, y ′ i Represents the slope of the smooth curve at the i-th discrete point, y ″ i Represents the slope change rate of the smooth curve at the i-th discrete point, y ′ i and y ″ i The values of are:
[0173]
[0174] In the formula, (x i ,y i )、(x i-1 ,y i-1 )、(x i+1 ,y i+1 ) represent the coordinates of the i-th, i-1-th, and i+1-th discrete points respectively.
[0175] As an optional implementation, the curvature determination module determines the second curvature of the smooth curve based on the first curvatures of multiple discrete points. This can be achieved by: determining the average value of the first curvatures of multiple discrete points as the second curvature of the smooth curve; or determining the maximum value of the first curvatures of multiple discrete points as the second curvature of the smooth curve. The above two second curvatures can also be calculated simultaneously.
[0176] As an optional implementation, the curvature radius determination module determines the curvature radius of the target optical jumper based on the second curvature, which can be achieved by: determining the inverse of the second curvature as the curvature radius of the target optical jumper.
[0177] As an optional embodiment, the curvature radius detection device of the optical jumper may further include an evaluation module. After determining the curvature radius of the target optical jumper based on the second curvature, the evaluation module may determine the type of the target optical jumper and obtain a curvature radius threshold corresponding to the type; determine the standard deviation of the first curvature of multiple discrete points; when the curvature radius of the target optical jumper is not less than the curvature radius threshold and the standard deviation is not greater than the preset standard deviation threshold, determine that the target optical jumper is normal; when the curvature radius of the target optical jumper is less than the curvature radius threshold, or the standard deviation is greater than the preset standard deviation threshold, determine that the target optical jumper is abnormal.
[0178] It should be noted that the modules in the curvature radius detection device of the optical jumper in the embodiment of the present application correspond one-to-one to the implementation steps of the curvature radius detection method of the optical jumper in Example 1. Since a detailed description has been given in Example 1, some details not reflected in this embodiment can be referred to Example 1 and will not be elaborated here.
[0179] Example 3
[0180] According to an embodiment of the present application, a computer program product is further provided. The computer program product includes a computer program. When the computer program is executed by a processor, the method for detecting the curvature radius of the optical jumper in Example 1 is implemented.
[0181] According to an embodiment of the present application, a non-volatile storage medium is further provided, which includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the curvature radius detection method of the optical jumper in Example 1 by running the computer program.
[0182] According to an embodiment of the present application, a processor is further provided, which is used to run a computer program, wherein the computer program executes the curvature radius detection method of the optical jumper in Example 1 when running.
[0183] According to an embodiment of the present application, an electronic device is further provided, comprising: a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute the curvature radius detection method of the optical jumper in Example 1 through the computer program.
[0184] Specifically, the computer program executes the following steps when it is running: acquiring a first image, wherein the first image includes a target light jumper to be detected and a background; using a pre-trained instance segmentation model to segment a target image corresponding to the target light jumper from the first image, and determining a target contour corresponding to the target light jumper, wherein the instance segmentation model is a convolutional neural network model based on a mask area, and the target contour includes multiple discrete points; fitting the multiple discrete points into a smooth curve, determining a first curvature of each discrete point on the smooth curve, and determining a second curvature of the smooth curve based on the first curvatures of the multiple discrete points; and determining a curvature radius of the target light jumper based on the second curvature.
[0185] As an optional implementation, the electronic device may be in the form of a mobile terminal, a computer terminal or a similar computing device. Figure 8 FIG1 shows a hardware structure block diagram of an electronic device for implementing a method for detecting the curvature radius of an optical jumper. Figure 8 As shown, the electronic device 80 may include one or more (802a, 802b, ..., 802n are used to illustrate) processors 802 (the processor 802 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 804 for storing data, and a transmission device 806 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It will be understood by those skilled in the art that Figure 8 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 8 More or fewer components than shown, or with Figure 8 Different configurations shown.
[0186] It should be noted that the one or more processors 802 and / or other data processing circuits described above may generally be referred to herein as "data processing circuitry". The data processing circuitry may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuitry may be a single independent processing module, or may be incorporated in whole or in part into any of the other components of the electronic device 80. As described in the embodiments of the present application, the data processing circuitry serves as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0187] The memory 804 can be used to store software programs and modules for application software, such as the program instructions / data storage device corresponding to the curvature radius detection method for optical jumpers in the embodiments of the present application. The processor 802 executes various functional applications and data processing by running the software programs and modules stored in the memory 804, thereby implementing the vulnerability detection method for the application described above. The memory 804 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 804 may further include memory remotely located relative to the processor 802, and these remote memories may be connected to the electronic device 80 via a network. Examples of the aforementioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0188] The transmission device 806 is used to receive or send data via a network. Specific examples of the aforementioned network may include a wireless network provided by the communications provider of the electronic device 80. In one embodiment, the transmission device 806 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In one embodiment, the transmission device 806 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0189] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the electronic device 80 .
[0190] The serial numbers of the above embodiments are for description only and do not represent the advantages or disadvantages of the embodiments.
[0191] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0192] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only exemplary. For example, the division of units can be a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0193] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple units. Some or all of the units may be selected to achieve the purpose of the present embodiment according to actual needs.
[0194] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0195] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program code.
[0196] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for detecting the curvature radius of an optical jumper, characterized in that: include: Acquire a first image, wherein the first image includes a target light jumper to be detected and a background; Segmenting a target image corresponding to the target light jumper from the first image using a pre-trained instance segmentation model, and determining a target contour corresponding to the target light jumper, wherein the instance segmentation model is a convolutional neural network model based on a mask region, and the target contour includes a plurality of discrete points; Fitting the plurality of discrete points into a smooth curve, determining a first curvature of each discrete point on the smooth curve, and determining a second curvature of the smooth curve based on the first curvatures of the plurality of discrete points; A curvature radius of the target optical patch cord is determined based on the second curvature.
2. The method according to claim 1, characterized in that The training process of the instance segmentation model includes: Constructing an instance segmentation model, wherein the instance segmentation model includes at least: a backbone network, a region candidate network, a region of interest adjustment network, and a prediction head network; Acquire multiple second images containing optical jumpers captured under various environments, and annotate each second image, using each second image as a training sample and the corresponding annotation information as a sample label, wherein the annotation information includes at least: each detection frame in the second image, a category label corresponding to each detection frame, and a segmentation mask; During the iterative training process, each training sample is analyzed using the instance segmentation model to obtain a prediction result for the training sample, and a target loss function is constructed based on the prediction result and the sample label corresponding to the training sample, wherein the prediction result includes at least: a predicted detection box, a class label corresponding to each predicted detection box, and a segmentation mask; The model parameters of the instance segmentation model are adjusted based on the target loss function using a back-propagation mechanism.
3. The method according to claim 2, characterized in that Analyze each training sample using the instance segmentation model to obtain a prediction result for the training sample, including: For each training sample, extracting an image feature map in the training sample using the backbone network; Using the region candidate network to perform a convolution operation on the image feature map according to a convolution kernel of a preset size to obtain multiple anchor frames, and determining the confidence that each anchor frame includes the light jump line, determining the anchor frame with a confidence higher than a first preset threshold as the candidate frame, and removing overlapping candidate frames by a non-maximum suppression method; Mapping each obtained candidate box onto the image feature map using the region of interest adjustment network to obtain a feature representation of a preset size corresponding to each candidate box; The prediction head network is used to analyze the feature representation corresponding to each candidate box, and predict multiple detection boxes, the category label corresponding to each detection box, and the segmentation mask.
4. The method according to claim 2, characterized in that Constructing a target loss function based on the prediction results and the sample labels corresponding to the training samples, including: The classification loss function is constructed using the following formula: Where, L cls Represents the classification loss function, N represents the total number of detection boxes predicted in the same training batch, and C represents the total number of categories of detection boxes. Indicates the probability of predicting the nth detection box as the cth category, y nc Indicates the category unique encoding of the nth detection box. When the predicted category is the same as the actual category, y nc =1, when the predicted category is different from the actual category, y nc =0; The bounding box regression loss function is constructed using the following formula: Where, L bbox represents the bounding box regression loss function, i represents the detection box parameters, {x, y, w, h} represents the horizontal coordinate of the center point of the detection box, the vertical coordinate of the center point, the width, and the height, respectively. Represents the parameters of the predicted n-th detection box, t ni Represents the actual parameters of the nth detection box, represents smooth L1 loss; The mask loss function is constructed using the following formula: Where, L bbox represents the mask loss function, M×M represents the resolution of the segmentation mask corresponding to the detection box, represents the mask probability of the jth pixel of the predicted nth detection box, y nj Represents the actual mask value of the jth pixel of the nth detection box. The actual mask value of the foreground pixel is 1, and the actual mask value of the background pixel is 0; The target loss function is obtained by weighting and summing the classification loss function, the bounding box regression loss function, and the mask loss function using a preset weight coefficient.
5. The method according to claim 1, wherein Segmenting a target image corresponding to the target light jumper from the first image using a pre-trained instance segmentation model, and determining a target contour corresponding to the target light jumper, including: Analyzing the first image using the instance segmentation model to obtain at least one predicted detection box and an object segmentation mask corresponding to each detection box; For each detection frame, the contour of the detection target in the detection frame is determined based on the segmentation mask corresponding to the detection frame, and when the parameters of the contour match the preset contour parameter conditions, the area image corresponding to the detection frame is determined to be the target image, the detection target in the detection frame is determined to be the target light jumper, and the target contour of the target light jumper is determined, wherein the parameters of the contour include at least one of the following: area, perimeter, center point, and contour point.
6. The method according to claim 5, characterized in that Determining the contour of the detection target in the detection frame according to the segmentation mask corresponding to the detection frame includes: Segmenting a region image of the detection target from the segmentation mask based on a preset grayscale threshold; Determining the edge of the detection target from the region image using an edge detection algorithm; The edges of the detection target are smoothed to obtain the contour of the detection target.
7. The method according to claim 1, characterized in that Fitting the plurality of discrete points into a smooth curve and determining a first curvature of each discrete point on the smooth curve comprises: Fitting the plurality of discrete points using a polynomial to obtain a smooth curve; The first curvature of each discrete point on the smooth curve is calculated according to the following formula: Where k i represents the first curvature of the i-th discrete point, y ′ i Represents the slope of the smooth curve at the i-th discrete point, y″ i Represents the slope change rate of the smooth curve at the i-th discrete point, y ′ i and y″ i The values of are: In the formula, (x i ,y i )、(x i-1 ,y i-1 )、(x i+1 ,y i+1 ) represent the coordinates of the i-th, i-1-th, and i+1-th discrete points respectively.
8. The method according to claim 1, characterized in that Determining a second curvature of the smooth curve based on the first curvatures of the plurality of discrete points includes: Determine an average value of the first curvatures of the plurality of discrete points as the second curvature of the smooth curve; or, The maximum value among the first curvatures of the plurality of discrete points is determined as the second curvature of the smooth curve.
9. The method according to claim 8, characterized in that Determining a curvature radius of the target optical jumper based on the second curvature includes: The reciprocal of the second curvature is determined as the curvature radius of the target optical patch cord.
10. The method according to claim 1, characterized in that After determining a curvature radius of the target optical patch cord based on the second curvature, the method further includes: Determining the type of the target optical jumper and obtaining a curvature radius threshold corresponding to the type; determining a standard deviation of the first curvature of the plurality of discrete points; When the curvature radius of the target optical jumper is not less than the curvature radius threshold and the standard deviation is not greater than a preset standard deviation threshold, determining that the target optical jumper is normal; When the curvature radius of the target optical jumper is smaller than the curvature radius threshold, or the standard deviation is larger than the preset standard deviation threshold, it is determined that the target optical jumper is abnormal.
11. A device for detecting the curvature radius of an optical jumper, characterized in that: include: An acquisition module, configured to acquire a first image, wherein the first image includes a target light jumper to be detected and a background; a contour determination module, configured to segment a target image corresponding to the target light jumper from the first image using a pre-trained instance segmentation model, and determine a target contour corresponding to the target light jumper, wherein the instance segmentation model is a convolutional neural network model based on a mask region, and the target contour includes a plurality of discrete points; a curvature determination module, configured to fit the plurality of discrete points into a smooth curve, determine a first curvature of each discrete point on the smooth curve, and determine a second curvature of the smooth curve based on the first curvatures of the plurality of discrete points; A curvature radius determining module is configured to determine a curvature radius of the target optical jumper based on the second curvature.
12. A computer program product, characterized in that include: A computer program, wherein when the computer program is executed by a processor, the method for detecting the curvature radius of an optical jumper according to any one of claims 1 to 10 is implemented.
13. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the method for detecting the curvature radius of an optical jumper according to any one of claims 1 to 10 through the computer program.