Rapid generation method of ballast numerical file based on machine vision and geometric feature matching
By using a method based on machine vision and geometric feature matching, ballast numerical files can be quickly generated, solving the problems of poor accuracy and high cost of ballast three-dimensional models in existing technologies, achieving efficient and accurate ballast shape simulation, and providing real and reliable simulation materials for discrete element simulation.
Patent Information
- Application Number
- CN202510070954.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-16
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2045-01-16
AI Technical Summary
In the existing technology, the method of constructing a three-dimensional model of ballast has problems such as poor model accuracy, long scanning time, complex operation and high cost. It is difficult to quickly and accurately construct a representative three-dimensional model of the ballast shape and provide real and reliable simulation materials for discrete element simulation.
A method based on machine vision and geometric feature matching is adopted. Ballast particles are scanned with a 3D scanner to establish a 3D model library. The machine vision model is combined to perform instance segmentation on actual photos of ballast aggregates, extract geometric features, and generate ballast numerical files through comprehensive matching. Fourier descriptors and Euclidean distance calculation are used to optimize the matching process.
It achieves the rapid and accurate generation of ballast models close to their real shapes, simplifies the operation process, reduces costs, improves the reusability and accuracy of the model, is suitable for discrete element simulation, and optimizes running time and resource utilization.
Smart Images

Figure CN119989529B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a railway ballast digital simulation technology, and in particular to a method for quickly generating a ballast numerical file based on machine vision and geometric feature matching. Background Art
[0002] Ballasted track is a common and important structural form in railways and urban rail transit. It offers numerous advantages, including good elasticity, low cost, and easy maintenance. It exhibits particularly good noise absorption properties in terms of track vibration noise. As a crucial component of ballasted track, the ballast trackbed plays a vital role in transferring load, maintaining track shape and position, and preventing water accumulation. Research has shown that these properties are closely related to the shape and characteristics of the ballast that makes up the trackbed.
[0003] Numerical simulation is a common analytical method used to study the mechanical properties of ballasted trackbeds, with the discrete element method (DEM) being the most prevalent. To make DEM simulation results as close as possible to actual test results, it is necessary to accurately simulate the characteristic shape of the numerical ballast. Numerical ballast is a ballast DEM model formed by bonding or inlaying spherical particles into a closed three-dimensional model. The shape of this DEM model is closely related to the shape of the three-dimensional model. Currently, methods for constructing three-dimensional models can be divided into two main categories. The first method uses a simple polyhedron representation; the second method uses CT layered scanning of two-dimensional cross-sections of real particles, and then the cross-sections are superimposed to form the model. The former method mainly uses modeling software to draw a simple polyhedron, and then uses the polyhedron to simulate the ballast shape. This method is convenient, but the constructed discrete element model of ballast has the problem of poor model accuracy and cannot reflect the morphological characteristics of real particles; the latter method can accurately obtain the real ballast three-dimensional model for constructing discrete element ballast particles, but this method has the disadvantages of long scanning time, high cost, complex operation and high cost, and the particle model used to obtain is difficult to reuse, which easily leads to waste of resources.
[0004] Therefore, how to quickly and accurately construct a representative three-dimensional model of ballast shape and provide particle units with real and reliable shape characteristics for discrete element simulation remains a difficult problem that needs to be solved urgently. Summary of the Invention
[0005] To address the aforementioned issues with existing numerical simulations of ballast, such as poor model accuracy, long scanning times, complex operations, and high costs, the present invention provides a method for rapidly generating ballast numerical files based on machine vision and geometric feature matching. This method aims to fully consider the authenticity of ballast particle shapes and rapidly match or generate numerical ballast that closely resembles the true shape through simple two-dimensional projection, providing realistic and reliable simulation materials for discrete element simulations. The specific technical solution is as follows:
[0006] First, the present invention provides a method for quickly generating ballast numerical files based on machine vision and geometric feature matching, comprising the following steps:
[0007] Step 1: Create a 2D information table for the ballast model
[0008] A certain number of ballast particles are scanned using a 3D scanner to obtain a 3D model of each ballast particle. Each model is named according to a certain naming rule to establish a 3D model library of ballast particles. Multiple surfaces of each 3D model of the ballast particle are projected, and the geometric features of each projection contour are extracted to establish a 2D information table of the ballast model.
[0009] Step 2: Create a two-dimensional information table of ballast particles
[0010] Collect real-life photos of ballast aggregates, perform instance segmentation on them using a machine vision model, convert them into binary images, extract the geometric features of each ballast particle outline in the binary images, and create a two-dimensional information table of ballast particles;
[0011] Step 3: Ballast numerical file generation
[0012] The matching degree between the geometric features of each ballast particle in the actual photos of ballast aggregate and the geometric features of the three-dimensional model of each ballast particle in the ballast particle three-dimensional model library is comprehensively considered, and the name is used as the index medium to select or calculate and generate the numerical file of each ballast particle in the actual photos of ballast aggregate.
[0013] The aforementioned method for rapidly generating ballast numerical files based on machine vision and geometric feature matching, in step 1, uses a 3D scanner to scan a certain number of ballast particles to obtain a 3D model of each ballast particle, specifically: randomly collect a number of ballast particles, whose particle size distribution range includes 16.5-22.5mm, 22.4-31.5mm, 31.5-40mm, 40-50mm, and 50-63mm; place the collected ballast particles stably on the rotating table of the 3D scanner and perform 3D scanning; after one round of scanning, turn the ballast particles over and scan them again; and splice the two scanning results to form a complete 3D model of the ballast particles.
[0014] In the aforementioned method for rapidly generating ballast numerical files based on machine vision and geometric feature matching, in step one, the naming rule is to obtain the major axis, median axis and minor axis lengths of each collected ballast particle through a measuring tool, with "major axis length L-median axis length I-minor axis length S" as the naming rule.
[0015] Preferably, in the aforementioned method for quickly generating ballast numerical files based on machine vision and geometric feature matching, in step one, the three-dimensional model of each ballast particle is projected on multiple surfaces, specifically, each three-dimensional model of the ballast particle is rotated and projected 12 times around the X, Y, and Z axes, each rotation is 30°, to obtain projections of each three-dimensional model of the ballast particle at 12 different angles on the XY plane, XZ plane, and YZ plane.
[0016] In the aforementioned method for rapidly generating ballast numerical files based on machine vision and geometric feature matching, in step 2, the actual photographs of ballast aggregates are collected by photographing the ballast aggregates on the railway track bed in real time, or by randomly selecting a number of ballast particles on the railway track bed for photographing; the photographs contain images of reference spheres of known diameter, which are used to calculate the ratio between the ballast particle size in the photographs and the actual ballast particle size.
[0017] Preferably, in the aforementioned method for rapidly generating ballast numerical files based on machine vision and geometric feature matching, in step 2, the use of a machine vision model to perform instance segmentation on the actual photos of ballast aggregates is to use a pre-trained Mask R-CNN model to segment the actual photos of ballast;
[0018] The Mask R-CNN model training process is as follows: using ballast particles with particle size ranges of 50-63 mm, 40-50 mm, 31.5-40 mm, 22.4-31.5 mm, and 16.5-22.5 mm and actual photos of green balls with a diameter of 3 cm as the model training data set; performing instance segmentation model training in the MMdetection deep learning framework; during the training process, the model's recognition categories are set to three categories, including ballast particles, green balls, and background; the model performance evaluation parameters are set to: mAp parameter of 55.1, AP50 parameter of 77.9, and AP75 parameter of 73.3; the ability of the Mask R-CNN model to accurately segment ballast particles and green ball images in actual photos of ballast aggregate is considered a successful training result.
[0019] In the aforementioned method for rapidly generating ballast numerical files based on machine vision and geometric feature matching, in step 2, the conversion into a binary image is to convert the sample mask image formed by instance segmentation into a binary image with a black background and a white projection.
[0020] In the aforementioned method for rapidly generating ballast numerical files based on machine vision and geometric feature matching, in steps one and two, the geometric features include contour features and shape features; the contour features are the projection contour of the three-dimensional model of the ballast particles or the first eight Fourier descriptors of the ballast particle contour; the shape features include the aspect ratio, circularity, sphericity, roughness, convexity and equivalent ellipsoid volume of the projection contour of the three-dimensional model of the ballast particles or the ballast particle contour.
[0021] In the aforementioned method for rapidly generating ballast numerical files based on machine vision and geometric feature matching, in step three, the specific steps for matching the geometric features of each ballast particle in the actual ballast aggregate photo with the geometric features of each ballast particle 3D model in the ballast particle 3D model library are as follows:
[0022] 3-1) extracting the contour features and shape feature information of the ballast particles from the two-dimensional information table of the ballast particles in sequence;
[0023] 3-2) Using the "equivalent ellipsoid volume" of the ballast particle as an indicator, compare it with the "equivalent ellipsoid volume" of each 3D ballast model in the 2D ballast model information table. Obtain all 3D ballast models whose "equivalent ellipsoid volume" deviation between the two is within ±15%, and record them as ballast model set 1;
[0024] 3-3) Calculating the Euclidean distance between the geometric characteristic values of the ballast particle, excluding the "equivalent ellipsoid volume," and the corresponding geometric characteristic values of each 3D ballast model in ballast model set 1, and selecting the numerical file of the 3D ballast model with the smallest Euclidean distance as the numerical file A of the ballast particle;
[0025] 3-4) Simultaneously calculating the Euclidean distance between the geometric characteristic values of the ballast particle, excluding the "equivalent ellipsoid volume," and the corresponding geometric characteristic values of each 3D ballast model in the complete 2D ballast model information table; selecting the numerical file of the 3D ballast model with the smallest Euclidean distance as numerical file B for the ballast particle, and starting from numerical file B, selecting the first 30% of the 3D ballast models as ballast model set 2;
[0026] 3-5) If numerical file A is included in ballast model set 2, then numerical file A is directly selected as the numerical file for the ballast particle. If numerical file A is not included in ballast model set 2, then the characteristic values in numerical file B are scaled to the corresponding size of the characteristic values of the ballast particle according to the "equivalent ellipsoid volume", and the scaled numerical file is used as the numerical file for the ballast particle.
[0027] 3-6) and so on, repeat steps 3-1) to 3-5) until the numerical files of all ballast particles in the ballast particle two-dimensional information table are obtained.
[0028] In the aforementioned method for rapidly generating ballast numerical files based on machine vision and geometric feature matching, the equivalent ellipsoid volume calculation formula is as follows:
[0029]
[0030] Where: Ve is the equivalent ellipsoid volume, b is the equivalent ellipsoid minor axis, and a is the equivalent ellipsoid major axis.
[0031] The beneficial effects of the present invention are as follows:
[0032] 1) The matching method of the present invention fully considers the authenticity of the ballast particle shape. The model is completely obtained by scanning the real ballast with a 3D scanner. The matched model can fully conform to the morphological characteristics of general ballast. The produced model is obtained by matching contour features. Compared with the randomly reconstructed 3D model, the matching speed is faster and more accurate. The accuracy of the generated model will increase with the increase of data in the database.
[0033] 2) The method of the present invention uses a three-dimensional scanner to collect real ballast. In terms of operability, the method of the present invention is simple and feasible, and the obtained three-dimensional model can be reused according to the two-dimensional projection of the real ballast; the running speed is fast, and compared with other methods, there is no need for the tedious operation of temporarily generating ballast, which greatly optimizes the running time; the operation is convenient, and only the binary image of the target particle and the proportional relationship between the image and the real particle need to be obtained to complete the particle matching; in terms of practicality, the matching accuracy of the method of the present invention can continue to increase with the increase of data in the model library and the information library; due to the characteristics of the Fourier descriptor, the model of small-particle ballast can also be used to generate large-particle ballast, even if the amount of data in the library is not large enough, a good reconstruction effect can still be achieved; in terms of complexity, the method of the present invention is simple and accurate in obtaining the ballast model and physical characteristics, and does not require professional operating knowledge compared to CT scanning, and the generated model occupies less memory.
[0034] In general, the matching method of the present invention is simple to operate, has a clear principle, a fast and more accurate matching speed, and can quickly generate a numerical ballast that is close to its real shape through simple two-dimensional projection, providing more realistic and reliable simulation materials for discrete element simulation, and has good practical value and promotion prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 Establishing a flow chart for the two-dimensional information table of the ballast model of the present invention;
[0036] Figure 2 Schematic diagram of projection results of different surface angles of the ballast model of the present invention;
[0037] Figure 3This is a trend diagram of the average value of the minimum Euclidean distance between the ballast aggregate sample characteristics and the model characteristics of the present invention;
[0038] Figure 4 Establishing a flow chart for the two-dimensional information table of ballast particles of the present invention;
[0039] Figure 5 Taking actual photos of ballast aggregate on the railway track bed for the present invention;
[0040] Figure 6 The sample mask image is formed by using a machine vision model to perform instance segmentation on real photos of ballast aggregates;
[0041] Figure 7 This is the workflow diagram of the Mask R-CNN model of the present invention;
[0042] Figure 8 Use Python to process the sample masks formed by the Mask R-CNN model segmentation into binary images;
[0043] Figure 9 A flow chart for generating a ballast numerical file according to the present invention;
[0044] Figure 10 This is the result of collecting photos of ballast aggregate in Example 2 of the present invention;
[0045] Figure 11 This is the result of binarization of the ballast aggregate photo in Example 2 of the present invention;
[0046] Figure 12 Schematic diagram of ballast particle outlines extracted from a binarized image in Example 2 of the present invention;
[0047] Figure 13 This is a comparison of model numerical files obtained by considering the equivalent ellipsoid volume in Example 2 of the present invention. DETAILED DESCRIPTION
[0048] The following will be combined with the embodiments and drawings to clearly and completely describe the technical solutions of the present invention. Obviously, the embodiments described are only preferred embodiments of the present invention, not all embodiments, and are not intended to limit the present invention in any other form. Any person skilled in the art may use the disclosed technical content to make changes or modifications. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention shall still fall within the scope of protection of the technical solution of the present invention.
[0049] Example 1
[0050] This embodiment is a method for rapidly generating numerical ballast files based on machine vision and geometric feature matching. As previously mentioned, for discrete element simulation, existing numerical ballast creation methods primarily use simple polyhedron representations or employ CT layered scanning of two-dimensional cross-sections of real particles, which are then superimposed to form a model. Simple polyhedrons are too crude, and the model accuracy is too poor; CT layered scanning is not only complex to operate and wastes ballast resources, but also requires a long time and is difficult to operate in actual simulation work. Furthermore, existing 3D scanning modeling mostly relies on manually selecting ballast particles for simulation, resulting in insufficiently representative results.
[0051] The method for quickly generating ballast numerical files based on machine vision and geometric feature matching provided in this embodiment scans a certain number of ballast particles to establish a three-dimensional model library, extracts the geometric features of the projection contours of multiple faces of each ballast model, and establishes a two-dimensional information table of the ballast model; at the same time, the machine vision model is used to perform instance segmentation on the actual photos of the ballast aggregate and perform binarization, extracts the geometric features of the contours of each ballast particle in the binary image, and establishes a two-dimensional information table of the ballast particles; then, the geometric features of the ballast particles in the actual photos are matched with the geometric features of each ballast model in the three-dimensional model library, and the similarity between the particle projection features and the model projection features is compared, and the numerical files of the ballast particles are selected or calculated to generate. The details are as follows:
[0052] Step 1: Create a two-dimensional information table of the ballast model.
[0053] Process such as Figure 1 As shown, a 3D scanner is used to scan a certain number of ballast particles, obtaining 3D models of each particle. Each model is named according to a specific naming convention to establish a 3D model library for ballast particles. The number of ballast particles scanned can range from hundreds to thousands, or even more. The particle size distribution ranges include 16.5-22.5mm, 22.4-31.5mm, 31.5-40mm, 40-50mm, and 50-63mm. For example, if 1000 ballast particles are scanned, 200 particles fall within each particle size range. The more ballast particles scanned, the more robust the 3D model library and the closer the subsequent matching models are to the actual ballast morphology.
[0054] In this example, the 3D scanner used is the Einscan-SE. This scanner's scanning method differs from the layered scanning modeling method. Instead, it scans the entire surface of the ballast particle to obtain the entire ballast configuration. Specifically, the ballast particle is placed steadily on the 3D scanner's rotating table for 3D scanning. Because the surface in contact with the turntable cannot be scanned, the ballast particle is flipped over and scanned again after the machine completes a full scan. After the scan is complete, the two scan results are spliced together to form a complete 3D model of the ballast particle. The scanned ballast particles can be reused, avoiding resource waste and being simpler and faster than layered scanning.
[0055] The naming method described in this embodiment is to measure the length of the major axis, median axis and minor axis of each ballast particle by a measuring tool, and name the scanned model of each ballast particle using the naming rule of "major axis length L-median axis length I-minor axis length S". The measurement method of the major axis, median axis and minor axis length of the ballast particle is as follows: the major axis is the maximum distance between two points on the ballast; with the major axis as the center axis, the median axis perpendicular to it is measured. The median axis is the longest axis perpendicular to the central axis, and its length is second only to the major axis; with the median axis as the center, the minor axis perpendicular to it and the shortest minor axis is measured. In addition to measuring the axis length, physical information such as the mass of the ballast particle can also be measured. While scanning, information such as the surface area and volume of the ballast particle is obtained, which can provide more detailed parameter information such as density for subsequent simulations.
[0056] After the 3D model of the ballast particles is scanned and established, multiple faces of the 3D model of each ballast particle are projected, and the geometric features of each projection contour are extracted, that is, the "contour features" and "shape features" of each projection contour are extracted.
[0057] The 3D model of ballast particles is actually a collection of numerous 3D coordinate points (x, y, z). Projection is to return the value of one of the three-dimensional coordinates X, Y, and Z to 0, and obtain the 2D coordinates of the projected contour curve on the XY, YZ, and XZ planes, such as Figure 2 As shown; then the coordinate points of the ballast particle projection contour curve are imported into the fft.fft function in the Numpy module to obtain the first 8 Fourier descriptors corresponding to the contour, that is, to obtain the "contour features" of each projection contour.
[0058] The Fourier descriptor is a mathematical method used to describe the shape of a plane curve and is used to compare the similarity of objects of different shapes. Assume that the two-dimensional contour points of a model projection are (x0, y0), (x1, y1), ..., (x N-1 ,y N-1 ), its corresponding Fourier descriptor is:
[0059] Z n =x n +iy n (1);
[0060]
[0061] Where: Z n is the complex form of the contour point, i is the imaginary unit, Z k is the k-th Fourier descriptor, N is the total number of points, k = 0, 1, ..., N-1.
[0062] The "shape features" of a projected profile include aspect ratio, circularity, sphericity, roughness, concavity and convexity, and equivalent ellipsoid volume. The "equivalent ellipsoid volume" is calculated based on similar ellipses, and its formula is as follows.
[0063]
[0064] Where: V e is the volume of the ellipsoid, b is the minor axis of the equivalent ellipse, and a is the major axis of the equivalent ellipse.
[0065] The aspect ratio, circularity, sphericity, roughness, and concavity are mainly calculated using the Python third-party library OpenCV combined with relevant programming codes. The specific calculation formula is:
[0066] Aspect Ratio:
[0067]
[0068] Where: Dmax is the major axis of the equivalent ellipse, and Dmin is the minor axis of the equivalent ellipse.
[0069] Roundness:
[0070]
[0071] Where: A is the particle projection area, P is the particle projection contour perimeter.
[0072] Sphericity:
[0073]
[0074] Where: Rinsc is the maximum inscribed circle radius of the particle projection, and Rcirc is the minimum circumscribed circle radius of the particle projection.
[0075] Roughness:
[0076]
[0077] Where: Pc is the perimeter of the circumscribed polygon of the particle projection, and Pe is the perimeter of the equivalent ellipse of the particle projection.
[0078] Convexity:
[0079]
[0080] Where: The area of the circumscribed polygon of the projection of the Sc particle.
[0081] The above-mentioned "contour features" and "shape features" of the projected profile are summarized in a table. Using "long axis length L - median axis length I - minor axis length S" as a mediator for subsequent matching indexing, a "ballast model 2D information table" is established. Specifically, one column in the table contains the model name ("long axis length L - median axis length I - minor axis length S"), and the remaining columns contain the corresponding shape and contour information. After comparing the similarity between the ballast projection and the model's projected shape information, the target ballast model can be found using the projected shape information. The established "ballast model 2D information table" is shown in Table 1.
[0082] Table 1. Two-dimensional information table of ballast model (partial)
[0083]
[0084] Because the projection profile of a ballast particle model varies depending on its placement angle, multiple surface profile projections are required for more accurate comparison. This means that after the first projection feature acquisition, the model is rotated around the X, Y, and Z axes, and the feature profiles of the corresponding projection surfaces are repeatedly acquired. However, the rotation angle should not be too small or too large. Too few rotations will result in too few feature profiles being acquired, resulting in an inaccurate model. Too many rotations will result in excessive similarity in the acquired profiles, and the large number of feature values will also impose an additional computational burden, severely reducing computational efficiency and occupying computer resources.
[0085] In this embodiment, the influence of the number of model rotations on the model generation accuracy is investigated, and the average similarity between the ballast aggregate sample characteristic value and the model characteristic value is determined by calculating the minimum Euclidean distance between the two, that is, the change trend of the average minimum Euclidean distance, as shown in the following example. Figure 4 As shown in the figure, the experiment found that when the number of rotations is 8 to 20, the oscillation is relatively stable. Considering the effect of equal distribution of the rotating circle and the amount of calculated data, 12 data collection operations are the most preferred. That is, after the first data collection operation, the model is rotated 30° around the X, Y, and Z axes respectively, and then the contour features of the corresponding projection surfaces are obtained (for example, the features of the XY projection surface are collected when rotating around the X axis). The contour features obtained after each rotation are indexed by the model name and counted in the "Ballast Model Two-Dimensional Information Table".
[0086] Euclidean distance is a calculation method used to measure the difference between corresponding feature values in an image. During the image matching process, Euclidean distance can be used to help find the best matching model. The calculation process of Euclidean distance is as follows:
[0087] In a two-dimensional plane, the Euclidean distance formula between two points A(x1, y1) and B(x2, y2) is:
[0088]
[0089] In the n-dimensional plane, for two points A(x1, y1, ..., n1) and B(x2, y2, ..., n2), the Euclidean distance formula between them is:
[0090]
[0091] In this embodiment, the two-dimensional contour feature values extracted from the ballast particle example photos are calculated, compared and matched with the two-dimensional contour feature values of multiple surface projections of the three-dimensional model of each ballast particle.
[0092] Step 2: Create a two-dimensional information table of ballast particles.
[0093] This step can be performed simultaneously with step one. However, after the two-dimensional information table of the ballast model is established and improved, only this step is required to compare or calculate the numerical file of the target ballast in the three-dimensional model library of ballast particles. This greatly saves the process of establishing digital ballast and greatly improves the simulation accuracy. It is of great significance to the study of discrete element simulation and ballasted track bed performance.
[0094] In this embodiment, the process of establishing the two-dimensional information table of ballast particles is as follows: Figure 4 shown.
[0095] Take real-life photos of the ballast aggregate on the railway track bed, or randomly collect a number of ballast aggregates from the track bed for photography, such as Figure 5 As shown in the figure, the axial length of each ballast particle is measured using a measuring tool, and each ballast particle is named using the same naming method as the 3D ballast model: "long axis length L - middle axis length I - short axis length S". A green reference ball with a known diameter is placed during the photo shoot to be used as a reference for later calculations of the photo size and actual size of the ballast particles. The diameter of the reference ball is generally 3 to 5 cm. A machine vision model is then used to perform instance segmentation on the actual ballast aggregate photos to form a sample mask, as shown in the figure. Figure 6 In this embodiment, the machine vision model used is the Mask R-CNN model. In other embodiments, other machine vision models can also be used as long as they can achieve the segmentation and projection of the ballast aggregate in the actual photo.
[0096] The Mask R-CNN model needs to be pre-trained before use. The training process is as follows:
[0097] First, a dataset for model training was created using real-life photos of granite special-grade ballast with particle sizes ranging from 50 to 63 mm, 40 to 50 mm, 31.5 to 40 mm, 22.4 to 31.5 mm, and 16.5 to 22.5 mm, and green balls with a diameter of 3 cm, as annotation materials. Then, a Mask-RCNN instance segmentation model was trained in the MMdetection deep learning framework. During model training, the recognition categories were set to three, including ballast, green balls with a diameter of 3 cm, and background.
[0098] During model training, anchor sizes were set to 8, 16, 32, 64, and 128, with 256 anchor boxes per image and img_scale set to (1333, 640). The model was optimized using stochastic gradient descent (SGD). The initial learning rate was set to 0.001, the momentum factor was 0.9, and the weight decay coefficient was 0.0001. A total of 560 iterative epochs were set, and the learning rate was reduced to 0.0001 when the number of iterative epochs reached 160.
[0099] The MaskR-CNN model workflow is as follows: Figure 7 As shown, the incoming ballast particle image is processed by the Resnext101 neural network into a feature image. This feature map is then fed into the FPN to generate a series of feature maps of varying scales. The RPN then filters out candidate regions most likely to contain ballast particles and fine-tunes their positions and sizes. The variously sized feature maps and candidate regions are fed into ROI Align, which outputs a set of precisely sampled, fixed-size feature maps. This is then used by the fully connected layer (FCN) for localization, classification, and pixel-level mask generation. Finally, the three are combined to produce instance-level segmentation results.
[0100] In this embodiment, in the model performance evaluation, the mAp parameter is 55.1, the AP50 parameter is 77.9, and the AP75 parameter is 73.3; the Mask R-CNN model's ability to accurately segment the ballast particles and green ball images in the actual ballast aggregate photos is used as the basis for successful training.
[0101] The mask obtained in the Mask-RCNN instance segmentation model is actually a two-dimensional matrix composed of "True" and "Fulse". Each value represents a pixel coordinate, where the "True" value represents the area where the ballast particles or balls are located, and the "Fulse" value represents other areas. Binarizing the image is to use Python to process the sample mask formed by the Mask R-CNN model segmentation into a binary image, such as Figure 8 As shown,.
[0102] The specific binarization method is to set all areas where "True" values are located to 255 (255 is the RGB value of white) and all areas where "Fulse" values are located to 0 (0 is the RGB value of black). This can achieve the binarization of the image mask. The formula is shown below:
[0103]
[0104] Where: det(x,y) is the pixel value of the binary image, and f(x,y) is the pixel point on the x row and y column of the matrix.
[0105] The resulting binary image is then further processed using the findContours function in the Python third-party library OpenCV to obtain the projected contour corresponding to each ballast particle in the image. This contour is essentially a curve formed by a set of coordinate points. The coordinate points of the projected contour curve are then imported into the fft.fft function in the Numpy module to obtain the first eight Fourier descriptors corresponding to the contour, which are the "contour features" of the ballast particle. The Python third-party library OpenCV, combined with relevant programming code, is also used to calculate the aspect ratio, circularity, sphericity, roughness, concavity, and equivalent ellipsoid volume of each ballast particle contour. These "contour features" and "shape features" are tabulated in a table, and the "major axis length L - median axis length I - minor axis length S" is used as a mediator for subsequent matching indexing to create a "two-dimensional information table of ballast models."
[0106] Step 3: Generate ballast numerical file.
[0107] Comprehensively consider the matching degree between the geometric features of each ballast particle in the ballast aggregate photo and the geometric features of each ballast particle 3D model in the ballast particle 3D model library, use the name as the index medium, select or calculate and generate the numerical file of each ballast particle in the ballast aggregate photo, such as Figure 9 The specific process is as follows:
[0108] 3-1) Extract the contour features and shape feature information of the ballast particles from the 2D information table of the ballast particles in sequence, and compare and match them with the corresponding feature information in the 2D information table of the ballast model.
[0109] 3-2) Due to the numerous projections of naturally placed ballast particles, depending on their placement, this inevitably affects the final 3D model generation. Therefore, to minimize this impact, a first screening step using equivalent ellipsoid volume is performed before similarity matching. This involves first comparing the "equivalent ellipsoid volume" of the ballast particle with the "equivalent ellipsoid volume" of each 3D ballast model in the 2D ballast model information table. All 3D ballast models whose "equivalent ellipsoid volume" deviations are within ±15% are obtained, and are denoted as Ballast Model Set 1.
[0110] 3-3) Then, the Euclidean distance between the geometric eigenvalues of the ballast particle, excluding the "equivalent ellipsoid volume", and the geometric eigenvalues corresponding to each ballast three-dimensional model in ballast model set 1 is calculated, and the numerical file of the ballast three-dimensional model with the smallest Euclidean distance is taken as the numerical file A of the ballast particle.
[0111] 3-4) At the same time, the Euclidean distance between the geometric characteristic values of the ballast particle, excluding the "equivalent ellipsoid volume", and the corresponding geometric characteristic values of each ballast three-dimensional model in the complete ballast model two-dimensional information table is calculated; the numerical file of the ballast three-dimensional model with the smallest Euclidean distance is taken as the numerical file B of the ballast particle, and starting from the numerical file B, the first 30% of the ballast three-dimensional models are taken as the ballast model set 2.
[0112] 3-5) Compare and select the best one. If numerical file A falls in ballast model set 2, numerical file A is directly selected as the numerical file of the ballast particle. If numerical file A is not in ballast model set 2, the characteristic values in numerical file B are scaled to the corresponding size of the characteristic values of the ballast particle according to the "equivalent ellipsoid volume", and the scaled numerical file is used as the numerical file of the ballast particle.
[0113] 3-6) and so on, repeat steps 3-1) to 3-5) until the numerical files of all ballast particles in the ballast particle two-dimensional information table are obtained.
[0114] Example 2
[0115] This embodiment utilizes the method for rapidly generating ballast numerical files based on machine vision and geometric feature matching described in Example 1 to rapidly generate files for establishing a digital ballast model in a discrete element simulation. The specific process is as follows:
[0116] First, take photos of the ballast aggregate, such as Figure 10 As shown in the image, there are three ballast particles with particle sizes of 7.1 cm, 6.4 cm, and 7.3 cm. Before taking the photo, a reference ball with a diameter of 3 cm was placed in the ballast aggregate. After taking the photo, the diameter of the ball in the photo is 247 pixels long.
[0117] The trained Mask R-CNN model is used to perform instance segmentation on the photo to form a sample mask, which is then binarized to form a binary image with a black background and a white projection. Figure 11 shown.
[0118] The obtained binary image is further processed through the findContours function in the Python third-party library OpenCV to obtain the corresponding projection contour curve, such as Figure 12 shown.
[0119] The coordinate points are imported into the fft.fft function in the Numpy module to obtain the first 8 Fourier descriptors corresponding to the contour, and the “contour features” of the three ballast particles are obtained, as shown in Table 2.
[0120] Table 2. Ballast particle projection profile characteristics (partial)
[0121]
[0122] At the same time, the two-dimensional information of the ballast particle projection is collected, including aspect ratio, circularity, sphericity, roughness, concavity and convexity, and equivalent ellipsoid volume, to obtain the “shape characteristics” of the three ballast particles, as shown in Table 3.
[0123] Table 3. Projection shape characteristics of ballast particles (partial)
[0124]
[0125] Three ballast particles were measured using a vernier caliper and an electronic scale. The results are as follows:
[0126] Ballast particle 1: The length of the major axis L is 109, the length of the intermediate axis I is 71, and the length of the minor axis S is 28; the weight is 307.1g;
[0127] Ballast particle 2: The length of the major axis L is 108, the length of the intermediate axis I is 67, and the length of the minor axis S is 32; the weight is 310.6g;
[0128] Ballast particle 3: The length of the major axis L is 105, the length of the intermediate axis I is 73, and the length of the minor axis S is 41; the weight is 384.4g;
[0129] The "contour features" and "shape features" of the three ballast particles in the live image are stored in the same table and the ballast particles are named, as shown in Table 4:
[0130] Table 4. Two-dimensional information table of ballast model (partial)
[0131]
[0132] Then, the equivalent ellipsoid volume information is used as an indicator to perform feature matching from the 2D ballast model database to obtain a set of 3D ballast models corresponding to all model projections with a deviation value within ±15%. The equivalent ellipsoid volume of ballast particle 1 is 117219 mm 3 Among the 1000 models constructed in Example 1, 82 models have deviation values within ±15%, which are referred to as Set 1-1. The equivalent ellipsoidal volume of ballast particle 2 is 117406 mm 3 Among the 1000 models constructed in Example 1, 86 models have deviation values within ±15%, which are referred to as Set 1-2. The equivalent ellipsoidal volume of ballast particle 3 is 144469 mm 3 ,Among the 1000 models constructed in Example 1, 47 models have deviation values within ±15%, which are ,collected as Sets 1-3.
[0133] Then, the minimum Euclidean distances between the aspect ratio, circularity, sphericity, roughness, and concavity of the three ballast particle projections and the aspect ratio, circularity, sphericity, roughness, and concavity corresponding to the projections of each model in set 1-1, set 1-2, and set 1-3 are calculated respectively, and the model with the smallest Euclidean distance is taken as the numerical files A1, A2, and A3 of the three ballast instances.
[0134] Then, the characteristic values of the aspect ratio, circularity, sphericity, roughness, and concavity of the three ballasts are used with the minimum Euclidean distance of the aspect ratio, circularity, sphericity, roughness, and concavity corresponding to the projections of each model in the complete three-dimensional model library. Starting from the numerical files B1, B2, and B3 corresponding to the minimum Euclidean distance, the sets of the first 30% models are taken forward to obtain sets 2-1, 2-2, and 2-3.
[0135] After comparison, the numerical file A1 is in the set 2-1, and the numerical file A3 is in the set 2-3, so the numerical file A1 is the numerical file of the ballast particle 1, and the numerical file A3 is the numerical file of the ballast particle 3.
[0136] However, the numerical file A2 is not in set 2-2, so the numerical file B2 is selected as the basis and the numerical file B is scaled to the size of the equivalent ellipsoid volume corresponding to the ballast particle. The specific calculation is as follows:
[0137] The equivalent ellipsoid volume of ballast particle 2 is 117406 mm 3 , the model volume of numerical file B2 is 86412mm 3 , the specific scaling calculation process is:
[0138]
[0139] V new =86412*k
[0140] Where: k is the proportional relationship between the volume of ballast particle 1 and the model volume of numerical file B2; V new is the volume of the scaled B2 model. The numerical file of ballast particle 2 can be obtained, such as Figure 13 As shown in the figure, it can be seen that the numerical file obtained by considering the ellipsoid volume is closer to the real ballast projection, and the generation result considering the ellipsoid volume is better than the generation result without considering the ellipsoid volume.
[0141] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential features of the present invention. Therefore, the embodiments should be viewed as exemplary and non-restrictive in all respects. Furthermore, it should be understood that although this specification is described in terms of implementation methods, it does not encompass only one technical solution. This narrative is provided for clarity only, and those skilled in the art should consider the specification as a whole. The technical solutions in the embodiments may also be appropriately combined to form other implementation methods that are understandable to those skilled in the art.
Claims
1. A method for rapidly generating ballast numerical files based on machine vision and geometric feature matching, characterized by: The following steps are involved: Step 1: Create a 2D information table for the ballast model A certain number of ballast particles are scanned using a 3D scanner to obtain a 3D model of each ballast particle. Each model is named according to a certain naming rule to establish a 3D model library of ballast particles. Multiple surfaces of each 3D model of the ballast particle are projected, and the geometric features of each projection contour are extracted to establish a 2D information table of the ballast model. Step 2: Create a two-dimensional information table of ballast particles Collect real-life photos of ballast aggregates, perform instance segmentation on them using a machine vision model, convert them into binary images, extract the geometric features of each ballast particle outline in the binary images, and create a two-dimensional information table of ballast particles; Step 3: Ballast numerical file generation Comprehensively considering the matching degree between the geometric features of each ballast particle in the ballast aggregate photo and the geometric features of each ballast particle 3D model in the ballast particle 3D model library, using the name as the index medium, select or calculate and generate the numerical file of each ballast particle in the ballast aggregate photo; The specific steps include: 3-1) extracting the contour features and shape feature information of the ballast particles from the two-dimensional information table of the ballast particles in sequence; 3-2) Using the "equivalent ellipsoid volume" of the ballast particle as an indicator, compare it with the "equivalent ellipsoid volume" of each 3D ballast model in the 2D ballast model information table. Obtain all 3D ballast models whose "equivalent ellipsoid volume" deviation between the two is within ±15%, and record them as ballast model set 1; 3-3) Calculating the Euclidean distance between the geometric eigenvalues of the ballast particle, excluding the "equivalent ellipsoid volume," and the corresponding geometric eigenvalues of each 3D ballast model in ballast model set 1, and selecting the numerical file of the 3D ballast model with the smallest Euclidean distance as the numerical file A for the ballast particle; 3-4) Simultaneously calculating the Euclidean distance between the geometric characteristic values of the ballast particle, excluding the "equivalent ellipsoid volume," and the corresponding geometric characteristic values of each 3D ballast model in the complete 2D ballast model information table; selecting the numerical file of the 3D ballast model with the smallest Euclidean distance as numerical file B for the ballast particle, and starting from numerical file B, selecting the first 30% of 3D ballast models as ballast model set 2; 3-5) If value file A is included in ballast model set 2, then directly select value file A as the value file for the ballast particle. If value file A is not included in ballast model set 2, then scale the characteristic values in value file B to the corresponding size of the characteristic values of the ballast particle based on the "equivalent ellipsoid volume", and use the scaled value file as the value file for the ballast particle. 3-6) and so on, repeat steps 3-1) to 3-5) until the numerical files of all ballast particles in the ballast particle two-dimensional information table are obtained.
2. The method for rapidly generating ballast numerical files based on machine vision and geometric feature matching according to claim 1 is characterized in that: In step 1, a certain number of ballast particles are scanned using a 3D scanner to obtain a 3D model of each ballast particle, specifically: Several ballast particles were randomly collected, and their particle size distribution ranges included 16.5-22.5 mm, 22.4-31.5 mm, 31.5-40 mm, 40-50 mm, and 50-63 mm; The collected ballast particles are placed stably on the rotating table of the 3D scanner for 3D scanning; After one week of scanning, the ballast particles are turned over and scanned again; The two scanning results are spliced together to form a complete three-dimensional model of the ballast particles.
3. The method for rapidly generating ballast numerical files based on machine vision and geometric feature matching according to claim 2 is characterized in that: In step 1, the naming rule is to obtain the lengths of the major axis, median axis and minor axis of each collected ballast particle by measuring tools, with "major axis length L-median axis length I-minor axis length S" as the naming rule.
4. The method for rapidly generating ballast numerical files based on machine vision and geometric feature matching according to claim 3 is characterized in that: In step 1, the three-dimensional model of each ballast particle is projected on multiple surfaces. Specifically, each three-dimensional model of the ballast particle is rotated and projected 12 times around the X, Y, and Z axes, with each rotation of 30°, to obtain projections of each three-dimensional model of the ballast particle at 12 different angles on the XY plane, XZ plane, and YZ plane.
5. The method for rapidly generating ballast numerical files based on machine vision and geometric feature matching according to claim 1 is characterized in that: In step 2, the actual photographs of the ballast aggregate are collected by photographing the ballast aggregate on the railway track bed, or by randomly selecting a number of ballast particles on the railway track bed for photographing; the photographs contain images of reference balls of known diameter, which are used to refer to and calculate the ratio of the ballast particle size in the photographs to the actual ballast particle size.
6. The method for rapidly generating ballast numerical files based on machine vision and geometric feature matching according to claim 5 is characterized in that: In step 2, the machine vision model is used to perform instance segmentation on the real photos of ballast aggregate, which is to use a pre-trained Mask R-CNN model to segment the real photos of ballast; The Mask R-CNN model training process is as follows: using ballast particles with particle size ranges of 50-63mm, 40-50mm, 31.5-40mm, 22.4-31.5mm, and 16.5-22.5mm and real-life photos of green balls with a diameter of 3cm as the model training data set; Instance segmentation model training in the MMdetection deep learning framework; During the training process, the model's recognition categories were set to three, including ballast particles, green balls, and background; The parameters for model performance evaluation were set as follows: mAp parameter was 55.1, AP50 parameter was 77.9, and AP75 parameter was 73.
3. The Mask R-CNN model was considered successful if it could accurately segment the ballast particles and green ball images in the actual photos of ballast aggregate.
7. The method for rapidly generating ballast numerical files based on machine vision and geometric feature matching according to claim 6 is characterized in that: In step 2, the conversion into a binary image is to convert the sample mask image formed by instance segmentation into a binary image with a black background and a white projection.
8. The method for rapidly generating ballast numerical files based on machine vision and geometric feature matching according to claim 1 is characterized in that: In step 1 and step 2, the geometric features include contour features and shape features; The profile feature is a projection profile of a 3D model of a ballast particle or the first eight Fourier descriptors of the ballast particle profile; The shape features include the projection outline of the 3D model of the ballast particles or the aspect ratio, circularity, sphericity, roughness, concavity and convexity, and equivalent ellipsoid volume of the ballast particle outline.
9. The method for rapidly generating ballast numerical files based on machine vision and geometric feature matching according to claim 1, characterized in that: The calculation formula of the equivalent ellipsoid volume is as follows: Where: Ve is the equivalent ellipsoid volume, b is the equivalent ellipsoid minor axis, and a is the equivalent ellipsoid major axis.
Citation Information
Patent Citations
Polyhedral unit construction method and system for holographic simulation of irregular ballast particles
CN115965757A
Non-contact rockfill grain composition detection method and device based on machine vision
CN117237303A