CN116206171A - Method and device for detecting foreign matter faults of vehicle, electronic equipment and storage medium - Google Patents

Method and device for detecting foreign matter faults of vehicle, electronic equipment and storage medium Download PDF

Info

Publication number
CN116206171A
CN116206171A CN202211582797.1A CN202211582797A CN116206171A CN 116206171 A CN116206171 A CN 116206171A CN 202211582797 A CN202211582797 A CN 202211582797A CN 116206171 A CN116206171 A CN 116206171A
Authority
CN
China
Prior art keywords
image
training
vehicle
generated
network model
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211582797.1A
Other languages
Chinese (zh)
Inventor
王喆波
史红梅
丁颖
徐建喜
李林俊
李朋
马瑞峰
王尧
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jiaotong University
CHN Energy Railway Equipment Co Ltd
Original Assignee
Beijing Jiaotong University
CHN Energy Railway Equipment Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jiaotong University, CHN Energy Railway Equipment Co Ltd filed Critical Beijing Jiaotong University
Priority to CN202211582797.1A priority Critical patent/CN116206171A/en
Publication of CN116206171A publication Critical patent/CN116206171A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • G06V10/774Generating sets of training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4038Image mosaicing, e.g. composing plane images from plane sub-images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2200/00Indexing scheme for image data processing or generation, in general
    • G06T2200/32Indexing scheme for image data processing or generation, in general involving image mosaicing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20112Image segmentation details
    • G06T2207/20132Image cropping
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V2201/00Indexing scheme relating to image or video recognition or understanding
    • G06V2201/08Detecting or categorising vehicles
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02TCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
    • Y02T10/00Road transport of goods or passengers
    • Y02T10/10Internal combustion engine [ICE] based vehicles
    • Y02T10/40Engine management systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • Computing Systems (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • Medical Informatics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Molecular Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Image Analysis (AREA)

Abstract

The invention relates to a fault detection technology, and discloses a method, a device, electronic equipment and a storage medium for detecting a fault of a foreign body of a vehicle, wherein the method comprises the following steps: obtaining a training sample, cutting and splicing the training sample to obtain a training image; carrying out image reconstruction on the training image by utilizing the pre-constructed generated countermeasure network model to obtain a generated image; optimizing and training the generated countermeasure network model by using a preset loss function, a training image and a generated image to obtain a target generated countermeasure network model; acquiring a vehicle image to be detected, and encoding the vehicle image to be detected by utilizing a target generation countermeasure network model to obtain a latent vector; and calculating an abnormal value score according to the latent vector, and judging that the foreign object fault exists in the vehicle corresponding to the vehicle image to be detected when the abnormal value score is larger than a preset score threshold value. The invention can identify the foreign body faults of the vehicle under various weather conditions, reduces the dependence on the balance of training samples, and realizes the recognition of the foreign body of the vehicle with higher degree of autonomy.

Description

Method and device for detecting foreign matter faults of vehicle, electronic equipment and storage medium
Technical Field
The present invention relates to the field of fault detection technologies, and in particular, to a method and apparatus for detecting a fault of a foreign object in a vehicle, an electronic device, and a computer readable storage medium.
Background
This section is intended to provide a background or context for the embodiments recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
At present, the track traffic industry in China is vigorously developed, the continuous expansion of railway network scale and the huge economic effect of heavy load freight make the guarantee of railway operation safety more and more important, a heavy load freight car fault detection system is an important means for guaranteeing the operation safety of heavy load freight cars, but the existing solution of the heavy load freight car fault detection system for the foreign object faults of vehicles is to take images from the bottom and the side of the train by using a high-speed industrial camera arranged at the rail side, then transmit the images to a train detection center through a network, finally judge the fault type and the fault position of the images in a manual mode, thus the working intensity of indoor detectors is overlarge, and the overhaul operation quality is also influenced by the subjectivity of people.
In the prior art, algorithms for truck fault detection in China mainly comprise two methods based on traditional digital image processing, the method is divided into four steps, firstly, preprocessing methods such as smoothing, sharpening, segmentation and the like are adopted to strengthen the characteristics of image gray scale, contrast, target component boundary and the like, secondly, potential fault areas are positioned, then geometric visual and algebraic calculation is combined to describe faults, finally, whether the truck breaks down or not is identified according to set rules, but the method has low identification rate, is seriously influenced by factors such as illumination and the like, and still needs to identify the train faults in a man-machine combined mode; secondly, a method based on supervised learning mainly adopts a target detection algorithm such as FasterRCNN, YOLO, SSD, an anchor frame mechanism is introduced, and a variable convolution optimization method is used for improving the model effect, but the method based on supervised learning needs a large number of sample labels, and meanwhile, the identification of the types of foreign matters is limited.
Therefore, developing a vehicle foreign matter detection algorithm which is strong in robustness, meets the real-time requirement and does not need to manufacture sample labels, and can identify the vehicle foreign matter faults of the heavy-duty truck under various weather conditions becomes a technical problem to be solved urgently.
Disclosure of Invention
In view of the foregoing, embodiments of the present invention provide a method, apparatus, electronic device, and computer-readable storage medium for detecting a foreign object failure of a vehicle.
In a first aspect, an embodiment of the present invention provides a method for detecting a foreign object fault of a vehicle, including:
obtaining a training sample, and cutting and splicing the training sample to obtain a training image;
performing image reconstruction on the training image by utilizing a pre-constructed generation countermeasure network model to obtain a generated image;
optimizing training the generated countermeasure network model by using a preset loss function, the training image and the generated image to obtain a target generated countermeasure network model;
acquiring a vehicle image to be detected, and encoding the vehicle image to be detected by utilizing the target generation countermeasure network model to obtain a latent vector;
and calculating an abnormal value score according to the latent vector, and judging that the vehicle corresponding to the vehicle image to be detected has foreign object faults when the abnormal value score is larger than a preset score threshold.
According to an embodiment of the present invention, the clipping and stitching the training samples to obtain training images includes:
scaling the training sample, and shearing the scaled training sample by using a preset sliding window method to obtain a sheared image;
performing resolution screening on the sheared images to obtain initial training images;
splicing the initial training images to obtain spliced images;
and performing color adjustment on the spliced images to obtain training images.
According to an embodiment of the invention, the pre-constructed generated countermeasure network model comprises a generator network and a discrimination network, wherein the generator network comprises an encoder and a decoder, and the discrimination network comprises a discriminator.
According to an embodiment of the present invention, the image reconstruction of the training image using the pre-constructed generation countermeasure network model, to obtain a generated image, includes:
extracting features of the training image by using an encoder in the generated countermeasure network model to obtain a training latent vector;
and decoding the training latent vector by using a decoder in the generating countermeasure network model to obtain a generated image.
According to an embodiment of the present invention, the predetermined loss function includes an anti-loss function, a reconstruction loss function, and a coding loss function.
According to an embodiment of the present invention, the performing optimization training on the generated countermeasure network model by using a preset loss function, the training image and the generated image to obtain a target generated countermeasure network model includes:
performing feature extraction on the generated image by using an encoder in the generated countermeasure network to obtain a generated latent vector;
calculating loss of the discriminators in the generated countermeasure network model by using the countermeasure loss function to obtain countermeasure loss;
the challenge loss function is expressed as:
Figure BDA0003988978580000021
wherein L is adv Indicating that the loss of resistance is to be noted,
Figure BDA0003988978580000022
representing the expected value of the training image X, P X Representing the distribution of the training image, f (X, Z) representing the feature extraction function of the training image X and the training latent vector Z, f (X) (') represents the generated image X And said generated latent vector Z Is a feature extraction function of (1);
calculating the difference value of the training image and the generated image by using the reconstruction loss function to obtain reconstruction loss;
the reconstruction loss function is expressed as:
L con =||X-X′|| 1
Wherein L is con Representing the reconstruction loss, X representing the training image, X' representing the generated mapAn image;
filtering the training latent vector and the generated latent vector by using the coding loss function to obtain coding loss;
the coding loss function is expressed as:
L enc =||Z-Z′|| 1
wherein L is enc Representing the coding loss, Z representing the training latent vector, Z' representing the generated latent vector;
performing weight assignment on the countermeasures, the reconstruction losses and the coding losses to obtain countermeasures, reconstruction weights and coding weights;
taking the countermeasures, the reconstruction losses and the coding losses as target losses, taking the countermeasures, the reconstruction weights and the coding weights as target weights, and generating a target function according to the target losses and the target weights;
the objective function is expressed as:
L full =λ sdv L advcon L conenc L enc
wherein L is full Representing the objective function, L adv Represents the countermeasures against loss, lambda adv Representing the counterweights corresponding to the counterlosses, L con Representing the reconstruction loss, lambda con Representing the reconstruction weight corresponding to the reconstruction loss, L enc Representing the coding loss, lambda enc Representing the coding weight corresponding to the coding loss;
And updating the generated countermeasure network model by using the objective function to obtain an objective generated countermeasure network model.
According to an embodiment of the present invention, the calculating an outlier score according to the latent vector includes:
calculating outlier scores using the following formula:
A=||Y-Y′|| 2
wherein a represents the outlier score, a represents a vehicle latent vector of the latent vectors, and Y' represents a reconstructed latent vector of the latent vectors.
In a second aspect, an embodiment of the present invention provides a foreign object fault detection device for a vehicle, including:
the training image generation module is used for acquiring training samples, and cutting and splicing the training samples to obtain training images;
the training image reconstruction module is used for carrying out image reconstruction on the training image by utilizing the pre-constructed generation countermeasure network model to obtain a generated image;
the generated countermeasure network model training module is used for optimally training the generated countermeasure network model by utilizing a preset loss function, the training image and the generated image to obtain a target generated countermeasure network model;
the latent vector generation module is used for acquiring a vehicle image to be detected, and encoding the vehicle image to be detected by utilizing the target generation countermeasure network model to obtain a latent vector;
And the latent vector calculation module is used for calculating an abnormal value score according to the latent vector, and judging that the vehicle corresponding to the vehicle image to be detected has foreign object faults when the abnormal value score is larger than a preset score threshold value.
In a third aspect, an embodiment of the present invention provides an electronic device, including:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement a vehicle foreign matter fault detection method as described in the previous first aspect.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a vehicle foreign matter fault detection method as described in the foregoing first aspect.
Compared with the prior art, the technical scheme of the invention has the following beneficial effects:
according to the embodiment of the invention, the training samples are cut and spliced, so that the obtained training images are more diversified; the training image is reconstructed by generating the countermeasure network model, so that a normal image can be clearly reconstructed, and the recognition accuracy is higher; optimizing and training the generated countermeasure network model through the loss function, the training image and the generated image, so that the generated target generated countermeasure network model is more intelligent and automatic, and the calculation efficiency can be accelerated; the accuracy of the latent vector can be ensured by utilizing the target generation countermeasure network model to encode the vehicle image to be detected; calculating an abnormal value score through the latent vector, and judging whether a foreign object fault exists in the vehicle corresponding to the vehicle image to be detected or not according to the abnormal value score, so that a judging result is more accurate and the efficiency is higher; by generating the countermeasure network model to perform foreign matter fault recognition, the dependence on the balance of training samples is reduced, and the recognition of the vehicle foreign matter with higher degree of autonomy is realized, so that the method has better coping capability and reliability for various complex severe conditions of extreme weather, tunnel road sections and mountain road sections, and has better robustness for applications under different light rays, different backgrounds and different weather conditions.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart showing a method for detecting a foreign object failure of a vehicle according to a first embodiment of the present invention;
FIG. 2 is a schematic diagram showing a network structure for generating an countermeasure network model according to the first embodiment of the present invention;
fig. 3 is a flow chart schematically showing an overall scheme of a method for detecting a foreign object fault of a vehicle based on semi-supervised learning according to the first embodiment of the present invention;
FIG. 4 is a functional block diagram showing a foreign matter fault detection device for a vehicle according to a third embodiment of the present invention;
fig. 5 is a schematic diagram showing the composition structure of an electronic device for realizing the method for detecting a foreign matter failure in a vehicle according to the fourth embodiment of the invention.
Detailed Description
The disclosure is further described below with reference to the embodiments shown in the drawings.
It should be noted that, in the case of no conflict, the embodiments and features in the embodiments may be combined with each other. The invention will be described in detail below with reference to the drawings in connection with embodiments.
The invention provides a vehicle foreign matter fault detection method, which is characterized in that a training sample is taken as a basis, a training image is obtained after cutting and splicing the training sample, a generated countering network model is utilized to reconstruct the training image, a generated image is obtained, the countering network model is generated according to a loss function, the generated image and the training image in an optimized mode, the vehicle image to be detected is encoded by utilizing the obtained target generating network model, an outlier score is calculated by utilizing a latent vector obtained after encoding, and whether the vehicle corresponding to the vehicle image to be detected has a foreign matter fault or not is judged according to the outlier score. Compared with the traditional method, the vehicle foreign matter fault detection method realizes the recognition of the vehicle foreign matter with higher degree, reduces the dependence on the balance of training samples, has better coping ability and reliability for various complex and severe conditions such as extreme weather, tunnel sections and the like, and has better robustness for applications under different light rays, different backgrounds and different weather conditions.
Example 1
As shown in fig. 1, the present invention provides a method for detecting a foreign object fault of a vehicle, comprising the steps of:
s1, acquiring a training sample, and cutting and splicing the training sample to obtain a training image;
In the embodiment of the invention, the training sample comprises running images of trains in the up-down process; since the resolution of the image is too high when the running image is acquired, the resolution can be reduced by cropping the image.
In the embodiment of the present invention, the step of clipping and stitching the training samples to obtain training images includes:
scaling the training sample, and shearing the scaled training sample by using a preset sliding window method to obtain a sheared image;
performing resolution screening on the sheared images to obtain initial training images;
splicing the initial training images to obtain spliced images;
and performing color adjustment on the spliced images to obtain training images.
According to the embodiment of the invention, the training samples can be scaled according to a preset proportion, for example, the training samples with the resolution of 1400 x 1024 are scaled to the training samples with the resolution of 768 x 512; clipping the scaled training samples by utilizing the sliding window method, for example, the scaled training samples can be clipped into 6 blocks of 256-256 resolution clipping images; filtering the sheared images with low correlation degree after cutting to obtain initial training images; splicing the initial training images according to the corresponding positions of the original training samples to obtain spliced images; and adjusting the brightness and contrast of the spliced image to realize the expansion of a data set and obtain a training image.
S2, performing image reconstruction on the training image by utilizing a pre-constructed generation countermeasure network model to obtain a generated image;
in the embodiment of the invention, the pre-constructed generating countermeasure network model comprises a generator network and a judging network, wherein the generator network comprises an encoder and a decoder, and the judging network comprises a judging device.
In the embodiment of the present invention, the performing image reconstruction on the training image by using the pre-constructed generating countermeasure network model to obtain a generated image includes:
extracting features of the training image by using an encoder in the generated countermeasure network model to obtain a training latent vector;
and decoding the training latent vector by using a decoder in the generating countermeasure network model to obtain a generated image.
In the embodiment of the invention, a preset mixed domain attention mechanism can be added to an encoder and a decoder for combined use, when the encoder performs feature extraction on the training image, convolution operation, pooling operation and activation operation on the training image, normalization processing is performed on the processed training image to obtain a training latent vector, wherein the activation operation can be activated by using a LeakyReLU activation function, the normalization processing can be performed by using a BN layer, for example, when the training image is unified to 256x256x3 resolution and input to the generated countermeasure network model for convolution, a convolution layer with a 6-layer convolution kernel size of 4x4, a step length of 2 and a layer of convolution kernel size of 4x4, a step length of 1 is designed, the training image is extracted to be a training latent vector with a dimension of 100, and a channel attention mechanism (SE module) is added to the 4 th to 6 th layer convolution layer for subsequent processing of the training image; and when the decoder decodes the latent vector, deconvolution operation, pooling operation and activation operation are carried out on the training latent vector to obtain a generated image, wherein the activation operation can be activated by using a Tanh activation function, and the spatial attention mechanisms (self-attention) are added to the layers 4 to 6 when deconvolution operation is carried out to carry out subsequent processing on the training latent vector.
Specifically, the mixed domain attention mechanism (CBAM module) is a resource allocation mechanism, which can change the resource allocation mode according to the importance degree of the attention target, so as to incline the resource more toward the attention target, and is composed of a channel attention mechanism (SE module) and a spatial attention mechanism (self-attention); the network structure of the channel attention mechanism (SE module) comprises global maximum pooling operation, global average pooling operation, convolution operation, activation operation and normalization operation; the network structure of the spatial attention mechanism (self-attention) includes a max pooling operation, an average pooling operation, a convolution operation, and an activation operation.
In the embodiment of the invention, the mixed domain attention mechanism is added into the encoder and the decoder, so that the image reconstruction effect can be improved, and the calculation efficiency can be accelerated.
S3, optimizing and training the generated countermeasure network model by using a preset loss function, the training image and the generated image to obtain a target generated countermeasure network model;
in the embodiment of the present invention, the predetermined loss function includes an anti-loss function, a reconstruction loss function, and a coding loss function.
In the embodiment of the present invention, the optimizing training of the generated countermeasure network model by using a preset loss function, the training image and the generated image to obtain a target generated countermeasure network model includes:
performing feature extraction on the generated image by using an encoder in the generated countermeasure network to obtain a generated latent vector;
calculating loss of the discriminators in the generated countermeasure network model by using the countermeasure loss function to obtain countermeasure loss;
the challenge loss function is expressed as:
Figure BDA0003988978580000071
wherein L is adv Indicating that the loss of resistance is to be noted,
Figure BDA0003988978580000072
representing the expected value of the training image X, P X Representing the distribution of the training image, f (X, Z) representing the feature extraction function of the training image X and the training latent vector Z, and f (X ', Z') representing the feature extraction function of the generated image X 'and the generated latent vector Z';
calculating the difference value of the training image and the generated image by using the reconstruction loss function to obtain reconstruction loss;
the reconstruction loss function is expressed as:
L con =||X-X′|| 1
wherein L is con Representing the reconstruction loss, X representing the training image, X' representing the generated image;
filtering the training latent vector and the generated latent vector by using the coding loss function to obtain coding loss;
The coding loss function is expressed as:
L enc =||Z-Z′|| 1
wherein L is enc Representing the coding loss, Z representing the training latent vector, Z' representing the generated latent vector;
performing weight assignment on the countermeasures, the reconstruction losses and the coding losses to obtain countermeasures, reconstruction weights and coding weights;
taking the countermeasures, the reconstruction losses and the coding losses as target losses, taking the countermeasures, the reconstruction weights and the coding weights as target weights, and generating a target function according to the target losses and the target weights;
the objective function is expressed as:
L full =λ adv L advcon L conenc L enc
wherein L is full Representing the objective function, L adv Represents the countermeasures against loss, lambda adv Representing the counterweights corresponding to the counterlosses, L con Representing the reconstruction loss, lambda con Representing the reconstruction weight corresponding to the reconstruction loss, L enc Representing the coding loss, lambda enc Representing the coding weight corresponding to the coding loss;
and updating the generated countermeasure network model by using the objective function to obtain an objective generated countermeasure network model.
In an alternative embodiment of the present invention, the loss calculation may be performed using a least squares method.
In an embodiment of the present invention, a network structure for generating an countermeasure network model is shown in fig. 2, and includes a generating network and a discriminating network, where the generating network includes an encoder (G E1 、G E2 ) Decoder (G) D ) The discrimination network comprises a discriminator (D); inputting the training image X to the encoder G E1 Coding to obtain training latent vector Z, and inputting the training latent vector Z into decoder G D Decoding to obtain a generated image X', and passing through an encoder G E2 Decoding to obtain a generated latent vector Z'; performing loss calculation according to the training vector, the training latent vector, the generated image and the generated latent vector to obtain counterloss L adv Reconstruction loss L con Coding loss L enc
S4, acquiring a vehicle image to be detected, and encoding the vehicle image to be detected by utilizing the target generation countermeasure network model to obtain a latent vector;
in the embodiment of the invention, the vehicle image to be detected can be a vehicle enterprise shooting image, a road camera snap shooting image and the like.
In the embodiment of the present invention, the encoding the vehicle image to be detected by using the target generation countermeasure network model to obtain a latent vector includes:
encoding the vehicle image to be detected by using an encoder in the target generation countermeasure network model to obtain a vehicle latent vector;
decoding the vehicle latent vector by using a decoder in the target generation countermeasure network model to obtain a reconstructed vehicle image;
And encoding the reconstructed vehicle image by using the encoder to obtain a reconstructed latent vector.
In the embodiment of the invention, the target generation countermeasure network model is utilized to encode, decode and recode the vehicle image to be detected, so that the vehicle image to be detected is more real and can extract deeper latent vectors.
And S5, calculating an abnormal value score according to the latent vector, and judging whether the vehicle corresponding to the vehicle image to be detected has foreign matter faults or not according to the abnormal value score.
In an embodiment of the present invention, the calculating an outlier score according to the latent vector includes:
calculating outlier scores using the following formula:
A=||Y-Y′|| 2
wherein a represents the outlier score, a represents a vehicle latent vector of the latent vectors, and Y' represents a reconstructed latent vector of the latent vectors.
And when the abnormal value score is larger than a preset score threshold, executing S6, and judging that the foreign object fault exists in the vehicle corresponding to the vehicle image to be detected.
In the embodiment of the invention, the target generation countermeasure network model is utilized to judge whether the abnormal value score is larger than a preset score threshold, and when the abnormal value score is larger than the preset score threshold, the vehicle corresponding to the vehicle image to be detected is judged to have the foreign object fault, for example, when the preset score threshold is 0.005, that is, when the abnormal value score is larger than 0.005, the vehicle corresponding to the vehicle image to be detected is judged to have the foreign object fault.
And when the abnormal value score is smaller than or equal to a preset score threshold value, executing S7, and judging that the vehicle corresponding to the vehicle image to be detected does not have foreign object faults.
In the embodiment of the present invention, when the abnormal value score is less than or equal to a preset score threshold, for example, the preset score threshold is 0.005, that is, when the abnormal value score is equal to 0.005, it is determined that the vehicle corresponding to the vehicle image to be detected has no foreign object fault.
In the embodiment of the invention, the overall scheme flow of the vehicle foreign matter fault detection method based on semi-supervised learning is shown in fig. 3, and the training phase is as follows: performing image reconstruction based on a pre-constructed generated countermeasure network model, performing data enhancement, cutting and splicing on the training image to obtain a generated image, and performing training based on the generated image, the training image and the like to generate a countermeasure network model to obtain a target generated countermeasure network model; the application stage comprises the following steps: and testing the image of the vehicle to be detected subjected to image preprocessing by using the trained target generation countermeasure network model, calculating an outlier score, and judging whether the vehicle corresponding to the image of the vehicle to be detected has foreign matter faults or not according to the outlier score.
Example two
In order to more clearly understand the present invention, the case of performing image reconstruction on the training image by using the pre-constructed generation countermeasure network model to obtain the generated image according to the embodiment of the present invention will be further explained below by using a second embodiment.
In an embodiment of the present invention, the pre-constructed generating countermeasure network model includes a generator network and a discrimination network, wherein the generator network includes an encoder (G E1 、G E2 ) Decoder (G) D ) The discrimination network includes a discriminator (D).
In the embodiment of the present invention, the performing image reconstruction on the training image by using the pre-constructed generating countermeasure network model to obtain a generated image includes:
convolving and pooling the training image by using an encoder in the generated countermeasure network model to obtain pooling characteristics;
residual connection is carried out on the pooling feature and the training image, so that connection features are obtained;
activating and normalizing the connection characteristics to obtain training latent vectors;
and decoding the training latent vector by using a decoder in the generating countermeasure network model to obtain a generated image.
In the embodiment of the invention, the pooling process may be global average pooling process; residual connection, namely linear superposition of input (the training image) and input nonlinear transformation (the pooling feature), is carried out on the pooling feature and the training image, so that the complexity of generating an countermeasure network model can be reduced, and the overfitting phenomenon is reduced; the activation may be performed using a preset LeakyReLU activation function; the normalization processing refers to pixel normalization and spectrum normalization processing on the connection features; and performing deconvolution operation, average pooling operation and activation operation on the training latent vector by using the decoder to obtain a generated image.
Example III
As shown in fig. 4, the present embodiment also provides a functional block diagram of a vehicle foreign matter fault detection device.
The vehicle foreign matter fault detection apparatus 400 described in the present embodiment may be mounted in an electronic device. Depending on the functions implemented, the vehicle foreign object fault detection apparatus 400 may include a training image generation module 401, a training image reconstruction module 402, a generation countermeasure network model training module 403, a latent vector generation module 404, and a latent vector calculation module 405. The module of the invention, which may also be referred to as a unit, refers to a series of computer program segments, which are stored in the memory of the electronic device, capable of being executed by the processor of the electronic device and of performing a fixed function.
In the present embodiment, the functions concerning the respective modules/units are as follows:
the training image generating module 401 is configured to obtain a training sample, and cut and splice the training sample to obtain a training image;
the training image reconstruction module 402 is configured to reconstruct an image of the training image by using a pre-constructed generated countermeasure network model, so as to obtain a generated image;
the generated countermeasure network model training module 403 is configured to perform optimization training on the generated countermeasure network model by using a preset loss function, the training image, and the generated image, so as to obtain a target generated countermeasure network model;
The latent vector generation module 404 is configured to obtain a vehicle image to be detected, and encode the vehicle image to be detected by using the target generation countermeasure network model to obtain a latent vector;
the latent vector calculation module 405 is configured to calculate an outlier score according to the latent vector, and determine that a foreign object fault exists in the vehicle corresponding to the vehicle image to be detected when the outlier score is greater than a preset score threshold.
In detail, each module in the vehicle foreign matter fault detection device 400 in the embodiment of the present invention adopts the same technical means as the vehicle foreign matter fault detection method in the first embodiment and the second embodiment, and can produce the same technical effects, which are not described herein.
Example IV
As shown in fig. 5, the present embodiment further provides a computer electronic device, where the electronic device 500 may include a processor 501, a memory 502, a communication bus 503, and a communication interface 504, and may further include a computer program, such as a vehicle foreign matter fault detection program, stored in the memory 502 and executable on the processor 501.
The processor 501 may be formed by an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be formed by a plurality of integrated circuits packaged with the same function or different functions, including one or more central processing units (Central Processing unit, CPU), a microprocessor, a digital processing chip, a graphics processor, a combination of various control chips, and so on. The processor 501 is a Control Unit (Control Unit) of the electronic device, connects various components of the entire electronic device using various interfaces and lines, executes or executes programs or modules (e.g., a vehicle foreign matter fault detection program, etc.) stored in the memory 502, and invokes data stored in the memory 502 to perform various functions of the electronic device and process data.
The memory 502 includes at least one type of readable storage medium including flash memory, a removable hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. The memory 502 may in some embodiments be an internal storage unit of the electronic device, such as a mobile hard disk of the electronic device. The memory 502 may also be an external storage device of the electronic device in other embodiments, for example, a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like. Further, the memory 502 may also include both internal storage units and external storage devices of the electronic device. The memory 502 may be used not only to store application software installed in an electronic device and various data such as codes of a vehicle foreign matter fault detection program, but also to temporarily store data that has been output or is to be output.
The communication bus 503 may be a peripheral component interconnect standard (peripheral component interconnect, PCI) bus or an extended industry standard architecture (extended industry standard architecture, EISA) bus, among others. The bus may be classified as an address bus, a data bus, a control bus, etc. The bus is arranged to enable connected communication between the memory 502 and the at least one processor 501 etc.
The communication interface 504 is used for communication between the electronic device and other devices, including network interfaces and user interfaces. Optionally, the network interface may include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), typically used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a Display (Display), an input unit such as a Keyboard (Keyboard), or alternatively a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, or the like. The display may also be referred to as a display screen or display unit, as appropriate, for displaying information processed in the electronic device and for displaying a visual user interface.
Only an electronic device having components is shown, and it will be understood by those skilled in the art that the structures shown in the figures do not limit the electronic device, and may include fewer or more components than shown, or may combine certain components, or a different arrangement of components.
For example, although not shown, the electronic device may further include a power source (such as a battery) for supplying power to the respective components, and preferably, the power source may be logically connected to the at least one processor 501 through a power management device, so that functions of charge management, discharge management, power consumption management, and the like are implemented through the power management device. The power supply may also include one or more of any of a direct current or alternating current power supply, recharging device, power failure detection circuit, power converter or inverter, power status indicator, etc. The electronic device may further include various sensors, bluetooth modules, wi-Fi modules, etc., which are not described herein.
It should be understood that the embodiments described are for illustrative purposes only and are not limited to this configuration in the scope of the patent application.
The vehicle foreign matter fault detection program stored in the memory 502 in the electronic device is a combination of a plurality of instructions, which when executed in the processor 501, can implement:
obtaining a training sample, and cutting and splicing the training sample to obtain a training image;
performing image reconstruction on the training image by utilizing a pre-constructed generation countermeasure network model to obtain a generated image;
Optimizing training the generated countermeasure network model by using a preset loss function, the training image and the generated image to obtain a target generated countermeasure network model;
acquiring a vehicle image to be detected, and encoding the vehicle image to be detected by utilizing the target generation countermeasure network model to obtain a latent vector;
and calculating an abnormal value score according to the latent vector, and judging that the vehicle corresponding to the vehicle image to be detected has foreign object faults when the abnormal value score is larger than a preset score threshold.
In particular, the specific implementation method of the above instruction by the processor 501 may refer to the description of the relevant steps in the corresponding embodiment of the drawings, which is not repeated herein.
Further, the electronic device integrated modules/units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. The computer readable storage medium may be volatile or nonvolatile. For example, the computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM).
Example five
The present embodiment provides a storage medium storing a computer program which, when executed by a processor, implements the steps of the vehicle foreign matter fault detection method as described above.
These program code may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows.
Storage media includes both permanent and non-permanent, removable and non-removable media, and information storage may be implemented by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media may include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, read only compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
It is noted that the terms used herein are used merely to describe particular embodiments and are not intended to limit exemplary embodiments in accordance with the present application and when the terms "comprises" and/or "comprising" are used in this specification they specify the presence of stated features, steps, operations, devices, components, and/or combinations thereof.
It is to be understood that the terms so used are interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein.
In the several embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be other manners of division when actually implemented.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units can be realized in a form of hardware or a form of hardware and a form of software functional modules.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof.
The present embodiments are, therefore, to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The embodiment of the application can acquire and process the related data based on the artificial intelligence technology. Among these, artificial intelligence (Artificial Intelligence, AI) is the theory, method, technique and application system that uses a digital computer or a digital computer-controlled machine to simulate, extend and extend human intelligence, sense the environment, acquire knowledge and use knowledge to obtain optimal results.
Furthermore, it is evident that the word "comprising" does not exclude other elements or steps, and that the singular does not exclude a plurality. A plurality of units or means recited in the system claims can also be implemented by means of software or hardware by means of one unit or means. The terms first, second, etc. are used to denote a name, but not any particular order.
Finally, it should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention.

Claims (10)

1. A method for detecting a foreign object failure of a vehicle, the method comprising:
obtaining a training sample, and cutting and splicing the training sample to obtain a training image;
performing image reconstruction on the training image by utilizing a pre-constructed generation countermeasure network model to obtain a generated image;
optimizing training the generated countermeasure network model by using a preset loss function, the training image and the generated image to obtain a target generated countermeasure network model;
Acquiring a vehicle image to be detected, and encoding the vehicle image to be detected by utilizing the target generation countermeasure network model to obtain a latent vector;
and calculating an abnormal value score according to the latent vector, and judging that the vehicle corresponding to the vehicle image to be detected has foreign object faults when the abnormal value score is larger than a preset score threshold.
2. The method for detecting a foreign object failure of a vehicle according to claim 1, wherein the step of clipping and stitching the training samples to obtain a training image includes:
scaling the training sample, and shearing the scaled training sample by using a preset sliding window method to obtain a sheared image;
performing resolution screening on the sheared images to obtain initial training images;
splicing the initial training images to obtain spliced images;
and performing color adjustment on the spliced images to obtain training images.
3. The vehicle foreign matter fault detection method of claim 1, wherein the pre-built generation countermeasure network model includes a generator network and a discrimination network, wherein the generator network includes an encoder and a decoder, and the discrimination network includes a discriminator.
4. The method for detecting a foreign object failure in a vehicle according to claim 3, wherein the image reconstruction of the training image using the pre-constructed generation countermeasure network model to obtain a generated image includes:
extracting features of the training image by using an encoder in the generated countermeasure network model to obtain a training latent vector;
and decoding the training latent vector by using a decoder in the generating countermeasure network model to obtain a generated image.
5. The method for detecting a foreign object fault in a vehicle according to claim 1, wherein the predetermined loss function includes an countermeasure loss function, a reconstruction loss function, and a coding loss function.
6. The method for detecting a foreign object fault in a vehicle according to claim 5, wherein the optimizing training of the generated countermeasure network model using a predetermined loss function, the training image, and the generated image to obtain a target generated countermeasure network model comprises:
performing feature extraction on the generated image by using an encoder in the generated countermeasure network to obtain a generated latent vector;
calculating loss of the discriminators in the generated countermeasure network model by using the countermeasure loss function to obtain countermeasure loss;
The challenge loss function is expressed as:
Figure FDA0003988978570000021
wherein L is adv Indicating that the loss of resistance is to be noted,
Figure FDA0003988978570000022
representing the expected value of the training image X, P X Representing the distribution of the training image, f (X, Z) representing the feature extraction function of the training image X and the training latent vector Z, and f (X ', Z') representing the feature extraction function of the generated image X 'and the generated latent vector Z';
calculating the difference value of the training image and the generated image by using the reconstruction loss function to obtain reconstruction loss;
the reconstruction loss function is expressed as:
L con =||X-X′|| 1
wherein L is con Representing the reconstruction loss, X representing the training image, X' representing the generated image;
filtering the training latent vector and the generated latent vector by using the coding loss function to obtain coding loss;
the coding loss function is expressed as:
L enc =||Z-Z′|| 1
wherein L is enc Representing the coding loss, Z representing the training latent vector, Z' representing the generated latent vector;
performing weight assignment on the countermeasures, the reconstruction losses and the coding losses to obtain countermeasures, reconstruction weights and coding weights;
taking the countermeasures, the reconstruction losses and the coding losses as target losses, taking the countermeasures, the reconstruction weights and the coding weights as target weights, and generating a target function according to the target losses and the target weights;
The objective function is expressed as:
L full =λ adv L advcon L conenc L enc
wherein L is full Representing the objective function, L adv Represents the countermeasures against loss, lambda adv Representing the counterweights corresponding to the counterlosses, L con Representing the reconstruction loss, lambda con Representing the reconstruction weight corresponding to the reconstruction loss, L enc Representing the coding loss, lambda enc Representing the coding weight corresponding to the coding loss;
and updating the generated countermeasure network model by using the objective function to obtain an objective generated countermeasure network model.
7. The vehicle foreign matter fault detection method of claim 1, wherein the calculating an outlier score from the latent vector includes:
calculating outlier scores using the following formula:
A=||Y-Y′|| 2
wherein a represents the outlier score, a represents a vehicle latent vector of the latent vectors, and Y' represents a reconstructed latent vector of the latent vectors.
8. A foreign matter fault detection device for a vehicle, the device comprising:
the training image generation module is used for acquiring training samples, and cutting and splicing the training samples to obtain training images;
the training image reconstruction module is used for carrying out image reconstruction on the training image by utilizing the pre-constructed generation countermeasure network model to obtain a generated image;
The generated countermeasure network model training module is used for optimally training the generated countermeasure network model by utilizing a preset loss function, the training image and the generated image to obtain a target generated countermeasure network model;
the latent vector generation module is used for acquiring a vehicle image to be detected, and encoding the vehicle image to be detected by utilizing the target generation countermeasure network model to obtain a latent vector;
and the latent vector calculation module is used for calculating an abnormal value score according to the latent vector, and judging that the vehicle corresponding to the vehicle image to be detected has foreign object faults when the abnormal value score is larger than a preset score threshold value.
9. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the vehicle foreign matter fault detection method of any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that a computer program is stored thereon, which when executed by a processor, implements the vehicle foreign matter fault detection method according to any one of claims 1 to 7.
CN202211582797.1A 2022-12-08 2022-12-08 Method and device for detecting foreign matter faults of vehicle, electronic equipment and storage medium Pending CN116206171A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211582797.1A CN116206171A (en) 2022-12-08 2022-12-08 Method and device for detecting foreign matter faults of vehicle, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211582797.1A CN116206171A (en) 2022-12-08 2022-12-08 Method and device for detecting foreign matter faults of vehicle, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116206171A true CN116206171A (en) 2023-06-02

Family

ID=86518155

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211582797.1A Pending CN116206171A (en) 2022-12-08 2022-12-08 Method and device for detecting foreign matter faults of vehicle, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116206171A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117726990A (en) * 2023-12-27 2024-03-19 浙江恒逸石化有限公司 Method and device for detecting spinning workshop, electronic equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117726990A (en) * 2023-12-27 2024-03-19 浙江恒逸石化有限公司 Method and device for detecting spinning workshop, electronic equipment and storage medium
CN117726990B (en) * 2023-12-27 2024-05-03 浙江恒逸石化有限公司 Method and device for detecting spinning workshop, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN113486726B (en) Rail transit obstacle detection method based on improved convolutional neural network
CN112016500B (en) Group abnormal behavior identification method and system based on multi-scale time information fusion
CN104350510B (en) For the method and system for distinguishing the foreground object of image and background model
CN113033604B (en) Vehicle detection method, system and storage medium based on SF-YOLOv4 network model
CN111079627A (en) Railway wagon brake beam body breaking fault image identification method
CN110111581A (en) Target identification method, device, computer equipment and storage medium
CN110826429A (en) Scenic spot video-based method and system for automatically monitoring travel emergency
CN116206171A (en) Method and device for detecting foreign matter faults of vehicle, electronic equipment and storage medium
CN109635823A (en) The method and apparatus and engineering machinery of elevator disorder cable for identification
CN115601682A (en) Method and device for detecting foreign matters of underground belt conveyor
Zhang et al. Detecting small chinese traffic signs via improved yolov3 method
CN112907138B (en) Power grid scene early warning classification method and system from local to whole perception
CN113936299A (en) Method for detecting dangerous area in construction site
CN113159046A (en) Method and device for detecting foreign matters in ballastless track bed
CN116129100A (en) Truck part positioning and fault identifying method, device, equipment and medium
CN115294774B (en) Non-motor vehicle road stopping detection method and device based on deep learning
CN116630989A (en) Visual fault detection method and system for intelligent ammeter, electronic equipment and storage medium
AYSAL et al. Real-Time Application of Traffic Sign Recognition Algorithm with Deep Learning
Bi et al. CASA-Net: a context-aware correlation convolutional network for scale-adaptive crack detection
CN113792801A (en) Method, device and equipment for detecting dazzling degree of human face and storage medium
Li et al. Damage detection algorithm based on faster-RCNN
CN113657488B (en) User grading method, device, equipment and storage medium based on driving behaviors
CN112017065B (en) Method, device and computer readable storage medium for vehicle damage assessment and claim
Setyawan et al. Detection and Assessment of Damaged Objects on the Car Body Based on YOLO-V5
CN117934417A (en) Method, device, equipment and medium for identifying apparent defects of road based on neural network

Legal Events

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