Image-based foreign body intrusion detection method and device for petrochemical plants
Through image-based detection methods and infrared thermal imaging cameras, combined with the YOLOv5 model, the problem of insufficient accuracy in foreign object intrusion detection in petrochemical plants is solved, achieving high-accuracy detection under poor light conditions and improving production safety.
Patent Information
- Application Number
- CN202411140922.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-08-20
AI Technical Summary
In petrochemical plants, existing technology is difficult to accurately detect foreign object intrusion under poor lighting conditions, resulting in missed detection problems and affecting production safety.
The image-based detection method is used to obtain multi-category image data, train the YOLOv5 model, and combine it with an infrared thermal imaging camera to determine the movement and temperature anomalies of the target and send alarm information.
It improves the accuracy of foreign object intrusion detection under poor light conditions and ensures safe management of petrochemical plants.
Smart Images

Figure CN118657934B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of object detection, and in particular to an image-based petrochemical plant foreign body intrusion detection method and device. Background Art
[0002] With the vigorous development of the chemical industry, the safety management issues brought about by the development of chemical enterprises have become increasingly prominent. In chemical enterprises, the material media of many production devices are explosive, toxic, flammable and other dangerous. In the production process of petrochemical plants, cats, dogs, mice and other creatures often break into the production area and cabinet room, affecting the normal production order and becoming one of the difficulties within the industry.
[0003] At present, the safety monitoring of most chemical production enterprises is limited to general video monitoring, which can only rely on manual identification and manual alarm. With the development of technology, some factories have adopted visible light to detect foreign body intrusion, but it is easy to miss detection during the period of poor lighting. Summary of the invention
[0004] Based on this, it is necessary to provide an image-based petrochemical plant foreign object intrusion detection method and device that can improve the accuracy of foreign object intrusion detection during periods of poor lighting to address the above technical problems.
[0005] The present invention provides an image-based foreign body intrusion detection method for a petrochemical plant, the method comprising:
[0006] Acquire multi-category image data of different targets, and annotate the corresponding targets in the image data to mark the bounding box of each target, and generate a label file corresponding to each target;
[0007] Building an image dataset based on the multi-category image data of the different targets, and training a YOLOv5 model based on the image dataset and the label file to obtain a target object recognition model;
[0008] Acquire current image data, and preprocess the current image data, so as to use the preprocessed current image data as input of the target object recognition model, perform forward propagation, and output a preset frame and target object category of the target object in the current image data;
[0009] Based on a preset frame of the target object in the current image data, acquiring multiple frames of image data including the current image data, and calculating a sum of differences of the multiple frames of image data to determine whether the target object in the preset frame moves; and
[0010] Acquire the highest temperature and the lowest temperature of the target object in the preset frame by using an infrared thermal imaging camera to determine whether the temperature of the target object in the preset frame is abnormal;
[0011] When the target object in the preset frame moves and the temperature is abnormal, an alarm message indicating the invasion of foreign objects is sent to the terminal.
[0012] In one embodiment, the constructing an image dataset based on the multi-category image data of the different targets, and training a YOLOv5 model based on the image dataset and the label file to obtain a target object recognition model includes:
[0013] Based on the image dataset, dividing the image dataset into a training set, a validation set, and a test set according to multi-category image data of different targets in the image dataset;
[0014] The training set and label file are called to train the YOLOv5 model, and the hyperparameters and optimizer in the YOLOv5 model are adjusted through the validation set, and the performance of the trained YOLOv5 model is evaluated through the test set.
[0015] In one embodiment, the acquiring of current image data and preprocessing of the current image data so as to use the preprocessed current image data as input of the target object recognition model and to perform forward propagation so as to output a preset frame and a target object category of the target object in the current image data includes:
[0016] Performing preprocessing operations of adjusting the image size and normalizing the current image data so that the current image data meets the input requirements of the target object recognition model;
[0017] The preprocessed current image data is used as the input of the target object recognition model to call the target object recognition model to perform forward propagation on the current image data to obtain the bounding box coordinates and target object category of the target object in the current image data.
[0018] In one embodiment, the method of acquiring current image data and preprocessing the current image data so as to use the preprocessed current image data as input of the target object recognition model and perform forward propagation to output a preset frame and target object category of the target object in the current image data further includes:
[0019] Performing non-maximum suppression processing on the bounding box coordinates and the target object category in the current image data to eliminate the overlapping bounding boxes of the target object in the current image data, and filtering out the preset box according to the probability threshold of the target object category;
[0020] A preset frame area in the current image data is intercepted, and based on the position coordinates of the preset frame, an image sequence in which the target object in the current image data is locked is obtained, wherein the image sequence is a plurality of frames of image data including the current image data where the target object in the current image data is located.
[0021] In one embodiment, based on the preset frame of the target object in the current image data, acquiring multiple frames of image data including the current image data, and calculating the sum of differences of the multiple frames of image data to determine whether the target object in the preset frame moves, includes:
[0022] Calculate the sum of differences of multiple frames of image data in the image sequence, and determine whether the sum of differences exceeds a set first threshold; if so,
[0023] Determine whether the target in the current image data is moving; if not, then
[0024] It is determined that the target object in the current image data has not moved.
[0025] In one embodiment, the step of obtaining the highest temperature and the lowest temperature of the target in the preset frame by using an infrared thermal imaging camera to determine whether the temperature of the target in the preset frame is abnormal includes:
[0026] Generate an image mask according to the current image data, the mask expression is:
[0027] ;
[0028] In the formula, For the mask, are the coordinates of the pixels in the image, It is the area contained by the preset frame;
[0029] When the image acquisition device switches to the current image data, the matrix of the mask is subjected to Hadamard product processing with the matrix corresponding to the current image data of the preset frame to lock the target object in the current image data.
[0030] In one embodiment, obtaining the highest temperature and the lowest temperature of the target object in the preset frame by using an infrared thermal imaging camera to determine whether the temperature of the target object in the preset frame is abnormal includes:
[0031] Obtaining the highest temperature or the lowest temperature of the target object in each frame of image data in the multiple frames of image data, and obtaining the highest temperature or the lowest temperature after data smoothing by weighted acquisition to obtain the mean and standard deviation of the highest temperature or the lowest temperature;
[0032] Based on the mean and standard deviation of the maximum temperature or the minimum temperature, determine whether the maximum temperature exceeds the set second threshold or whether the minimum temperature is lower than the set third threshold; if so, then
[0033] It is determined that the temperature of the target object in the preset frame is abnormal.
[0034] The present invention also provides an image-based foreign body intrusion detection device for a petrochemical plant, the device comprising:
[0035] A foreign object labeling module is used to obtain multi-category image data of different targets, and label the corresponding targets in the image data to mark the boundary box of each target and generate a label file corresponding to each target;
[0036] A model training module is used to construct an image dataset based on the multi-category image data of the different targets, and train a YOLOv5 model based on the image dataset and the label file to obtain a target object recognition model;
[0037] A foreign object recognition module, used to obtain current image data and preprocess the current image data, so as to use the preprocessed current image data as input of the target object recognition model, perform forward propagation, and output a preset frame and target object category of the target object in the current image data;
[0038] a foreign body movement judgment module, configured to obtain, based on a preset frame of the target object in the current image data, multiple frames of image data including the current image data, and calculate the sum of differences of the multiple frames of image data to judge whether the target object in the preset frame has moved; and
[0039] A foreign body temperature judgment module, used to obtain the highest temperature and the lowest temperature of the target object in the preset frame through an infrared thermal imaging camera to judge whether the temperature of the target object in the preset frame is abnormal;
[0040] The alarm module is used to alert the terminal when the target object in the preset frame moves and the temperature is abnormal.
[0041] The present invention also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, it implements any of the above-mentioned image-based petrochemical plant foreign body intrusion detection methods.
[0042] The present invention also provides a computer storage medium storing a computer program, wherein when the computer program is executed by a processor, the method for detecting foreign matter intrusion in a petrochemical plant based on an image as described above is implemented.
[0043] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the image-based petrochemical plant foreign body intrusion detection method as described above is implemented.
[0044] The above-mentioned image-based petrochemical plant foreign body intrusion detection method and device obtains multi-category image data of different targets and annotates the corresponding targets in the image data to mark the bounding box of each target and generate a label file corresponding to each target. Subsequently, an image data set is constructed based on the multi-category image data of different targets, and the YOLOv5 model is trained based on the image data set and the label file to obtain a target recognition model. Then, the current image data is obtained and preprocessed to use the preprocessed current image data as the input of the target recognition model, and forward propagation is performed to output the preset frame and target category of the target in the current image data. After that, based on the preset frame of the target in the current image data, multiple frames of image data containing the current image data are obtained, and the difference sum of the multiple frames of image data is calculated to determine whether the target in the preset frame moves, and the highest temperature and the lowest temperature of the target in the preset frame are obtained by an infrared thermal imaging camera to determine whether the temperature of the target in the preset frame is abnormal. Finally, when the target in the preset frame moves and the temperature is abnormal, an alarm message for characterizing the intrusion of foreign bodies is sent to the terminal. Based on the visible light detection of foreign objects, this method adds the determination methods of target motion and temperature to make a comprehensive determination of foreign object intrusion in petrochemical plants, which to a certain extent improves the detection accuracy of foreign object intrusion in factories under poor light conditions. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0046] Figure 1 One of the flow charts of the method for detecting foreign matter intrusion in a petrochemical plant based on an image provided by the present invention;
[0047] Figure 2 A schematic diagram of the overall process of foreign body intrusion detection in a petrochemical plant based on an image in a specific embodiment of the present invention;
[0048] Figure 3 The second flow chart of the method for detecting foreign matter intrusion in a petrochemical plant based on an image provided by the present invention;
[0049] Figure 4The third flow chart of the method for detecting foreign matter intrusion in a petrochemical plant based on an image provided by the present invention;
[0050] Figure 5 The fourth flow chart of the method for detecting foreign matter intrusion in a petrochemical plant based on an image provided by the present invention;
[0051] Figure 6 The fifth flow chart of the method for detecting foreign matter intrusion in a petrochemical plant based on an image provided by the present invention;
[0052] Figure 7 The sixth flow chart of the method for detecting foreign matter intrusion in a petrochemical plant based on an image provided by the present invention;
[0053] Figure 8 A schematic diagram of the structure of the image-based foreign body intrusion detection device for a petrochemical plant provided by the present invention;
[0054] Fig. 9 This is a diagram of the internal structure of the computer device provided by the present invention. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0056] Combine the following Figure 1-Figure 9 The present invention describes a method and device for detecting foreign matter intrusion into a petrochemical plant based on an image.
[0057] like Figure 1 As shown, in one embodiment, a method for detecting foreign matter intrusion in a petrochemical plant based on an image comprises the following steps:
[0058] Step S110 , obtaining multi-category image data of different targets, and marking the corresponding targets in the image data to mark the boundary box of each target, and generating a label file corresponding to each target.
[0059] Specifically, the server obtains multi-category image data of different targets, and annotates the corresponding targets in the image data to mark the boundary box of each target, and generates a label file corresponding to each target.
[0060] Combination Figure 2As shown, in a specific embodiment, the image-based petrochemical plant foreign body intrusion detection method provided by the present invention collects a high-quality image data set containing cats, dogs, and mice. Each category should have enough samples to ensure the generalization ability of the model, and the data set is divided into a training set, a validation set, and a test set. Usually the training set is used to train the model, the validation set is used to adjust the hyperparameters and monitor the training process, and the test set is used to finally evaluate the model performance. The image is annotated, a bounding box is marked for each target object (cat, dog, mouse), and a corresponding label file is generated.
[0061] Step S120, constructing an image dataset based on multi-category image data of different targets, and training a YOLOv5 model based on the image dataset and the label file to obtain a target object recognition model.
[0062] Specifically, the server constructs an image dataset based on multi-category image data of different targets, and trains the YOLOv5 model based on the image dataset and the label file to obtain a target object recognition model.
[0063] Combination Figure 2 As shown, in a specific embodiment, the image-based petrochemical plant foreign body intrusion detection method provided by the present invention uses a training set and a label file to train the YOLOv5 model during the model training process, and sets appropriate training rounds (epochs), learning rate and other hyperparameters. During the training process, a validation set is used to monitor the performance of the model, and hyperparameters or optimizers are adjusted in a timely manner. Indicators such as loss changes and accuracy during the training process are recorded for subsequent analysis, and finally a model M, i.e., a target object recognition model, is obtained.
[0064] Step S130, obtaining current image data, and preprocessing the current image data, so as to use the preprocessed current image data as the input of the target object recognition model, and perform forward propagation to output the preset frame and target object category of the target object in the current image data.
[0065] Specifically, the server obtains current image data and preprocesses the current image data, and uses the preprocessed current image data as input of the target object recognition model, and performs forward propagation to output a preset frame and target object category in the current image data.
[0066] Combination Figure 2As shown, in a specific embodiment, the image-based petrochemical plant foreign body intrusion detection method provided by the present invention needs to preprocess the image to be identified before image recognition, including adjusting the image size, normalization and other operations to adapt to the input requirements of the model. The preprocessed image is input into the trained YOLOv5 model M for forward propagation, and the model outputs information such as the bounding box coordinates and category probability of the target. Subsequently, the output of the model is subjected to non-maximum suppression (NMS) processing to eliminate overlapping bounding boxes, and the final recognition result is screened out according to the category probability threshold. The screenshot is taken to extract the area where the foreign body is detected. For example, (x, y, w, h) is obtained before, x is the horizontal coordinate of the center of the object, y is the vertical coordinate of the center of the object, w is the width of the object, and h is the height of the object. Then the screenshot area is (x, y, 3*w, 3*h), and a new picture is obtained, and the picture sequence is obtained at the same time. , is the current frame, The previous frame of the current frame, and so on.
[0067] Step S140 , based on the preset frame of the target object in the current image data, multiple frames of image data including the current image data are acquired, and the sum of differences of the multiple frames of image data is calculated to determine whether the target object in the preset frame moves.
[0068] Specifically, the server obtains multiple frames of image data including the current image data based on the preset frame of the target object in the current image data, and calculates the sum of differences of the multiple frames of image data to determine whether the target object in the preset frame moves.
[0069] Combination Figure 2 As shown, in a specific embodiment, the image-based petrochemical plant foreign body intrusion detection method provided by the present invention, when n frames of visible light images are obtained ,in is the current frame, , calculate the sum of differences S of the entire frame: [ S = sum_{x, y} |dif(x, y)>T1 ]. Motion judgment: If S is greater than the set threshold T2, it is judged that the object is moving.
[0070] Step S150, obtaining the highest temperature and the lowest temperature of the target object in the preset frame by using an infrared thermal imaging camera to determine whether the temperature of the target object in the preset frame is abnormal.
[0071] Specifically, the server obtains the highest temperature and the lowest temperature of the target object in the preset frame through an infrared thermal imaging camera to determine whether the temperature of the target object in the preset frame is abnormal.
[0072] Combination Figure 2As shown, in a specific embodiment, the image-based petrochemical plant foreign body intrusion detection method provided by the present invention uses an infrared thermal imaging camera to determine whether the area detected in the first step has temperature abnormalities. Get the maximum and minimum temperatures of the preset frame
[0073] According to the current group PresentPoint (Current point) Generates the mask of the image M :
[0074] .
[0075] in,( x , y ) are the coordinates of the pixel in the image, R It is the area contained by the preset point, usually composed of rectangular areas. AllPresetGroup The total area of the (x, y, w, h) combination to which all current groups belong. When the camera is turned to the current group, let the resulting mask M Matrix and current frame image of current preset position I Do the Hadamard product of the matrix to get the required area Roi : Then, get the highest temperature inside the Roi through the infrared camera SDK.
[0076] Smoothing data through exponential moving average: Get the highest temperature in Roi at each moment, and get the highest temperature in the current Roi at the i-th moment ct max , and weighted to obtain the smoothed data arr [i]:
[0077] .
[0078] In the formula, arr It means the highest temperature in Roi at each moment after recording the exponential moving average smoothing. β Represents the attenuation factor, which can be adjusted according to the specific application scenario and data characteristics to achieve the best smoothing effect.
[0079] After that, calculate the anomaly score: according to the i-th frame, the sliding window l , combined with the smoothed arr [i] We get:
[0080] ,
[0081] ,
[0082] .
[0083] in, represents the anomaly score, arr It means the highest temperature in Roi at each moment after recording the exponential moving average smoothing. express arr Recently l -1 the average value of data, represents the average value of the i-th frame data, Represents a sliding window l The average value of the data, express arr recent l -1 standard deviation in the data, represents the standard deviation of the i-th frame data, It represents the highest temperature in Roi at time k after exponential moving average smoothing. Similarly, the same method is used to calculate the lowest temperature to obtain its mean and standard deviation.
[0084] Step S160: When the target object in the preset frame moves and the temperature is abnormal, an alarm message indicating the invasion of foreign objects is sent to the terminal.
[0085] Specifically, when the target object in the preset frame moves and the temperature is abnormal, the server will send an alarm message indicating the invasion of foreign objects to the terminal.
[0086] Combination Figure 2 As shown, in a specific embodiment, the image-based petrochemical plant foreign body intrusion detection method provided by the present invention sets a dynamic alarm threshold to warn of foreign body intrusion, that is, sets a threshold, and sends an alarm to the server when the abnormal score is greater than a certain threshold. According to the central limit theorem, if there are enough data points and they are independently extracted from the same distribution (independent and identically distributed), even if the original data itself is not normally distributed, the distribution of the sample mean will tend to be normally distributed. By setting this dynamic threshold to 5 σ recent , when the AS score is greater than 5 σ recent When , it means that the sample falls outside of approximately 99.99994% of the data. Combined with the dynamic threshold adjustment of reinforcement learning, the alarm can be more accurate and the algorithm can be robust.
[0087] In this embodiment, when the first step determines that there is a foreign object, the second step determines that there is a moving object, and the third step determines that there is a temperature abnormality, then it is determined that there is foreign object intrusion. On the basis of visible light detection of foreign objects, the target motion and temperature judgment methods are added to perform a comprehensive judgment on the intrusion of foreign objects in the petrochemical plant, thereby improving the detection accuracy of foreign object intrusion in the factory under poor light conditions.
[0088] The above-mentioned image-based petrochemical plant foreign body intrusion detection method obtains multi-category image data of different targets and annotates the corresponding targets in the image data to mark the bounding box of each target and generate a label file corresponding to each target. Subsequently, an image dataset is constructed based on the multi-category image data of different targets, and the YOLOv5 model is trained based on the image dataset and the label file to obtain a target recognition model. Then, the current image data is obtained and preprocessed to use the preprocessed current image data as the input of the target recognition model, and forward propagation is performed to output the preset frame and target category of the target in the current image data. After that, based on the preset frame of the target in the current image data, multiple frames of image data containing the current image data are obtained, and the difference sum of the multiple frames of image data is calculated to determine whether the target in the preset frame moves, and the highest temperature and the lowest temperature of the target in the preset frame are obtained by an infrared thermal imaging camera to determine whether the temperature of the target in the preset frame is abnormal. Finally, when the target in the preset frame moves and the temperature is abnormal, an alarm message for characterizing the intrusion of foreign bodies is sent to the terminal. Based on the visible light detection of foreign objects, this method adds the determination methods of target motion and temperature to make a comprehensive determination of foreign object intrusion in petrochemical plants, which to a certain extent improves the detection accuracy of foreign object intrusion in factories under poor light conditions.
[0089] like Figure 3 As shown, in one embodiment, the image-based petrochemical plant foreign body intrusion detection method provided by the present invention constructs an image dataset based on multi-category image data of different targets, and trains the YOLOv5 model based on the image dataset and the label file to obtain a target object recognition model, which specifically includes the following steps:
[0090] Step S122: based on the image data set, the image data set is divided into a training set, a validation set, and a test set according to multi-category image data of different targets in the image data set.
[0091] Step S124, calling the training set and label file to train the YOLOv5 model, adjusting the hyperparameters and optimizer in the YOLOv5 model through the validation set, and evaluating the performance of the trained YOLOv5 model through the test set.
[0092] like Figure 4 As shown, in one embodiment, the image-based petrochemical plant foreign body intrusion detection method provided by the present invention obtains current image data, and preprocesses the current image data, so as to use the preprocessed current image data as the input of the target object recognition model, and performs forward propagation to output the preset frame and target object category of the target object in the current image data, specifically comprising the following steps:
[0093] Step S132, performing preprocessing operations of adjusting the image size and normalizing the current image data so that the current image data meets the input requirements of the target object recognition model.
[0094] Step S134, using the preprocessed current image data as the input of the target object recognition model to call the target object recognition model to perform forward propagation on the current image data to obtain the bounding box coordinates and target object category of the target object in the current image data.
[0095] like Figure 5 As shown, in one embodiment, the image-based petrochemical plant foreign body intrusion detection method provided by the present invention obtains current image data, and preprocesses the current image data, so as to use the preprocessed current image data as the input of the target object recognition model, and performs forward propagation to output the preset frame and target object category of the target object in the current image data, and specifically also includes the following steps:
[0096] Step S136, performing non-maximum suppression processing on the bounding box coordinates and the target category of the target in the current image data to eliminate the overlapping bounding boxes of the target in the current image data, and filtering out the preset box according to the probability threshold of the target category.
[0097] Step S138, intercepting the preset frame area in the current image data, and based on the position coordinates of the preset frame, obtaining the image sequence where the target object is locked in the current image data, the image sequence is a plurality of frames of image data including the current image data where the target object is located in the current image data.
[0098] like Figure 6 As shown, in one embodiment, the image-based petrochemical plant foreign body intrusion detection method provided by the present invention obtains multiple frames of image data including the current image data based on the preset frame of the target object in the current image data, and calculates the sum of the differences of the multiple frames of image data to determine whether the target object in the preset frame moves, specifically comprising the following steps:
[0099] Step S142, calculating the sum of differences between multiple frames of image data in the image sequence, and determining whether the sum of differences exceeds a set first threshold.
[0100] Step S144, determining whether the target object in the current image data is moving.
[0101] Specifically, when the judgment result of step S142 is that the sum of the differences exceeds the set first threshold, the server will determine that the target object in the current image data is moving.
[0102] Step S146, determining whether the target object in the current image data has not moved.
[0103] Specifically, when the judgment result in step S142 is that the sum of the differences does not exceed the set first threshold, the server will determine that the target object in the current image data has not moved.
[0104] like Figure 7 As shown, in one embodiment, the image-based petrochemical plant foreign body intrusion detection method provided by the present invention obtains the highest temperature and the lowest temperature of the target object in the preset frame by an infrared thermal imaging camera to determine whether the temperature of the target object in the preset frame is abnormal, and specifically includes the following steps:
[0105] Step S152, obtaining the highest temperature or the lowest temperature of the target object in each frame of image data in the multiple frames of image data, and obtaining the highest temperature or the lowest temperature after data smoothing by weighted acquisition to obtain the mean and standard deviation of the highest temperature or the lowest temperature.
[0106] Step S154, based on the mean and standard deviation of the maximum temperature or the minimum temperature, determine whether the maximum temperature exceeds the set second threshold or whether the minimum temperature is lower than the set third threshold.
[0107] Step S156, determining whether the temperature of the target object in the preset frame is abnormal.
[0108] Specifically, when the judgment result in step S154 is that the highest temperature exceeds the set second threshold or the lowest temperature is lower than the set third threshold, the server will determine that the temperature of the target object in the preset frame is abnormal.
[0109] The image-based petrochemical plant foreign object intrusion detection device provided by the present invention is described below. The image-based petrochemical plant foreign object intrusion detection device described below and the image-based petrochemical plant foreign object intrusion detection method described above can be referenced to each other.
[0110] like Figure 8 As shown, in one embodiment, an image-based petrochemical plant foreign object intrusion detection device includes a foreign object labeling module 810, a model training module 820, a foreign object recognition module 830, a foreign object movement judgment module 840, a foreign object temperature judgment module 850 and an alarm module 860.
[0111] The foreign object labeling module 810 is used to obtain multi-category image data of different targets, and label the corresponding targets in the image data to mark the boundary box of each target and generate a label file corresponding to each target.
[0112] The model training module 820 is used to construct an image dataset based on multi-category image data of different targets, and train the YOLOv5 model based on the image dataset and the label file to obtain a target object recognition model.
[0113] The foreign object recognition module 830 is used to obtain current image data and preprocess the current image data so as to use the preprocessed current image data as the input of the target object recognition model and perform forward propagation to output the preset frame and target object category of the target object in the current image data.
[0114] The foreign object movement judgment module 840 is used to obtain multiple frames of image data including the current image data based on the preset frame of the target object in the current image data, and calculate the sum of the differences of the multiple frames of image data to determine whether the target object in the preset frame has moved.
[0115] The foreign object temperature judgment module 850 is used to obtain the highest temperature and the lowest temperature of the target object in the preset frame through an infrared thermal imaging camera to determine whether the temperature of the target object in the preset frame is abnormal.
[0116] The alarm module 860 is used to send an alarm message indicating the invasion of foreign objects to the terminal when the target object in the preset frame moves and the temperature is abnormal.
[0117] In this embodiment, the image-based petrochemical plant foreign body intrusion detection device provided by the present invention, the model training module is specifically used for:
[0118] Based on the image dataset, the image dataset is divided into a training set, a validation set, and a test set according to the multi-category image data of different targets in the image dataset.
[0119] Call the training set and label file to train the YOLOv5 model, adjust the hyperparameters and optimizer in the YOLOv5 model through the validation set, and evaluate the performance of the trained YOLOv5 model through the test set.
[0120] In this embodiment, the foreign body identification module of the image-based petrochemical plant foreign body intrusion detection device provided by the present invention is specifically used for:
[0121] The current image data is preprocessed by adjusting the image size and normalizing it so that the current image data meets the input requirements of the target object recognition model.
[0122] The preprocessed current image data is used as the input of the target object recognition model to call the target object recognition model to perform forward propagation on the current image data to obtain the bounding box coordinates and target object category of the target object in the current image data.
[0123] In this embodiment, the foreign body identification module of the image-based petrochemical plant foreign body intrusion detection device provided by the present invention is further used for:
[0124] Non-maximum suppression is performed on the bounding box coordinates and the target category of the target in the current image data to eliminate the overlapping bounding boxes of the target in the current image data, and the preset box is screened out according to the probability threshold of the target category.
[0125] The preset frame area in the current image data is intercepted, and based on the position coordinates of the preset frame, an image sequence in which the target object in the current image data is locked is obtained. The image sequence is a plurality of frames of image data including the current image data where the target object in the current image data is located.
[0126] In this embodiment, the foreign body movement judgment module of the image-based petrochemical plant foreign body intrusion detection device provided by the present invention is specifically used for:
[0127] Calculate the sum of differences of multiple frames of image data in the image sequence, and determine whether the sum of differences exceeds a set first threshold. If so,
[0128] Determine if the target in the current image data is moving. If not, then
[0129] It is determined that the target object in the current image data has not moved.
[0130] In this embodiment, the image-based petrochemical plant foreign body intrusion detection device provided by the present invention further includes an image mask processing module for:
[0131] Generate an image mask based on the current image data. The mask expression is:
[0132] .
[0133] In the formula, For the mask, are the coordinates of the pixels in the image, It is the area contained by the preset frame.
[0134] When the image acquisition device switches to the current image data, the matrix of the mask is processed with the matrix corresponding to the current image data of the preset frame to lock the target object in the current image data.
[0135] In this embodiment, the foreign body temperature judgment module of the image-based petrochemical plant foreign body intrusion detection device provided by the present invention is specifically used for:
[0136] The maximum temperature or minimum temperature of the target object in each frame of image data in multiple frames of image data is obtained, and the maximum temperature or minimum temperature after data smoothing is obtained by weighting to obtain the mean and standard deviation of the maximum temperature or minimum temperature.
[0137] Based on the mean and standard deviation of the maximum temperature or the minimum temperature, determine whether the maximum temperature exceeds the set second threshold or whether the minimum temperature is lower than the set third threshold. If so, then
[0138] Determine that the temperature of the target object in the preset frame is abnormal.
[0139] Fig. 9 An example of a physical structure diagram of an electronic device is shown. The electronic device may be a smart terminal, and its internal structure diagram may be as follows: Fig. 9 As shown. The electronic device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for detecting foreign objects in a petrochemical plant based on an image is implemented, and the method includes:
[0140] Obtain multi-category image data of different targets, and annotate the corresponding targets in the image data to mark the bounding box of each target, and generate a label file corresponding to each target;
[0141] An image dataset is constructed based on multi-category image data of different targets, and the YOLOv5 model is trained based on the image dataset and label file to obtain a target object recognition model;
[0142] Acquire current image data, and preprocess the current image data, so as to use the preprocessed current image data as input of the target object recognition model, perform forward propagation, and output a preset frame and target object category of the target object in the current image data;
[0143] Based on a preset frame of the target object in the current image data, acquiring multiple frames of image data including the current image data, and calculating the sum of differences of the multiple frames of image data to determine whether the target object in the preset frame moves; and
[0144] The highest temperature and the lowest temperature of the target object in the preset frame are obtained by using an infrared thermal imaging camera to determine whether the temperature of the target object in the preset frame is abnormal;
[0145] When the target object in the preset frame moves and the temperature is abnormal, an alarm message indicating the invasion of foreign objects is sent to the terminal.
[0146] Those skilled in the art will understand that Fig. 9The structure shown in the figure is only a block diagram of a part of the structure related to the scheme of the present invention, and does not constitute a limitation on the electronic device to which the scheme of the present invention is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0147] On the other hand, the present invention also provides a computer storage medium storing a computer program, which, when executed by a processor, implements an image-based foreign body intrusion detection method for a petrochemical plant, the method comprising:
[0148] Obtain multi-category image data of different targets, and annotate the corresponding targets in the image data to mark the bounding box of each target, and generate a label file corresponding to each target;
[0149] An image dataset is constructed based on multi-category image data of different targets, and the YOLOv5 model is trained based on the image dataset and label file to obtain a target object recognition model;
[0150] Acquire current image data, and preprocess the current image data, so as to use the preprocessed current image data as input of the target object recognition model, perform forward propagation, and output a preset frame and target object category of the target object in the current image data;
[0151] Based on a preset frame of the target object in the current image data, acquiring multiple frames of image data including the current image data, and calculating the sum of differences of the multiple frames of image data to determine whether the target object in the preset frame moves; and
[0152] The highest temperature and the lowest temperature of the target object in the preset frame are obtained by using an infrared thermal imaging camera to determine whether the temperature of the target object in the preset frame is abnormal;
[0153] When the target object in the preset frame moves and the temperature is abnormal, an alarm message indicating the invasion of foreign objects is sent to the terminal.
[0154] In another aspect, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and when the processor executes the computer instructions, an image-based petrochemical plant foreign body intrusion detection method is implemented, the method comprising:
[0155] Obtain multi-category image data of different targets, and annotate the corresponding targets in the image data to mark the bounding box of each target, and generate a label file corresponding to each target;
[0156] An image dataset is constructed based on multi-category image data of different targets, and the YOLOv5 model is trained based on the image dataset and label file to obtain a target object recognition model;
[0157] Acquire current image data, and preprocess the current image data, so as to use the preprocessed current image data as input of the target object recognition model, perform forward propagation, and output a preset frame and target object category of the target object in the current image data;
[0158] Based on a preset frame of the target object in the current image data, acquiring multiple frames of image data including the current image data, and calculating the sum of differences of the multiple frames of image data to determine whether the target object in the preset frame moves; and
[0159] The highest temperature and the lowest temperature of the target object in the preset frame are obtained by using an infrared thermal imaging camera to determine whether the temperature of the target object in the preset frame is abnormal;
[0160] When the target object in the preset frame moves and the temperature is abnormal, an alarm message indicating the invasion of foreign objects is sent to the terminal.
[0161] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing related hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory.
[0162] By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0163] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0164] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. An image-based foreign body intrusion detection method for a petrochemical plant, characterized in that: The method comprises: Acquire multi-category image data of different targets, and annotate the corresponding targets in the image data to mark the bounding box of each target, and generate a label file corresponding to each target; Building an image dataset based on the multi-category image data of the different targets, and training a YOLOv5 model based on the image dataset and the label file to obtain a target object recognition model; Acquire current image data, and preprocess the current image data, so as to use the preprocessed current image data as input of the target object recognition model, perform forward propagation, and output a preset frame and target object category of the target object in the current image data; Based on a preset frame of the target object in the current image data, acquiring multiple frames of image data including the current image data, and calculating the sum of differences of the multiple frames of image data to determine whether the target object in the preset frame moves; Acquire the highest temperature and the lowest temperature of the target object in the preset frame by using an infrared thermal imaging camera to determine whether the temperature of the target object in the preset frame is abnormal; When the target object in the preset frame moves and the temperature is abnormal, an alarm message indicating the invasion of foreign objects is sent to the terminal.
2. The image-based petrochemical plant foreign body intrusion detection method according to claim 1 is characterized in that: The method of constructing an image dataset based on the multi-category image data of different targets, and training a YOLOv5 model based on the image dataset and the label file to obtain a target object recognition model includes: Based on the image dataset, dividing the image dataset into a training set, a validation set, and a test set according to multi-category image data of different targets in the image dataset; The training set and label file are called to train the YOLOv5 model, and the hyperparameters and optimizer in the YOLOv5 model are adjusted through the validation set, and the performance of the trained YOLOv5 model is evaluated through the test set.
3. The image-based petrochemical plant foreign body intrusion detection method according to claim 1 is characterized in that: The acquiring of current image data and preprocessing of the current image data, so as to use the preprocessed current image data as the input of the target object recognition model, and to perform forward propagation to output a preset frame and a target object category in the current image data, comprises: Performing preprocessing operations of adjusting the image size and normalizing the current image data so that the current image data meets the input requirements of the target object recognition model; The preprocessed current image data is used as the input of the target object recognition model to call the target object recognition model to perform forward propagation on the current image data to obtain the bounding box coordinates and target object category of the target object in the current image data.
4. The image-based petrochemical plant foreign body intrusion detection method according to claim 3 is characterized in that: The method of acquiring current image data and preprocessing the current image data so as to use the preprocessed current image data as input of the target object recognition model and perform forward propagation so as to output a preset frame and a target object category in the current image data also includes: Performing non-maximum suppression processing on the bounding box coordinates and the target object category in the current image data to eliminate the overlapping bounding boxes of the target object in the current image data, and filtering out the preset box according to the probability threshold of the target object category; A preset frame area in the current image data is intercepted, and based on the position coordinates of the preset frame, an image sequence in which the target object in the current image data is locked is obtained, wherein the image sequence is a plurality of frames of image data including the current image data where the target object in the current image data is located.
5. The image-based petrochemical plant foreign body intrusion detection method according to claim 4 is characterized in that: The step of acquiring multiple frames of image data including the current image data based on the preset frame of the target object in the current image data, and calculating the sum of differences of the multiple frames of image data to determine whether the target object in the preset frame moves includes: The sum of differences of multiple frames of image data in the image sequence is calculated, and it is determined whether the sum of differences exceeds a set first threshold; if so, it is determined that the target object in the current image data is moving; if not, it is determined that the target object in the current image data is not moving.
6. The image-based petrochemical plant foreign body intrusion detection method according to claim 5, characterized in that: The method of obtaining the highest temperature and the lowest temperature of the target object in the preset frame by using an infrared thermal imaging camera to determine whether the temperature of the target object in the preset frame is abnormal includes: Generate an image mask according to the current image data, the mask expression is: ; In the formula, For the mask, are the coordinates of the pixels in the image, It is the area contained by the preset frame; When the image acquisition device switches to the current image data, the matrix of the mask is subjected to Hadamard product processing with the matrix corresponding to the current image data of the preset frame to lock the target object in the current image data.
7. The image-based petrochemical plant foreign body intrusion detection method according to claim 6, characterized in that: The step of obtaining the highest temperature and the lowest temperature of the target object in the preset frame by using an infrared thermal imaging camera to determine whether the temperature of the target object in the preset frame is abnormal includes: Obtaining the highest temperature or the lowest temperature of the target object in each frame of image data in the multiple frames of image data, and obtaining the highest temperature or the lowest temperature after data smoothing by weighted acquisition to obtain the mean and standard deviation of the highest temperature or the lowest temperature; Based on the mean and standard deviation of the maximum temperature or the minimum temperature, it is determined whether the maximum temperature exceeds a set second threshold or whether the minimum temperature is lower than a set third threshold; if so, it is determined that the temperature of the target object in the preset frame is abnormal.
8. An image-based foreign body intrusion detection device for a petrochemical plant, characterized in that: The device comprises: A foreign object labeling module is used to obtain multi-category image data of different targets, and label the corresponding targets in the image data to mark the boundary box of each target and generate a label file corresponding to each target; A model training module is used to construct an image dataset based on the multi-category image data of the different targets, and train a YOLOv5 model based on the image dataset and the label file to obtain a target object recognition model; A foreign object recognition module, used to obtain current image data and preprocess the current image data, so as to use the preprocessed current image data as input of the target object recognition model, perform forward propagation, and output a preset frame and target object category of the target object in the current image data; A foreign body movement judgment module, used for obtaining multiple frames of image data including the current image data based on a preset frame of the target object in the current image data, and calculating the sum of differences of the multiple frames of image data to judge whether the target object in the preset frame has moved; A foreign body temperature judgment module, used to obtain the highest temperature and the lowest temperature of the target object in the preset frame through an infrared thermal imaging camera to judge whether the temperature of the target object in the preset frame is abnormal; The alarm module is used to send alarm information indicating the invasion of foreign objects to the terminal when the target object in the preset frame moves and the temperature is abnormal.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
10. A computer storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Real-time detection method and device for abnormal intruder in monitoring scene
CN113837001A
Power transmission network foreign matter detection method based on federated learning and YOLOv5
CN117710312A
