CN109766939B - Photo-based galvanized steel and low-carbon steel classification method and device - Google Patents

Photo-based galvanized steel and low-carbon steel classification method and device Download PDF

Info

Publication number
CN109766939B
CN109766939B CN201811632530.2A CN201811632530A CN109766939B CN 109766939 B CN109766939 B CN 109766939B CN 201811632530 A CN201811632530 A CN 201811632530A CN 109766939 B CN109766939 B CN 109766939B
Authority
CN
China
Prior art keywords
training
support vector
classifier
image
vector machine
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811632530.2A
Other languages
Chinese (zh)
Other versions
CN109766939A (en
Inventor
王海贤
王敬
张友红
于辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Foshan University
Original Assignee
Foshan University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Foshan University filed Critical Foshan University
Priority to CN201811632530.2A priority Critical patent/CN109766939B/en
Publication of CN109766939A publication Critical patent/CN109766939A/en
Application granted granted Critical
Publication of CN109766939B publication Critical patent/CN109766939B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The application discloses a galvanized steel and low carbon steel classification method and device based on photos, which comprises the following steps of: the method comprises the steps of collecting photo images from the Internet, manually cutting photos to remove noise-containing parts, sliding resampling, deleting noise pictures obtained by resampling, equalizing samples, graying color pictures, and classifying by using a support vector machine and two-dimensional principal component analysis. The application is successfully applied to classifying galvanized steel and low-carbon steel photos downloaded from a network, obtains a good recognition effect, and is beneficial to online transaction classification of the two steels.

Description

Photo-based galvanized steel and low-carbon steel classification method and device
Technical Field
The application relates to the technical field of image recognition of steel types, in particular to a galvanized steel and low-carbon steel classification method and device based on photos.
Background
Galvanized steel and low carbon steel have found wide application in industry. Specifically, the galvanized steel is obtained by performing galvanization on common carbon building steel, so that corrosion and rust of the steel are effectively prevented, and the service life of the steel is prolonged. Galvanization is generally classified into hot dip galvanization and electrogalvanizing. Hot dip galvanization is the process of reacting molten metal with an iron substrate to produce an alloy layer, thereby bonding both the substrate and the coating. The hot dip galvanizing has the advantages of uniform coating, strong adhesive force, long service life, strong corrosion resistance and the like. Electrogalvanizing is also called cold galvanizing, the galvanized quantity is small, the corrosion resistance is far different from that of hot galvanizing, and the low-carbon steel is carbon steel with carbon content lower than 0.25 percent. It is also called mild steel because of its low strength, low hardness and softness. It includes most of common carbon structural steel and some of high quality carbon structural steel, most of which are used for engineering structural members without heat treatment, and some of which are used for mechanical parts requiring wear resistance via carburization and other heat treatments. As these two steels are widely used in industry, they are also present in large numbers in online transactions. It is a significant task to identify the type of steel automatically and accurately.
Disclosure of Invention
The application provides a classification method and a classification device for galvanized steel and low carbon steel based on photos, and aims to classify and identify the photos of the galvanized steel and the low carbon steel by using a pattern recognition algorithm.
To achieve the above object, according to an aspect of the present disclosure, there is provided a method of classifying galvanized steel and low carbon steel based on photographs, the method comprising the steps of:
step 1, reading an image to be identified, and sliding and resampling the image to be identified according to a sliding window to generate a plurality of sampling subgraphs;
step 2, graying all sampling subgraphs;
step 3, dividing each sampling subgraph into a training subgraph and a testing subgraph;
step 4, constructing a support vector machine;
step 5, training a support vector machine by taking the training subgraph as a training sample;
and 6, classifying and identifying the test subgraphs through the decimal cross verification according to the support vector machine.
Further, in step 1, the reading of the image to be identified is that the crawler crawls pictures of steel, steel wires, steel strands, steel pipes, steel plates, steel products and steel coils in the website or manually downloads photo images of the steel, steel wires, steel strands, steel pipes, steel plates, steel products and steel coils in the website, after the photo images are stored, the photo images are manually cut, noise parts are removed from the reserved steel parts, the noise parts of the photo images are the surrounding environment where the steel products are located in the photo images, watermarks on the photo and workers appearing on the photo, and the image to be identified is obtained after the manual cutting.
Further, in step 1, the method for reading the image to be identified and sliding resampling the image to be identified according to the sliding window to generate a plurality of sampling subgraphs includes: sliding resampling is carried out on the image to be identified through a sliding window with 80 multiplied by 80 pixels to generate a plurality of sampling subgraphs, the sliding resampling is carried out on the image to be identified through the sliding window with the interval of 80 multiplied by 80 pixels, the sampling is that the image in the sliding window is stored as a new sub-image, the new sub-image is the sampling subgraph, the sliding window slides from the upper left corner of the original image, the sliding window is transversely or longitudinally moved by 40 pixels on the image for sampling each time until the sliding window traverses the image to be identified, and a plurality of sampling subgraphs are generated.
Further, in step 2, the method for graying all the sampling subgraphs includes: the method for graying all sampling subgraphs comprises the following steps: each pixel point f (i * ,j * ) Taking red R (i) * ,j * ) Green G (i) * ,j * ) Blue B (i) * ,j * ) The average of the three color components is used as the pixel point f (i * ,j * ) The quantized brightness value is graying, and the graying calculation method is as follows
Further, in step 3, the method for dividing each sampling sub-graph into a training sub-graph and a test sub-graph is as follows: that is, all the graying sampling subgraphs are randomly and equally divided into ten parts, nine parts of the graying sampling subgraphs are selected as training subgraphs, and the rest test subgraphs.
Further, in step 4, the method for constructing the support vector machine includes:
training subgraph is used as a sample set, and the sample set is (x i ,y i ),i=1...n,x∈R d Y epsilon { +1, -1} is the class label, in d-dimensional space R d In the linear discriminant function g (x) =ω T x+b, b classification threshold value calculated by any support vector, classifier equation is: omega T x+b=0。
Normalizing the discriminant function to ensure that all samples of two types meet the requirement of |g (x) |not less than 1, namely: so that the sample |g (x) |=1 nearest to the classifier, such that the classification interval is equal to 2/||omega|, equivalent to minimizing the norm of the support vector ω while requiring the classification line to correctly classify all samples, i.e., requiring it to satisfy the condition: y is iT x i +b)-1≥0,i=1...n,ω T Transpose of support vectors; satisfy the condition and let ω 2 The smallest classifier is the optimal classifier, and the closest point to the classifier in the two types of samples is parallel to the hyperplane H of the optimal classifier 1 ,H 2 The training samples are the samples of the optimal classifier, namely the support vector machine.
Further, in step 5, the method for training the support vector machine by using the training subgraph as the training sample is as follows: inputting a sample set, and expressing the optimal classifier problem as: y is iT x i Under the constraint that +b) -1 is greater than or equal to 0, i=1..n, solving a functionIs set to be a minimum value of (c),
the Lagrangian function is defined as:
wherein a is iFor Lagrangian coefficient, a i >0, partial differentiation of ω and b, respectively, and the result being equal to 0, under the constraint +.>a i 0.gtoreq.i=1. Pair a under n i The maximum value of the following function is solved:if->Maximum value, omega after training * The method comprises the following steps: />That is, the weight coefficient vector of the optimal classifier is a linear combination of training sample vectors, and the classifier equation of the optimization problem after training satisfies: a, a i [y iT x i +b)-1]=0, i=1..n; thus, for most samples->Will be 0, the value is not 0 +.>Corresponds to classifier equation y iT x i +b) -1 is greater than or equal to 0, i=1..n; the samples with the established equal sign, namely the support vector after training, are the optimal classification function obtained after solving the problems, namely the support vector machine after training is +.>Due to non-support vector correspondence +.>All 0, so that the summation in the equation is actually only performed on the support vector. And b * The method is characterized in that the method is obtained by any support vector after training, namely, an input space is firstly transformed into a high-dimensional space through nonlinear transformation defined by an inner product function, a generalized optimal classifier, namely, a nonlinear subinterval optimal classifier is obtained in the space, and the kernel function of the support vector machine after training comprises any one kernel function of a linear kernel function and a Gaussian radial basis kernel function, wherein the expression of the linear kernel function is K (x, x ')=a (x'); the gaussian radial basis function has the expression: />Where x and x' are vectors of samples.
Further, in step 6, the method for classifying and identifying the test subgraphs through the decimal cross validation according to the support vector machine comprises the following steps:
step 6.1, dividing the test subgraph as a training set into 10 subsets with equal size;
step 6.2, selecting one subset as a check set, adopting other subsets as training samples, and training a support vector machine according to the step 5;
step 6.3, using the trained classifier y iT x i +b) -1 is greater than or equal to 0, i=1..n performing iterative tests on the check set to record test errors until all subsets are checked;
and 6.4, counting all test errors.
Further, in step 6, the classifier used in the classification method is any one or a combination of two classifiers selected from the group consisting of a support vector machine and a two-dimensional principal component analysis.
The application also provides a galvanized steel and low-carbon steel classification device based on the photo, which comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor executing the computer program to run in units of:
the sliding resampling unit is used for reading the image to be identified and performing sliding resampling on the image to be identified according to the sliding window to generate a plurality of sampling subgraphs;
the sub-image graying unit is used for graying all the sampling sub-images;
the sub-graph classification unit is used for dividing each sampling sub-graph into a training sub-graph and a test sub-graph;
the vector machine building unit is used for building a support vector machine;
the vector machine training unit is used for training the support vector machine by taking the training subgraph as a training sample;
and the classification and identification unit is used for classifying and identifying the test subgraphs through the decimal cross verification according to the support vector machine.
The beneficial effects of the present disclosure are: the application provides a galvanized steel and low-carbon steel classification method and device based on photos, which are beneficial to online transaction classification of the two steels, have simple and convenient obtained classification characteristics, are universal, and reduce the cost of manual classification.
Drawings
The above and other features of the present disclosure will become more apparent from the detailed description of the embodiments illustrated in the accompanying drawings, in which like reference numerals designate like or similar elements, and which, as will be apparent to those of ordinary skill in the art, are merely some examples of the present disclosure, from which other drawings may be made without inventive effort, wherein:
FIG. 1 is a flow chart illustrating a method of classifying galvanized steel and low carbon steel based on photographs;
FIG. 2 is a schematic illustration of sliding resampling;
FIG. 3 is a graph showing the average classification accuracy of classification;
FIG. 4 is a photograph-based drawing of a galvanized steel and mild steel classification apparatus.
Detailed Description
The conception, specific structure, and technical effects produced by the present disclosure will be clearly and completely described below in connection with the embodiments and the drawings to fully understand the objects, aspects, and effects of the present disclosure. It should be noted that, without conflict, the embodiments of the present application and features of the embodiments may be combined with each other.
A flowchart of a photo-based galvanized steel and low carbon steel classification method according to the present disclosure is shown in fig. 1, and a photo-based galvanized steel and low carbon steel classification method according to an embodiment of the present disclosure is described below in conjunction with fig. 1.
The present disclosure provides a classification method for galvanized steel and low carbon steel based on photographs, which specifically comprises the following steps:
step 1, reading an image to be identified, and sliding and resampling the image to be identified according to a sliding window to generate a plurality of sampling subgraphs;
step 2, graying all sampling subgraphs;
step 3, dividing each sampling subgraph into a training subgraph and a testing subgraph;
step 4, constructing a support vector machine;
step 5, training a support vector machine by taking the training subgraph as a training sample;
and 6, classifying and identifying the test subgraphs through the decimal cross verification according to the support vector machine.
Further, in step 1, the reading of the image to be identified is that the crawler crawls pictures of steel, steel wires, steel strands, steel pipes, steel plates, steel products and steel coils in the website or manually downloads photo images of the steel, steel wires, steel strands, steel pipes, steel plates, steel products and steel coils in the website, after the photo images are stored, the photo images are manually cut, noise parts are removed from the reserved steel parts, the noise parts of the photo images are the surrounding environment where the steel products are located in the photo images, watermarks on the photo and workers appearing on the photo, and the image to be identified is obtained after the manual cutting.
Further, in step 1, the method for reading the image to be identified and sliding resampling the image to be identified according to the sliding window to generate a plurality of sampling subgraphs includes: sliding resampling is carried out on the image to be identified through a sliding window with 80 multiplied by 80 pixels to generate a plurality of sampling subgraphs, the sliding resampling is carried out on the image to be identified through the sliding window with the interval of 80 multiplied by 80 pixels, the sampling is that the image in the sliding window is stored as a new sub-image, the new sub-image is the sampling subgraph, the sliding window slides from the upper left corner of the original image, the sliding window is transversely or longitudinally moved by 40 pixels on the image for sampling each time until the sliding window traverses the image to be identified, and a plurality of sampling subgraphs are generated.
Further, in step 2, the method for graying all the sampling subgraphs includes: each pixel point f (i * ,j * ) Taking red R (i) * ,j * ) Green G (i) * ,j * ) Blue B (i) * ,j * ) The average of the three color components is used as the pixel point f (i * ,j * ) The quantized brightness value is graying, and the graying calculation method is as follows
Further, in step 3, the method for dividing each sampling sub-graph into a training sub-graph and a test sub-graph is as follows: that is, all the graying sampling subgraphs are randomly and equally divided into ten parts, nine parts of the graying sampling subgraphs are selected as training subgraphs, and the rest test subgraphs.
Further, in step 4, the method for constructing the support vector machine includes:
training subgraph is used as a sample set, and the sample set is (x i ,y i ),i=1...n,x∈R d Y epsilon { +1, -1} is the class label, in d-dimensional space R d In the linear discriminant function g (x) =ω T x+b, b is the threshold for classification, calculated from any support vector, the classifier equation is: omega T x+b=0;
Normalizing the discriminant function to ensure that all samples of two types meet the requirement of |g (x) |not less than 1, namely: so that the sample |g (x) |=1 nearest to the classifier, such that the classification interval is equal to 2/||omega|, equivalent to minimizing the norm of the support vector ω while requiring the classification line to correctly classify all samples, i.e., requiring it to satisfy the condition: y is iT x i +b)-1≥0,i=1...n,ω T Transpose of support vectors; satisfy the condition and let ω 2 The smallest classifier is the optimal classifier, and the closest point to the classifier in the two types of samples is parallel to the hyperplane H of the optimal classifier 1 ,H 2 The training samples are the samples of the optimal classifier, namely the support vector machine.
Further, in step 5, the method for training the support vector machine by using the training subgraph as the training sample is as follows: the input sample set, the optimal classifier problem is expressed as: y is iT x i Under the constraint that +b) -1 is greater than or equal to 0, i=1..n, solving a functionMinimum, defining a lagrangian function as:
wherein a is iFor Lagrangian coefficient, a i >0, partial differentiation of ω and b, respectively, and the result being equal to 0, under the constraint +.>a i 0.gtoreq.i=1. Pair a under n i The maximum value of the following function is solved:if->Maximum value, omega after training * The method comprises the following steps: />That is, the weight coefficient vector of the optimal classifier is a linear combination of training sample vectors, and the classifier equation of the optimization problem after training satisfies: a, a i [y iT x i +b)-1]=0, i=1..n; thus, for most samples->Will be 0, the value is not 0 +.>Corresponds to classifier equation y iT x i +b) -1 is greater than or equal to 0, i=1..n; the samples with the established equal sign, namely the support vector after training, are the optimal classification function obtained after solving the problems, namely the support vector machine after training is +.>Due to non-support vector correspondence +.>All 0, so that the summation in the equation is actually only performed on the support vector. And b * Is a threshold value of classification after training, and is obtained by any support vector, in general, the trained support vector machine firstly transforms an input space into a high-dimensional space through nonlinear transformation defined by an inner product function, a generalized optimal classifier, namely a nonlinear subnormal optimal classifier is obtained in the space, and a kernel function of the trained support vector machine comprises a linear kernel function and a GaussianAny one of the radial basis functions, wherein the expression of the linear kernel function is K (x, x ')=a (x×x'); the gaussian radial basis function has the expression: />Where x and x' are vectors of samples.
Further, in step 6, the method for classifying and identifying the test subgraphs through the decimal cross validation according to the support vector machine comprises the following steps:
step 6.1, dividing the test subgraph as a training set into 10 subsets with equal size;
step 6.2, selecting one subset as a check set, adopting other subsets as training samples, and training a support vector machine according to the step 5;
step 6.3, using the trained classifier y iT x i +b) -1 is greater than or equal to 0, i=1..n performing iterative tests on the check set to record test errors until all subsets are checked;
and 6.4, counting all test errors.
Further, in step 6, the classifier used in the classification method is any one or a combination of two classifiers selected from the group consisting of a support vector machine and a two-dimensional principal component analysis.
In one embodiment of the present application, first, the present application collects photographs of galvanized steel and low carbon steel from the web. The photo sources are google, hundred degrees, and alebab websites. Because the picture on the network has a lot of noise which is irrelevant to the identification task, such as the surrounding environment where the steel is located, the picture watermark, workers and the like, the picture is cut out in a first step after the picture is stored, the noise is removed as much as possible, and the part where the steel is located is reserved. In this way, pictures of the original galvanized steel and low carbon steel can be obtained.
Since there is some duplication in crawling pictures in the network by crawlers or manually downloading them in the network, there are few pictures that meet the conditions. In order to fully utilize the downloaded pictures, the application resamples the original pictures. Specifically, the application uses a small sliding window to slide on the picture, and extracts the part in the window as a new image. This operation is applied to all downloaded pictures so that a new series of pictures can be generated. This sliding resampling operation also allows all generated pictures to be uniform in size so that various pattern recognition algorithms can be applied on them.
In the newly generated pictures, a large proportion of the pictures are noise, such as the surrounding environment of steel during photographing, photo watermarks and the like. And removing the part of pictures which do not meet the requirements, wherein the rest pictures are pictures meeting the requirements of classification and identification.
And finally, classifying and identifying the pictures obtained in the steps. Specifically, the application applies the ten-fold cross-validation to the set of data, namely randomly dividing all pictures into ten parts, selecting nine parts of the pictures as training each time, and repeating ten times by using the rest parts as testing until all the pictures are tested. After the identification result of the test picture is obtained, a total classification accuracy can be calculated and used for evaluating the performance of the classification identification framework.
In another embodiment of the present application, the photos are downloaded from the web. The photo sources are google, hundred degrees, and alebab websites. Since the present application aims to identify the type of steel based on a photograph of the steel, a photograph satisfying the requirements needs to be able to better present information such as color, texture, etc. of the steel. The coil of steel meets this requirement and is therefore selected for use. In addition to the coil of steel, many photographs of related steel materials, such as steel wires, steel strands, steel pipes, steel sheets, outer packaging for steel products, advertising pages, etc., are filtered. After careful searching and selection, a total of 53 photographs of galvanized steel coils and 18 photographs of mild steel coils were obtained.
And manually cutting the collected photos to remove the part containing more noise, thereby obtaining a series of new steel pictures. The noise in a portion of the photograph is not completely removed, which is preserved in order to make full use of the picture. These noise will be removed after sliding resampling. Although the main body in these pictures is steel, the effect exhibited by the steel pictures themselves is affected by many factors, including the shooting angle; ambient light intensity; the distance between the lens and the steel coil; reflection or shading of the steel surface; some shielding of the steel surface, such as wrapping tape, text marking; the cambered surface, the side surface and the winding hole of the steel coil are different. In addition, zinc is a surface of galvanized steel, which appears to have a relatively uniform appearance to the naked eye, while low-carbon steel is a generic term for steels having a carbon content of less than 0.25%, and it is also possible to separate very many kinds of subspecies, which may vary in appearance, depending on the quality, forming method, metallographic structure, classification of use, smelting method, etc. This is a great challenge for classification algorithms. Although these factors have a great influence on the picture recognition effect, the present application does not specifically deal with or operate on these factors in view of their objectively existing. These factors present difficulties, and it is the verification of the effectiveness of the recognition algorithm.
After obtaining an image with a body of steel, slide resampling is performed on the picture with a slide window of 80×80.
As shown in fig. 2, fig. 2 is a schematic diagram of sliding resampling. Sliding resampling is performed by placing an 80 x 80 sliding window over the picture and saving the image in the window as a new picture. The sliding is started from the upper left corner of the original picture, and the sliding window is transversely or longitudinally moved on the picture for 40 pixel points each time until the sliding window traverses the whole picture. Applying this sliding resampling step to all pictures, a new series of pictures can be obtained. From these pictures, the pictures that are clearly noisy are manually removed, leaving the pictures that can be used for classification. Since the initial manual cropping is performed before, the number of pictures that need to be removed in this step is small. Through two steps of sliding resampling and deleting noise pictures, 3696 new pictures are generated by galvanized steel pictures, and 495 new pictures are generated by low carbon steel pictures.
Due to unbalance of the two types of samples, 495 samples are randomly selected from the galvanized steel pictures during classification, so that the two types of samples are balanced. Since the pictures are themselves colored, and color information can be omitted in classification, all the pictures are subjected to graying before classification and identification, and 495 Zhang Duxin steel pictures and 495 low carbon steel pictures are classified by adopting ten-fold cross validation after graying. The pictures are randomly equally divided into ten parts, nine parts are selected each time as training, the rest is used as test, ten times are repeated until all the pictures are tested, and then the classification accuracy is calculated.
The application adopts two popular pattern recognition classification algorithms to classify, namely a support vector machine and two-dimensional principal component analysis. The average classification accuracy obtained by the former is 0.5293, and the average classification accuracy obtained by the latter is 0.5293;
as shown in fig. 3, fig. 3 is an average classification accuracy chart obtained by classification, and the maximum is 0.6940 when the first 5 two-dimensional principal components are selected. The two-sample t-test shows that the obtained recognition rate is significantly higher than the random level, and the two-dimensional principal component analysis has obvious advantages in the classification task compared with a support vector machine.
In summary, the application provides a process for classifying and identifying galvanized steel and low-carbon steel based on photos, and is successfully applied to classifying photos downloaded from a network.
The embodiment of the disclosure provides a galvanized steel and low carbon steel sorting device based on photos, as shown in fig. 4, which is a diagram of the galvanized steel and low carbon steel sorting device based on photos of the disclosure, and the galvanized steel and low carbon steel sorting device based on photos of the embodiment comprises: a processor, a memory, and a computer program stored in the memory and executable on the processor, which when executed implements the steps of one of the above-described photo-based galvanized steel and mild steel classification device embodiments.
The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor executing the computer program to run in units of:
the sliding resampling unit is used for reading the image to be identified and performing sliding resampling on the image to be identified according to the sliding window to generate a plurality of sampling subgraphs;
the sub-image graying unit is used for graying all the sampling sub-images;
the sub-graph classification unit is used for dividing each sampling sub-graph into a training sub-graph and a test sub-graph;
the vector machine building unit is used for building a support vector machine;
the vector machine training unit is used for training the support vector machine by taking the training subgraph as a training sample;
and the classification and identification unit is used for classifying and identifying the test subgraphs through the decimal cross verification according to the support vector machine.
The galvanized steel and low carbon steel classification device based on the photos can be operated in computing equipment such as desktop computers, notebooks, palm computers, cloud servers and the like. The photo-based galvanized steel and mild steel sorting device may include, but is not limited to, a processor, a memory. It will be appreciated by those skilled in the art that the examples are merely examples of one type of photo-based galvanized steel and mild steel classification device and are not limiting of one type of photo-based galvanized steel and mild steel classification device, may include more or fewer components than examples, or may combine certain components, or different components, such as the one type of photo-based galvanized steel and mild steel classification device may also include input and output devices, network access devices, buses, etc.
The processor may be a central processing unit (Central Processing Unit, CPU), other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like, which is the control center of the one photo-based galvanized steel and mild steel sorting device operating device, connecting the various parts of the entire one photo-based galvanized steel and mild steel sorting device operating device using various interfaces and lines.
The memory may be used to store the computer program and/or module, and the processor may implement the various functions of the photo-based galvanized steel and mild steel classification device by running or executing the computer program and/or module stored in the memory and invoking data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like; the storage data area may store data (such as audio data, phonebook, etc.) created according to the use of the handset, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as a hard disk, memory, plug-in hard disk, smart Media Card (SMC), secure Digital (SD) Card, flash Card (Flash Card), at least one disk storage device, flash memory device, or other volatile solid-state storage device.
While the present disclosure has been described in considerable detail and with particularity with respect to several described embodiments, it is not intended to be limited to any such detail or embodiments or any particular embodiment, but is to be construed as providing broad interpretation of such claims by reference to the appended claims in view of the prior art so as to effectively encompass the intended scope of the disclosure. Furthermore, the foregoing description of the present disclosure has been presented in terms of embodiments foreseen by the inventor for the purpose of providing a enabling description for enabling the enabling description to be available, notwithstanding that insubstantial changes in the disclosure, not presently foreseen, may nonetheless represent equivalents thereto.

Claims (5)

1. A method for classifying galvanised steel and mild steel based on photographs, said method comprising the steps of:
step 1, reading an image to be identified, sliding and resampling the image to be identified according to a sliding window to generate a plurality of sampling subgraphs, wherein the image to be identified is a photograph of galvanized steel and low-carbon steel;
step 2, graying all sampling subgraphs;
the method for graying all sampling subgraphs comprises the following steps: each pixel point f (i * ,j * ) Taking red R (i) * ,j * ) Green G (i) * ,j * ) Blue B (i) * ,j * ) The average of the three color components is used as the pixel point f (i * ,j * ) The quantized brightness value is graying, and the graying calculation method is as follows
Step 3, dividing each sampling subgraph into a training subgraph and a testing subgraph;
step 4, constructing a support vector machine;
step 5, training a support vector machine by taking the training subgraph as a training sample;
step 6, classifying and identifying the test subgraphs through the decimal cross validation according to the support vector machine;
in step 4, the method for constructing the support vector machine is as follows:
training subgraph is used as a sample set, and the sample set is (x i ,y i ),i=1...n,x∈R d Y epsilon { +1, -1} is the class label, in d-dimensional space R d In the linear discriminant function g (x) =ω T x+b, b classification threshold value calculated by any support vector, classifier equation is: omega T x+b=0, normalizing the discriminant function to make all samples of two types meet |g (x) |gtoreq 1, namely: so that the sample |g (x) |=1 nearest to the classifier, such that the classification interval is equal to 2/||omega|, equivalent to minimizing the norm of the support vector ω while requiring the classification line to correctly classify all samples, i.e., requiring it to satisfy the condition: y is iT x i +b)-1≥0,i=1...n,ω T Transpose of support vectors; satisfy the condition and let ω 2 The smallest classifier is the optimal classifierThe closest point to the classifier in the two types of samples is parallel to the hyperplane H of the optimal classifier 1 ,H 2 The training sample is the sample of the optimal classifier, namely the support vector machine;
in step 5, the method for training the support vector machine by using the training subgraph as a training sample comprises the following steps: inputting a sample set, and expressing the optimal classifier problem as: y is iT x i Under the constraint that +b) -1 is greater than or equal to 0, i=1..n, solving a functionDefining a lagrangian function as: />Wherein a is i 、/>For Lagrangian coefficient, a i >0, partial differentiation of ω and b is performed respectively, and the result is equal to 0, under constraint conditionsSolving ai for the maximum of the following function:if->Maximum value, omega after training * The method comprises the following steps: />That is, the weight coefficient vector of the optimal classifier is a linear combination of training sample vectors, and the classifier equation of the optimization problem after training satisfies: a, a i [y iT x i +b)-1]=0, i=1..n; thus, for most samples->Will be 0, the value is not 0 +.>Corresponds to classifier equation y iT x i +b) -1 is greater than or equal to 0, i=1..n; the samples with the established equal sign are trained and then support the vector machine to be,
2. the method for classifying galvanized steel and low-carbon steel based on photo according to claim 1, wherein in step 1, the method for reading the image to be recognized and sliding resampling the image to be recognized according to a sliding window to generate a plurality of sampling subgraphs comprises the following steps: sliding resampling is carried out on the image to be identified through a sliding window with 80 multiplied by 80 pixels to generate a plurality of sampling subgraphs, the sliding resampling is carried out on the image to be identified through the sliding window with the interval of 80 multiplied by 80 pixels, the sampling is that the image in the sliding window is stored as a new sub-image, the new sub-image is the sampling subgraph, the sliding window slides from the upper left corner of the original image, the sliding window is transversely or longitudinally moved by 40 pixels on the image for sampling each time until the sliding window traverses the image to be identified, and a plurality of sampling subgraphs are generated.
3. The method for classifying galvanized steel and low carbon steel based on photo according to claim 1, wherein in step 3, the method for dividing each sampling sub-graph into a training sub-graph and a test sub-graph is as follows: that is, all the graying sampling subgraphs are randomly and equally divided into ten parts, nine parts of the graying sampling subgraphs are selected as training subgraphs, and the rest test subgraphs.
4. The method for classifying galvanized steel and low carbon steel based on photo according to claim 1, wherein in step 6, the method for classifying and identifying the test subgraphs by the ten-fold cross-validation according to the support vector machine comprises the following steps:
step 6.1, dividing the test subgraph as a training set into 10 subsets with equal size;
step 6.2, selecting one subset as a check set, adopting other subsets as training samples, and training a support vector machine according to the step 5;
step 6.3, using the trained classifier y iT x i +b) -1 is greater than or equal to 0, i=1..n, performing iterative testing on the check set to record testing errors until all subsets are checked;
and 6.4, counting all test errors.
5. A photograph-based galvanized steel and mild steel classification apparatus, the apparatus comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor executing the computer program to run in units of:
the sliding resampling unit is used for reading an image to be identified and carrying out sliding resampling on the image to be identified according to a sliding window to generate a plurality of sampling subgraphs, wherein the image to be identified is a photograph of galvanized steel and low carbon steel;
the sub-image graying unit is used for graying all the sampling sub-images;
the method for graying all sampling subgraphs comprises the following steps: each pixel point f (i * ,j * ) Taking red R (i) * ,j * ) Green G (i) * ,j * ) Blue B (i) * ,j * ) The average of the three color components is used as the pixel point f (i * ,j * ) The quantized brightness value is graying, and the graying calculation method is as follows
The sub-graph classification unit is used for dividing each sampling sub-graph into a training sub-graph and a test sub-graph;
the vector machine building unit is used for building a support vector machine;
the vector machine training unit is used for training the support vector machine by taking the training subgraph as a training sample;
the classifying and identifying unit is used for classifying and identifying the test subgraphs through the decimal cross verification according to the support vector machine;
the method for constructing the support vector machine comprises the following steps:
training subgraph is used as a sample set, and the sample set is (x i ,y i ),i=1...n,x∈R d Y epsilon { +1, -1} is the class label, in d-dimensional space R d In the linear discriminant function g (x) =ω T x+b, b classification threshold value calculated by any support vector, classifier equation is: omega T x+b=0, normalizing the discriminant function to make all samples of two types meet |g (x) |gtoreq 1, namely: so that the sample |g (x) |=1 nearest to the classifier, such that the classification interval is equal to 2/||omega|, equivalent to minimizing the norm of the support vector ω while requiring the classification line to correctly classify all samples, i.e., requiring it to satisfy the condition: y is iT x i +b)-1≥0,i=1...n,ω T Transpose of support vectors; satisfy the condition and let ω 2 The smallest classifier is the optimal classifier, and the closest point to the classifier in the two types of samples is parallel to the hyperplane H of the optimal classifier 1 ,H 2 The training sample is the sample of the optimal classifier, namely the support vector machine;
the method for training the support vector machine by taking the training subgraph as a training sample comprises the following steps: inputting a sample set, and expressing the optimal classifier problem as: y is iT x i Under the constraint that +b) -1 is greater than or equal to 0, i=1..n, solving a functionDefining a lagrangian function as: />Wherein a is i 、/>For Lagrangian coefficient, a i >0, partial differentiation of ω and b, respectively, and making the result equal to 0, under constraintCondition->a i Not less than 0, i=1..n; pair a i The maximum value of the following function is solved: />If->Maximum value, omega after training * The method comprises the following steps:that is, the weight coefficient vector of the optimal classifier is a linear combination of training sample vectors, and the classifier equation of the optimization problem after training satisfies: a, a i [y iT x i +b)-1]=0, i=1..n; thus, for most samples->Will be 0, the value is not 0 +.>Corresponds to classifier equation y iT x i +b) -1 is greater than or equal to 0, i=1..n; samples with established equal sign, support vector machine after training is ++>
CN201811632530.2A 2018-12-29 2018-12-29 Photo-based galvanized steel and low-carbon steel classification method and device Active CN109766939B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811632530.2A CN109766939B (en) 2018-12-29 2018-12-29 Photo-based galvanized steel and low-carbon steel classification method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811632530.2A CN109766939B (en) 2018-12-29 2018-12-29 Photo-based galvanized steel and low-carbon steel classification method and device

Publications (2)

Publication Number Publication Date
CN109766939A CN109766939A (en) 2019-05-17
CN109766939B true CN109766939B (en) 2023-09-26

Family

ID=66452680

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811632530.2A Active CN109766939B (en) 2018-12-29 2018-12-29 Photo-based galvanized steel and low-carbon steel classification method and device

Country Status (1)

Country Link
CN (1) CN109766939B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110532924A (en) * 2019-08-22 2019-12-03 江苏联峰实业有限公司 A kind of identifying processing method and device of high heat resistance steel

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104112143A (en) * 2014-07-23 2014-10-22 大连民族学院 Weighted hyper-sphere support vector machine algorithm based image classification method
CN105426842A (en) * 2015-11-19 2016-03-23 浙江大学 Support vector machine based surface electromyogram signal multi-hand action identification method
CN106295661A (en) * 2016-08-15 2017-01-04 北京林业大学 The plant species identification method of leaf image multiple features fusion and device
CN107679453A (en) * 2017-08-28 2018-02-09 天津大学 Weather radar electromagnetic interference echo recognition methods based on SVMs
CN107688829A (en) * 2017-08-29 2018-02-13 湖南财政经济学院 A kind of identifying system and recognition methods based on SVMs
CN108647718A (en) * 2018-05-10 2018-10-12 江苏大学 A kind of different materials metallographic structure is classified the method for grading automatically
CN108765412A (en) * 2018-06-08 2018-11-06 湖北工业大学 A kind of steel strip surface defect sorting technique

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104112143A (en) * 2014-07-23 2014-10-22 大连民族学院 Weighted hyper-sphere support vector machine algorithm based image classification method
CN105426842A (en) * 2015-11-19 2016-03-23 浙江大学 Support vector machine based surface electromyogram signal multi-hand action identification method
CN106295661A (en) * 2016-08-15 2017-01-04 北京林业大学 The plant species identification method of leaf image multiple features fusion and device
CN107679453A (en) * 2017-08-28 2018-02-09 天津大学 Weather radar electromagnetic interference echo recognition methods based on SVMs
CN107688829A (en) * 2017-08-29 2018-02-13 湖南财政经济学院 A kind of identifying system and recognition methods based on SVMs
CN108647718A (en) * 2018-05-10 2018-10-12 江苏大学 A kind of different materials metallographic structure is classified the method for grading automatically
CN108765412A (en) * 2018-06-08 2018-11-06 湖北工业大学 A kind of steel strip surface defect sorting technique

Also Published As

Publication number Publication date
CN109766939A (en) 2019-05-17

Similar Documents

Publication Publication Date Title
Alotaibi et al. Deep face liveness detection based on nonlinear diffusion using convolution neural network
Walia et al. Digital image forgery detection: a systematic scrutiny
US20220019853A1 (en) Systems, methods, and storage media for training a machine learning model
JP5527554B2 (en) Image search method, image search program, and image registration method
CN108446621A (en) Bank slip recognition method, server and computer readable storage medium
Chen et al. A multi-purpose image forensic method using densely connected convolutional neural networks
CN110032989B (en) Table document image classification method based on frame line characteristics and pixel distribution
CN106846011A (en) Business license recognition methods and device
Zhu et al. Blind image splicing detection via noise level function
US11599983B2 (en) System and method for automated electronic catalogue management and electronic image quality assessment
Rafique et al. Deep fake detection and classification using error-level analysis and deep learning
Park et al. Fast and robust copy-move forgery detection based on scale-space representation
Jhang et al. CNN training for face photo based gender and age group prediction with camera
CN109766939B (en) Photo-based galvanized steel and low-carbon steel classification method and device
CN108694398B (en) Image analysis method and device
CN111178398A (en) Method, system, storage medium and device for detecting tampering of image information of identity card
Kumar et al. PCB defect classification using logical combination of segmented copper and non-copper part
Ghosh et al. GSD-Net: compact network for pixel-level graphical symbol detection
Rafi et al. L2-constrained remnet for camera model identification and image manipulation detection
Paczolay et al. Wlab of university of szeged at lifeclef 2014 plant identification task
CN111027670B (en) Feature map processing method and device, electronic equipment and storage medium
Zhou et al. Real time detection of surface defects with inception-based MobileNet-SSD detection network
Ahmed et al. Blind copy-move forgery detection using SVD and KS test
Tan et al. Multi-scale attentive residual network for single image deraining
Rafi RemNet: Remnant Convolutional Neural Network for Camera Model Identification and Image Manipulation Detection

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant