Red punching and hot forging defect detection method and system based on image processing

Through local area division, dynamic sampling step size, weighting, adaptive convolution kernel generation and multi-head attention fusion, the problems of low detection coverage and stability in red-throwing hot forging defect detection are solved, the ability to identify small defects is improved, and defect detection with higher accuracy is achieved.

CN120355685AInactive Publication Date: 2025-07-22WENLING HONSON BRASSWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510458508.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-14
Publication Date
2025-07-22
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing red-shampling hot forging defect detection methods have problems such as low detection coverage, interference from external light and thermal radiation, unstable detection results, weak identification ability of micro defects, and easy to miss inspection. They also ignore the defects in small areas of the workpiece surface and insufficient local feature extraction, resulting in poor detection results.

Method used

The image is divided into multiple rectangular blocks through local area division, and dynamic sampling step size and local weighting are used to generate a convolution kernel dynamically. Combined with adaptive convolution and multi-head attention fusion modules, an object detection model is built, which gives defective areas higher weight, suppresses lighting changes and background noise interference, and improves the detection ability of local defects.

Benefits of technology

It significantly improves the stability and accuracy of red impulse hot forging defect detection, can accurately identify local defects such as cracks, burns, and pores, improves the detection ability of tiny defects, and enhances the stability and accuracy of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120355685A_ABST
    Figure CN120355685A_ABST
Patent Text Reader

Abstract

The invention discloses a red punching and hot forging defect detection method and system based on image processing. The method comprises the steps of image acquisition, preliminary feature extraction, local feature construction, defect area identification, defect area target detection model establishment and red punching and hot forging defect detection. The invention belongs to the field of defect detection, and particularly relates to a red punching and hot forging defect detection method and system based on image processing, according to the scheme, a complete image is divided into a plurality of rectangular blocks through local region division, and each region independently captures local details and is more sensitive to local defects; by dynamically sampling the step length, the sampling density is adaptively adjusted according to the local gray level or texture gradient change, and the hot punching and hot forging defect detection stability and precision are improved; a convolution kernel is dynamically generated according to local image features, so that the network can automatically adapt to defect features of different regions; on the basis of local weighting and foreground enhancement loss, a defect area is endowed with a higher weight, so that the red punching and hot forging defect detection effect is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of defect detection, and specifically refers to a red-hot forging defect detection method and system based on image processing. Background Art

[0002] The red-hot forging defect detection method is a technical method for detecting defects in red-hot forging workpieces during the production process. Red-hot forging is a metal forming process in which metal materials are heated and plastically deformed by impact or pressure. During this process, the workpieces may have surface or internal defects due to factors such as temperature changes, mechanical stress, or material inhomogeneity. However, general red-hot forging defect detection methods have problems such as low detection coverage, unstable detection results caused by external light and thermal radiation interference, weak recognition ability for tiny defects, and easy omission of detection; general red-hot forging defect detection methods ignore small-area defects on the workpiece surface and insufficient local feature extraction, resulting in poor red-hot forging defect detection effects. Summary of the Invention

[0003] In view of the above situation, to overcome the defects of the prior art, the present invention provides a red-hot forging defect detection method and system based on image processing. Aiming at the problems of general red-hot forging defect detection methods, such as low detection coverage, unstable detection results caused by external light and thermal radiation interference, weak recognition ability for tiny defects, and easy omission of detection, this solution divides the complete image into multiple rectangular blocks through local area division, and each area independently captures local details, being more sensitive to local defects such as cracks, burns, and pores; through dynamic sampling step size, the sampling density is adaptively adjusted according to local gray-scale or texture gradient changes, effectively suppressing the interference of light changes and background noise, and improving the stability and accuracy of red-hot forging defect detection; aiming at the problem that general red-hot forging defect detection methods ignore small-area defects on the workpiece surface and insufficient local feature extraction, resulting in poor red-hot forging defect detection effects, this solution dynamically generates convolution kernels according to local image features, enabling the network to automatically adapt to the defect features of different regions, and improving the detection ability for fine defects such as cracks, local burns, and poor fusion; based on local weighting and foreground enhancement loss, by assigning higher weights to the defect regions, the model can still accurately identify defects when the local defect signal is weak or the background noise is strong, thus significantly improving the red-hot forging defect detection effect.

[0004] The technical solution adopted by the present invention is as follows: The red-hot forging defect detection method based on image processing provided by the present invention includes the following steps:

[0005] Step S1: Image acquisition;

[0006] Step S2: Preliminary feature extraction;

[0007] Step S3: Local feature construction;

[0008] Step S4: Defect area identification;

[0009] Step S5: Establish a target detection model for the defect area;

[0010] Step S6: Red punching hot forging defect detection.

[0011] Further, in step S1, the image acquisition is to acquire historical red punching hot forging workpiece images; and label whether there are defects and label the defect areas on the images; regard the acquired historical red punching hot forging workpiece images as two-dimensional matrices, and use the local area division method to divide the images into M image blocks.

[0012] Further, in step S2, the preliminary feature extraction is to perform dynamic spatial sampling for each image block, adaptively adjust the sampling density according to the local pixel gradient change; introduce a dynamic sampling step; calculate the energy integral moment; calculate the gradient integral moment.

[0013] Further, in step S3, the local feature construction is to further calculate the features describing the local image state on the basis of the preliminary features of each image block; construct the effective light intensity; construct the covariance matrix of the pixels within the image block; calculate the spatial complexity.

[0014] Further, in step S4, the defect area identification is to perform weighted average fusion on the local features of all image blocks to form a global feature description, and based on the historical annotation data, train a support vector machine to judge whether there are defect areas in each image block.

[0015] Further, in step S5, the establishment of the target detection model for the defect area is to use the image data with defect areas and the corresponding annotations to construct a target detection network, which specifically includes the following steps:

[0016] Step S51: Adaptively generate convolution kernels on the high-level feature map; use the historical red punching hot forging workpiece images with defects as the initial input feature map; perform adaptive convolution processing; construct adaptive convolution kernels based on local features;

[0017] Step S52: Position embedding; introduce position encoding; perform multi-head attention calculation after adding the position embedding information to the features; use residual connection to process the attention result; further process through a feed-forward network and reconstruct the output; perform a second residual connection; feature map reconstruction;

[0018] Step S53: Feature attention fusion module; fuse and splice the information of the local features and the encoder output features; extract the fusion features through two layers of convolution; perform global average pooling on the features to obtain , generate channel weights through a fully connected network; apply weights to weight features; finally, segment and convolve the weighted features to reconstruct output;

[0019] Step S54: input the finally obtained feature map to the target detection head; the detection head generates candidate regions and performs target bounding box regression on the local abnormal region in the feature map, and outputs the target annotation of the defect region;

[0020] Step S55: loss function design; construct local weighted loss, and give higher weights to defect areas through local weighted strategy; construct foreground enhancement loss.

[0021] Furthermore, in step S6, the hot stamping and hot forging defect detection is to collect image data of the hot stamping and hot forging workpiece in real time, input the image data identified as the defect area into the defect area target detection model, and the model outputs the defect area labeling.

[0022] The hot stamping and hot forging defect detection system based on image processing provided by the present invention comprises an image acquisition module, a preliminary feature extraction module, a local feature construction module, a defect area recognition module, a defect area target detection model establishment module and a hot stamping and hot forging defect detection module;

[0023] The image acquisition module acquires the historical hot stamping and hot forging workpiece image, and performs local division and defect marking on the image;

[0024] The preliminary feature extraction module adopts dynamic spatial sampling for each image block and performs preliminary feature extraction;

[0025] The local feature construction module constructs local features based on preliminary features;

[0026] The defective area recognition module performs weighted fusion on the local features of all image blocks and uses historical annotation data to train a support vector machine to determine whether each area has defects;

[0027] The defect area target detection model establishment module uses defect image data to build a target detection network, strengthens local defect features through adaptive convolution, multi-head attention and feature attention fusion modules, and thus realizes the establishment of a defect area target detection model;

[0028] The hot stamping and hot forging defect detection module realizes defect detection on the hot stamping and hot forging workpiece image collected in real time.

[0029] The beneficial effects achieved by the present invention using the above scheme are as follows:

[0030] (1)In view of the problems existing in general red-hot forging defect detection methods, such as low detection coverage rate, unstable detection results caused by external light and thermal radiation interference, weak ability to identify tiny defects, and easy omission of detection, this solution divides the complete image into multiple rectangular blocks through local area division. Each area independently captures local details and is more sensitive to local defects such as cracks, burns, and pores. Through dynamic sampling step size, the sampling density is adaptively adjusted according to local gray-scale or texture gradient changes, effectively suppressing the interference of light changes and background noise, and improving the stability and accuracy of red-hot forging defect detection.

[0031] (2)In view of the problem that general red-hot forging defect detection methods ignore small-area defects on the workpiece surface and lack of local feature extraction, resulting in poor detection effect of red-hot forging defects, this solution dynamically generates convolution kernels according to local image features, enabling the network to automatically adapt to the defect features of different regions and improving the detection ability for subtle defects such as cracks, local burns, and poor fusion. Based on local weighted and foreground enhancement loss, by assigning higher weights to the defect regions, the model can still accurately identify defects when the local defect signal is weak or the background noise is strong, thus significantly improving the detection effect of red-hot forging defects. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 is a schematic flow chart of the red-hot forging defect detection method based on image processing provided by the present invention;

[0033] Figure 2 is a schematic diagram of the red-hot forging defect detection system based on image processing provided by the present invention.

[0034] The drawings are used to provide a further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation to the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0035] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0036] In the description of the present invention, it should be understood that the terms "upper", "lower", "front", "rear", "left", "right", "top", "bottom", "inner", "outer", etc. indicating the orientation or positional relationship are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the system or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation to the present invention.

[0037] Example 1. Refer to Figure 1 , the hot stamping and forging defect detection method based on image processing provided by the present invention includes the following steps:

[0038] Step S1: Image acquisition; acquire historical hot stamping and forging workpiece images, and perform local division and defect annotation on the images;

[0039] Step S2: Preliminary feature extraction; perform dynamic spatial sampling on each image block and conduct preliminary feature extraction;

[0040] Step S3: Local feature construction; construct local features based on the preliminary features;

[0041] Step S4: Defect area identification; perform weighted fusion on the local features of all image blocks, and use historical annotation data to train a support vector machine to determine whether there are defects in each area;

[0042] Step S5: Establish a target detection model for the defect area; use the defect image data to construct a target detection network, strengthen the local defect features through adaptive convolution, multi-head attention, and feature attention fusion modules, and then establish a target detection model for the defect area;

[0043] Step S6: Hot stamping and forging defect detection; perform defect detection on the images of the hot stamping and forging workpieces collected in real time.

[0044] Example 2. Refer to Figure 1 , based on the above example, in step S1, the image acquisition is to acquire historical hot stamping and forging workpiece images; and annotate whether there are defects and the defect areas on the images; arrange a high-density and multi-angle camera array on the hot stamping and forging production line to take full coverage photos of the forging workpieces; regard the acquired historical hot stamping and forging workpiece images as two-dimensional matrices, and use the local area division method to divide the images into multiple image blocks; ensure that each block can independently reflect local details and is convenient for capturing defects such as cracks, pores, and local burns..

[0045] Example 3. Refer to Figure 1, based on the above embodiment, in step S2, for each image block, dynamic spatial sampling is adopted for preliminary feature extraction, and the sampling density is adaptively adjusted according to the local pixel gradient change; a dynamic sampling step is introduced, and in regions with rich details and sharp gradients, higher-resolution sampling is used; in regions with gentle changes, the sampling density is appropriately reduced to reduce redundant calculations; it is expressed as: ; where is the dynamic sampling step; is; is the adjustment coefficient; is the local pixel gradient; calculate the energy integral moment , which reflects the local light intensity level and is expressed as: ; where h and w are the height and width of the image block respectively; is the image block; i and j are pixel position indices; I(·) is the gray value; calculate the gradient integral moment , which reflects the local detail change; it is expressed as: ; where x and y represent the horizontal direction and the vertical direction respectively.

[0046] Embodiment 4, refer to Figure 1 , based on the above embodiment, in step S3, on the basis of the preliminary features of each image block, features describing the local image state are further calculated to enhance the sensitivity to cracks, local burns, and poor fusion defects in the red-hot forging workpiece; construct the effective light intensity , which measures the overall brightness level of the image within the block and is used to detect the reduction in light intensity caused by local melting and burning of defects, and is expressed as: ; where is the average value of the energy integral moment within the image block; is the total number of pixels within the image block; calculate the light intensity change rate , which reflects the spectral characteristics of the local response and can capture texture changes caused by subtle structural damage, and is expressed as: ; to describe the degree of dispersion of the gray distribution of pixels within the block, the local covariance matrix and its eigenvalue distribution are used to reflect the uniformity of the internal structure of the region, and the covariance matrix of the pixels within the image block is constructed and expressed as: ; where is the feature vector at pixel (i,j); is the mean of all pixel feature vectors within the image block; T is the transpose operation; calculate the spatial complexity , which is expressed as: ; where is the covariance matrix 's k-th eigenvalue.

[0047] Embodiment 5, refer toFigure 1 , based on the above embodiment, in step S4, for defect area recognition, the local features of all image patches are weighted and averaged for fusion to form a global feature description. Based on historical annotation data, a support vector machine is trained to determine whether there is a defect area in each image patch.

[0048] By performing the above operations, aiming at the problems of low detection coverage rate, unstable detection results caused by external light and thermal radiation interference, weak ability to identify tiny defects, and easy omission of detection in the general hot stamping and forging defect detection method, this solution divides the complete image into multiple rectangular patches through local area division. Each area independently captures local details and is more sensitive to local defects such as cracks, burns, and pores. Through dynamic sampling step size, the sampling density is adaptively adjusted according to local gray level or texture gradient changes, effectively suppressing the interference of light changes and background noise, and improving the stability and accuracy of hot stamping and forging defect detection.

[0049] Embodiment Six, refer to Figure 1 , based on the above embodiment, in step S5, to establish a defect area target detection model, the image data with defect areas and corresponding annotations are used to construct a target detection network. This network still incorporates adaptive convolution, multi-head attention, and feature attention fusion modules in its design to fully focus on the subtle defect areas in the hot stamping and forging workpiece images; it specifically includes the following steps:

[0050] Step S51: Adaptive convolution kernels are generated on the high-level feature map to better capture local defect features; the historical hot stamping and forging workpiece images with defects are used as the initial input feature map ; perform adaptive convolution processing; based on local features construct adaptive convolution kernels , the adaptive convolution is expressed as: ; ; where is the learning weight of the convolution kernel; is the convolution operation; X is the final input map;

[0051] Step S52: Position embedding; introduce position encoding to enhance the model's ability to capture the position information of defect areas, especially suitable for small defect areas; the position embedding is expressed as: ; after adding the position embedding information to the features, perform multi-head attention calculation, expressed as: ; use residual connection to process the attention result, expressed as: ; further process through a feed-forward network and reconstruct the output, expressed as: ; secondary residual connection, expressed as: ; feature map reconstruction, expressed as: ; where is the spatial location information encoding; is the embedding weight; b is the position index in the row direction of the feature map; c is the channel index; is the multi-head attention output; is the multi-head attention; is the layer normalization; is the residual connection output; is the feed-forward network output; is the ReLU activation function; is the reconstructed feature map; is the shape reconstruction;

[0052] Step S53: Feature attention fusion module; adaptively weights features of different scales and channels through the attention mechanism to highlight the local image information related to defects; fuses and splices the information of local features and encoder output features, expressed as: ; extracts the fused features through two layers of convolution, expressed as: ; performs global average pooling on the features to obtain , generates the channel weight through the fully connected network, expressed as: ; applies the weight to weight the features, expressed as: ; finally, divides, convolves, and reconstructs the weighted features for output, expressed as: ; where is the fusion splicing output; is the splicing; is to adjust each feature map to the same size; are the reconstructed feature maps of different scales; is the fused feature extracted by two layers of convolution; and are the second and first layer convolution operations respectively; is the Sigmoid function; is the second layer fully connected network; is the weight matrix of the first layer fully connected network; is the weighted feature map; is the element-wise multiplication; is the reconstruction output; is the convolution operation on each part of the feature after division; is the division; enables the model to focus on the local features in the sensor data that reflect defects, effectively filtering out the interference information in the background area, thereby improving the recognition accuracy of defect targets;

[0053] Step S54: The finally obtained feature map Input to the object detection head; the detection head generates candidate regions and regresses the target bounding boxes for the local abnormal regions in the feature map, and outputs the target annotations of the defect regions.

[0054] Step S55: Loss function design; construct the local weighted loss. Through the local weighting strategy, higher weights are assigned to the defect regions, making the model more focused on the defect regions. The local weighted loss is expressed as: ; ; construct the foreground enhancement loss , making the model pay more attention to the foreground defect regions and suppressing the influence of background noise, which is expressed as: ; The final loss function is expressed as: ; where, is the weighting coefficient; is the Euclidean distance; is the pixel at coordinates (i, j); is the central pixel of the defect region; is the predicted defect region label; is the true defect region label; i and j are the image coordinate indices; is the weighted attenuation rate factor; is the defect region probability value; is the loss weight.

[0055] By performing the above operations, for the problem that the general hot forging defect detection method for red punching ignores the small area defects on the workpiece surface and has insufficient local feature extraction, resulting in poor detection effect of hot forging defects for red punching, this solution dynamically generates convolution kernels according to local image features, enabling the network to automatically adapt to the defect features in different regions and improving the detection ability for fine defects such as cracks, local burns, and poor fusion; based on the local weighted and foreground enhancement losses, by assigning higher weights to the defect regions, the model can still accurately identify defects when the local defect signal is weak or the background noise is strong, thus significantly improving the detection effect of hot forging defects for red punching.

[0056] Example Seven, refer to Figure 1 , based on the above example, in step S6, the hot forging defect detection for red punching is to collect the image data of the red punching hot forging workpiece in real time, input the image data identified as the defect region into the defect region object detection model, and the model outputs the defect region annotation.

[0057] Example Eight, refer to Figure 2, based on the above embodiments, the red punching hot forging defect detection system based on image processing provided by the present invention includes an image acquisition module, a preliminary feature extraction module, a local feature construction module, a defect area recognition module, a defect area target detection model establishment module, and a red punching hot forging defect detection module;

[0058] The image acquisition module acquires historical red punching hot forging workpiece images, and performs local partitioning and defect annotation on the images;

[0059] The preliminary feature extraction module performs dynamic spatial sampling on each image block and conducts preliminary feature extraction;

[0060] The local feature construction module constructs local features based on the preliminary features;

[0061] The defect area recognition module performs weighted fusion on the local features of all image blocks, and uses historical annotation data to train a support vector machine to determine whether there are defects in each area;

[0062] The defect area target detection model establishment module constructs a target detection network using defect image data, strengthens local defect features through adaptive convolution, multi-head attention, and feature attention fusion modules, and then realizes the establishment of a defect area target detection model;

[0063] The red punching hot forging defect detection module realizes defect detection on real-time collected red punching hot forging workpiece images.

[0064] It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device.

[0065] Although the embodiments of the present invention have been shown and described, those of ordinary skill in the art can understand that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principle and spirit of the present invention.

[0066] The above description of the present invention and its embodiments is not restrictive. What is shown in the drawings is only one of the embodiments of the present invention, and the actual structure is not limited thereto. In general, if those of ordinary skill in the art are inspired by it and, without departing from the spirit of the present invention, design similar structural forms and embodiments to this technical solution without creative efforts, they shall fall within the protection scope of the present invention.

Claims

1. A method for detecting red punching hot forging defects based on image processing, characterized in that: The method comprises the following steps: Step S1: image acquisition: acquiring a historical hot stamping and hot forging workpiece image, and performing local segmentation and defect marking on the image; Step S2: preliminary feature extraction: dynamic spatial sampling is used for each image block, and preliminary feature extraction is performed; Step S3: local feature construction: constructing local features based on preliminary features; Step S4: defect area identification: weighted fusion of local features of all image blocks, and use of historical annotation data to train a support vector machine to determine whether each area has defects; Step S5: Establishing a defect area target detection model; using defect image data to build a target detection network, strengthening local defect features through adaptive convolution, multi-head attention and feature attention fusion modules, and then realizing the establishment of a defect area target detection model; Step S6: bridge pile foundation defect detection: performing defect detection on the hot stamping and hot forging workpiece images collected in real time.

2. The method for detecting red punching hot forging defects based on image processing according to claim 1, characterized in that: In step S2, the preliminary feature extraction is performed for each image block, using dynamic spatial sampling, adaptively adjusting the sampling density according to the local pixel gradient change; introducing a dynamic sampling step; calculating the energy integral moment; and calculating the gradient integral moment.

3. The method for detecting red punching and hot forging defects based on image processing according to claim 2, wherein: In step S3, the local feature construction is to further calculate the features describing the local image state based on the preliminary features of each image block; construct the effective light intensity; calculate the light intensity change rate; and construct the covariance matrix of the pixels in the image block.

4. The method for detecting red punching hot forging defects based on image processing according to claim 3, wherein: In step S5, the establishment of the defect area target detection model is to construct a target detection network using the image data of the defect area and the corresponding annotations, which specifically includes the following steps: Step S51: adaptively generate a convolution kernel on a high-level feature map; use a defective historical hot stamping and hot forging workpiece image as an initial input feature map; perform adaptive convolution processing; and construct an adaptive convolution kernel based on local features; Step S52: position embedding; introducing position encoding; performing multi-head attention calculation after adding the position embedding information to the feature; processing the attention result using residual connection; further processing through the feedforward network and reconstructing the output; secondary residual connection; feature map reconstruction; through position embedding and multi-head attention; Step S53: feature attention fusion module; fuse and splice the information of local features and encoder output features; extract fusion features through two layers of convolution; perform global average pooling on the features, generate channel weights through a fully connected network; apply weights to weight the features; finally, segment the weighted features, reconstruct and output them through convolution; Step S54: Input the finally obtained feature map into the object detection head; the detection head generates candidate regions for local abnormal regions in the feature map and performs target bounding box regression, and outputs the target annotation of the defect region; Step S55: loss function design; construct local weighted loss, and give higher weights to defect areas through local weighted strategy; construct foreground enhancement loss.

5. The method for detecting red-hot forging defects based on image processing according to claim 4, wherein: In step S1, the image acquisition is to acquire the historical red punching and hot forging workpiece image; and mark the image whether there are defects and mark the defect area; regard the acquired historical red punching and hot forging workpiece image as a two-dimensional matrix, and use the local area division method to divide the image into M image blocks.

6. The method for detecting red-hot forging defects based on image processing according to claim 5, wherein: In step S4, the defect area recognition is to perform weighted average fusion on the local features of all image patches to form a global feature description, and based on historical annotation data, train a support vector machine to determine whether there is a defect area in each image patch.

7. The method for detecting red punching hot forging defects based on image processing according to claim 6, characterized in that: In step S6, the bridge pile foundation defect detection is to collect the image data of the red-hot forged workpiece in real time, input the image data identified as the defect area into the defect area target detection model, and the model outputs the defect area annotation.

8. A red-hot forging defect detection system based on image processing, which is used to implement the red-hot forging defect detection method based on image processing according to any one of claims 1-7, and is characterized in that: It includes an image acquisition module, a preliminary feature extraction module, a local feature construction module, a defect area recognition module, a defect area target detection model establishment module, and a bridge pile foundation defect detection module; The image acquisition module acquires historical red-hot forged workpiece images, and performs local division and defect annotation on the images; The preliminary feature extraction module performs dynamic spatial sampling on each image patch and performs preliminary feature extraction; The local feature construction module constructs local features based on the preliminary features; The defect area recognition module performs weighted fusion on the local features of all image patches, and uses historical annotation data to train a support vector machine to determine whether there are defects in each area; The defect area target detection model establishment module uses defect image data to construct a target detection network, strengthens local defect features through an adaptive convolution, multi-head attention, and feature attention fusion module, and then realizes the establishment of the defect area target detection model; The bridge pile foundation defect detection module realizes defect detection on the images of the red-hot forged workpiece collected in real time.