Lightweight automobile part defect classification method based on knowledge distillation
Patent Information
- Application Number
- CN202611236579.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-14
- Publication Date
- 2026-11-03
AI Technical Summary
Existing lightweight convolutional networks have limited stability in classifying surface defects such as low-contrast cracks, fine scratches, small dents, rust spots, and stains in automotive parts inspection, making it difficult to improve inspection accuracy without increasing production line hardware and inspection cycle pressure.
By using a knowledge distillation-based approach, a ring-shaped brightness deviation map is generated from pixel position and brightness information in industrial camera images. This map is then combined with a teacher network to train a lightweight student network, ensuring consistent input during the training and detection phases and improving the sensitivity to local brightness anomalies.
It improves the classification stability of low-contrast defects without increasing hardware and inspection time, and maintains low inference burden on edge computing devices, making it suitable for classifying surface defects of automotive parts in industrial vision inspection.
Smart Images

Figure CN123033041A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial visual inspection technology, and more specifically, to a method for classifying defects in lightweight automotive parts based on knowledge distillation. Background Technology
[0002] For rotating parts such as automotive brake discs, wheel hubs, and bearing rings, stable assessment of the working surface or surface condition is required during pre-machining, heat treatment, handling, and assembly inspections. Production lines are typically equipped with industrial cameras, fixed-focus lenses, ring light sources, triggers, industrial control computers, or edge computing devices to acquire images. After image acquisition, these images undergo cropping, scaling, normalization, region localization, and classification network inference. The inspection results then enter the sorting, rework, re-inspection, or quality traceability processes.
[0003] In brake disc friction surface inspection, concentric machining textures, lighting gradients, and differences in surface reflection can coexist with defects such as cracks, scratches, dents, rust spots, and stains. Field models need to run under cycle time constraints, typically employing lightweight convolutional networks to reduce inference time and model file size. However, lightweight networks have fewer channels and stronger downsampling, making them more susceptible to being affected by normal textures and local exposure fluctuations in response to narrow or low-contrast anomalies, thus limiting classification stability.
[0004] Knowledge distillation, which uses the class probability distribution of a larger teacher network to guide the training of a lightweight student network, is a common practice in industrial vision model compression. This approach mainly improves the student network's learning of inter-class relationships. However, the online input for the student network is still mainly conventional images. If the differences between defects and processing textures in the input are not obvious, distillation training itself is difficult to continuously supplement local anomaly cues in the field images.
[0005] Therefore, without increasing production line hardware and inspection cycle pressure, how to utilize the existing pixel position and brightness information of camera images to provide the local brightness deviation within the same ring range of the surface of rotating parts to a lightweight student network in a stable input form, and ensure that the processing is consistent between the training phase and the online inspection phase, is a problem that needs to be addressed in the deployment of surface defect classification for automotive parts. Summary of the Invention
[0006] This invention provides a method for classifying defects in lightweight automotive parts based on knowledge distillation, which solves the technical problems mentioned in the background art.
[0007] To achieve the above-mentioned objectives, the present invention provides the following technical solution.
[0008] A knowledge distillation-based method for classifying defects in lightweight automotive parts is used to classify defects in surface images of automotive parts that have center positions determined by image pixel locations and can form concentric ring reference relationships. This includes: Collect raw images and create a labeled dataset with category labels; Preprocess the original image to obtain the i-th part image and the effective area of the part, where i represents the image number; Determine the center's horizontal and vertical positions based on the effective area of the part. Based on the horizontal pixel position, vertical pixel position, and pixel brightness, establish a set of reference pixels in the same ring based on the radius distance difference, azimuth distance difference, ring half-width, nearest neighbor exclusion angle, and far neighbor cutoff angle. The median brightness of the pixels in the same ring reference pixel set is obtained by taking the median value of the brightness of the same ring. The brightness deviation value of the same ring is determined based on the normalized deviation of the brightness of the pixel to be measured relative to the median brightness of the same ring. The brightness deviation map of the same ring corresponding to the i-th part image is formed as the i-th deviation map. Enable the teacher network to receive the i-th part image, and enable the lightweight student network to receive the channel stitching result of the i-th part image and the i-th offset image; The total training loss is determined based on the label classification loss and distillation matching loss, and only the parameters of the lightweight student network are updated; During online detection, the original images acquired in the online detection phase undergo the same preprocessing as those in the training phase to obtain online detection images. The trained lightweight student network then outputs the defect category and confidence level based on the channel stitching results of the online detection images and the corresponding ring brightness deviation maps.
[0009] Compared with the prior art, the present invention has the following substantial features and significant progress: This invention converts the center position, horizontal pixel position, vertical pixel position, and pixel brightness in industrial camera images into a ring-shaped brightness deviation map, enabling a lightweight student network to receive local brightness anomaly input while receiving images of regular parts. This processing, combined with knowledge distillation training of the teacher network, can improve the classification stability of surface defects such as low-contrast cracks, fine scratches, small dents, rust spots, and stains without increasing the number of on-site cameras, light sources, or additional sensors, while maintaining a low inference burden on edge computing devices. The online detection stage uses the same preprocessing and channel stitching methods as the training stage to output defect categories and confidence levels, facilitating production line sorting, defect marking, manual re-inspection, and quality recording. Attached Figure Description
[0010] Figure 1 This is a schematic diagram of the architecture and data flow of the lightweight automotive parts defect classification system based on knowledge distillation of the present invention. Detailed Implementation
[0011] The following description is provided in conjunction with the accompanying drawings. It should be understood that the following embodiments are for illustrative purposes only and are not intended to limit the invention; those skilled in the art can make equivalent substitutions or combinations for the specific implementations.
[0012] Example 1: This embodiment is applicable to defect classification of automotive part surface images whose center position can be determined by the image pixel position and which can form a concentric reference relationship. The automotive part surface image can originate from the friction surface of an automotive brake disc, or from automotive part surfaces with common annular, arc-shaped, or approximately concentric structural relationships. In this embodiment, for ease of explanation, the automotive brake disc friction surface image is used as the main illustrative object. The automotive brake disc friction surface typically has concentric machining textures extending around the center. Surface defects such as low-contrast cracks, fine scratches, small pits, rust spots, and stains may coexist with normal machining textures, lighting gradients, and differences in surface reflection. When the number of channels and downsampling capability are limited, lightweight student networks are prone to weakening local anomaly cues during deep feature aggregation.
[0013] Specifically, this implementation, without adding a field camera, light source, or additional sensors, utilizes the existing horizontal and vertical pixel positions and pixel brightness in the original image, combined with the center horizontal and center vertical positions determined by the effective area of the part, to establish a ring-shaped reference pixel set. Then, using the median pixel brightness in the ring-shaped reference pixel set as the ring-shaped brightness median, the normalized deviation of the brightness of the pixel to be tested relative to the ring-shaped brightness median is calculated to obtain the ring-shaped brightness deviation value, which is further used to form a ring-shaped brightness deviation map. Through this ring-shaped brightness deviation map, the lightweight student network receives not only the i-th part image but also the i-th deviation map, thus obtaining inputs that are more sensitive to local brightness anomalies during both the training and online detection phases.
[0014] like Figure 1 As shown, the system corresponding to this embodiment includes an image acquisition module, a labeled data management module, a preprocessing module, a same-ring brightness deviation map calculation module, a teacher network training module, a student network training module, a knowledge distillation training module, and an online classification module. Figure 1 The data acquisition area includes an image acquisition module 100 and a labeled data management module 200. The image processing area includes a preprocessing module 300 and a same-ring brightness deviation map calculation module 400. The training area includes a teacher network training module 500, a student network training module 600, and a knowledge distillation training module 700. An online classification module 800 is located on the far right. The online classification module 800, located outside the training area, represents the on-site detection output after training. The lightweight student network it receives is output by the knowledge distillation training module 700. The online detection images and their corresponding same-ring brightness deviation maps are generated in real-time by the preprocessing module 300 and the same-ring brightness deviation map calculation module 400. Figure 1Solid arrows represent the data flow during the training phase, while dashed arrows represent the data flow during the online detection phase.
[0015] Example 2: The image acquisition module 100 is used to acquire raw images and output them to the preprocessing module 300. In specific implementations, an industrial camera, fixed-focus lens, diffused ring light source, photoelectric trigger, and industrial computer can be installed on the automotive brake disc conveyor line, offline inspection station, or quality re-inspection station. This ensures that the friction surface of the automotive brake disc is substantially perpendicular to the camera's optical axis during imaging, and that the camera height, focal length, exposure time, and light source operating status remain consistent across the same batch of inspections. The aforementioned hardware is a standard configuration in industrial vision inspection, used to ensure that the raw images have repeatable imaging conditions.
[0016] When the automotive part reaches the shooting position, a photoelectric trigger sends a trigger signal to the industrial camera, which then acquires the original image. The image acquisition module 100 can write the original image, part number, shooting time, and workstation number into the data storage area. When multiple perspectives are needed to capture the same automotive part, the original images from each perspective can be saved separately according to a preset shooting order, and each original image from each perspective can be associated with the same part number. This setting allows for the identification of different perspective images of the same automotive part when subsequent training samples are grouped and read according to part number, avoiding information leakage of the same physical sample during data partitioning or verification evaluation.
[0017] The labeled data management module 200 is used to create a labeled dataset with category labels and output the category labels to the teacher network training module 500 and the knowledge distillation training module 700. The category labels can be determined based on existing quality inspection standards in the production site. These standards can classify automotive part surface images into categories such as normal, cracks, scratches, dents, rust spots, and stains. Inspectors can assign category labels to each original image or the i-th pre-processed part image based on the results of physical re-inspection. When an original image contains multiple anomalies, the main defect category can be selected according to established on-site rules, or the corresponding image can be included in existing multi-label data records; this processing is a routine engineering process in labeled data management.
[0018] In terms of category labeling, defect categories can include outputs such as normal, cracks, scratches, dents, rust spots, and stains. "Normal" indicates that no surface defects as defined by the on-site quality inspection standard were detected. Therefore, "normal" is not a separate output parameter from the defect category, but rather a classification output within the set of defect categories.
[0019] The labeled dataset can be saved as a CSV file, JSON file, database table, or index file supported by the training framework. Record fields in the labeled dataset may include the original image path, part number, category label, shooting time, workstation number, and dataset partition identifier. To ensure terminology consistency, this embodiment consistently refers to the manually labeled results used for supervised training as category labels, and consistently refers to the dataset containing category labels as the labeled dataset. The labeled data management module 200 outputs category labels to the teacher network training module 500 to support the teacher network training using the i-th part image and category labels; the labeled data management module 200 outputs category labels to the knowledge distillation training module 700 to support the determination of the label classification loss.
[0020] During the creation of the labeled dataset, blurry, severely overexposed, misplaced car parts, or excessively obstructed original images can be removed. The reasons for removal can also be recorded in the labeled dataset. The purpose of this removal process is to prevent obviously invalid original images from affecting the training of both the teacher's network and the lightweight student network. This process is simply routine data cleaning.
[0021] Example 3: The preprocessing module 300 generates the i-th part image and the effective part region based on the original image, and performs the same preprocessing on the original image acquired during the online detection phase as during the training phase to obtain the online detection image. The i-th part image refers to the input image obtained after cropping, scaling, channel order unification, pixel normalization, and mean-variance standardization of the i-th image sample during the training phase, where i represents the image sequence number. The effective part region refers to the set of pixels in the image that belong to the friction surface of the car brake disc or other target surfaces of the car parts to be detected, used to determine the center lateral position and center longitudinal position.
[0022] The preprocessing module 300 can first convert the original image into a grayscale image. When the original image itself is a grayscale image, the grayscale image can be directly obtained from the original image; when the original image is a color image, a conventional weighted grayscale conversion method can be used to obtain the grayscale image. The position in the grayscale image is determined by the horizontal pixel position and the vertical pixel position. The pixel brightness at that location is denoted as .in, Indicates the horizontal pixel position. Indicates the vertical pixel position. Indicates pixel brightness.
[0023] Under fixed background and lighting conditions, the preprocessing module 300 can obtain candidate regions based on the grayscale image by segmenting a brightness threshold. Specifically, pixels whose brightness is not lower than the segmentation brightness threshold can be used as the initial pixels of the candidate regions. Then, contour closure, hole filling, and maximum connected region selection are performed on the candidate regions to obtain the effective region of the part. This process is consistent with the preprocessing process defined in the claims, wherein the segmentation brightness threshold is a conventional threshold for extracting the brake disc region from a fixed imaging background, and contour closure, hole filling, and maximum connected region selection are all conventional processes in industrial vision segmentation.
[0024] The segmentation brightness threshold can be determined during the on-site calibration stage. Specifically, after fixing the camera exposure time, light source operating current, and shooting distance, acquire one background image without the car parts and at least one calibration image with the car parts placed and in the correct position. Convert both the background image and the calibration image to the same pixel brightness scale as subsequent calculations. If using an 8-bit grayscale image, first divide the grayscale value by 255 to obtain the threshold. The pixel brightness within the range. Then, the maximum pixel brightness of the background is obtained in the background image. The minimum pixel brightness of the automotive part is obtained within the friction surface area of the part, determined by manual selection or existing positioning fixtures in the calibration image. The midpoint between the two values is used as the initial value for the brightness threshold.
[0025]
[0026] In the above formula, This indicates the segmentation brightness threshold. Indicates the maximum pixel brightness of the background. This represents the minimum pixel brightness of the part. All three are at the same pixel brightness scale, therefore they can be directly compared. If the automotive part appears as a low-brightness target relative to the background, the candidate region condition is changed accordingly to ensure the pixel brightness does not exceed the segmentation brightness threshold, which is still calibrated according to the same pixel brightness scale. High-brightness target rules and low-brightness target rules must not be mixed simultaneously in the same production line batch.
[0027] When performing contour closure on candidate regions, a square structuring element with a side length of 3 or 5 pixels can be used to perform one or two closure processes. The size of the structuring element is determined based on the continuity of the part's edges on the validation set. Hole filling is used to fill internal holes that are completely surrounded by candidate regions and whose area is less than 5% of the effective area of the part. Maximum connected region selection is used to select the connected region with the largest area as the effective area of the part from multiple connected regions. If the area of the largest connected region is less than 60% of the effective area of the part in the calibration image, the preprocessing module 300 records the original image as an invalid original image and does not enter the classification output process of the teacher network training, lightweight student network training, or online classification module 800.
[0028]
[0029] In the above formula, Indicates the effective area of the part. This represents the pixel position determined by the horizontal and vertical pixel positions. Indicates pixel brightness. This represents the segmentation brightness threshold. This formula describes how the effective area of a part can be obtained from a grayscale image in one feasible implementation, and does not require a single segmentation algorithm to be used. As long as the preprocessing module 300 can obtain the effective area of the part used to determine the center lateral and center longitudinal positions, subsequent calculations of the same-ring brightness deviation map can be performed.
[0030] After obtaining the effective area of the part, the preprocessing module 300 crops and scales the original image according to the effective area, and performs channel order unification, pixel normalization, and mean-variance standardization. Cropping can preserve the image range containing the friction surface of the car brake disc or the surface of the target car part, and scaling can adjust the cropped image to a uniform size. Pixel size. Here, Indicates the height of the input image. This represents the width of the input image. Channel order consistency is used to ensure that the input channels are arranged consistently during the training and online detection phases; pixel normalization and mean-variance standardization are used to make the numerical scale of different batches of original images easier for network training and inference.
[0031] During cropping, the preprocessing module 300 can first obtain the minimum bounding rectangle of the effective area of the part, and then add cropping edge allowances around the minimum bounding rectangle. The cropping edge allowance can be 5% to 10% of the length of the short side of the minimum bounding rectangle, and the part exceeding the original image boundary is truncated to within the original image boundary. During scaling, the i-th part image and the effective area of the part use the same target size; in one feasible example, the target size can be taken as... and The original image or color image channels use bilinear interpolation, while the effective area of the part uses nearest-neighbor interpolation. This avoids grayscale transitions between non-part pixels and part pixels during scaling. The same cropping margin, target size, and interpolation method are used in both the training and online detection phases.
[0032] The preprocessing module 300 also determines the center horizontal and center vertical positions based on the effective area of the part. Specifically, the number of effective pixels in the effective area of the part can be determined first, and then the horizontal and vertical pixel positions of the pixels in the effective area of the part can be averaged to obtain the center horizontal and center vertical positions. The center horizontal and center vertical positions are only used to establish the image coordinate relationship and do not represent the processing or mechanical adjustment of the physical center of the automotive part.
[0033] The i-th part image, the effective area of the part, and the i-th offset image all use the same cropped and scaled image coordinate system. This image coordinate system has the top-left pixel as the origin, with the horizontal pixel position increasing from left to right along the column direction and the vertical pixel position increasing from top to bottom along the row direction. The center horizontal and vertical positions are both determined in this cropped and scaled image coordinate system; therefore, the distance of subsequent pixels to the center, the angle of pixels around the center, the radius distance difference, and the azimuth distance difference are all calculated based on the same coordinate scale.
[0034]
[0035] In the above formula, Indicates the number of valid pixels. Indicates the effective area of the part. This indicates the total number of pixels in the effective area of the part.
[0036]
[0037] In the above formula, Indicates the horizontal position of the center. Indicates the number of valid pixels. Indicates the effective area of the part. This indicates the horizontal pixel position. The formula states that the center horizontal position is obtained by averaging the horizontal pixel positions of all pixels within the effective area of the part.
[0038]
[0039] In the above formula, Indicates the center longitudinal position. Indicates the number of valid pixels. Indicates the effective area of the part. This indicates the vertical pixel position. The formula states that the center vertical position is obtained by averaging the vertical pixel positions of all pixels within the effective area of the part.
[0040] During the training phase, the preprocessing module 300 can perform conventional image enhancements on the original image, such as small-angle rotation, flipping, slight brightness adjustment, and random cropping. To ensure a one-to-one correspondence between the pixel positions of the i-th part image and the i-th deviation map, when performing geometric enhancements that change the pixel position relationship, such as rotation, flipping, or random cropping, on the original image during training, the preprocessing module 300 first performs the same geometric transformation or the same cropping window on the original image and the effective area of the part, and then provides the geometrically enhanced image and the geometrically enhanced effective area of the part to the same-ring brightness deviation map calculation module 400 to recalculate the i-th deviation map. When only slight brightness adjustment is performed during training without changing the pixel position relationship, the preprocessing module 300 re-performs pixel normalization and mean-variance standardization on the brightness-adjusted image, and the same-ring brightness deviation map calculation module 400 regenerates the i-th deviation map based on the brightness-adjusted image. Therefore, the i-th part image and the i-th deviation image received by the lightweight student network are consistent in spatial position and brightness processing order, avoiding the incorrect splicing of the i-th deviation image before enhancement to the i-th part image after enhancement.
[0041] Example 4: The same-ring brightness deviation map calculation module 400 is used to establish a same-ring reference pixel set and generate the i-th deviation map based on the i-th part image and the effective area of the part. The input of the same-ring brightness deviation map calculation module 400 includes the i-th part image, the effective area of the part, the center horizontal position, the center vertical position, the horizontal pixel position, the vertical pixel position, and the pixel brightness; the output includes the i-th deviation map with the same spatial size as the i-th part image, and outputs the same-ring brightness deviation map corresponding to the online detection image during the online detection stage.
[0042] The same-ring brightness deviation map calculation module 400 first converts each pixel to be measured in the effective area of the part into a same-ring relationship. For position The same-ring brightness deviation map calculation module 400 calculates the distance from the pixel to the center and the angle of the pixel around the center based on the center's horizontal and vertical positions. The distance from the pixel to the center is used to determine whether the pixel to be tested and the reference pixel are located in the same narrow ring band, and the angle of the pixel around the center is used to determine whether the reference pixel is located within the reference arc segments on both sides of the pixel to be tested.
[0043]
[0044] In the above formula, This represents the distance from the pixel to the center. Indicates the horizontal pixel position. Indicates the vertical pixel position. Indicates the horizontal position of the center. Indicates the vertical position of the center.
[0045]
[0046] In the above formula, Indicates the angle of a pixel around the center. Indicates the horizontal pixel position. Indicates the vertical pixel position. Indicates the horizontal position of the center. Indicates the center longitudinal position. This represents the standard arctangent function. This formula is used to determine the azimuth angle of a pixel relative to its center position.
[0047] For the pixel to be measured and reference pixel The same ring brightness deviation calculation module 400 calculates the radius distance difference and azimuth distance difference respectively. (Refer to the lateral position.) Indicates the column position of the reference pixel in the same ring, and the reference vertical position. This indicates the row position of the reference pixel within the same ring. The radial distance difference is used to limit the proximity of the reference pixel and the pixel being measured in the radial direction, while the azimuth distance difference is used to exclude excessively close neighboring pixels and limit the range of the reference arc segment.
[0048]
[0049] In the above formula, Indicates the difference in radius. This represents the distance from the reference pixel to the center. This represents the distance from the pixel being measured to the center. The smaller the radius difference, the closer the reference pixel and the pixel being measured are to the same narrow ring.
[0050]
[0051] In the above formula, Indicates the difference in azimuth distance. This indicates the angle of the reference pixel around the center. This represents the angle of the pixel being measured around the center. This represents the angle normalization function, which is used to map the angle difference to a fixed angle range, thereby obtaining the minimum azimuth angle difference between the reference pixel and the pixel to be measured.
[0052]
[0053] In the above formula, This represents the angle normalization function. This represents the angle difference to be normalized. This indicates a modulo operation. The unit of angle is uniformly set to radians. The output range is Therefore, the azimuth distance difference The range of values is For angle differences that are exactly on the negative boundary, the result of the modulo operation is used to classify them. The rule remains consistent throughout the training and online testing phases.
[0054] The set of reference pixels within the same ring consists of reference pixels whose radius difference with the pixel under test satisfies the ring band half-width limit, and whose azimuth distance difference with the pixel under test is not less than the nearest neighbor exclusion angle and not greater than the far neighbor cutoff angle. The ring band half-width is used to define the radius range of the same narrow ring band, the nearest neighbor exclusion angle is used to exclude areas immediately adjacent to the pixel under test, and the far neighbor cutoff angle is used to prevent the reference arc from being too long, causing slow changes in illumination to enter the reference value. Thus, the reference pixels are both close to the radius of the pixel under test, and do not get too close to the pixel under test itself, nor do they cross an excessively large azimuth range.
[0055]
[0056] In the above formula, Represents the set of reference pixels in the same ring. This represents a reference pixel determined by a reference horizontal position and a reference vertical position. Indicates the effective area of the part. Indicates the difference in radius. Indicates half the width of the band. Indicates the difference in azimuth distance. Indicates the nearest neighbor exclusion angle. Indicates the nearest neighbor cutoff angle.
[0057] The half-width of the ring band is measured in pixels and can be selected between 1 and 5 pixels. to The nearest neighbor exclusion angle and the far neighbor cutoff angle are selected and rounded to the nearest pixel count. Both the nearest neighbor exclusion angle and the far neighbor cutoff angle are expressed in radians. The nearest neighbor exclusion angle can be... to The nearest cutoff angle can be selected from among them. to The nearest neighbor exclusion angle is selected from the nearest neighbor cutoff angle, and the relationship that the nearest neighbor exclusion angle is less than the far neighbor cutoff angle is always satisfied.
[0058]
[0059] In the above formula, Indicates the nearest neighbor exclusion angle. This represents the cutoff angle between distant and nearby pixels. This relationship ensures that the reference pixel will not fall into the immediate vicinity of the pixel being measured, and that the azimuth distance difference will not cross more than half a circumference of the reference arc.
[0060] The ring half-width, nearest neighbor exclusion angle, and far neighbor cutoff angle can be calibrated using a validation set. During calibration, ring brightness deviation maps are first generated in normal samples and known defect samples, and the validation set statistics are used as the judgment criteria. In normal samples, the 95th percentile of the ring brightness deviation value within the effective area of the part is not greater than 0.2, and the proportion of the number of test pixels with a reference pixel count lower than the lower limit of the reference pixel count to the number of effective pixels within the effective area of the part is not greater than 5%. In known defect samples, the median of the ring brightness deviation value within the manually marked defect area is not less than 1.5 times the median of the ring brightness deviation value within the effective area of non-defective parts in the same sample. If the number of test pixels with a reference pixel count lower than the lower limit accounts for more than 5% of the total effective pixels within the effective area of the part, then the annular half-width should be increased first. If the median of the brightness deviation value of the same ring within the manually annotated defect area is less than 1.5 times the median of the brightness deviation value of the same ring within the effective area of non-defective parts in the same sample, then the nearest neighbor exclusion angle should be increased. If the 95th percentile of the brightness deviation value of the same ring within the effective area of the part in the normal sample is greater than 0.2, then the far neighbor cutoff angle should be decreased. The annular half-width, nearest neighbor exclusion angle, and far neighbor cutoff angle determined by the validation set are written into the same ring brightness deviation map parameter configuration file and recalibrated when the camera, lens, light source, shooting distance, or target size changes.
[0061]
[0062] In the above formula, Indicates the number of reference pixels. This represents the set of reference pixels within the same ring. The lower limit for the number of reference pixels can be 16 or 32; when the target size is... In the example where the friction surface of the car brake disc occupies the main area of the image, the lower limit of the reference pixel count can be 32.
[0063] When the number of reference pixels for a certain pixel under test is lower than the lower limit of the number of reference pixels, the same-ring brightness deviation map calculation module 400 performs supplementation processing in a unique order. First, without changing the nearest neighbor exclusion angle and the far neighbor cutoff angle, the half-width of the ring band is increased by 1 pixel at a time, up to a maximum of two times; second, if the number of reference pixels is still lower than the lower limit of the number of reference pixels, then without changing the nearest neighbor exclusion angle, the far neighbor cutoff angle is increased at a time. And the maximum neighboring cutoff angle does not exceed Secondly, if the number of reference pixels is still lower than the lower limit of the number of reference pixels, the brightness deviation value of the corresponding ring of the pixel to be tested is set to 0, and the pixel to be tested is recorded as a pixel with insufficient reference. This processing order is fixed in the training and online detection phases and is not allowed to be changed in the same model version.
[0064]
[0065] In the above formula, This represents the half-width of the ring used in the r-th compensation process. This indicates the half-width of the annular band to be used in the next padding process. Padding of the annular half-width is performed in pixels.
[0066]
[0067] In the above formula, This represents the nearest neighbor cutoff angle used in the r-th compensation process. This indicates the nearest neighbor cutoff angle to be used in the next completion process. This formula makes the expansion of the nearest neighbor cutoff angle explicit and avoids the reference arc segment exceeding a quarter of the circumference.
[0068] After obtaining the reference pixel set within the same ring, the same-ring brightness deviation calculation module 400 takes the median brightness of the pixels in the same-ring reference pixel set to obtain the median brightness of the same ring. The median brightness of the same ring is used to represent the normal brightness baseline in the reference arc segments on both sides of the narrow ring band where the pixel under test is located. The reason for using the median instead of a simple average value is that the same-ring reference pixel set may contain a small number of pixels with cracks, scratches, stains, or local noise. The median is not sensitive to a small number of outliers and can reduce the impact of a small number of outliers on the normal brightness baseline.
[0069]
[0070] In the above formula, This represents the median brightness of the same ring. Represents the set of reference pixels in the same ring. This indicates the pixel brightness at the reference pixel. This indicates that the median brightness value is calculated. The formula states that the median brightness value within a ring is derived solely from the brightness of pixels in the same ring's reference pixel set.
[0071] The same-ring brightness deviation calculation module 400 further determines the same-ring brightness deviation value based on the normalized deviation of the measured pixel brightness relative to the median of the same-ring brightness. Specifically, the same-ring brightness deviation value is obtained by dividing the absolute difference between the measured pixel brightness and the median of the same-ring brightness by the sum of the median of the same-ring brightness and the stable small value. The stable small value is used to prevent abnormal denominator when the median of the same-ring brightness is close to zero. The stable small value can be set in a conventional way according to the image grayscale normalization scale.
[0072]
[0073] In the above formula, This indicates the brightness deviation value within the same ring. Indicates the brightness of the pixel being measured. This represents the median brightness of the same ring. This indicates a stable, small value. The formula outputs the normalized deviation of the measured pixel's brightness from the median brightness of the same ring, rather than the absolute brightness of the measured pixel.
[0074] Stable small values are on the same numerical scale as pixel brightness. If pixel brightness is normalized to... Stable small quantities can be taken to In one feasible example, take If an 8-bit grayscale original scale is used, stable small values can be scaled up to values between 0.001 and 0.255 using the same scale. To facilitate channel stitching between the i-th offset image and the i-th part image, the same-ring brightness offset image calculation module 400 can truncate and normalize the same-ring brightness offset values according to the upper limit of the offset image truncation, thus obtaining the value of the corresponding pixel in the i-th offset image.
[0075]
[0076] In the above formula, Indicates the position of the i-th offset image. The value, This indicates the brightness deviation value within the same ring. This represents the upper limit of the deviation plot truncation. The upper limit of the deviation plot truncation is a dimensionless positive number, which can be selected between 1 and 5, and is set to 1 in one feasible example. After this processing, the numerical range of the i-th deviation plot is... The pixel normalization scale matches that of the i-th part image.
[0077] The same-ring brightness deviation map calculation module 400 determines the same-ring brightness deviation value for each pixel in the effective area of the part, and obtains the i-th deviation map with the same spatial size as the i-th part image. For pixels outside the effective area of the part, the values in the i-th deviation map are uniformly set to 0; this fixed fill value does not participate in the calculation of the same-ring brightness median, nor does it change the calculation relationship of the same-ring brightness deviation value in the effective area of the part, but is only used to ensure that the i-th deviation map can be stitched with the i-th part image in channel order.
[0078] For a pixel under test that is recorded as a reference insufficient pixel, the value in the i-th deviation map is uniformly set to 0. This fixed fill value indicates that the pixel does not provide available same-ring brightness deviation information.
[0079] Example 5: After generating the i-th part image and the i-th offset image, the training samples can be grouped according to the part number, ensuring that images of the same car part from different perspectives do not participate in the same round of training and validation evaluation simultaneously. Specifically, the part number can be used as the grouping key to assign multiple perspective images corresponding to the same part number to one set in the training, validation, or test set, avoiding the simultaneous appearance of images of the same car part from different perspectives in a single round of training and validation evaluation. This setup reduces the correlation influence caused by the same physical sample between training and evaluation, making the classification performance evaluation more consistent with the handling of unknown car parts in the online detection stage.
[0080] When reading data in groups by part number, the annotation data management module 200 first generates a set of part numbers, and then divides the samples into training, validation, and test sets using the part number as the smallest dividing unit. All original images, the i-th part image, the i-th offset image, and the category label under the same part number can only be assigned to one of the training, validation, or test sets. During training batch sampling, the same part number is not read repeatedly within the same training batch; if a part number corresponds to multiple viewpoint images, only one viewpoint image is extracted in a training batch. These rules ensure a one-to-one correspondence between the i-th part image, the i-th offset image, and the category label, and reduce the bias caused by the repeated appearance of the same physical sample in the training batch.
[0081] The teacher network training module 500 trains the teacher network and outputs the teacher softening probability to the knowledge distillation training module 700. The teacher network has a larger number of parameters than the lightweight student network, and can employ conventional convolutional neural network structures, such as those with more layers or channels. The teacher network is trained using the i-th part image and category labels. The input to the teacher network is the i-th part image, and the output is the original category score or category probability corresponding to the number of defect categories. After training, parameter updates are stopped, and the teacher network is used as a fixed network during the knowledge distillation training phase.
[0082] The number of parameters in the teacher network can be determined by the total number of trainable parameters, i.e., by counting the number of weights and biases participating in backpropagation updates in both the teacher and lightweight student networks. The teacher network's parameter count is greater than the lightweight student network's parameter count when the total number of trainable parameters in the teacher network is greater than the total number of trainable parameters in the lightweight student network. ResNet34 or ResNet50 can be used as examples for the teacher network, and a depthwise separable convolutional structure can be used as an example for the lightweight student network.
[0083] When training the teacher network, the teacher network training module 500 can input the i-th part image into the teacher network, determine the conventional cross-entropy loss based on the teacher network output and category label, and update the teacher network parameters through conventional backpropagation. After training, the teacher network training module 500 freezes the teacher network parameters, so that the teacher network only outputs the teacher softening probability during the knowledge distillation training phase and does not participate in parameter updates. This setting enables the teacher network to provide relatively stable inter-category relationship information and avoids changing the teacher network output distribution during the knowledge distillation training phase.
[0084] The determination of whether teacher network training is complete can be achieved by combining the maximum number of training epochs and early stopping on the validation set. In one feasible example, the teacher network is trained for a maximum of 100 epochs. After each epoch, the validation set accuracy and validation set loss are calculated on the validation set, and the parameter file of the teacher network with the highest validation set accuracy and validation set loss not higher than that of the adjacent candidate models is saved. If the validation set accuracy does not improve for 10 consecutive epochs, the teacher network training is stopped. After the teacher network training stops, the teacher network training module 500 loads the saved teacher network parameter file, sets the trainable state of all teacher network parameters to non-trainable, and then outputs the teacher softening probability to the knowledge distillation training module 700.
[0085] The teacher network only receives the i-th part image and not the i-th deviation image. This input relationship allows the teacher network to still act as a larger model providing knowledge distillation supervision based on regular image information, while the lightweight student network obtains additional local anomaly information through the channel concatenation result of the i-th part image and the i-th deviation image. Thus, the input difference between the teacher network and the lightweight student network lies in the lightweight student network additionally receiving the i-th deviation image, rather than changing the training task of the teacher network.
[0086] Example 6: The student network training module 600 is used to construct a lightweight student network that receives the channel concatenation result of the i-th part image and the i-th offset map. The lightweight student network includes a depthwise separable convolutional module, channel configuration, and a category output. The number of input channels in the first layer of the lightweight student network is the number of channels in the i-th part image plus one, with the added channel used to input the i-th offset map. Except for the increase in the number of input channels in the first layer, the remaining layers, channel configuration, category output, and computational flow of the lightweight student network can maintain the structure of a conventional lightweight convolutional neural network.
[0087] The input to the lightweight student network is obtained by concatenating the i-th part image and the i-th offset image in channel order. The channel order is determined during training and remains consistent during online detection. If the i-th part image is a single-channel grayscale image, the first layer of the lightweight student network has two input channels; if the i-th part image is a three-channel image, the first layer has four input channels. The above example is only used to illustrate that the number of input channels in the first layer is the number of channels in the i-th part image plus one, and does not limit the specific network framework.
[0088] In a directly reproducible example of a lightweight student network, the lightweight student network includes a first convolutional layer, six depthwise separable convolutional modules, a global average pooling layer, and a fully connected class output. The kernel size of the first convolutional layer is [size missing]. The first convolutional layer has a stride of 2 and 16 output channels. The channel configurations of the six depthwise separable convolutional modules are 16, 32, 64, 96, 128, and 128 respectively. The stride of the second, third, and fifth depthwise separable convolutional modules is 2, while the stride of the remaining modules is 1. The global average pooling layer compresses spatial features into channel features, and the fully connected class output outputs the original student class score corresponding to the number of defect categories. If the i-th part image is a three-channel image, the first convolutional layer has 4 input channels; if the i-th part image is a single-channel grayscale image, the first convolutional layer has 2 input channels.
[0089] If the lightweight student network is initialized based on an existing three-channel lightweight convolutional neural network, the original channel weights corresponding to the i-th part image in the first convolutional layer can use the existing initialized weights, and the newly added channel weights for the i-th offset image can be the average of the original channel weights. If the lightweight student network is trained from scratch, all input channel weights in the first convolutional layer can use the same random initialization method. Regardless of the initialization method used, the newly added i-th offset image channel only changes the number of input channels in the first layer, without changing the correspondence between the depthwise separable convolutional module, channel configuration, and category output.
[0090]
[0091] In the above formula, This indicates that the teacher inputs data. Let represent the i-th part image. This formula indicates that the teacher network only receives the i-th part image.
[0092]
[0093] In the above formula, This indicates that the data was entered by the student. This represents the image of the i-th part. This represents the i-th offset image. This indicates the channel stitching operation. The formula describes the channel stitching result of the i-th part image and the i-th offset image received by the lightweight student network.
[0094] The knowledge distillation training module 700 trains a lightweight student network based on label classification loss and distillation matching loss, and outputs the trained lightweight student network to the online classification module 800. The knowledge distillation training module 700 receives class labels from the labeled data management module 200, teacher softening probabilities from the teacher network training module 500, and the lightweight student network from the student network training module 600. The knowledge distillation training module 700 determines the label classification loss based on the student's normal probability and the class label, determines the distillation matching loss based on the teacher's softening probability and the student's softening probability, weights the label classification loss and distillation matching loss according to the proportion of label loss to obtain the total training loss, and updates only the lightweight student network parameters based on the total training loss.
[0095] In each training batch, the number of images that can be read in each batch is [number missing]. For the sample, the i-th part image is input into the teacher network to obtain the raw score for the teacher category, and the channel concatenation result of the i-th part image and the i-th deviation image is input into the lightweight student network to obtain the raw score for the student category. The teacher network and the lightweight student network use the same softening temperature to calculate the teacher softening probability and the student softening probability. The number of defect categories is denoted as... The category number is recorded as The summation category number is denoted as .
[0096] The number of images per batch can be 16 or 32. When the edge computing device has limited video memory or the target image size is large, the number of images per batch can be 16. When the training device has sufficient video memory and the category distribution is relatively balanced, the number of images per batch can be 32. The softening temperature is a dimensionless positive number and can be selected between 2 and 4. The label loss ratio is a dimensionless proportion and can be selected between 0.3 and 0.7. In specific selection, the overall accuracy, recall of each defect category, and validation set loss are compared on the validation set. The combination with a recall rate of each defect category that is not lower than the minimum requirement in the field and a low validation set loss is preferred. In one feasible example, the number of images per batch is 32, the softening temperature is 3, and the label loss ratio is 0.5.
[0097]
[0098] In the above formula, This represents the probability of teacher softening. Represents the raw scores for the teacher category. Indicates the softening temperature. Indicates the number of defect categories. This indicates the summation category number. The teacher softening probability is used to represent the teacher network's output on inter-category relationships at the softening temperature.
[0099]
[0100] In the above formula, This represents the probability of a student becoming soft. Represents the raw scores for each student category. Indicates the softening temperature. Indicates the number of defect categories. This indicates the summation category number. The student softening probability is used to represent the category output of the lightweight student network at the same softening temperature.
[0101] The label classification loss is determined by the student's ordinary probability and the class label. The student's ordinary probability is the class probability obtained by the lightweight student network based on ordinary temperature. The label value indicates whether the i-th part image belongs to the c-th class; it is 1 if it belongs and 0 otherwise. The label classification loss is used to constrain the output of the lightweight student network to be consistent with the manual class label.
[0102]
[0103] In the above formula, Indicates the label classification loss. Indicates the number of images in each batch. Indicates the number of defect categories. Indicates the value of the label. This represents the average probability of a student. The formula corresponds to the cross-entropy relationship between the student's output and the human category label.
[0104] The distillation matching loss is determined by the teacher's softening probability and the student's softening probability. The distillation matching loss is used to constrain the lightweight student network to learn the inter-category similarity relationships provided by the teacher network, thereby enabling the lightweight student network to obtain softening supervision from the teacher network with a smaller number of parameters.
[0105]
[0106] In the above formula, Indicates distillation matching loss, Indicates the softening temperature. Indicates the number of images in each batch. This represents the probability of teacher softening. This represents the probability of a student softening. This formula is used to measure the difference between the probability of a teacher softening and the probability of a student softening.
[0107] The total training loss is obtained by weighting the label classification loss and distillation matching loss according to the proportion of the label loss. The proportion of the label loss is used to control the weight of the label classification loss in the total training loss, and the proportion of the label loss can be set in a conventional way based on the validation set results. The knowledge distillation training module 700 performs backpropagation based on the total training loss and only updates the lightweight student network parameters, without updating the teacher network parameters.
[0108]
[0109] In the above formula, Indicates total training loss. Indicates the percentage of label loss. Indicates the label classification loss. This represents the distillation matching loss. The formula directly reflects the weighted relationship between the label classification loss and the distillation matching loss.
[0110] The Knowledge Distillation Training Module 700 can use the Adam optimizer to train a lightweight student network, and the initial learning rate can be set to... If the loss on the validation set does not decrease after five consecutive rounds, the learning rate will be reduced to one-tenth of its original value, with a minimum learning rate not lower than [missing value]. The lightweight student network is trained for a maximum of 100 epochs. If the validation set accuracy does not improve for 10 consecutive epochs, training stops, and the lightweight student network with the highest validation set accuracy is saved. During the training process, the teacher network parameters remain frozen, and only the lightweight student network parameters participate in backpropagation updates.
[0111] After training the lightweight student network, the overall accuracy, accuracy for each class, recall, confusion matrix, inference time per image, and model file size can be calculated on the validation and test sets. The lightweight student network parameters that meet the minimum accuracy and inference time requirements for field deployment can then be selected. When deploying to edge computing devices, the lightweight student network can be converted to a standard model format supported by the edge computing device. To reduce storage footprint, standard floating-point to half-precision conversion or post-training integer quantization can be used, and the difference in classification results before and after conversion can be verified on the test set to be within the acceptable range for field deployment.
[0112] Example 7: The online classification module 800 receives the online detection image and the corresponding ring brightness deviation map of the online detection image. It concatenates the online detection image and the corresponding ring brightness deviation map of the online detection image in channel order and inputs them into the trained lightweight student network, and outputs the defect category and confidence level.
[0113] When the online classification module 800 starts, it first loads the on-site deployment file and completes the consistency verification of the model version number and configuration version number. After the verification is passed, the online classification module 800 performs the input construction before online inference according to the image preprocessing configuration file and the same ring brightness deviation map parameter configuration file.
[0114] During online inspection, after the automotive part reaches the inspection position, the image acquisition module 100 acquires the raw image for the online inspection phase. The preprocessing module 300 performs the same preprocessing on the raw image acquired during the online inspection phase as during the training phase, resulting in the online inspection image. This consistency includes consistency in cropping method, scaling size, channel order, pixel normalization, mean and variance standardization, and the method for determining the effective area of the part. This consistency can reduce the difference between the input distribution during the training phase and the input distribution during the online inspection phase.
[0115] The same ring brightness deviation map calculation module 400 establishes a set of same ring reference pixels corresponding to the online detection image based on the online detection image and the effective area of the part corresponding to the online detection image, and generates the same ring brightness deviation map corresponding to the online detection image, according to the same center horizontal position determination method, center vertical position determination method, radius distance difference calculation method, azimuth angle distance difference calculation method, ring half-width limitation method, nearest neighbor exclusion angle limitation method, and far neighbor cutoff angle limitation method.
[0116] To ensure that the brightness deviation between the online detection image and its corresponding ring is not too large... Figure 1 In a one-to-one correspondence, the image acquisition module 100 generates a part number, frame number, and capture time for each capture. The preprocessing module 300 retains the same part number and frame number when outputting the online detection image; the same part number and frame number are also retained when outputting the corresponding ring brightness deviation map of the online detection image by the same ring brightness deviation map calculation module 400. The online classification module 800 performs channel stitching only when the online detection image and its corresponding ring brightness deviation map have the same part number and frame number; if they are inconsistent, the online classification module 800 discards the current input and requests the image acquisition module 100 to re-acquire the original image from the online detection stage.
[0117] The online classification module 800 concatenates the online detection image and its corresponding ring brightness deviation map according to the channel order during training, and then inputs them into the trained lightweight student network. The trained lightweight student network outputs the student common probability corresponding to each defect category. The online classification module 800 can select the category corresponding to the maximum student common probability as the defect category and use this maximum student common probability as the confidence level.
[0118]
[0119] In the above formula, Indicates the defect category, Indicates the number of defect categories. Indicates the category number. This represents the general probability of a student. This formula is used to determine the defect category given by the lightweight student network.
[0120]
[0121] In the above formula, Indicates credibility. Indicates the number of defect categories. Indicates the category number. This represents the general probability of a student. This formula is used to determine the confidence level corresponding to a defect category.
[0122] The online classification module 800 can refresh its output once per inspection cycle for each automotive part. The output includes defect category, confidence level, part number, frame number, capture time, and model version number. Edge computing devices can send defect categories and confidence levels to the PLC via Ethernet, industrial bus, or digital interface. When model file loading fails, the online inspection image and its corresponding ring brightness deviation map are out of sync, the effective area of the part is invalid, or the inference program times out, the online classification module 800 outputs a manual re-inspection mark and the corresponding error reason, but does not output a normal release signal.
[0123] The defect categories and reliability output by the online classification module 800 can be used by the production line control system for qualified release, defect marking, sorting, manual re-inspection, or quality recording. The detection results can be written into the quality record along with the original image path, the online detection image path, the corresponding ring brightness deviation map path or calculation record, part number, workstation number, and model version number.
[0124] Example 8: As an optional implementation, the friction surface of the automotive brake disc is free of obvious cracks, scratches, dents, rust spots, or stains, and the illumination changes relatively smoothly. In this case, normal areas at different locations within the same narrow ring have similar material surface conditions and processing radii. The brightness of the pixel being measured is close to the median brightness of the pixels in the reference pixel set within the same ring, and the brightness deviation within the same ring is small. Most locations of the effective area of the part in the i-th deviation image exhibit a low degree of normalized deviation. The lightweight student network provides overall appearance information in the i-th part image while simultaneously obtaining input with a low degree of local anomalies through the i-th deviation image, thus outputting the defect category as normal and the corresponding confidence level.
[0125] As an optional implementation, a narrow anomalous region exists locally on the friction surface of a car brake disc. However, the absolute brightness difference of this anomalous region in the original image may be masked by concentric processing textures and local exposure fluctuations. In this case, the same-ring brightness deviation map calculation module 400 selects reference pixels in the reference arc segments on both sides within the same narrow ring and uses the median brightness of the same ring as the normal brightness baseline. If the pixel to be tested is located in a crack or fine scratch area, the brightness of the pixel to be tested deviates significantly from the median brightness of the same ring, the same-ring brightness deviation value increases, and the i-th deviation map forms a more obvious anomalous input in this local area. After the lightweight student network receives the channel stitching result of the i-th part image and the i-th deviation map, it can simultaneously utilize the overall appearance and the degree of local brightness deviation.
[0126] This implementation can be achieved by using an industrial camera, a fixed-focus lens, a diffuse ring light source, a photoelectric trigger, an industrial computer, an edge computing device, a PLC, and a data storage area. The industrial camera and fixed-focus lens are used to acquire the original image, the diffuse ring light source is used to provide relatively stable illumination, the photoelectric trigger is used to synchronize the acquisition of the original image with the arrival status of the automotive parts, the industrial computer or edge computing device is used to run the software programs in the preprocessing module 300, the same-ring brightness deviation map calculation module 400, the teacher network training module 500, the student network training module 600, the knowledge distillation training module 700, and the online classification module 800, and the PLC can receive the defect category and confidence level and execute the production line sorting or re-inspection flow.
[0127] The lightweight student and teacher networks can adopt the aforementioned network structure examples, or they can adopt conventional convolutional neural network structures that meet the corresponding requirements for parameter quantity, number of input channels, and output end.
[0128] Although embodiments of this application have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of this application, and all such modifications and variations fall within the scope defined by the appended claims.
Claims
1. A method for classifying defects in lightweight automotive parts based on knowledge distillation, used to classify defects in surface images of automotive parts where the center position can be determined by the image pixel position and a co-loop reference relationship can be formed, characterized in that, include: Collect raw images and create a labeled dataset with category labels; Preprocess the original image to obtain the i-th part image and the effective area of the part, where i represents the image number; Determine the center's horizontal and vertical positions based on the effective area of the part. Based on the horizontal pixel position, vertical pixel position, and pixel brightness, establish a set of reference pixels in the same ring based on the radius distance difference, azimuth distance difference, ring half-width, nearest neighbor exclusion angle, and far neighbor cutoff angle. The median brightness of the pixels in the same ring reference pixel set is obtained by taking the median value of the brightness of the same ring. The brightness deviation value of the same ring is determined based on the normalized deviation of the brightness of the pixel to be measured relative to the median brightness of the same ring. The brightness deviation map of the same ring corresponding to the i-th part image is formed as the i-th deviation map. Enable the teacher network to receive the i-th part image, and enable the lightweight student network to receive the channel stitching result of the i-th part image and the i-th offset image; The total training loss is determined based on the label classification loss and distillation matching loss, and only the parameters of the lightweight student network are updated; During online detection, the original images acquired in the online detection phase undergo the same preprocessing as those in the training phase to obtain online detection images. The trained lightweight student network then outputs the defect category and confidence level based on the channel stitching results of the online detection images and the corresponding ring brightness deviation maps.
2. The method for classifying defects in lightweight automotive parts based on knowledge distillation according to claim 1, characterized in that, The preprocessing includes: The original image is converted to a grayscale image, and candidate regions are obtained by segmenting the brightness threshold based on the grayscale image; Perform contour closure, hole filling, and maximum connected region selection on the candidate region to obtain the effective region of the part; The original image is cropped and scaled according to the effective area of the part, and the channel order is unified, the pixels are normalized, and the mean and variance are standardized.
3. The method for classifying defects in lightweight automotive parts based on knowledge distillation according to claim 1, characterized in that, The set of reference pixels in the same ring consists of reference pixels whose radius distance difference with the pixel to be tested satisfies the ring band half-width limit, and whose azimuth distance difference with the pixel to be tested is not less than the nearest neighbor exclusion angle and not greater than the far neighbor cutoff angle.
4. The method for classifying defects in lightweight automotive parts based on knowledge distillation according to claim 1, characterized in that, Generating the i-th offset map includes: The median brightness of pixels in the same ring reference pixel set is obtained by taking the median brightness of the same ring. The brightness deviation value of the same ring is determined based on the normalized deviation of the brightness of the pixel under test from the median brightness of the same ring. For each pixel of the effective area of the part, determine the brightness deviation value of the same ring to obtain the i-th deviation image that is consistent with the spatial size of the i-th part image.
5. The method for classifying defects in lightweight automotive parts based on knowledge distillation according to claim 1, characterized in that, When performing rotation or flipping geometric augmentation on the original image during the training phase, the corresponding geometric transformation is first performed on the original image, and then the i-th offset image is recalculated based on the transformed image to maintain a one-to-one correspondence between the pixel positions of the i-th part image and the i-th offset image.
6. The method for classifying defects in lightweight automotive parts based on knowledge distillation according to claim 1, characterized in that, The training samples are grouped and read according to the part number, so that images of the same car part from different perspectives do not participate in the same round of training and validation evaluation at the same time.
7. The method for classifying defects in lightweight automotive parts based on knowledge distillation according to claim 1, characterized in that, The number of parameters in the teacher network is greater than that in the lightweight student network. After the teacher network is trained using the i-th part image and category label, parameter updates are stopped, and the teacher softening probability is output during the knowledge distillation training phase.
8. The method for classifying defects in lightweight automotive parts based on knowledge distillation according to claim 1, characterized in that, The lightweight student network includes a depthwise separable convolutional module, channel configuration, and category output. The number of input channels in the first layer of the lightweight student network is the number of channels in the i-th part image plus one, and the added channel is used to input the i-th offset image.
9. The method for classifying defects in lightweight automotive parts based on knowledge distillation according to claim 1, characterized in that, The knowledge distillation training of the lightweight student network includes: determining the label classification loss based on the student's normal probability and category label; determining the distillation matching loss based on the teacher's softening probability and the student's softening probability; weighting the label classification loss and distillation matching loss according to the proportion of label loss to obtain the total training loss; and updating the parameters of the lightweight student network only based on the total training loss.
10. A lightweight automotive parts defect classification system based on knowledge distillation, used for defect classification of automotive brake disc friction surface images, characterized in that, include: The image acquisition module is used to acquire raw images and output them to the preprocessing module. The labeled data management module is used to create labeled datasets with category labels and output category labels to the teacher network training module and the knowledge distillation training module; The preprocessing module is used to generate the i-th part image and the effective area of the part based on the original image, and to perform the same preprocessing on the original image acquired in the online detection stage as in the training stage to obtain the online detection image; The same-ring brightness deviation map calculation module is used to establish a same-ring reference pixel set and generate the i-th deviation map based on the i-th part image and the effective area of the part. The teacher network training module is used to train the teacher network and output the teacher softening probability to the knowledge distillation training module. The student network training module is used to construct a lightweight student network that receives the channel stitching result of the i-th part image and the i-th offset image; The knowledge distillation training module is used to train a lightweight student network based on label classification loss and distillation matching loss, and outputs the trained lightweight student network to the online classification module. The online classification module receives the online detection image and the corresponding ring brightness deviation map. It concatenates the online detection image and the corresponding ring brightness deviation map in channel order and inputs them into the trained lightweight student network, and outputs the defect category and confidence level.
