A method for quantifying physical properties of scrap steel based on physical property numerical mapping
By reconstructing the scrap steel grading task into a multi-dimensional physical property regression task, and employing a deep residual network and an asymmetric composite loss function, the problems of subjectivity and poor model generalization ability in existing scrap steel grading technologies are solved. This achieves high-precision and interpretable scrap steel property quantification, and reduces costs and environmental adaptation difficulties.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- FUJIAN MINGUANG SOFTWARE CO LTD
- Filing Date
- 2026-05-12
- Publication Date
- 2026-06-09
Smart Images

Figure CN122176430A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of machine learning, and particularly relates to a method for quantifying physical properties of scrap steel based on a regression learning model driven by physical constraints, and more particularly to a neural network training method and device for encoding physical prior knowledge as directional constraints of a loss function. BACKGROUND
[0002] Early and some existing scrap steel grading mainly relies on manual visual inspection combined with simple mechanical sorting. Workers estimate the thickness, shape and impurities of scrap steel according to experience. However, this method has great subjectivity, the grading standards are not uniform, the working environment is poor, the labor intensity is high, and it is difficult to achieve real-time accurate supervision all day long.
[0003] Some existing technologies attempt to use laser scanners or 3D cameras to obtain surface point cloud data of scrap steel carriages, calculate the volume and weight ratio to estimate the bulk density and thus perform grading. However, such precise optical equipment is expensive, and is easily damaged in the high-dust and strong-vibration environment of scrap steel sites, making maintenance difficult, and it is also difficult to obtain the physical properties of individual scrap steel that is hidden.
[0004] With the development of deep learning, the mainstream technology route adopts general classification networks such as ResNet and VGG to directly classify scrap steel images. However, this rigid classification method, which forcibly divides the continuously changing physical specifications into orthogonal categories, ignores the order of physical properties between classes, resulting in poor generalization ability of the model when processing samples near the classification boundary, and the fine-grained classification accuracy is difficult to break through the bottleneck. From the perspective of machine learning paradigm, the deep reason for the above defects is that the discrete one-hot encoding supervision signal used by conventional classification models cannot express the continuous and ordered structure of physical properties; the ordered regression problem is degenerated into a discrete classification problem, resulting in a lack of perception of small physical differences near the threshold, and structural confusion at the class boundary.
[0005] The patent document with publication number CN109919243A and the name of "A scrap steel type automatic identification method and device based on CNN" constructs a convolutional neural network to extract image features, optimizes parameters using a semi-supervised strategy, and finally outputs the probability that the image belongs to each discrete category through a fully connected layer to realize automatic identification. However, this method uses an end-to-end discrete classification paradigm, ignoring the continuity and order of scrap steel physical properties, which easily confuses the model when processing samples near the classification boundary. In addition, directly outputting the class label makes the grading result lack physical numerical support, and cannot meet the explainability requirements of high-precision quality inspection.
[0006] The patent document, CN120495717A, entitled "An AI-based Scrap Steel Type Recognition Method Based on Machine Vision," establishes a target detection model based on an improved YOLOv7 network. It identifies the type and quantity of scrap steel by adding an instance segmentation head and optimizing the loss function, and then compares the results with a standard library to obtain a classification result. However, the core logic of this method is still based on a rigid mapping from "visual features to category labels," which can only perform qualitative classification and cannot perceive specific physical attribute values. This rigid classification is difficult to adapt to the flexible tolerances of non-standard scrap steel products, and it is prone to misclassification for samples whose visual features have changed due to environmental factors but whose physical attributes remain unchanged.
[0007] The common drawback of the aforementioned existing technologies is that, at the construction level of supervised learning tasks, discrete class labels or conventional regression labels are used as training targets, and the loss function applies isotropic symmetric penalties to all prediction biases. This symmetric penalty mechanism cannot explicitly encode the prior knowledge that "physical attribute values only need to satisfy unidirectional boundary constraints to be compliant" into the model training process, causing the model to be forced to learn a non-existent "precise value" instead of learning a "feasible interval" that conforms to physical constraints, which exacerbates boundary confusion and limits generalization ability. Summary of the Invention
[0008] To address the shortcomings and deficiencies of existing technologies, this invention provides a method for quantifying the physical properties of scrap steel based on numerical mapping of physical attributes. This method reconstructs traditional scrap steel images from a discrete classification paradigm into a multidimensional physical attribute regression task. Based on a pre-defined scrap steel classification standard, each discrete category label is mapped to a multidimensional continuous physical attribute target vector. Each dimension of this vector corresponds to a key physical attribute, and serves as both an associated direction mask and an attribute validity mask. The direction mask identifies the constraint direction of the corresponding physical attribute, while the attribute validity mask indicates whether the attribute is applicable in the current scrap steel category. Furthermore, the scrap steel image is input into a neural network model with a deep residual network as the backbone and fully connected regression layers as the output, to obtain a multidimensional physical attribute prediction vector that matches the dimensions of the target vector. During model training, an asymmetric composite loss function is constructed. This function includes a basic regression loss term in the form of mean squared error, and a directional asymmetric constraint loss term combining a direction mask and an attribute validity mask. The directional asymmetric constraint loss term applies an asymmetric penalty to the prediction bias. When the deviation direction of the predicted value relative to the target value conforms to the constraint direction identified by the direction mask, the penalty approaches zero, allowing the model to form a flexible prediction margin in the compliant direction. When the deviation direction violates the constraint direction, a penalty approaching the upper limit is applied to force correction. After training convergence, the model directly outputs a prediction vector containing quantified values of each key physical attribute. The quantified physical attribute results output by this method can be directly used for scrap steel grading. When the scrap steel classification standard changes, only the grading logic threshold needs to be adjusted, without retraining the model. Therefore, this invention achieves a structured physical quantification representation of unstructured scrap steel images, overcoming the shortcomings of existing discrete classification paradigms, such as poor generalization ability at category boundaries and lack of physical numerical support.
[0009] The specific technical solution adopted by this invention to solve its technical problem is as follows:
[0010] A method for quantifying the physical properties of scrap steel based on numerical mapping of physical properties includes the following steps:
[0011] Obtain scrap steel image samples, and based on the preset scrap steel classification standard, convert the discrete category labels corresponding to the scrap steel images into multi-dimensional continuous physical attribute target vectors; each dimension of the multi-dimensional continuous physical attribute target vector corresponds to a key physical attribute of scrap steel, and each dimension is associated with a direction mask and an attribute validity mask. The direction mask is used to identify the constraint direction of the corresponding physical attribute, and the attribute validity mask is used to identify whether the corresponding physical attribute is applicable to the current scrap steel category.
[0012] The scrap steel image is input into the neural network model, and the output is a multidimensional physical property prediction vector that matches the dimension of the multidimensional continuous physical property target vector.
[0013] Calculate an asymmetric composite loss function, which includes a basic regression loss term and a directional asymmetric constraint loss term. The basic regression loss term, combined with the attribute validity mask, masks the loss contribution of invalid dimensions and constrains the multidimensional physical attribute prediction vector to approximate the multidimensional continuous physical attribute target vector. The directional asymmetric constraint loss term, combined with the direction mask and the attribute validity mask, applies a penalty greater than the penalty for deviations in the direction of conforming to the constraint to the deviations of the prediction vector from the direction of the physical constraint.
[0014] The neural network model is trained using the aforementioned asymmetric composite loss function, and the results of multidimensional physical property quantification of scrap steel are output.
[0015] Furthermore, the assignment rule for the orientation mask is as follows: when the constraint of the corresponding physical attribute is not less than a preset threshold, the orientation mask is assigned a value of 1; when the constraint of the corresponding physical attribute is not greater than the preset threshold, the orientation mask is assigned a value of -1. It should be noted that in the scrap steel classification standard upon which this scheme is based, the same physical attribute dimension has only a single constraint direction for the same scrap steel category. Two types of constraints will not appear simultaneously on the same attribute dimension, therefore there is no premise for assignment conflict. In extreme cases, when the model's predicted value is exactly equal to the label threshold, this point itself is a compliant boundary point. The contribution of the directional asymmetric constraint loss term at this point is constant and of extremely small magnitude, and will not change the overall trend of the model converging towards the compliant interval. The model can still be correctly trained and output prediction results that conform to the physical constraints.
[0016] Furthermore, the assignment rule for the attribute validity mask is as follows: when the corresponding physical attribute is applicable to the current scrap steel category, the attribute validity mask is assigned a value of 1; when the corresponding physical attribute is not applicable to the current scrap steel category, the attribute validity mask is assigned a value of 0, and the loss contribution of the invalid physical attribute dimension is masked and does not participate in gradient backpropagation.
[0017] Furthermore, the multidimensional continuous physical attribute target vector is subjected to linear normalization with a safety margin, mapping the value of the target vector to the interval [δ, 1-δ], where δ is a preset safety margin constant, and the final supervision label is generated.
[0018] Furthermore, the neural network model includes a deep residual backbone network, a feature aggregation module, and a physical property regression layer. The deep residual backbone network is used to extract deep, high-dimensional semantic features from scrap steel images. The feature aggregation module is used to compress the spatial dimension of the semantic features to obtain a global feature vector. The physical property regression layer consists of a linear fully connected layer and a sigmoid activation function, which is used to map the global feature vector to the normalized physical property numerical space and output a multi-dimensional physical property prediction vector.
[0019] Furthermore, the basic regression loss term is the mean squared error loss, and the directional asymmetric constraint loss term is based on the Sigmoid function, which applies a nonlinear penalty to the prediction deviation that violates the physical constraint direction, so that the deviation that violates the direction is penalized to a preset upper limit value, and the deviation penalty that conforms to the direction tends to zero.
[0020] Furthermore, the key physical properties of the scrap steel include thickness, diameter of the solid cylindrical body, geometric dimensions, minimum thickness, and proportion.
[0021] Furthermore, the multidimensional physical attribute quantification results output by the trained neural network model are used for scrap steel grading. Scrap steel classification is completed based on the quantification results and preset logical thresholds. When the scrap steel classification standard changes, only the logical thresholds need to be adjusted to complete the adaptation, without the need to retrain the neural network model.
[0022] And, a scrap steel physical property quantification system based on physical property numerical mapping, comprising:
[0023] The data preprocessing module is used to acquire scrap steel images and, based on a preset scrap steel classification standard, convert the discrete category labels corresponding to the scrap steel images into multi-dimensional continuous physical attribute target vectors. Each dimension of the multi-dimensional continuous physical attribute target vector corresponds to a key physical attribute of scrap steel, and each dimension is associated with a direction mask and an attribute validity mask. The direction mask is used to identify the constraint direction of the corresponding physical attribute, and the attribute validity mask is used to identify whether the corresponding physical attribute is applicable to the current scrap steel category.
[0024] The feature extraction and regression module is used to input the scrap steel image into the neural network model and output a multidimensional physical attribute prediction vector that matches the dimension of the multidimensional continuous physical attribute target vector.
[0025] The loss calculation module is used to calculate the asymmetric composite loss function, which includes a basic regression loss term and a directional asymmetric constraint loss term. The basic regression loss term, combined with the attribute validity mask, masks the loss contribution of invalid dimensions and constrains the multidimensional physical attribute prediction vector to approximate the multidimensional continuous physical attribute target vector. The directional asymmetric constraint loss term, combined with the direction mask and the attribute validity mask, applies a penalty greater than the penalty for deviations in the direction of conforming to the constraint to the deviations of the prediction vector from the direction of the physical constraint.
[0026] The model training module is used to train the neural network model using the asymmetric composite loss function and output the quantification results of the multidimensional physical properties of scrap steel.
[0027] Furthermore, the neural network model built into the feature extraction and regression module includes a deep residual backbone network, a feature aggregation module, and a physical property regression layer. The deep residual backbone network is used to extract deep, high-dimensional semantic features from scrap steel images. The feature aggregation module is used to compress the spatial dimension of the semantic features to obtain a global feature vector. The physical property regression layer consists of a linear fully connected layer and a sigmoid activation function, which is used to map the global feature vector to the normalized physical property numerical space and output a multi-dimensional physical property prediction vector.
[0028] And a computer system including a processor and a memory, the memory storing a computer program, the processor executing the computer program to implement the method described above.
[0029] A non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described above.
[0030] Compared with the prior art, the present invention and its preferred embodiments have at least the following beneficial effects:
[0031] First, this invention reconstructs the rigid discrete classification task of traditional scrap steel grading into a regression quantification task of multi-dimensional physical attributes. This fundamentally solves the inherent flaw of existing classification schemes that ignore the continuity and orderliness of scrap steel's physical attributes, effectively improving the model's generalization ability for samples near the classification boundary. Simultaneously, it decouples the model from the grading criteria, allowing for adaptation without retraining the model when quality standards change, significantly reducing deployment and maintenance costs in industrial settings. Second, through the combined design of orientation masks and attribute validity masks, this invention explicitly encodes the prior physical constraints of scrap steel grading into the model training process while shielding invalid attribute dimensions from interfering with model training. This enables joint training of samples from all categories, eliminating the need to build separate models for different scrap steel categories and improving the model's versatility and training efficiency. Furthermore, the asymmetric composite loss function designed in this invention abandons the conventional mechanism of applying symmetric penalties to all prediction biases in traditional regression tasks. It drives the model to learn flexible prediction boundaries that conform to physical constraints, rather than forcibly fitting a single fixed precise value. This effectively improves the model's anti-interference capability and robustness in complex industrial environments, adapting to the flexible tolerance requirements of non-standard scrap steel products. Finally, this invention directly outputs intuitively interpretable quantitative values of key physical properties of scrap steel, replacing the black-box category label output of existing technologies. This provides objective and interpretable data support for automatic scrap steel grading and end-to-end quality traceability, meeting the compliance and traceability requirements of high-precision quality inspection in industrial scenarios. Simultaneously, it eliminates the need for expensive precision optical inspection equipment, reducing hardware deployment costs and the difficulty of adapting to harsh on-site environments. Attached Figure Description
[0032] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments:
[0033] Figure 1 This is a schematic diagram illustrating the implementation process of an embodiment of the present invention. Detailed Implementation
[0034] To make the features and advantages of the present invention more apparent and understandable, specific embodiments are described below in detail:
[0035] It should be noted that the following detailed descriptions are exemplary and intended to provide further explanation of this application. Unless otherwise specified, all technical and scientific terms used in this specification have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains.
[0036] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments according to this application. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0037] This invention provides a method for quantifying the physical properties of scrap steel based on numerical mapping of physical attributes, enabling intelligent classification of scrap steel types. First, a ResNet50 backbone feature extraction network is used to extract high-dimensional visual features from scrap steel images. Then, the traditional fully connected classification layer is replaced with a regression prediction layer corresponding to the physical standard dimension, resulting in multi-dimensional numerical predictions of physical attributes including key indicators such as thickness, diameter, and proportion. Based on this, a numerical mapping mechanism for physical attributes is introduced, and an asymmetric composite loss function based on physical constraint direction is designed. Combined with data normalization processing, the model achieves accurate approximation of the physical specifications of scrap steel. The method ultimately outputs a multi-dimensional numerical vector of physical attributes including key indicators such as thickness, diameter, and proportion. This numerical vector realizes a structured physical quantitative representation of unstructured scrap steel images, providing objective and interpretable data support for subsequent automatic grading, quality traceability, and dynamic standard setting.
[0038] like Figure 1As shown, the implementation process of this invention consists of three main steps: the first step is data input and preprocessing, which involves acquiring scrap steel images, preprocessing them, and constructing physical attribute labels; the second step is feature extraction and regression prediction, which uses a deep neural network regression model to perform feature extraction, global feature aggregation, and physical attribute regression, outputting a predicted physical attribute vector; the third step is the model training mechanism, which uses an asymmetric composite loss function to calculate the prediction bias and complete backpropagation and model parameter updates. The specific implementation process of this invention is as follows:
[0039] (1) Data preparation; a dataset of scrap steel images collected by industrial cameras during the scrap steel unloading scene is provided. ,in The total number of samples, The original image has dimensions of [length and width]. Each sample has a discrete class label. ,in, This represents the total number of categories for scrap steel classification. In this invention, the discrete category labels are transformed into multidimensional continuous physical feature label vectors through a numerical mapping of physical attributes. ,in Let be the total dimension of the physical attribute features. The number of samples participating in each round of training iteration is defined as . The specific implementation steps are as follows:
[0040] I. Acquire raw image data of the scrap steel unloading scenario using image acquisition equipment; construct a preprocessing function. ,in Tensors that meet the input requirements of neural networks , , These represent the preset height, width, and number of channels, respectively. The preprocessing process includes: using interpolation algorithms to... Scaling to a fixed size Normalize the image pixels, that is... ,in and The pixel mean and standard deviation of the dataset are used to generate the model input tensor sequence. .
[0041] II. Analysis and vectorization mapping of physical property standards; based on the preset scrap steel classification standards, determine the materials used to distinguish different categories. Several key physical attribute dimensions. Construct a mapping function from the discrete category space to the continuous physical attribute space. ,in For the first The physical feature vectors corresponding to each category , Here, K represents the corresponding constraint direction mask vector, and K is the total number of dimensions. For the vector... eigenvalues of each dimension and orientation mask Its numerical mapping process is defined as follows:
[0042] Let the classification criteria apply to categories In the The constraints on physical properties constitute a feasible interval in the real number field. When the classification criteria stipulate that the attribute must be "greater than or equal to" a certain threshold. When the feasible interval is represented as a left-closed, right-open interval, the feasible interval is... At this point, the eigenvalue takes the infimum of the interval. And set the corresponding direction mask value to When the classification criteria stipulate that the attribute must be "less than or equal to" a certain threshold. When the feasible interval is represented as a left-open, right-closed interval, the feasible interval is... At this point, the eigenvalue takes the supremum of the interval. And set the corresponding direction mask value to .
[0043] III. Construction of a masking mechanism for missing attributes; For some scrap steel categories where specific physical attribute dimensions are not defined or are not applicable, an attribute validity mask vector is constructed. For the first One physical attribute dimension: If the current sample belongs to a certain category If the physical definition includes this attribute, then let the mask value... and physical characteristic values Let the boundary threshold obtained from the above analysis be set; if the current sample belongs to the category If the physical definition of this attribute is not included, then let the mask value... and physical characteristic values The mask vector is filled with a preset non-physical value. This will be used as part of the supervision signal to mask the prediction error of invalid dimensions in subsequent loss function calculations, ensuring that missing terms do not participate in gradient backpropagation, thereby eliminating the interference of invalid features on model parameter updates.
[0044] IV. Feature Normalization and Final Label Generation; Given the different physical attribute dimensions The numerical magnitudes may differ significantly. To eliminate the impact of this difference in scale on the gradient of the model's loss function, and considering that the regression head uses the Sigmoid activation function, to avoid gradient vanishing due to the training data being distributed in the saturation region of the activation function, and to reserve a certain margin of fluctuation for the model's predicted values outside the boundary, a normalization function with a safety margin is constructed. A linear transformation strategy is adopted to transform the physical feature vectors. Each component in the interval is mapped to an interval :
[0045]
[0046] in Represents the first in the entire dataset The set of all possible values for each physical attribute. After transformation, the generated components are distributed in... Normalized target vector of the interval This allows the model to predict values slightly smaller than the minimum during inference. or slightly greater than the maximum value The value of the vector. This will serve as the final supervision label, along with the input tensor. Construct training pairs This is used for training the subsequent regression model.
[0047] (2) Classification model construction: The ResNet50 deep residual network is used as the backbone feature extraction network of the scrap steel physical property quantification model. The preprocessed image is input into the network, and after five stages of convolution and residual module calculation, the deep high-dimensional semantic feature map is extracted. Based on this feature map, a feature aggregation module and a physical attribute regression head are constructed, as detailed below:
[0048] I. Feature Aggregation; Global Average Pooling (GAP) is used to aggregate the feature maps output by the backbone network. Spatial dimensionality compression is performed. This operation aims to eliminate the spatial location sensitivity of features, transforming a three-dimensional tensor into a one-dimensional feature vector containing global semantic information. . Indicates the height of the feature map Hekuan The specific implementation process of the average value calculation operation performed on the dimension is as follows:
[0049]
[0050] II. Regression Head Construction; For the aggregated global feature vector A fully connected regression layer is constructed to replace the traditional ResNet classification layer, thereby outputting multidimensional physical attribute prediction results. ,in This represents the total dimension of physical attributes and indicative features. The regression head consists of a linear fully connected layer and a sigmoid activation function, used to map high-dimensional semantic features to a normalized physical attribute numerical space. This represents the weight matrix of the fully connected layer. Indicates the bias term. This represents the Sigmoid activation function. Its specific implementation process is as follows:
[0051]
[0052] (3) This invention designs an asymmetric composite loss function based on physical constraint direction. This loss function abandons the "hard regression" mechanism in traditional regression tasks that forces predicted values to absolutely approximate the label values. Instead, it introduces a direction mask. and validity mask A loss function combining mean squared error loss and sigmoid direction weighting was constructed. Its aim is to improve the model's predicted values. Under the premise of satisfying physical constraints, the values can be reasonably distributed on one side of the label values, rather than collapsing to the boundary threshold. The specific structure is as follows:
[0053] I. Mean Squared Error Loss The mean squared error loss is used as the basic regression term. This term imposes a two-way constraint on the prediction bias between compliance and non-compliance, forcing the model to learn the standard physical characteristics of scrap steel categories and anchoring the predicted values near the classification threshold, thereby ensuring the convergence and numerical stability of the model training. The calculation formula is as follows:
[0054]
[0055] in, For the sample size, This is a mask for attribute validity. For normalized labels, These are the model's predicted values.
[0056] II. Asymmetric Constraint Loss in the Sigmoid Direction The loss is calculated as follows:
[0057]
[0058] This represents the Sigmoid activation function. The hyperparameters controlling the penalty steepness are used to adjust the slope of the sigmoid function. To symbolize the direction error, the calculation process is as follows:
[0059]
[0060] For the orientation mask. Under this definition, when When, it indicates that the predicted value violates the physical constraint direction, belonging to the violation range; when When the predicted value conforms to the physical constraint direction, it falls within the compliant range.
[0061] III. Total Loss Function It can be described as: The weights and To balance the weighting factors, by minimizing this loss function, the model outputs flexible predictions that conform to both physical constraints and are anchored to standard physical features.
[0062] (4) Model training; AdamW was selected as the optimizer for this model, with a decay rate of 0.01 and a momentum of 0.9. In the initial stage of model training, the learning rate was set to 0.0001 and adjusted according to the cosine annealing algorithm. Model training continued until the loss function converged to the preset threshold or the preset number of iterations was completed.
[0063] Once trained, the model can directly output quantitative values of physical properties. When the scrap steel classification standards change, only the classification thresholds of physical properties need to be adjusted to adapt the model without retraining it.
[0064] Compared to existing technologies:
[0065] 1) This invention innovatively reconstructs discrete classification into multidimensional physical attribute regression, realizing the decoupling of the model and the standard; when the quality inspection standard changes, there is no need to retrain the model, only to adjust the logic threshold, which greatly reduces the on-site maintenance cost.
[0066] 2) The composite loss function designed in this invention, based on the mean square error and the sigmoid asymmetric constraint, forms a safety margin for the classification while anchoring the standard threshold, which significantly improves the robustness of the model under illumination and corrosion interference.
[0067] 3) This invention introduces an attribute validity masking mechanism to eliminate interference from invalid features and achieve joint training of all samples; the model outputs intuitive physical quantification values, realizing the leap from black-box labeling to interpretable quantification decision, which facilitates quality traceability.
[0068] The following provides a more detailed preferred embodiment to further illustrate the solution.
[0069] (1) Data preparation; a dataset of scrap steel images collected by industrial cameras during the scrap steel unloading scene is provided. ,in The total number of samples, The original image has dimensions of [length and width]. Each sample has a discrete class label. , This represents the total number of categories for scrap steel classification. In this embodiment, the discrete category labels are transformed into multidimensional continuous physical feature label vectors through a numerical mapping of physical attributes. ,in Let be the total dimension of the physical attribute features. The number of samples participating in each round of training iteration is defined as . The specific implementation steps are as follows:
[0070] I. Acquire raw image data of the scrap steel unloading scenario using image acquisition equipment; construct a preprocessing function. ,in This is a tensor that meets the input requirements of a neural network. The preprocessing process includes: using interpolation algorithms to transform the original image... Scaling to a fixed size Normalize the image pixels, that is... ,in and These are the pixel mean and standard deviation of the dataset, respectively, using the mean from the ImageNet dataset. and standard deviation This generates the model input tensor sequence. .
[0071] II. Analysis and vectorization mapping of physical property standards; based on the preset scrap steel classification standards, determine the materials used to distinguish different categories. The key physical properties include thickness, diameter of the solid cylinder, dimensions, minimum thickness, and proportion. Specific requirements are shown in Table 1.
[0072] Table 1. Mapping of Scrap Steel Categories and Physical Property Values in This Example
[0073]
[0074] Construct a mapping function from a discrete category space to a continuous physical attribute space. ,in For the first The physical feature vectors corresponding to each category , For the corresponding constraint direction mask vector, For the vector... eigenvalues of each dimension and orientation mask Its numerical mapping process is defined as follows: Suppose that the classification criteria affect the categories In the The constraints on physical properties constitute a feasible interval in the real number field. When the classification criteria stipulate that the attribute must be "greater than or equal to" a certain threshold. When the feasible interval is represented as a left-closed, right-open interval, the feasible interval is... At this point, the eigenvalue takes the infimum of the interval. And set the corresponding direction mask value to When the classification criteria stipulate that the attribute must be "less than or equal to" a certain threshold. When the feasible interval is represented as a left-open, right-closed interval, the feasible interval is... At this point, the eigenvalue takes the supremum of the interval. And set the corresponding direction mask value to .
[0075] III. Construction of a masking mechanism for missing attributes; For some scrap steel categories where specific physical attribute dimensions are not defined or are not applicable, an attribute validity mask vector is constructed. For the first One physical attribute dimension: If the current sample belongs to a certain category If the physical definition includes this attribute, then let the mask value... and physical characteristic values Let the boundary threshold obtained from the above analysis be set; if the current sample belongs to the category If the physical definition of this attribute is not included, then let the mask value... and physical characteristic values The filler is a preset non-physical value. Preferably, the preset non-physical value can be a negative value with no physical meaning, such as -1 used to indicate undefined physical properties in Table 1 of this embodiment. This mask vector This will be used as part of the supervision signal to mask the prediction error of invalid dimensions in subsequent loss function calculations, ensuring that missing terms do not participate in gradient backpropagation, thereby eliminating the interference of invalid features on model parameter updates.
[0076] IV. Feature Normalization and Final Label Generation; Given the different physical attribute dimensions The numerical magnitudes may differ significantly. To eliminate the impact of this difference in scale on the gradient of the model's loss function, and considering that the regression head uses the sigmoid activation function, to avoid gradient vanishing due to the training data being distributed in the saturation region of the activation function, and to reserve a certain margin of fluctuation for the model's predicted values outside the boundary, a normalization function with a safety margin is constructed. A linear transformation strategy is adopted to transform the physical feature vectors. Each component in the interval is mapped to an interval :
[0077]
[0078] in Represents the first in the entire dataset The set of all possible values for each physical attribute. After transformation, the generated components are distributed in... Normalized target vector of the interval This allows the model to predict values slightly less than the minimum of 0.1 or slightly greater than the maximum of 0.9 during inference. This vector This will serve as the final supervision label, along with the input tensor. Construct training pairs This is used for training the subsequent regression model.
[0079] (2) Construction of deep regression quantization model; The deep residual network ResNet50 is used as the backbone feature extraction network of the physical property quantification model of scrap steel. The preprocessed image is input into the network, and after five stages of convolution and residual module calculation, the deep high-dimensional semantic feature map is extracted. Based on this feature map, a feature aggregation module and a physical attribute regression head are constructed, as detailed below:
[0080] I. Feature Aggregation; Global Average Pooling (GAP) is used to aggregate the feature maps output by the backbone network. Spatial dimensionality compression is performed. This operation aims to eliminate the spatial location sensitivity of features, transforming a three-dimensional tensor into a one-dimensional feature vector containing global semantic information. . Indicates the height of the feature map Hekuan The specific implementation process of the average value calculation operation performed on the dimension is as follows:
[0081]
[0082] II. Regression Head Construction; For the aggregated global feature vector A fully connected regression layer is constructed to replace the traditional ResNet classification layer, thereby outputting multidimensional physical attribute prediction results. ,in This represents the total dimension of physical attributes and indicative features. The regression head consists of a linear fully connected layer and a sigmoid activation function, used to map high-dimensional semantic features to a normalized physical attribute numerical space. This represents the weight matrix of the fully connected layer. Indicates the bias term. This represents the Sigmoid activation function. Its specific implementation process is as follows:
[0083]
[0084] (3) Loss function; an asymmetric composite loss function based on physical constraint direction is provided. The specific components are as follows:
[0085] I. Mean Squared Error Loss The mean squared error loss is used as the basic regression term. This term imposes a two-way constraint on the prediction bias between compliance and non-compliance, forcing the model to learn the standard physical characteristics of scrap steel categories and anchoring the predicted values near the classification threshold, thereby ensuring the convergence and numerical stability of the model training. The calculation formula is as follows:
[0086]
[0087] II. Asymmetric Constraint Loss in the Sigmoid Direction The loss is calculated as follows:
[0088]
[0089] This represents the Sigmoid activation function. To control the hyperparameters of penalty steepness, To symbolize the direction error, the calculation process is as follows:
[0090]
[0091] For the orientation mask. Under this definition, when When, it indicates that the predicted value violates the physical constraint direction, belonging to the violation range; when When the predicted value conforms to the physical constraint direction, it falls within the compliant range.
[0092] III. Total Loss Function It can be described as: The weights and To balance the weighting factors, take... , By minimizing this loss function, the model outputs flexible predictions that conform to both physical constraints and are anchored to standard physical features.
[0093] (4) Model training; AdamW was selected as the optimizer for this model, with a decay rate of 0.01 and a momentum of 0.9. In the early stage of model training, the learning rate was set to 0.0001 and adjusted according to the cosine annealing algorithm.
[0094] Based on the same inventive concept, this invention also provides a computer device, comprising: one or more processors, and a memory for storing one or more computer programs; the programs include program instructions, and the processor executes the program instructions stored in the memory. The processor may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. It is the computing and control core of the terminal, used to implement one or more instructions, specifically for loading and executing one or more instructions stored in a computer storage medium to implement the above-described method.
[0095] It should be further explained that, based on the same inventive concept, the present invention also provides a computer storage medium storing a computer program, which, when executed by a processor, performs the above-described method. This storage medium can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0096] It should be noted that, unless otherwise defined, the technical or scientific terms used in this invention should have the ordinary meaning understood by one of ordinary skill in the art to which this invention pertains. The terms "first," "second," and similar terms used in this invention do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0097] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments. 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 scope of the present invention shall still fall within the protection scope of the present invention.
[0098] This invention is not limited to the preferred embodiment described above. Anyone inspired by this invention can derive other forms of methods for quantifying the physical properties of scrap steel based on numerical mapping of physical properties. All equivalent changes and modifications made within the scope of the claims of this invention shall fall within the scope of this invention.
Claims
1. A method for quantifying the physical properties of scrap steel based on numerical mapping of physical properties, characterized in that, Includes the following steps: Obtain scrap steel image samples, and based on the preset scrap steel classification standard, convert the discrete category labels corresponding to the scrap steel images into multi-dimensional continuous physical attribute target vectors; each dimension of the multi-dimensional continuous physical attribute target vector corresponds to a key physical attribute of scrap steel, and each dimension is associated with a direction mask and an attribute validity mask. The direction mask is used to identify the constraint direction of the corresponding physical attribute, and the attribute validity mask is used to identify whether the corresponding physical attribute is applicable to the current scrap steel category. The scrap steel image is input into the neural network model, and the output is a multidimensional physical property prediction vector that matches the dimension of the multidimensional continuous physical property target vector. Calculate an asymmetric composite loss function, which includes a basic regression loss term and a directional asymmetric constraint loss term. The basic regression loss term, combined with the attribute validity mask, masks the loss contribution of invalid dimensions and constrains the multidimensional physical attribute prediction vector to approximate the multidimensional continuous physical attribute target vector. The directional asymmetric constraint loss term, combined with the direction mask and the attribute validity mask, applies a penalty greater than the penalty for deviations in the direction of conforming to the constraint to the deviations of the prediction vector from the direction of the physical constraint. The neural network model is trained using the aforementioned asymmetric composite loss function, and the results of multidimensional physical property quantification of scrap steel are output.
2. The method for quantifying the physical properties of scrap steel based on numerical mapping of physical properties according to claim 1, characterized in that: The assignment rule for the orientation mask is as follows: when the constraint of the corresponding physical attribute is not less than a preset threshold, the orientation mask is assigned a value of 1; when the constraint of the corresponding physical attribute is not greater than a preset threshold, the orientation mask is assigned a value of -1.
3. The method for quantifying the physical properties of scrap steel based on numerical mapping of physical properties according to claim 1, characterized in that: The assignment rule for the attribute validity mask is as follows: when the corresponding physical attribute is applicable to the current scrap steel category, the attribute validity mask is assigned a value of 1; when the corresponding physical attribute is not applicable to the current scrap steel category, the attribute validity mask is assigned a value of 0, and the loss contribution of the invalid physical attribute dimension is masked and does not participate in gradient backpropagation.
4. The method for quantifying the physical properties of scrap steel based on numerical mapping of physical properties according to claim 1, characterized in that: The multidimensional continuous physical attribute target vector is subjected to linear normalization with a safety margin, and the value of the target vector is mapped to the interval [δ, 1-δ], where δ is a preset safety margin constant, to generate the final supervision label.
5. The method for quantifying the physical properties of scrap steel based on numerical mapping of physical properties according to claim 1, characterized in that: The neural network model includes a deep residual backbone network, a feature aggregation module, and a physical property regression layer. The deep residual backbone network is used to extract deep, high-dimensional semantic features from scrap steel images. The feature aggregation module is used to compress the spatial dimension of the semantic features to obtain a global feature vector. The physical property regression layer consists of a linear fully connected layer and a sigmoid activation function, which is used to map the global feature vector to the normalized physical property numerical space and output a multi-dimensional physical property prediction vector.
6. The method for quantifying the physical properties of scrap steel based on numerical mapping of physical properties according to claim 1, characterized in that: The basic regression loss term is the mean squared error loss, and the directional asymmetric constraint loss term is based on the Sigmoid function. It applies a nonlinear penalty to the prediction deviation that violates the physical constraint direction, so that the deviation that violates the direction is penalized to a preset upper limit value, and the deviation penalty that conforms to the direction tends to zero.
7. The method for quantifying the physical properties of scrap steel based on numerical mapping of physical properties according to claim 1, characterized in that: The key physical properties of the scrap steel include thickness, diameter of solid cylindrical bodies, geometric dimensions, minimum thickness, and proportion.
8. The method for quantifying the physical properties of scrap steel based on numerical mapping of physical properties according to claim 1, characterized in that: The multidimensional physical property quantification results output by the trained neural network model are used for scrap steel grading. Scrap steel classification is completed based on the quantification results and preset logical thresholds. When the scrap steel classification standard changes, only the logical thresholds need to be adjusted to complete the adaptation, without retraining the neural network model.
9. A system for quantifying the physical properties of scrap steel based on numerical mapping of physical properties, characterized in that, include: The data preprocessing module is used to acquire scrap steel images and, based on a preset scrap steel classification standard, convert the discrete category labels corresponding to the scrap steel images into multi-dimensional continuous physical attribute target vectors. Each dimension of the multi-dimensional continuous physical attribute target vector corresponds to a key physical attribute of scrap steel, and each dimension is associated with a direction mask and an attribute validity mask. The direction mask is used to identify the constraint direction of the corresponding physical attribute, and the attribute validity mask is used to identify whether the corresponding physical attribute is applicable to the current scrap steel category. The feature extraction and regression module is used to input the scrap steel image into the neural network model and output a multidimensional physical attribute prediction vector that matches the dimension of the multidimensional continuous physical attribute target vector. The loss calculation module is used to calculate the asymmetric composite loss function, which includes a basic regression loss term and a directional asymmetric constraint loss term. The basic regression loss term, combined with the attribute validity mask, masks the loss contribution of invalid dimensions and constrains the multidimensional physical attribute prediction vector to approximate the multidimensional continuous physical attribute target vector. The directional asymmetric constraint loss term, combined with the direction mask and the attribute validity mask, applies a penalty greater than the penalty for deviations in the direction of conforming to the constraint to the deviations of the prediction vector from the direction of the physical constraint. The model training module is used to train the neural network model using the asymmetric composite loss function and output the quantification results of the multidimensional physical properties of scrap steel.
10. A scrap steel physical property quantification system based on physical property numerical mapping according to claim 9, characterized in that, The neural network model built into the feature extraction and regression module includes a deep residual backbone network, a feature aggregation module, and a physical property regression layer. The deep residual backbone network is used to extract deep, high-dimensional semantic features from scrap steel images. The feature aggregation module is used to compress the spatial dimension of the semantic features to obtain a global feature vector. The physical property regression layer consists of a linear fully connected layer and a sigmoid activation function, which is used to map the global feature vector to the normalized physical property numerical space and output a multi-dimensional physical property prediction vector.
Citation Information
Patent Citations
CN109919243A
CN120495717A