A 4c defect identification method and system based on a knowledge graph and a reversible ROI chain

CN123015434APending Publication Date: 2026-10-30TIEKE DIGITAL INTELLIGENT TRANSPORTATION TECHNOLOGY (CHENGDU) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611158828.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-31
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0006]本发明旨在提供一种基于知识图谱与可逆ROI链的4C缺陷识别方法及系统,以解决不同结构复杂度铁路部件采用固定识别层级时适配性不足、连续多级ROI裁剪后坐标难以准确回映、局部识别结果缺少父子几何校验以及单帧结果稳定性不足的问题

Benefits of technology

[0078]本发明通过预先建立的铁路部件层级知识图谱,将设备区域、部件、子部件及异常类型之间的父子层级关系与递进路径约束显式化、结构化。在递进识别过程中,系统以当前级类别标签查询知识图谱,在模型可用且满足置信度阈值条件的候选有向边中,按路由评分选取一条或多条下一级路径。与现有固定单级或两级级联方案相比,本发明允许同一父节点下选择不同深度和方向的识别路径,使结构简单的部件快速通过、结构复杂的部件逐级精细识别,有效减少无效计算,克服了固定级联流程适配性差的技术缺陷。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123015434A_ABST
    Figure CN123015434A_ABST
Patent Text Reader

Abstract

The application discloses a 4C defect identification method and system based on a knowledge graph and a reversible ROI chain, and relates to intelligent detection of railway parts. 4C inspection images are acquired, and frame-level records and quality scores are established. A railway part hierarchical knowledge graph is used to configure progressive paths, identification models and termination conditions among device regions, parts, subparts and abnormal types. After first-level positioning, one or more candidate paths are dynamically routed, ROIs are generated, and cropping, scaling, padding and actual image transformation parameters are recorded to form a reversible ROI parameter chain. Detection, classification or segmentation is progressively performed within the ROI until termination. The final results are reflected back to the original image, parent-child geometric verification and cross-frame review are performed, and structured results containing hierarchical relationships, original coordinates, parameter chains, confidence levels and risk priorities are output. The application can adapt to railway parts with different structural complexities, and improve the traceability and reliability of fine-grained defect positioning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of intelligent detection technology for railway catenary and railway components, specifically involving a 4C defect identification method and system based on knowledge graph and reversible ROI chain. Background Technology

[0002] Railway overhead contact lines and related railway components, such as catenary wires, contact wires, positioning devices, droppers, connecting hardware, bolts, nuts, pins, and clamps, are exposed to the elements for extended periods. This makes them susceptible to vibration, temperature differences, wind loads, dirt, corrosion, and the dynamic effects of the pantograph on trains, leading to abnormal conditions such as loosening, missing parts, misalignment, cracks, damage, and corrosion. Failure to detect and address these abnormalities promptly will affect the stability of the railway power supply system and operational safety.

[0003] The images of the overhead contact line suspension state acquired by the 4C inspection vehicle are characterized by high resolution, large field of view, and rich detail, capable of recording fine-grained structures such as bolts, nuts, pins, dropper clamps, and connectors. However, in automatic recognition scenarios, high resolution and a large field of view also bring problems such as high computational load, high GPU memory usage, and an extremely low proportion of small target anomalies. If the entire frame image is directly input into a single detection model to identify all fine-grained defects, the model needs to process both large-scale equipment areas and extremely small-scale anomaly areas simultaneously, which can easily lead to missed detections, false detections, and low inference efficiency.

[0004] Existing fixed single-level or two-level identification processes are ill-suited to the different assembly levels of railway components. Furthermore, existing multi-level ROI schemes typically fail to record the trimming, scaling, filling, and optional transformations at each level in the actual processing order, making it difficult to reliably reconstruct the geometric bearing areas of local points, detection boxes, segmentation masks, or classification results. Existing schemes also lack multi-path selection driven by parent-child structure knowledge, post-reconstruction parent-child geometric verification, and bounded retry mechanisms.

[0005] Therefore, a 4C defect identification scheme is needed that uses a railway component hierarchical knowledge graph to constrain the identification path, uses a reversible ROI parameter chain to ensure coordinate traceability, and performs geometric verification and cross-frame review on the results. Summary of the Invention

[0006] This invention aims to provide a 4C defect identification method and system based on knowledge graphs and reversible ROI chains, in order to solve the problems of insufficient adaptability when using fixed identification levels for railway components with different structural complexities, difficulty in accurately reflecting coordinates after continuous multi-level ROI clipping, lack of parent-child geometric verification in local identification results, and insufficient stability of single-frame results.

[0007] To address the aforementioned issues, this invention employs a railway component hierarchical knowledge graph to uniformly configure progressive paths, models, ROI strategies, termination conditions, and parent-child geometric constraints, and records the real spatial transformations at each level using a reversible ROI parameter chain.

[0008] The method includes the following steps:

[0009] Step S1: Acquire the inspection video or image sequence collected by the 4C detection device; decode and extract frames from the inspection video, or read the image sequence frame by frame to obtain the image to be detected, and establish a frame-level record containing the pixel coordinate system information, frame number, image quality score and occlusion ratio of the image to be detected.

[0010] Step S2: Load the preset railway component hierarchical knowledge graph. The nodes in the railway component hierarchical knowledge graph represent equipment areas, components, sub-components, or anomaly types. Among them, the anomaly type nodes are associated with preset anomaly severity levels. Directed edges represent parent-child progressive paths and are bound to model identifiers, model versions, task types, ROI expansion strategies, confidence thresholds, risk levels, candidate model computation costs, candidate model historical false alarm rates, termination conditions, and parent-child geometric constraints.

[0011] Step S3: Perform first-level localization and recognition using a pre-trained target detection model to obtain a current-level result object containing the current-level result identifier, current-level category label, current-level confidence score, parent-level result identifier, current-level coordinate system identifier, and current-level geometric carrying object; wherein, the current-level geometric carrying object obtained by first-level localization and recognition is the current-level detection box; establish a corresponding recognition branch for each current-level result object, and establish a corresponding detection chain for each recognition branch; the detection chain is an ordered record sequence that associates result objects at each level and ROI parameter records at each level in a progressive hierarchical order; when the first-level localization and recognition does not detect any target, terminate the recognition process and record the recognition result as no first-level target;

[0012] Step S4: Query the railway component hierarchical knowledge graph using the current level category label, perform routing scoring on candidate directed edges that are available in the model and meet the corresponding confidence threshold, and select one or more next-level paths; when selecting one next-level path, associate the next-level path with the current identification branch; when selecting multiple next-level paths, establish sub-branches corresponding to each next-level path, associate each next-level path with the corresponding sub-branch, the sub-branch belongs to the current identification branch, and inherits the detection chain and reversible ROI parameter chain formed by the current identification branch; when there is no available path, mark the current identification branch as terminated, record the termination reason as no available path, and proceed to step S7;

[0013] Step S5: For each recognition branch associated with the selected next-level path, based on the ROI expansion strategy bound to the next-level path and the geometric carrying object of the current-level result object of the recognition branch, determine the next-level ROI region in the source image, and perform cropping, scaling, filling, and other image transformations as needed on the next-level ROI region to obtain the next-level input ROI image. Calculate the image quality score and occlusion ratio of the next-level input ROI image, and record and save the image quality score and occlusion ratio of the next-level input ROI image in association with the corresponding ROI parameters. Record the actual cropped area, scaling ratio, fill amount, expansion coefficient, actual image transformation parameters, and coordinate system identifier to form the current level ROI parameter record; wherein, when step S5 is executed for the first time, a reversible ROI parameter chain for this recognition branch is established, and the current level ROI parameter record is used as the first record of the reversible ROI parameter chain; when step S5 is executed again in subsequent iterations, the current level ROI parameter record is appended to the reversible ROI parameter chain for this recognition branch; the source image during the first execution is the image to be detected, and the source image during subsequent executions is the previous level input ROI image;

[0014] Step S6: For each recognition branch processed in step S5, according to the task type and model bound to the next-level path associated with that recognition branch, perform detection, classification, or segmentation on the next-level input ROI image corresponding to that recognition branch to obtain one or more next-level result objects, including detection result objects, segmentation result objects, and classification result objects; wherein, the geometric carrying object of the detection result object is the detection box, the geometric carrying object of the segmentation result object is the segmentation mask, and the geometric carrying object of the classification result object is the region defined by the image boundary of the next-level input ROI image;

[0015] Step S7: Update the detection chain of each identification branch; for the identification branches processed by steps S5 and S6, append the corresponding current level ROI parameter record, the next level path identification status, and the next level result object to the detection chain of the identification branch; when the identification branch has been marked as having no available path, or has reached the terminal node, met the termination condition, or has not obtained the next level result object, terminate the identification branch and record the corresponding termination reason; otherwise, update the next level result object to the current level result object and return to step S4;

[0016] Step S8: After the detection chain terminates, the final-level results are mapped back to the pixel coordinate system of the image to be detected in reverse order of the reversible ROI parameter chain, and the verification is performed according to the parent-child geometric constraints of the railway component hierarchical knowledge graph. If the verification passes, the current detection chain is marked as passed; if the verification fails, the current detection chain is marked as a suspected detection chain and the recognition results at each level and the reversible ROI parameter chain are retained for manual review.

[0017] Step S9: Perform cross-frame association on the detection chains marked as passed or the detection chains marked as suspected, calculate the confidence level and risk priority respectively, and output a structured result containing hierarchical relationship, original coordinates, reversible ROI parameter chain, model version, termination reason, confidence level, risk priority and review status. The original coordinates are the position coordinates after being mapped to the pixel coordinate system of the image to be detected.

[0018] Furthermore, the step of performing route scoring on candidate directed edges that are available to the model and meet the corresponding thresholds, and selecting one or more next-level paths, includes:

[0019] First, perform availability checks on the models bound to each candidate directed edge. Specifically, if the model corresponding to the model identifier and model version bound to the candidate directed edge exists, the model can be successfully loaded, the input size of the model matches the input size of the model configured for the candidate directed edge, and the output fields of the model meet the output requirements of the task type bound to the candidate directed edge, then the model is determined to be available; otherwise, the model is determined to be unavailable, and the corresponding reason for unavailability is recorded.

[0020] Remove candidate directed edges that are unusable or whose current level confidence score is lower than the corresponding confidence threshold, and calculate the routing score of the remaining candidate directed edges;

[0021] When computational resources meet preset conditions, one or more candidate directed edges with a route score not lower than the route threshold are selected; when computational resources are limited, the top-ranked edges are selected in descending order of route score. Candidate directed edges, A preset integer not less than 1;

[0022] The routing threshold is a preset lower limit for scoring.

[0023] Furthermore, the routing score for the remaining candidate directed edges is calculated using the following formula:

[0024] ;

[0025] in, For the remaining candidate directed edges, The current confidence score. Score the image quality of the current input image. The occlusion ratio of the current level input image represents the proportion of the occluded area in the current level input image to the total area of ​​the image region. In the first progressive recognition, the current level input image is the image to be detected. In subsequent progressive recognition, the current level input image is the current level ROI image generated in the previous progressive loop. The risk level of the component corresponding to the candidate path. The cost is calculated for the candidate models, which are obtained by testing under preset hardware, input size and batch size and normalized to [0,1]. The historical false alarm rate of the candidate model represents the statistical result of false alarms on the validation data or historical labeled data for the candidate model version bound by the directed edge. to The weights are non-negative.

[0026] Further, the step of determining the next-level ROI region in the source image based on the geometric carrying object of the current-level result object of the recognition branch, according to the ROI expansion strategy bound to the next-level path, includes:

[0027] Based on the geometrically supporting object in the current level result object, the ROI expansion coefficient is dynamically calculated.

[0028] The next level ROI region is obtained by expanding the geometric bearing objects in the current level result object using the ROI expansion coefficient.

[0029] Furthermore, the formula for dynamically calculating the ROI expansion factor is as follows:

[0030] ,

[0031] in, For category The corresponding basic expansion factor, Score the image quality of the current input image. The occlusion ratio of the current-level input image represents the proportion of the occluded area to the total area of ​​the image region. In the first progressive recognition, the current-level input image is the image to be detected; in subsequent progressive recognitions, the current-level input image is the current-level ROI image generated in the previous progressive loop. For the current level of component risk, The current confidence score. For the target scale normalized value, , , , and Non-negative weights and These are the lower and upper limits of the expansion coefficient, respectively.

[0032] Furthermore, the step of using the ROI expansion coefficient to expand the geometrically bearing objects in the current-level result object to obtain the next-level ROI region includes:

[0033] Using the center point of the geometric carrier object in the current level result object as the expansion center, the width and height of the geometric carrier object are multiplied by the ROI expansion coefficient to obtain the width and height of the expanded next level ROI region.

[0034] Furthermore, the extended formula is:

[0035] ,

[0036] in, and These represent the width and height of the geometrically supported object, respectively. W is the ROI expansion factor. k and H k These represent the width and height of the expanded next-level ROI region, respectively.

[0037] Furthermore, the cropping, scaling, filling, and other image transformations performed on the next-level ROI region include:

[0038] Cropping is performed on the source image according to the next level ROI region: if the expanded ROI region exceeds the boundary of the source image, the ROI region is cropped to the effective range of the source image;

[0039] Scale the cropped ROI region proportionally and fill it to the model input size; let the... The actual clipping offset of level is The scaling ratio is The left fill amount and the top fill amount are Then the source image coordinates (u k−1 ,v k−1 Mapped to current level image coordinates (u k ,v k The forward transformation relation is:

[0040] ;

[0041] in, To identify the number of levels, For the first The actual trimming offset is... For the first Scaling level For the first Left and top fill amounts, (u k−1 ,v k−1 (u) represents the coordinates of the source image. k ,v k () represents the coordinates of the current level image;

[0042] The first Mapping level coordinates to level The fundamental homogeneous transformation matrix corresponding to the level coordinates for:

[0043] ;

[0044] Specifically, only when performing rotation, flip, affine transformation, or perspective correction, the corresponding transformation matrix is ​​compared with the fundamental homogeneous transformation matrix according to the actual processing order. By combining the results, we obtain the final homogeneous transformation matrix of the k-th level. And write the combination order and matrix parameters into the invertible ROI parameter chain; when the additional image transformation is not performed, let .

[0045] Furthermore, the termination conditions of step S7 include at least one of the following: the final defect type is identified; the current level node is the terminal node; the current level confidence score is lower than the confidence threshold; the ROI size or segmentation mask area is lower than the minimum scale threshold; the maximum progressive level is reached; there are no candidate next-level nodes; there are no next-level paths that are available for the model and meet the confidence threshold; the parent-child category relationship is inconsistent; the critical safety component has not obtained a valid next-level result and the suspected detection chain needs to be retained.

[0046] Further, the step of mapping the final-level result objects back to the pixel coordinate system of the image to be detected in reverse order according to the reversible ROI parameter chain includes:

[0047] Let the last level be the th If the order is homogeneous, then the coordinates are homogeneous. for: and homogeneous coordinates satisfy:

[0048] The relationship between the final-level coordinates and the original image coordinates is as follows:

[0049] ,

[0050] in, Let be the final homogeneous transformation matrix of the k-th order, and let be the homogeneous coordinates. Represents the k-th level image coordinates The homogeneous coordinates, where K is the last level sequence number;

[0051] When the geometric carrier of the final result object is a detection box, the corner points of the detection box are mapped back and its circumscribed region is taken; when the geometric carrier of the final result object is a segmentation mask, the mask pixels or boundary points are mapped back; when the final task is image classification, the image boundary of the next-level input ROI image is used as the geometric carrier object for mapping back; when perspective transformation exists, the homogeneous coordinates obtained by mapping back are normalized according to the third component.

[0052] Furthermore, the verification based on the parent-child geometric constraints of the railway component hierarchical knowledge graph specifically includes:

[0053] For parent and child result objects at adjacent levels in the detection chain, determine whether the reflected child geometric bearing object is located within the preset allowable area of ​​the parent geometric bearing object or the railway component hierarchical knowledge graph, and determine whether the area ratio and relative position between the child geometric bearing object and the parent geometric bearing object fall within the corresponding preset range, so as to obtain the sub-item verification results of each applicable parent-child geometric constraint;

[0054] The sub-item verification results are normalized and summarized to obtain the parent-child geometric verification score, and the parent-child geometric verification score is compared with the preset geometric verification threshold.

[0055] When the parent-child geometric verification score is not lower than the preset geometric verification threshold, the verification is determined to be passed, and the current detection chain is marked as having passed the verification.

[0056] When the parent-child geometric verification score is lower than the preset geometric verification threshold and has not reached the preset retry limit, the parent geometric carrier object corresponding to the current failure level is expanded according to the ROI expansion strategy to obtain the parent ROI region, and steps S5 to S8 are re-executed based on the parent ROI region; when the parent-child geometric verification score is still lower than the preset geometric verification threshold after reaching the preset retry limit, the verification is determined to be unsuccessful, the current detection chain is marked as a suspected detection chain, and the identification results at each level and the reversible ROI parameter chain are retained for manual review.

[0057] Furthermore, the calculation of credibility and risk priority respectively includes:

[0058] Based on the matching of adjacent two-level categories in the detection chain with the parent-child relationship in the railway component hierarchical knowledge graph, a knowledge graph hierarchical consistency score is generated; based on the anomaly category consistency, confidence stability, and retrospective coordinate stability of the same component in adjacent frames after cross-frame association, a cross-frame consistency score is generated; the image quality score, parent-child geometric verification score, component risk level, and anomaly severity level configured in the railway component hierarchical knowledge graph of the image to be detected are read from the frame-level record, and combined with the confidence scores of each level in the detection chain, the credibility and risk priority are calculated respectively.

[0059] Furthermore, the credibility is calculated. The formula is:

[0060] ,

[0061] in, The confidence score for level k is... Scoring the consistency of knowledge graph hierarchical levels. To score the image quality of the image to be detected, For cross-frame consistency scoring, Geometric verification scoring for father and son , , , and These are the normalized non-negative weights;

[0062] Calculate risk priority The formula is:

[0063] ,

[0064] in, This refers to the risk level of the components configured in the knowledge graph path corresponding to the current detection chain. The anomaly severity score is obtained by normalizing the anomaly severity level associated with the current end-level anomaly type node in the detection chain. , and Non-negative weights are used; the structured defect identification results also preserve credibility. and risk priority .

[0065] Another aspect of the present invention provides a 4C defect identification system based on knowledge graphs and reversible ROI chains, comprising:

[0066] The 4C image acquisition and quality assessment module 1 is used to acquire inspection videos or image sequences collected by the 4C inspection device; decode and extract frames from the inspection video, or read the image sequence frame by frame to obtain the image to be inspected, and establish a frame-level record containing the pixel coordinate system information, frame number, image quality score and occlusion ratio of the image to be inspected.

[0067] The knowledge graph and identification chain configuration module 2 is used to load a preset railway component hierarchical knowledge graph. The nodes in the railway component hierarchical knowledge graph represent equipment areas, components, sub-components, or anomaly types. Among them, the anomaly type nodes are associated with a preset anomaly severity level. The directed edges represent parent-child progressive paths and are bound to model identifiers, model versions, task types, ROI expansion strategies, confidence thresholds, risk levels, candidate model computation costs, candidate model historical false alarm rates, termination conditions, and parent-child geometric constraints.

[0068] The first-level localization and recognition module 3 is used to perform first-level localization and recognition through a pre-trained target detection model to obtain a current-level result object containing the current-level result identifier, current-level category label, current-level confidence score, parent-level result identifier, current-level coordinate system identifier, and current-level geometric carrying object; wherein, the current-level geometric carrying object obtained by the first-level localization and recognition is the current-level detection box; a corresponding recognition branch is established for each current-level result object, and a corresponding detection chain is established for each recognition branch; the detection chain is an ordered record sequence that associates the result objects at each level and the ROI parameter records at each level in a progressive hierarchical order; when the first-level localization and recognition does not detect any target, the recognition process is terminated and the recognition result is recorded as no first-level target;

[0069] The dynamic graph routing module 4 is used to query the railway component hierarchical knowledge graph with the current level category label, perform routing scoring on candidate directed edges that are available in the model and meet the corresponding confidence threshold, and select one or more next-level paths. When selecting one next-level path, the next-level path is associated with the current identification branch. When selecting multiple next-level paths, sub-branches corresponding to each next-level path are established, and each next-level path is associated with its corresponding sub-branch. The sub-branch belongs to the current identification branch and inherits the detection chain and reversible ROI parameter chain formed by the current identification branch. When there is no available path, the current identification branch is marked as terminated, the reason for termination is recorded as no available path, and the detection chain and termination control module 8 is triggered.

[0070] The dynamic ROI generation module 5 is used to determine the next-level ROI region in the source image for each recognition branch associated with the selected next-level path, based on the ROI expansion strategy bound to the next-level path and the geometric carrier object of the current-level result object of the recognition branch. The module then performs cropping, scaling, filling, and other image transformations on the next-level ROI region to obtain the next-level input ROI image. The module also calculates the image quality score and occlusion ratio of the next-level input ROI image and records and saves the image quality score and occlusion ratio of the next-level input ROI image in association with the corresponding ROI parameter records.

[0071] The reversible parameter chain recording module 6 is used to record the actual cropping area, scaling ratio, padding amount, expansion coefficient, actual image transformation parameters, and coordinate system identifier to form the current-level ROI parameter record. When this module is run for the first time, a reversible ROI parameter chain for this recognition branch is established, and the current-level ROI parameter record is used as the first record in this reversible ROI parameter chain. When this module is run again in subsequent iterations, the current-level ROI parameter record is appended to the reversible ROI parameter chain of this recognition branch. The source image during the first run is the image to be detected, and the source image during subsequent runs is the previous-level input ROI image.

[0072] The multi-level progressive recognition module 7 is used to perform detection, classification, or segmentation on the next-level input ROI image corresponding to each recognition branch processed by the dynamic ROI generation module 5 and the reversible parameter chain recording module 6, according to the task type and model bound to the next-level path associated with the recognition branch, to obtain one or more next-level result objects, including detection result objects, segmentation result objects, and classification result objects; wherein, the geometric carrying object of the detection result object is the detection box, the geometric carrying object of the segmentation result object is the segmentation mask, and the geometric carrying object of the classification result object is the region defined by the image boundary of the next-level input ROI image;

[0073] The detection chain and termination control module 8 is used to update the detection chain of each identification branch. For identification branches processed by the dynamic ROI generation module 5, the reversible parameter chain recording module 6, and the multi-level progressive identification module 7, the corresponding current-level ROI parameter record, the next-level path identification status, and the next-level result object are appended to the detection chain of the identification branch. When the identification branch has been marked as having no available path, or has reached a terminal node, met the termination condition, or has not obtained a next-level result object, the identification branch is terminated and the corresponding termination reason is recorded. Otherwise, the next-level result object is updated to the current-level result object and the dynamic graph routing module 4 is triggered to continue execution.

[0074] The coordinate mapping and parent-child geometric verification module 9, after the detection chain terminates, maps the final-level results back to the pixel coordinate system of the image to be detected in reverse order of the reversible ROI parameter chain, and verifies them according to the parent-child geometric constraints of the railway component hierarchical knowledge graph. If the verification passes, the current detection chain is marked as passed; if the verification fails, the current detection chain is marked as a suspected detection chain and the recognition results at each level and the reversible ROI parameter chain are retained for manual review.

[0075] The cross-frame verification module 10 is used to perform cross-frame association on detection chains marked as passing verification or suspected detection chains;

[0076] The comprehensive scoring and structured output module 11 is used to calculate the credibility and risk priority respectively, and output the structured results containing hierarchical relationship, original coordinates, reversible ROI parameter chain, model version, termination reason, credibility, risk priority and review status. The original coordinates are the position coordinates after being mapped to the pixel coordinate system of the image to be detected.

[0077] By adopting the above technical solution, the present invention has the following beneficial effects:

[0078] This invention uses a pre-established hierarchical knowledge graph of railway components to explicitly and structurally represent the parent-child hierarchical relationships and progressive path constraints between equipment areas, components, sub-components, and anomaly types. During the progressive identification process, the system queries the knowledge graph using the current-level category label. From candidate directed edges that are available in the model and meet the confidence threshold, it selects one or more next-level paths based on routing scores. Compared to existing fixed single-level or two-level cascaded schemes, this invention allows for the selection of identification paths with different depths and directions under the same parent node, enabling simple components to pass quickly and complex components to be identified more precisely at each level. This effectively reduces unnecessary computation and overcomes the technical shortcomings of poor adaptability in fixed cascaded processes.

[0079] This invention records the actual cropping offset, scaling ratio, padding amount, expansion coefficient, and optional rotation, flip, affine, or perspective transformation parameters during each ROI generation process, forming a complete reversible ROI parameter chain. After the progressive termination, the final-level result objects (outliers, detection boxes, segmentation masks, or ROI boundaries) are mapped back to the original 4C image coordinate system in reverse order of the transformation matrices at each level. Compared with existing solutions, this invention solves the technical problem of difficulty in accurately restoring local coordinates to the original image after continuous multi-level ROI cropping, providing a reliable spatial positioning basis for manual review, precise defect location, and maintenance dispatch.

[0080] This invention verifies whether the mapped child result is located within the parent detection box, parent segmentation mask, or a preset allowed area based on pre-defined parent-child geometric constraints in the knowledge graph, and checks whether the area ratio and relative position meet the constraints. If verification fails, the corresponding parent ROI is expanded within a preset retry limit, and identification and verification are re-executed. If the result still fails after reaching the limit, it is marked as a suspected result instead of being directly discarded. Compared with existing solutions, this invention effectively filters out false alarms across components caused by pruning errors or model misdetections through geometric constraint verification and a limited-retry mechanism, while avoiding non-convergence of the processing due to infinite retries, thus balancing reliability and stability.

[0081] This invention quantifies the reliability and defect risk of the identification results separately: the reliability of the results is jointly constituted by confidence levels, hierarchical consistency, image quality, cross-frame consistency, and parent-child geometric verification scores, reflecting the strength of evidence in automatic identification; the risk priority independently integrates the component risk level and anomaly severity based on the reliability, reflecting the urgency of defect repair. Compared with existing solutions, this invention avoids the confusion of equating high risk with high reliability, enabling reviewers to prioritize the examination of suspected results with weak evidence based on reliability, and to rationally allocate repair resources according to risk priority, thereby improving review efficiency and the rationality of repair decisions. Attached Figure Description

[0082] This invention will be described in conjunction with the accompanying drawings, wherein:

[0083] Figure 1 This is a schematic diagram of the steps and progressive closed loop of the method of the present invention;

[0084] Figure 2 This is a schematic diagram showing the correspondence between the system modules and method steps of the present invention;

[0085] Figure 3 A schematic diagram of one or more candidate paths driven by a hierarchical knowledge graph of railway components;

[0086] Figure 4 A schematic diagram illustrating the dynamic ROI generation and actual transformation parameter recording;

[0087] Figure 5 This is a schematic diagram of the reversible ROI parameter chain, coordinate hierarchical mapping, and parent-child geometric verification. Detailed Implementation

[0088] To clarify the objectives, technical solutions, and effects of this invention, the following description is provided in conjunction with the accompanying drawings and embodiments. The following embodiments are used to explain this invention and are not intended to limit the scope of protection.

[0089] To facilitate understanding of the technical solution of this invention, the following definitions are provided for several key terms used herein:

[0090] Current level: The current identification level that is currently performing route judgment and identification, corresponding to a node being processed in the detection chain.

[0091] Source image: The image source upon which the current level ROI is generated. The first time it is executed, it is the image to be detected. The next time it is executed, it is the previous level input ROI image.

[0092] ROI region: The cropping space defined in the coordinate system of the source image, expressed in coordinate form.

[0093] ROI image: Pixel data obtained by cropping the source image according to the ROI region and then scaling, padding, or transforming the image.

[0094] ROI boundary: The geometric boundary corresponding to the edge of the ROI region or ROI image.

[0095] Geometric Carrier Object: The region defined by the boundary of the input ROI image corresponding to the detection box, segmentation mask, or classification result used to carry the spatial location of the recognition result.

[0096] Reversible ROI parameter chain: A collection of forward coordinate transformation parameters and their associated information stored in a progressive hierarchical order, used to support the final result to be mapped back to the original image coordinate system step by step.

[0097] Detection chain: An ordered record sequence established for each identification branch in step S3, used to associate the result objects and ROI parameter records at each level in a progressive hierarchical order.

[0098] The following text shall use the corresponding terms according to the above definitions.

[0099] This method follows the main line of "knowledge graph routing - dynamic ROI generation - multi-level recognition - parameter chain inverse transformation - geometric verification - cross-frame review". Each recognition branch uses a detection chain to record parent-child relationships, model version, coordinate system and termination reason.

[0100] The following combination Figures 1 to 5 Explain the possible implementation methods.

[0101] Example 1

[0102] This embodiment discloses Figure 1 One implementation of the method shown.

[0103] Step S1: 4C Image Acquisition and Quality Assessment.

[0104] First, the high-resolution inspection video or images collected by the 4C inspection vehicle are read, and the image frames to be inspected are obtained according to time, mileage, keyframes, or external trigger conditions. Then, before each image frame to be inspected enters the inspection process, a corresponding frame-level record is established for that frame, recording one or more of the following information for each frame: original image identifier, pixel coordinate information, size, frame number, acquisition time, line location, and camera number.

[0105] After frame extraction, each frame is scored for image quality. The image quality score can be obtained by normalizing one or more indicators, including brightness, sharpness, motion blur, occlusion ratio, and effective area ratio. The specific threshold is calibrated using a validation set. Low-quality frames can be processed with lower priority, but frames corresponding to critical security components are not discarded directly based on a single quality indicator.

[0106] Step S2: Knowledge graph and recognition chain configuration.

[0107] A pre-built hierarchical knowledge graph of railway components is loaded, with nodes categorized into equipment regions, components, sub-components, and anomaly types. Directed edges represent progressive paths allowing entry from parent nodes to child nodes. Configuration includes model identifiers and versions, model availability status, task type, input size, ROI expansion strategy, confidence threshold, minimum ROI size, maximum level, component risk level, candidate model computational cost, candidate model historical false alarm rate, termination conditions, terminal markers, and parent-child geometric constraints. In the specific implementation, the railway component hierarchical knowledge graph is pre-built and stored in a server or configuration library as structured data. At runtime, only read or load operations are performed; real-time graph construction is not involved.

[0108] Parent-child geometric constraints can include the requirement that the child geometrically carrying object should be located within the parent detection frame, parent segmentation mask, or a preset allowable area, as well as the proportional range and relative position range of the child's area to the parent's area. Different line or component types can change the recognition path by updating the map configuration without altering the main progressive control program.

[0109] Step S3: Primary positioning and identification.

[0110] The image frame to be detected is input into a pre-trained target detection model to perform first-level localization and recognition, locating the device region or target component region in the image frame and outputting the current-level recognition result. The current-level result object includes a current-level result identifier, a current-level category label, a current-level confidence score, a parent result identifier, a current-level coordinate system identifier, and a current-level geometric carrying object; wherein, the current-level geometric carrying object obtained from the first-level localization and recognition is the current-level detection box; during first-level localization, the parent number is empty or set to a preset root node number (such as 0 or -1) to identify it as the starting level of progressive recognition.

[0111] A corresponding identification branch is established for each current-level result object, and a corresponding detection chain is established for each identification branch. The detection chain is an ordered record sequence that associates result objects at each level and ROI parameter records at each level in a progressive hierarchical order.

[0112] If no target is detected in the first-level detection, the recognition process for that frame is terminated directly, an empty detection chain result is generated with the termination reason being "no first-level target", and the frame is marked as having no valid target and will not enter the subsequent progressive recognition process.

[0113] Step S4: Dynamic graph routing.

[0114] After obtaining the current level recognition results (category label, confidence score, geometrically carrying object, and parent number), the next step is to determine whether there is a progressive next level path based on these results and the knowledge graph, that is, to perform dynamic graph routing.

[0115] Specifically, candidate directed edges are obtained by querying the knowledge graph using the current category label. First, an availability check is performed on the model bound to each candidate directed edge. Specifically, if the model corresponding to the model identifier and model version bound to the candidate directed edge exists, the model can be successfully loaded, the input size of the model matches the input size configured for the candidate directed edge, and the output fields of the model meet the output requirements of the task type bound to the candidate directed edge, then the model is determined to be available. Otherwise, the model is determined to be unavailable, and the corresponding reason for unavailability is recorded.

[0116] Next, edges whose binding model is unavailable or whose current level confidence score is below the corresponding threshold are removed. Then, route scores are calculated for the remaining candidate edges.

[0117] ,

[0118] in, For the remaining candidate directed edges, The current confidence score. Score the image quality of the current input image. The occlusion ratio of the current level input image represents the proportion of the occluded area in the current level input image to the total area of ​​the image region. In the first progressive recognition, the current level input image is the image to be detected. In subsequent progressive recognition, the current level input image is the current level ROI image generated in the previous progressive loop. The risk level of the component corresponding to the candidate path. The cost is calculated for the candidate models, which are obtained by testing under preset hardware, input size and batch size and normalized to [0,1]. The historical false alarm rate of the candidate model represents the statistical result of false alarms on the validation data or historical labeled data for the candidate model version bound by the directed edge. to The weights are non-negative.

[0119] The model can use states as a filtering gate, without mixing them with continuous scoring items.

[0120] When computational resources meet preset conditions, one or more candidate directed edges with a route score not lower than the route threshold are selected. When resources are limited, the top-ranked edges are selected in descending order of route score. Candidate directed edges, The value is a preset integer not less than 1. When selecting a single next-level path, that path is associated with the current identification branch. When selecting multiple next-level paths, sub-branches are created corresponding to each path, and each path is associated with its corresponding sub-branch. These sub-branches belong to the current identification branch and inherit the detection chain and reversible ROI parameter chain already formed by the current identification branch. If no edge is available, the current identification branch is marked as terminated, the reason for termination is recorded as "no available path," and the process proceeds to the next step, S7. Figure 3 It illustrates the progression from the same parent node to multiple child nodes.

[0121] Step S5: Dynamic ROI generation and reversible parameter chain recording.

[0122] After selecting the next-level recognition path in step S4, for each recognition branch associated with the selected next-level path, the next-level ROI region is determined in the source image according to the ROI expansion strategy bound to that next-level path. The ROI region is the cropping space range determined in the coordinate system of the source image. The next-level ROI region is then cropped, scaled, filled, and subjected to image transformations as needed to obtain the next-level input ROI image.

[0123] After generating the next-level input ROI image, the image quality of the next-level input ROI image is evaluated to obtain the next-level image quality score Q. k And occlusion ratio O k It is then associated with and saved as the next-level input ROI image and its corresponding ROI parameter record, for use in the next progressive loop when performing route scoring and ROI expansion.

[0124] Specifically, the ROI expansion coefficient is first dynamically calculated based on the geometric carrier object of the current level result object, and then the geometric carrier object of the current level result object is expanded using the ROI expansion coefficient.

[0125] The ROI expansion coefficient is determined by the current class, bounding box size, confidence score, image quality score, occlusion ratio, risk level of the component corresponding to the candidate path, and target scale normalization value, and the formula is:

[0126] ,

[0127] in, For category The corresponding basic expansion factor, Score the image quality of the current input image. The occlusion ratio of the current-level input image represents the proportion of the occluded area to the total area of ​​the image region. In the first progressive recognition, the current-level input image is the image to be detected; in subsequent progressive recognitions, the current-level input image is the current-level ROI image generated in the previous progressive loop. For the current level of component risk, The current confidence score. For the target scale normalized value, , , , and Non-negative weights and These are the lower and upper limits of the expansion coefficient, respectively.

[0128] Using the center point of the current level geometric carrier object as the expansion center, the width of the current level geometric carrier object is... and height Multiply by the expansion factor respectively The width W of the expanded ROI image region is obtained. k and height H k The formula is:

[0129] , ,

[0130] in, and Let be the width and height of the k-th level detection box, respectively. The k-th level dynamic ROI expansion coefficient.

[0131] If the expanded next-level ROI region exceeds the boundary of the source image, the ROI region is cropped to the effective range of the source image, and the actual offset and actual size after cropping are recorded. The source image is the image to be detected when the process is first executed, and the previous level input ROI image when the process is executed again.

[0132] During the cropping process, it is necessary to completely record all the actual image transformation parameters performed to form a reversible ROI parameter chain. For example... Figure 4 As shown, let the actual clipping offset of the k-th level be (d x,k ,d y,k ), scaling ratio is The left fill amount is The filling amount is Then the source image coordinates (u k−1 ,v k−1 Mapped to current level image coordinates (u k ,v k The forward transformation relation is:

[0133] .

[0134] The first Mapping level coordinates to level The fundamental homogeneous transformation matrix corresponding to the level coordinates for:

[0135] .

[0136] If rotation, flipping, affine transformation, or perspective correction is actually performed, the corresponding matrices are then processed in the actual order, and the corresponding transformation matrices are compared with the fundamental homogeneous transformation matrix. By combining the results, we obtain the final homogeneous transformation matrix of the k-th level. And write the combination order and matrix parameters into the invertible ROI parameter chain; when the additional image transformation is not performed, let Unexecuted transformations are not written to the parameter chain. Each level records at least the following information: the fundamental homogeneous matrix. The final homogeneous transformation matrix The actual clipping offset, scaling ratio, padding amount, ROI expansion factor, source coordinate system identifier, target coordinate system identifier, parent number, and model version are used to form the current level ROI parameter record.

[0137] When step S5 is executed for the first time, a reversible ROI parameter chain for the current identification branch is established, and the current-level ROI parameter record is used as the first record of this reversible ROI parameter chain. In subsequent executions of step S5, the current-level ROI parameter record is appended to the reversible ROI parameter chain of the current identification branch. The source image for the first execution of step S5 is the image to be detected, and the source image for subsequent executions of step S5 is the previous-level input ROI image.

[0138] Step S6: Multi-level progressive recognition.

[0139] After obtaining the next-level input ROI image in step S5, for each recognition branch processed in step S5, according to the task type and model configuration information bound to the next-level path associated with that recognition branch, the corresponding model is called to perform detection, classification or segmentation on the next-level input ROI image to obtain one or more next-level result objects.

[0140] The task type is determined by the task type attribute of the directed edge corresponding to the next-level path selected in step S4, including object detection, image classification, and semantic segmentation; the node role is used to verify whether the task type matches the expected output. Specifically: when the current-level category label is a device region node or component node in the knowledge graph, the corresponding task type is object detection (detecting components or sub-components respectively); when the current-level category label is a terminal sub-component node, the corresponding task type is image classification (anomaly classification) or semantic segmentation (anomaly detection / segmentation).

[0141] The object detection model outputs a detection result object, which includes a category label, a confidence score, and a bounding box. The image classification model outputs a classification result object, which includes a category label, a confidence score, and the region defined by the image boundary of the next-level input ROI image. The semantic segmentation model outputs a segmentation result object, which includes a category label, a confidence score, and a segmentation mask. The geometrically carrying object for the detection result object is the bounding box, the geometrically carrying object for the segmentation result object is the segmentation mask, and the geometrically carrying object for the classification result object is the region defined by the image boundary of the next-level input ROI image. All the above outputs are uniformly converted into a next-level result object, which includes a geometrically carrying object (bounding box, segmentation mask, or ROI boundary), a category label, a confidence score, anomaly level, a parent number, and a coordinate system identifier, for subsequent replay and hierarchical binding.

[0142] Step S7: Detection chain recording and termination control.

[0143] After completing the current level identification and obtaining the next level result object in step S6, the detection chain of each identification branch is updated. For the identification branch processed by steps S5 and S6, the corresponding current level ROI parameter record, the next level path identification status, and the next level result object are appended to the detection chain of the identification branch, and it is determined whether the current level progression should continue.

[0144] Each identification branch forms an independent detection chain, recording at least each level of category, confidence level, geometric bearing object, coordinate system identifier, parameter chain, model version, and termination reason. If the termination condition is not triggered, the next level result object in step S6 is taken as the new current level result object and the process returns to step S4; multiple branches are processed sequentially by the queue.

[0145] When the current identification branch is marked as having no available path, or reaches the terminal node, meets the termination condition, or does not obtain a valid next-level result object, terminate the current identification branch and record the corresponding termination reason.

[0146] Termination conditions include one or more of the following:

[0147] The current level results have identified the final defect type;

[0148] The current-level node belongs to the terminal node in the railway component hierarchical knowledge graph;

[0149] The current level confidence score is lower than the confidence threshold for the directed edge binding of the railway component hierarchical knowledge graph;

[0150] The current level ROI image size or segmentation mask area is smaller than the minimum scale threshold for the directed edge binding of the railway component hierarchical knowledge graph;

[0151] The current progressive level has reached the maximum number of directed edges bound in the knowledge graph of the railway component level;

[0152] The current category label has no candidate next-level node in the railway component hierarchical knowledge graph;

[0153] The category label of the current level identification result is inconsistent with the parent level result identifier in the preset parent-child hierarchical relationship in the railway component hierarchical knowledge graph;

[0154] The current level belongs to the key safety components marked in the railway component hierarchical knowledge graph and the suspected detection chain needs to be retained for manual review.

[0155] Step S8: Coordinate mapping and parent-child geometry verification.

[0156] After the progression is terminated in step S7, the final recognition result needs to be mapped back to the original image coordinate system and geometrically verified to ensure the accuracy of the spatial location of the defect and the consistency of the hierarchical structure.

[0157] Specifically, starting from the final-level ROI image coordinate system (i.e., the current level at which the progression terminates), the final-level result object is mapped back to the pixel coordinate system of the image to be detected level by level, based on the cropping offset, scaling ratio, and image transformation parameters recorded at each level. Let the final level be the... If the order is homogeneous, then the coordinates are homogeneous. for: and homogeneous coordinates satisfy:

[0158] ,

[0159] Among them, homogeneous coordinates Represents the k-th level image coordinates The homogeneous coordinates, where K is the final level index. Let be the final homogeneous transformation matrix of the k-th order, and the last order be the k-th order. Then, as follows: Figure 5 As shown, the original image coordinates q0 can be obtained by multiplying the inverse matrices of each order:

[0160] .

[0161] The mapping method varies depending on the type of geometric object: for outliers, their homogeneous coordinates are directly mapped; for bounding boxes, the four corner points are mapped and their bounding rectangles are taken; for segmentation masks, all valid pixels or boundary contour points of the mask are mapped; for classification results (using the region defined by the image boundary of the current-level ROI image as the geometric object), the four corner points are mapped. When perspective transformation exists, the third component of the mapped coordinates is used for normalization.

[0162] After the coordinate mapping is completed, the parent-child geometric constraint verification needs to be performed on the mapping results.

[0163] Specifically, for parent and child result objects at adjacent levels in the detection chain, the actual inclusion relationship, actual area ratio, and actual relative position between the reflected child geometric bearing object and the parent geometric bearing object are determined in the same coordinate system. The actual inclusion relationship, actual area ratio, and actual relative position are compared with the corresponding parent-child geometric constraints in the knowledge graph to obtain the sub-item verification results of each applicable parent-child geometric constraint, and a parent-child geometric verification score is generated based on the sub-item verification results.

[0164] In one implementation, the parent-child geometric verification score is calculated according to the following formula:

[0165] ,

[0166] Where G is the parent-child geometric verification score. The result of the itemized verification shows the number of items that meet the corresponding constraints. To apply the total number of parent-child geometric constraints, and The applicable parent-child geometric constraints include one or more of the following: relational constraints, area ratio constraints, and relative position constraints.

[0167] The parent-child geometric verification score is compared with a preset geometric verification threshold. When the parent-child geometric verification score is not lower than the preset geometric verification threshold, the verification is determined to be successful. When the parent-child geometric verification score is lower than the preset geometric verification threshold but has not reached the preset retry limit, the parent geometric bearing object corresponding to the current failed level is expanded according to the ROI expansion strategy, and steps S5 to S8 are re-executed. When the parent-child geometric verification score is still lower than the preset geometric verification threshold after reaching the preset retry limit, the verification is determined to be unsuccessful, and the current detection chain is marked as a suspected detection chain. The identification results at each level and the reversible ROI parameter chain are retained for manual review to prevent the loop from not converging.

[0168] Step S9: Cross-frame review, scoring, and structured output.

[0169] After completing coordinate mapping and parent-child geometric verification in step S8, cross-frame association and comprehensive scoring are required, and the structured defect identification results are output.

[0170] Specifically, firstly, cross-frame association is performed on detection chains marked as passed verification or marked as suspected detection chains. Based on line location, pole number, parent number, acquisition time, and coordinate overlap rate after replay, detection chains of the same component in adjacent frames are associated. Then, a cross-frame consistency score is obtained based on anomaly category consistency, confidence stability, and replay coordinate stability. .

[0171] For cross-frame association groups that are associated with the same component and contain N detection chains, each detection chain is sorted according to the acquisition time, and the anomaly category consistency score, confidence stability score, and post-reflection geometric position stability score are calculated respectively.

[0172] Anomaly Category Consistency Score It is the ratio of the number of detection chains corresponding to the most frequently occurring last-level anomaly category in the cross-frame association group to the total number of detection chains N.

[0173] Confidence stability score The confidence stability score is determined based on the difference in confidence levels of the anomaly results at the final stage of each detection chain. The smaller the difference in confidence levels, the higher the score. The formula is as follows:

[0174] ,

[0175] in, Let be the confidence level of the final stage of the i-th detection chain.

[0176] Geometric position stability score after reflection It is the average geometric similarity of the detection results within the cross-frame association group. For a cross-frame association group containing N detection chains, the results of each frame are first transformed to the same reference coordinate system, or to the local normalized coordinate system of the corresponding parent object, and then the geometric position stability score after the regression is calculated. The formula is:

[0177] ,

[0178] in, The geometric similarity between the i-th and j-th detection chains is calculated using the intersection-union ratio (IU / U): when the geometrically carrying object is a detection box or a segmentation mask. When the geometrically supported object is a point, normalized distance is used: ; The detection box or segmentation mask after transforming the result of the i-th frame to a unified coordinate system; The normalized point coordinates after the transformation of the i-th frame result; The preset allowable positional deviation threshold is set to 0.05–0.15, preferably 0.10; geometric similarity and post-reflection geometric position stability score All values ​​are normalized to [0,1]; Geometric position stability score The larger the value, the more stable the geometric position of the same component is in different frames.

[0179] Consistency score based on anomaly category Confidence stability score and post-reflection geometric position stability score A cross-frame consistency score was obtained. :

[0180] ,

[0181] in, , , For normalized non-negative weights, and Each sub-item score and cross-frame consistency score are normalized to [0,1]. At that time, the confidence stability score is not calculated. and geometric position stability score This improves cross-frame consistency scoring. A preset single-frame baseline value is used and marked as a single frame to be reviewed; when N≥2, the above formula is used for calculation.

[0182] Reliability of recognition results It can be represented as:

[0183] ,

[0184] in, The confidence score for level k is... Scoring for hierarchical consistency; when the hierarchy season When the level The calculation can be based on the proportion of adjacent levels conforming to the parent-child relationship in the graph; Rate the image quality. For cross-frame consistency scoring, Geometric verification score for father and son. , , , and For the normalized non-negative weights, each term is normalized to... .

[0185] To avoid equating high risk with high credibility, risk priority is calculated separately. The formula is:

[0186] ,

[0187] in, This refers to the risk level of the components configured in the knowledge graph path corresponding to the current detection chain. The anomaly severity score is obtained by normalizing the anomaly severity level associated with the current anomaly type node at the end of the detection chain, where a, b, and c are non-negative weights.

[0188] The final output includes the device region, component, sub-component, anomaly type, original image coordinates (original coordinates are the position coordinates after being mapped back to the pixel coordinate system of the image to be detected), results at each level, reversible ROI parameter chain, model version, termination reason, and confidence level. Risk Priority The structured results of the verification status.

[0189] Example 2

[0190] This embodiment discloses a progressive railway defect identification system based on knowledge graphs and ROI parameter chains, such as... Figure 2 As shown, it includes:

[0191] The 4C image acquisition and quality assessment module 1 is used to acquire inspection videos or image sequences collected by the 4C inspection device; decode and extract frames from the inspection video, or read the image sequence frame by frame to obtain the image to be inspected, and establish a frame-level record containing the pixel coordinate system information, frame number, image quality score and occlusion ratio of the image to be inspected.

[0192] The knowledge graph and identification chain configuration module 2 is used to load a preset railway component hierarchical knowledge graph. The nodes in the railway component hierarchical knowledge graph represent equipment areas, components, sub-components, or anomaly types. Among them, the anomaly type nodes are associated with a preset anomaly severity level. The directed edges represent parent-child progressive paths and are bound to model identifiers, model versions, task types, ROI expansion strategies, confidence thresholds, risk levels, candidate model computation costs, candidate model historical false alarm rates, termination conditions, and parent-child geometric constraints.

[0193] The first-level localization and recognition module 3 is used to perform first-level localization and recognition through a pre-trained target detection model to obtain a current-level result object containing the current-level result identifier, current-level category label, current-level confidence score, parent-level result identifier, current-level coordinate system identifier, and current-level geometric carrying object; wherein, the current-level geometric carrying object obtained by the first-level localization and recognition is the current-level detection box; a corresponding recognition branch is established for each current-level result object, and a corresponding detection chain is established for each recognition branch; the detection chain is an ordered record sequence that associates the result objects at each level and the ROI parameter records at each level in a progressive hierarchical order; when the first-level localization and recognition does not detect any target, the recognition process is terminated and the recognition result is recorded as no first-level target;

[0194] The dynamic graph routing module 4 is used to query the railway component hierarchical knowledge graph with the current level category label, perform routing scoring on candidate directed edges that are available in the model and meet the corresponding confidence threshold, and select one or more next-level paths. When selecting one next-level path, the next-level path is associated with the current identification branch. When selecting multiple next-level paths, sub-branches corresponding to each next-level path are established, and each next-level path is associated with its corresponding sub-branch. The sub-branch belongs to the current identification branch and inherits the detection chain and reversible ROI parameter chain formed by the current identification branch. When there is no available path, the current identification branch is marked as terminated, the reason for termination is recorded as no available path, and the detection chain and termination control module 8 is triggered.

[0195] The dynamic ROI generation module 5 is used to determine the next-level ROI region in the source image for each recognition branch associated with the selected next-level path, based on the ROI expansion strategy bound to the next-level path and the geometric carrier object of the current-level result object of the recognition branch. The module then performs cropping, scaling, filling, and other image transformations on the next-level ROI region to obtain the next-level input ROI image. The module also calculates the image quality score and occlusion ratio of the next-level input ROI image and records and saves the image quality score and occlusion ratio of the next-level input ROI image in association with the corresponding ROI parameter records.

[0196] The reversible parameter chain recording module 6 is used to record the actual cropping area, scaling ratio, padding amount, expansion coefficient, actual image transformation parameters, and coordinate system identifier to form the current-level ROI parameter record. When this module is run for the first time, a reversible ROI parameter chain for this recognition branch is established, and the current-level ROI parameter record is used as the first record in this reversible ROI parameter chain. When this module is run again in subsequent iterations, the current-level ROI parameter record is appended to the reversible ROI parameter chain of this recognition branch. The source image during the first run is the image to be detected, and the source image during subsequent runs is the previous-level input ROI image.

[0197] The multi-level progressive recognition module 7 is used to perform detection, classification, or segmentation on the next-level input ROI image corresponding to each recognition branch processed by the dynamic ROI generation module 5 and the reversible parameter chain recording module 6, according to the task type and model bound to the next-level path associated with the recognition branch, to obtain one or more next-level result objects, including detection result objects, segmentation result objects, and classification result objects; wherein, the geometric carrying object of the detection result object is the detection box, the geometric carrying object of the segmentation result object is the segmentation mask, and the geometric carrying object of the classification result object is the region defined by the image boundary of the next-level input ROI image;

[0198] The detection chain and termination control module 8 is used to update the detection chain of each identification branch. For identification branches processed by the dynamic ROI generation module 5, the reversible parameter chain recording module 6, and the multi-level progressive identification module 7, the corresponding current-level ROI parameter record, the next-level path identification status, and the next-level result object are appended to the detection chain of the identification branch. When the identification branch has been marked as having no available path, or has reached a terminal node, met the termination condition, or has not obtained a next-level result object, the identification branch is terminated and the corresponding termination reason is recorded. Otherwise, the next-level result object is updated to the current-level result object and the dynamic graph routing module 4 is triggered to continue execution.

[0199] The coordinate mapping and parent-child geometric verification module 9, after the detection chain terminates, maps the final-level results back to the pixel coordinate system of the image to be detected in reverse order of the reversible ROI parameter chain, and verifies them according to the parent-child geometric constraints of the knowledge graph. If the verification passes, the current detection chain is marked as passed; if the verification fails, the current detection chain is marked as a suspected detection chain and the recognition results at each level and the reversible ROI parameter chain are retained for manual review.

[0200] The cross-frame verification module 10 is used to perform cross-frame association on detection chains marked as passing verification or suspected detection chains;

[0201] The comprehensive scoring and structured output module 11 is used to calculate the credibility and risk priority respectively, and output the structured results containing hierarchical relationship, original coordinates, reversible ROI parameter chain, model version, termination reason, credibility, risk priority and review status. The original coordinates are the position coordinates after being mapped to the pixel coordinate system of the image to be detected.

[0202] The above modules can be implemented by software units on the same computing device or by multiple computing units; the module division is used to illustrate the functional correspondence and does not limit the specific hardware deployment method.

[0203] Example 3

[0204] This embodiment illustrates the complete execution process of a three-level detection chain by using the identification of abnormal nuts in a bolt assembly.

[0205] The first-level localization and identification obtains the bolt assembly detection box; dynamic map routing selects one or more paths from candidate paths for nuts, pins, or anti-loosening components that are available in the model and meet the threshold; a first-level ROI is generated for the nut path and the homogeneous transformation matrix is ​​recorded. After detecting the nut, a secondary nut ROI is generated and the homogeneous transformation matrix is ​​recorded. Then perform exception classification or segmentation.

[0206] When the final stage is a classification task, the boundary of the nut-shaped ROI is used as the geometric carrying object; when the final stage is a segmentation task, the anomaly mask is used as the geometric carrying object. Reflect back to the original image and verify that the result is within the allowed area of ​​the parent bolt assembly.

[0207] If verification fails but the retry limit is not reached, the corresponding parent ROI is expanded for re-identification. If the limit is reached and the failure still occurs, the result is retained as a suspected result. When the conclusions and coordinate relationships of adjacent frames are consistent, the cross-frame consistency score is improved. The map can be configured with different progressive depths according to the component structure, but all use the same routing, parameter chain recording, termination, reflection, and verification closed loop.

[0208] Example 4

[0209] This embodiment, based on embodiment 1, illustrates the configuration, verification, and runtime routing methods of the railway component hierarchical knowledge graph.

[0210] Knowledge graphs can be stored in graph databases, relational tables, or in-memory adjacency lists, as long as candidate child nodes and their edge attributes can be obtained based on the current level category; the specific storage format of the graph does not affect the progressive control logic of this invention.

[0211] Each node record includes at least a node identifier, node type, category label, parent type, terminal marker, and component risk level. The node type is used to distinguish between equipment areas, components, sub-components, and exception types; the terminal marker indicates whether the node can continue to progress; when different constraints are required for the same category under different parent structures, node identifiers can be set separately to avoid incorrect path reuse.

[0212] Each directed edge record must include at least the parent node identifier, child node identifier, model identifier and version, model availability status, task type, model input size, confidence threshold, ROI strategy identifier, parent-child geometric constraint identifier, termination rule, and routing parameters. The task type can be detection, classification, or segmentation, and the model output fields should match the task type and the geometric carrying objects required by the child nodes.

[0213] Before the graph is put into use, a configuration consistency check is performed: non-terminal nodes should have at least one candidate outgoing edge or a clear termination rule; the model, ROI strategy, and geometric constraints referenced by the edge should all exist; the parent and child node types should conform to the preset hierarchy; edges that may form loops should have a maximum hierarchy or number of visits set. Edges that fail the check are not included in the runtime candidate set, and the reason for the configuration anomaly is recorded.

[0214] For detection tasks, the model output must include at least the class, confidence score, and bounding box; for segmentation tasks, the model output must include at least the class, confidence score, and mask; for classification tasks, the model output must include at least the class and confidence score, and use the boundary of its input ROI as the geometric carrying object. Through this unified interface, the output of step S6 can be directly used as a detection chain node in step S7, and can re-enter step S4 if it has not terminated.

[0215] When processing a frame of image, a detection chain-level snapshot is created for the current atlas version, model version, and threshold configuration. Subsequent layers within the same detection chain use this snapshot to avoid inconsistencies in rules between layers caused by configuration updates during processing. After completing the current detection chain, the new configuration can be used for the next detection chain, and the structured results save the actual atlas version and model version used.

[0216] When the process reaches step S4, edges are retrieved using the current-level node identifier and category label. First, gating is performed based on model availability, parent-child category relationship, and confidence threshold. Then, the routing score for the remaining candidate edges is calculated. If a candidate edge's model cannot be loaded, its input size does not match, or its output interface is incomplete, the edge is marked as temporarily unavailable, rather than directly terminating other candidate branches.

[0217] When multiple candidate edges are selected, an independent branch identifier is assigned to each edge, and the current level result, parameter chain reference, and parent number are copied as the branch starting point. Each branch performs ROI generation, next-level identification, and termination judgment respectively; the termination of any branch does not affect the continuation of other branches. Finally, the results of multiple branches are organized into a hierarchical result of the same component according to the common original image identifier and parent object.

[0218] If no usable edge exists after gating, a detection chain node with the termination reason NO_AVAILABLE_PATH is generated and the process proceeds to step S7. If the current node is itself a terminal node, a detection chain node with the termination reason TERMINAL_NODE is generated. In both cases, the existing results and parameter chains at each level are preserved, ensuring that even with "no path," there is a clear output, preventing the processing flow from becoming dangling.

[0219] Example 5

[0220] This embodiment further illustrates the recording structure and coordinate mapping process of the reversible ROI parameter chain based on Embodiment 1.

[0221] For the Level ROI, establish parameter records It includes at least the source coordinate system identifier, the target coordinate system identifier, the actual clipping rectangle, the scaling ratio, the surrounding padding, the ROI expansion coefficient, and the basic transformation matrix. The final homogeneous transformation matrix Optional transformation and combination order, interpolation method, parent number, and model version.

[0222] The actual cropping rectangle is recorded with the top-left corner of the source image as the origin. When the planned expansion area exceeds the boundary, it first intersects with the effective range of the source image, and then the coordinates of the top-left corner, width, and height of the intersection result are written into the parameter record. The subsequent transformation matrix is ​​calculated using this actual value, not the planned value before the boundary was exceeded. This avoids fixed deviations in boundary components that are inconsistent with the actual image content during the reconstruction.

[0223] When scaling and filling proportionally, first calculate the scaling ratio based on the actual cropped width and height and the model's input width and height, then calculate the left, right, top, and bottom fill amounts. Basic homogeneous transformation matrix. The translation term includes both clipping offset and fill offset; if the fill amount cannot be evenly distributed, the actual left fill amount and top fill amount are recorded separately so that the inverse transformation can restore the accurate coordinates.

[0224] If rotation, mirroring, affine correction, or perspective correction is actually performed, a corresponding matrix is ​​generated for each operation, and the matrix is ​​then compared with the fundamental homogeneous transformation matrix according to the actual order of image processing. Combining the results, we obtain the final homogeneous transformation matrix. The parameter chain stores the operation type, matrix, and combination order; it is only written when the processor actually executes the operation, and cannot infer an unexecuted matrix based on a preset strategy.

[0225] Check homogeneous transformation matrix before writing to parameter chain Is it invertible? For affine matrices, check if the determinant of its linear part is close to zero. For perspective matrices, check the overall determinant and the normalized denominator. If the matrix is ​​not invertible, the coordinate system identifier is missing, or the coordinate systems of adjacent levels are discontinuous, the current branch terminates with PARAMETER_CHAIN_INVALID as the reason and is retained as a suspected result for verification.

[0226] When retracing the detection bounding box, the four corner points are multiplied by the inverse matrix and the bounding rectangle is taken. When retracing the segmentation mask, the inverse transformation is performed on the mask boundary points or effective pixels, and the mask is restored using an interpolation method suitable for discrete labels. When retracing the classification results, the ROI boundary of the actual input to the classification model is used as the geometric carrying object. All retraced results are cropped to the effective range of the original 4C image.

[0227] For example, the top left corner of the detection box in a source image is With a width of 40 and a height of 20, and an expansion factor of 1.5, the actual ROI can be taken as the top left corner. The ROI has a width of 60 and a height of 30. Scale the ROI proportionally to a width of 320 and a height of 160, and... The input is padded with 80 pixels at the top and bottom. , , .

[0228] In the example above, the model input coordinates The source coordinates are obtained through inverse transformation. , This corresponds to the center of the original detection box. This example shows that clipping offset, scaling, and padding must all be included in the matrix; if the padding amount is omitted, the reflected ordinate will produce a fixed error.

[0229] The system can perform sampling round-trip verification on the parameter chain: selecting ROI corner points and center points from the source coordinates, and then performing homogeneous transformation matrix... Forward mapping followed by homogeneous transformation matrix The system reflects the difference between the two points and calculates the distance between them. If the error exceeds the preset tolerance, the failure level is recorded and the recording of this parameter is stopped. This tolerance is calibrated based on the image resolution and interpolation method, and does not require a fixed pixel value.

[0230] Example 6

[0231] This embodiment describes the state control and abnormal loop closure of the detection chain based on Embodiment 1. Each detection chain maintains at least the chain identifier, branch identifier, current node, current level, parent result reference, reversible ROI parameter chain, retry count, status, and termination reason; the status may include pending routing, ROI generated, identification completed, pending termination judgment, pending feedback, pending verification, pending retry, pending review, and output.

[0232] Under normal circumstances, the current result proceeds to steps S5 and S6 after route selection in step S4. Step S6 generates a valid next-level result and writes it into the detection chain. If step S7 determines that the process has not terminated, it sets the result as the new current result and returns to step S4. Upon return, the original branch identifier and existing parameter chain are retained, and only new level records are appended, thus forming a traceable progressive loop.

[0233] If no valid next-level result is obtained in step S6, the empty result is not sent back to step S4; instead, EMPTY_OUTPUT is recorded in step S7. For critical security components, existing parent results, along with the failed model, confidence level, and image quality, can be marked as suspected detection chains; for non-critical components, the chain can be terminated directly according to the graph termination rules. This process ensures that inference failures and normal terminal nodes have distinguishable termination reasons.

[0234] If the model fails to load, the input size is incorrect, or the output field is incomplete, the corresponding candidate edge will be marked as unavailable for this detection chain, and other candidate edges of the same parent node will be re-examined. If there are still available edges, routing will continue; if all edges are unavailable, the system will enter the NO_AVAILABLE_PATH. This exception only affects the corresponding recognition branch and does not delete the completed parent localization results.

[0235] When the geometric verification in step S8 fails, record the failure level, the type of constraint violated, and the current number of retries, and locate the parent ROI corresponding to that level. During the retry, expand the parent ROI, update the actual clipping parameters, and re-execute steps S5 to S8, without repeating steps that have passed verification before the failure level; the new parameter record is appended to the same branch and marked with the retry number.

[0236] Each layer has a maximum number of retries set, and the entire detection chain can also have a maximum cumulative number of retries and a maximum progression level set. When either limit is reached, returning to step S5 is prohibited; the branch is converted to a suspected or invalid result, and cross-frame review or manual review is initiated. This dual limit prevents loop non-convergence caused by alternating failures at multiple levels.

[0237] In multi-branch processing, each branch stores its termination reason and review status separately; the next branch under the same parent is deemed invalid and is not used to negate the valid results of other branches. The parent object is retained once in the output stage, and each branch is associated with it in its child result list to avoid incorrectly concatenating multi-path results into a non-existent hierarchical path.

[0238] After completing coordinate mapping, geometric verification, and cross-frame review, the detection chain enters the output state. Except for branches with a limited number of retries, the output chain will not automatically return to the previous stage. If manual review changes the result state, a new review record will be added, and the original automatic recognition result, parameter chain, and score will be retained to ensure the traceability of the results.

[0239] Example 7

[0240] This embodiment illustrates one method for cross-frame verification and structured output. First, a set of candidate components is determined according to the line location, pole number, or support post number. Then, matching is performed based on the camera number, acquisition time difference, parent category, and overlap rate of the detection box after reflection. Only results that meet the position and time window criteria participate in the cross-frame consistency calculation of the same component.

[0241] For detection bounding boxes or mask results, the geometric correlation score can be calculated based on the overlap rate, center distance, and area ratio after the mapping. For classification results, in addition to category consistency, the relative position of its geometrically carrying ROI with its parent region is also compared. When multiple candidates simultaneously meet the conditions, the one with the highest comprehensive correlation score is selected, and unmatched results are treated as new trajectories.

[0242] Cross-frame consistency score It can be obtained by normalizing the number of consecutively occurring frames, the proportion of class consistency, confidence fluctuations, and geometric position stability. When conclusions from adjacent frames conflict, the low-scoring result is not directly deleted; instead, the review status is set to conflict, and the cross-frame consistency score is reduced. Even if a critical safety component appears only in a single frame, it can be added to the manual review list based on its risk level.

[0243] Result reliability Used to describe the reliability of automatically identified evidence and the risk level of the component. and abnormal severity Not included in the result reliability Risk Priority In terms of the reliability of the results Risk level of integrated components and abnormal severity All inputs are first normalized, weights are determined by validation data, and the weight versions used are written into the output to avoid ambiguity in the meaning of the same score under different configuration versions.

[0244] The structured results should include at least the original image identifier, line location, device area, parent object, categories and confidence levels, original image coordinates, geometric carrying type, map path, model versions at each level, reversible ROI parameter chain, termination reason, retry record, geometric verification status, cross-frame association identifier, and result confidence level. Risk Priority and review status.

[0245] Before output, a field integrity check is performed: Detection chains with final-level results must have original coordinates or a clear reason for parameter chain anomalies; chains that have undergone retries must contain both the pre- and post-retries ROI records; multi-branch results must contain branch identifiers and common parent identifiers. If the check fails, a normal defect conclusion is not generated; instead, a record awaiting review is generated.

[0246] Example 8

[0247] This embodiment illustrates the collaborative work of knowledge graph, parameter chain, and verification loop using multi-path identification of a positioning device. The primary positioning module obtains the positioning device detection box in the original 4C image; the graph configures the positioning clamp path and locator path for this node. When the models of both edges are available and the routing score reaches the threshold, branches A and B are established respectively.

[0248] Branch A is generated using the positioning device detection frame. Invertible chain and record homogeneous transformation matrix The positioning clamp is detected within it; subsequently, a positioning clamp detection frame is generated. Invertible chain and record homogeneous transformation matrix ,exist In the reversible chain, pins are detected and their absence is determined. If a classification model is used in the final stage, the candidate ROI boundary of the pin is used as the geometric bearing object.

[0249] Branch B is generated using the positioning device detection frame. Invertible chain and record homogeneous transformation matrix The locator is detected within it; then the locator detection frame is generated. Invertible chain and record homogeneous transformation matrix The suspected crack region is segmented. The final-level mask is transformed using a homogeneous transformation matrix. and homogeneous transformation matrix By mapping back to the original image, the original coordinates of the cracked area are obtained.

[0250] For branch A, a geometric check determines whether the candidate ROI for the pin is located within the allowable area of ​​the positioning clamp and checks its relative position; for branch B, a geometric check determines whether the crack mask is located within the locator area. If either branch fails the check, only the corresponding parent ROI of that branch is expanded and re-identified a limited number of times; the other branch is not re-executed.

[0251] When branch A confirms the pin is missing while branch B does not find a crack, two detection chains are still output respectively; both share the parent identifier of the positioning device and save the parameter chain, score and termination reason respectively.

[0252] When the conclusions of adjacent frames are consistent, the cross-frame score of branch A is increased; when the crack appears only in a single frame or is located at the geometric boundary, branch B is marked as suspected, so as to uniformly handle the termination results of different paths.

[0253] The above embodiments are for illustration and not for limiting the present invention; any equivalent substitutions made without departing from the concept of the present invention shall fall within the protection scope of the present invention.

Claims

1. A 4C defect identification method based on knowledge graphs and reversible ROI chains, characterized in that, Includes the following steps: Step S1: Acquire the inspection video or image sequence collected by the 4C detection device; decode and extract frames from the inspection video, or read the image sequence frame by frame to obtain the image to be detected, and establish a frame-level record containing the pixel coordinate system information, frame number, image quality score and occlusion ratio of the image to be detected. Step S2: Load the preset railway component hierarchical knowledge graph. The nodes in the railway component hierarchical knowledge graph represent equipment areas, components, sub-components, or anomaly types. Among them, the anomaly type nodes are associated with preset anomaly severity levels. Directed edges represent parent-child progressive paths and are bound to model identifiers, model versions, task types, ROI expansion strategies, confidence thresholds, risk levels, candidate model computation costs, candidate model historical false alarm rates, termination conditions, and parent-child geometric constraints. Step S3: Perform first-level localization and recognition using a pre-trained target detection model to obtain a current-level result object containing the current-level result identifier, current-level category label, current-level confidence score, parent-level result identifier, current-level coordinate system identifier, and current-level geometric carrying object; wherein, the current-level geometric carrying object obtained by first-level localization and recognition is the current-level detection box; establish a corresponding recognition branch for each current-level result object, and establish a corresponding detection chain for each recognition branch; the detection chain is an ordered record sequence that associates result objects at each level and ROI parameter records at each level in a progressive hierarchical order; when the first-level localization and recognition does not detect any target, terminate the recognition process and record the recognition result as no first-level target; Step S4: Query the railway component hierarchical knowledge graph using the current level category label, perform routing scoring on candidate directed edges that are available in the model and meet the corresponding confidence threshold, and select one or more next-level paths; when selecting one next-level path, associate the next-level path with the current identification branch; when selecting multiple next-level paths, establish sub-branches corresponding to each next-level path, associate each next-level path with the corresponding sub-branch, the sub-branch belongs to the current identification branch, and inherits the detection chain and reversible ROI parameter chain formed by the current identification branch; when there is no available path, mark the current identification branch as terminated, record the termination reason as no available path, and proceed to step S7; Step S5: For each recognition branch associated with the selected next-level path, based on the ROI expansion strategy bound to the next-level path and the geometric carrying object of the current-level result object of the recognition branch, determine the next-level ROI region in the source image, and perform cropping, scaling, filling, and other image transformations as needed on the next-level ROI region to obtain the next-level input ROI image. Calculate the image quality score and occlusion ratio of the next-level input ROI image, and record and save the image quality score and occlusion ratio of the next-level input ROI image in association with the corresponding ROI parameters. Record the actual cropped area, scaling ratio, fill amount, expansion coefficient, actual image transformation parameters, and coordinate system identifier to form the current level ROI parameter record; wherein, when step S5 is executed for the first time, a reversible ROI parameter chain for this recognition branch is established, and the current level ROI parameter record is used as the first record of the reversible ROI parameter chain; when step S5 is executed again in subsequent iterations, the current level ROI parameter record is appended to the reversible ROI parameter chain for this recognition branch; the source image during the first execution is the image to be detected, and the source image during subsequent executions is the previous level input ROI image; Step S6: For each recognition branch processed in step S5, according to the task type and model bound to the next-level path associated with that recognition branch, perform detection, classification, or segmentation on the next-level input ROI image corresponding to that recognition branch to obtain one or more next-level result objects, including detection result objects, segmentation result objects, and classification result objects; wherein, the geometric carrying object of the detection result object is the detection box, the geometric carrying object of the segmentation result object is the segmentation mask, and the geometric carrying object of the classification result object is the region defined by the image boundary of the next-level input ROI image; Step S7: Update the detection chain of each identification branch; for the identification branches processed by steps S5 and S6, append the corresponding current level ROI parameter record, the next level path identification status, and the next level result object to the detection chain of the identification branch; when the identification branch has been marked as having no available path, or has reached the terminal node, met the termination condition, or has not obtained the next level result object, terminate the identification branch and record the corresponding termination reason; otherwise, update the next level result object to the current level result object and return to step S4; Step S8: After the detection chain terminates, the final-level results are mapped back to the pixel coordinate system of the image to be detected in reverse order of the reversible ROI parameter chain, and the verification is performed according to the parent-child geometric constraints of the railway component hierarchical knowledge graph. If the verification passes, the current detection chain is marked as passed; if the verification fails, the current detection chain is marked as a suspected detection chain and the recognition results at each level and the reversible ROI parameter chain are retained for manual review. Step S9: Perform cross-frame association on the detection chains marked as passed or the detection chains marked as suspected, calculate the confidence level and risk priority respectively, and output a structured result containing hierarchical relationship, original coordinates, reversible ROI parameter chain, model version, termination reason, confidence level, risk priority and review status. The original coordinates are the position coordinates after being mapped to the pixel coordinate system of the image to be detected.

2. The method according to claim 1, characterized in that, The process of scoring candidate directed edges that are available in the model and meet the corresponding thresholds, and selecting one or more next-level paths, includes: First, perform availability checks on the models bound to each candidate directed edge. Specifically, if the model corresponding to the model identifier and model version bound to the candidate directed edge exists, the model can be successfully loaded, the input size of the model matches the input size of the model configured for the candidate directed edge, and the output fields of the model meet the output requirements of the task type bound to the candidate directed edge, then the model is determined to be available; otherwise, the model is determined to be unavailable, and the corresponding reason for unavailability is recorded. Remove candidate directed edges that are unusable or whose current level confidence score is lower than the corresponding confidence threshold, and calculate the routing score of the remaining candidate directed edges; When computational resources meet preset conditions, one or more candidate directed edges with a route score not lower than the route threshold are selected; when computational resources are limited, the top-ranked edges are selected in descending order of route score. Candidate directed edges, A preset integer not less than 1; The routing threshold is a preset lower limit for scoring.

3. The method according to claim 1, characterized in that, The step of determining the next-level ROI region in the source image based on the geometric carrying object of the current-level result object of the recognition branch, according to the ROI expansion strategy bound to the next-level path, includes: Based on the geometrically supporting object in the current level result object, the ROI expansion coefficient is dynamically calculated. The next level ROI region is obtained by expanding the geometric bearing objects in the current level result object using the ROI expansion coefficient.

4. The method according to claim 3, characterized in that, The process of using ROI expansion coefficients to expand the geometrically bearing objects in the current-level result object to obtain the next-level ROI region includes: Using the center point of the geometric carrying object in the current level result object as the expansion center, multiply the width and height of the geometric carrying object by the ROI expansion coefficient to obtain the width and height of the expanded next-level ROI region. 。 5. The method according to claim 3, characterized in that, The process of cropping, scaling, filling, and performing other necessary image transformations on the next-level ROI region includes: Cropping is performed on the source image according to the next level ROI region: if the expanded ROI region exceeds the boundary of the source image, the ROI region is cropped to the effective range of the source image; Scale the cropped ROI region proportionally and fill it to the model input size; let the... The actual clipping offset of level is The scaling ratio is The left fill amount and the top fill amount are Then the source image coordinates (u k−1 ,v k−1 Mapped to current level image coordinates (u k ,v k The forward transformation relation is: ; in, To identify the number of levels, For the first The actual trimming offset is... For the first Scaling level For the first Left and top fill amounts, (u k−1 ,v k−1 (u) represents the coordinates of the source image. k ,v k () represents the coordinates of the current level image; The first Mapping level coordinates to level The fundamental homogeneous transformation matrix corresponding to the level coordinates for: ; Specifically, only when performing rotation, flip, affine transformation, or perspective correction, the corresponding transformation matrix is ​​compared with the fundamental homogeneous transformation matrix according to the actual processing order. By combining the results, we obtain the final homogeneous transformation matrix of the k-th level. And write the combination order and matrix parameters into the invertible ROI parameter chain; when the additional image transformation is not performed, let .

6. The method according to claim 1, characterized in that, The termination conditions for step S7 include at least one of the following: the final defect type is identified; the current level node is a terminal node; the current level confidence score is lower than the confidence threshold; the ROI size or segmentation mask area is lower than the minimum scale threshold. The maximum progression level has been reached; there are no candidate next-level nodes; there is no next-level path that is available in the model and meets the confidence threshold; the parent-child category relationship is inconsistent. If no valid next-level results are obtained for critical safety components, the suspected detection chain must be retained.

7. The method according to claim 1, characterized in that, The step of mapping the final-level result objects back to the pixel coordinate system of the image to be detected in reverse order of the reversible ROI parameter chain includes: Let the last level be the th If the order is homogeneous, then the coordinates are homogeneous. for: and homogeneous coordinates satisfy: The relationship between the final-level coordinates and the original image coordinates is as follows: , in, Let be the final homogeneous transformation matrix of the k-th order, and let be the homogeneous coordinates. Represents the k-th level image coordinates The homogeneous coordinates, where K is the last level sequence number; When the geometric carrier of the final result object is a detection box, the corner points of the detection box are mapped back and its circumscribed region is taken; when the geometric carrier of the final result object is a segmentation mask, the mask pixels or boundary points are mapped back; when the final task is image classification, the image boundary of the next-level input ROI image is used as the geometric carrier object for mapping back; when perspective transformation exists, the homogeneous coordinates obtained by mapping back are normalized according to the third component.

8. The method according to claim 7, characterized in that, The verification based on the parent-child geometric constraints of the railway component hierarchical knowledge graph specifically includes: For parent and child result objects at adjacent levels in the detection chain, determine whether the reflected child geometric bearing object is located within the preset allowable area of ​​the parent geometric bearing object or the railway component hierarchical knowledge graph, and determine whether the area ratio and relative position between the child geometric bearing object and the parent geometric bearing object fall within the corresponding preset range, so as to obtain the sub-item verification results of each applicable parent-child geometric constraint; The sub-item verification results are normalized and summarized to obtain the parent-child geometric verification score, and the parent-child geometric verification score is compared with the preset geometric verification threshold. When the parent-child geometric verification score is not lower than the preset geometric verification threshold, the verification is determined to be passed, and the current detection chain is marked as having passed the verification. When the parent-child geometric verification score is lower than the preset geometric verification threshold and has not reached the preset retry limit, the parent geometric carrier object corresponding to the current failure level is expanded according to the ROI expansion strategy to obtain the parent ROI region, and steps S5 to S8 are re-executed based on the parent ROI region; when the parent-child geometric verification score is still lower than the preset geometric verification threshold after reaching the preset retry limit, the verification is determined to be unsuccessful, the current detection chain is marked as a suspected detection chain, and the identification results at each level and the reversible ROI parameter chain are retained for manual review.

9. The method according to claim 8, characterized in that, The calculation of credibility and risk priority includes: Based on the matching of adjacent two-level categories in the detection chain with the parent-child relationship in the railway component hierarchical knowledge graph, a knowledge graph hierarchical consistency score is generated; based on the anomaly category consistency, confidence stability, and retrospective coordinate stability of the same component in adjacent frames after cross-frame association, a cross-frame consistency score is generated; the image quality score, parent-child geometric verification score, component risk level, and anomaly severity level configured in the railway component hierarchical knowledge graph of the image to be detected are read from the frame-level record, and combined with the confidence scores of each level in the detection chain, the credibility and risk priority are calculated respectively.

10. A 4C defect identification system based on knowledge graphs and reversible ROI chains, characterized in that, include: 4C Image Acquisition and Quality Assessment Module 1 is used to acquire inspection videos or image sequences collected by the 4C inspection device; Decode and extract frames from the inspection video, or read the image sequence frame by frame to obtain the image to be detected, and establish a frame-level record containing the pixel coordinate system information, frame number, image quality score and occlusion ratio of the image to be detected. The knowledge graph and identification chain configuration module 2 is used to load a preset railway component hierarchical knowledge graph. The nodes in the railway component hierarchical knowledge graph represent equipment areas, components, sub-components, or anomaly types. Among them, the anomaly type nodes are associated with a preset anomaly severity level. The directed edges represent parent-child progressive paths and are bound to model identifiers, model versions, task types, ROI expansion strategies, confidence thresholds, risk levels, candidate model computation costs, candidate model historical false alarm rates, termination conditions, and parent-child geometric constraints. The first-level localization and recognition module 3 is used to perform first-level localization and recognition through a pre-trained target detection model to obtain a current-level result object containing the current-level result identifier, current-level category label, current-level confidence score, parent-level result identifier, current-level coordinate system identifier, and current-level geometric carrying object; wherein, the current-level geometric carrying object obtained by the first-level localization and recognition is the current-level detection box; a corresponding recognition branch is established for each current-level result object, and a corresponding detection chain is established for each recognition branch; the detection chain is an ordered record sequence that associates the result objects at each level and the ROI parameter records at each level in a progressive hierarchical order; when the first-level localization and recognition does not detect any target, the recognition process is terminated and the recognition result is recorded as no first-level target; The dynamic graph routing module 4 is used to query the railway component hierarchical knowledge graph with the current level category label, perform routing scoring on candidate directed edges that are available in the model and meet the corresponding confidence threshold, and select one or more next-level paths. When selecting one next-level path, the next-level path is associated with the current identification branch. When selecting multiple next-level paths, sub-branches corresponding to each next-level path are established, and each next-level path is associated with its corresponding sub-branch. The sub-branch belongs to the current identification branch and inherits the detection chain and reversible ROI parameter chain formed by the current identification branch. When there is no available path, the current identification branch is marked as terminated, the reason for termination is recorded as no available path, and the detection chain and termination control module 8 is triggered. The dynamic ROI generation module 5 is used to determine the next-level ROI region in the source image for each recognition branch associated with the selected next-level path, based on the ROI expansion strategy bound to the next-level path and the geometric carrier object of the current-level result object of the recognition branch. The module then performs cropping, scaling, filling, and other image transformations on the next-level ROI region to obtain the next-level input ROI image. The module also calculates the image quality score and occlusion ratio of the next-level input ROI image and records and saves the image quality score and occlusion ratio of the next-level input ROI image in association with the corresponding ROI parameter records. The reversible parameter chain recording module 6 is used to record the actual cropping area, scaling ratio, padding amount, expansion coefficient, actual image transformation parameters, and coordinate system identifier to form the current-level ROI parameter record. When this module is run for the first time, a reversible ROI parameter chain for this recognition branch is established, and the current-level ROI parameter record is used as the first record in this reversible ROI parameter chain. When this module is run again in subsequent iterations, the current-level ROI parameter record is appended to the reversible ROI parameter chain of this recognition branch. The source image during the first run is the image to be detected, and the source image during subsequent runs is the previous-level input ROI image. The multi-level progressive recognition module 7 is used to perform detection, classification, or segmentation on the next-level input ROI image corresponding to each recognition branch processed by the dynamic ROI generation module 5 and the reversible parameter chain recording module 6, according to the task type and model bound to the next-level path associated with the recognition branch, to obtain one or more next-level result objects, including detection result objects, segmentation result objects, and classification result objects; wherein, the geometric carrying object of the detection result object is the detection box, the geometric carrying object of the segmentation result object is the segmentation mask, and the geometric carrying object of the classification result object is the region defined by the image boundary of the next-level input ROI image; The detection chain and termination control module 8 is used to update the detection chain of each identification branch. For identification branches processed by the dynamic ROI generation module 5, the reversible parameter chain recording module 6, and the multi-level progressive identification module 7, the corresponding current-level ROI parameter record, the next-level path identification status, and the next-level result object are appended to the detection chain of the identification branch. When the identification branch has been marked as having no available path, or has reached a terminal node, met the termination condition, or has not obtained a next-level result object, the identification branch is terminated and the corresponding termination reason is recorded. Otherwise, the next-level result object is updated to the current-level result object and the dynamic graph routing module 4 is triggered to continue execution. The coordinate mapping and parent-child geometric verification module 9, after the detection chain terminates, maps the final-level results back to the pixel coordinate system of the image to be detected in reverse order of the reversible ROI parameter chain, and verifies them according to the parent-child geometric constraints of the railway component hierarchical knowledge graph. If the verification passes, the current detection chain is marked as passed; if the verification fails, the current detection chain is marked as a suspected detection chain and the recognition results at each level and the reversible ROI parameter chain are retained for manual review. The cross-frame verification module 10 is used to perform cross-frame association on detection chains marked as passing verification or suspected detection chains; The comprehensive scoring and structured output module 11 is used to calculate the credibility and risk priority respectively, and output the structured results containing hierarchical relationship, original coordinates, reversible ROI parameter chain, model version, termination reason, credibility, risk priority and review status. The original coordinates are the position coordinates after being mapped to the pixel coordinate system of the image to be detected.