A kind of fire image detection alarm method based on machine learning
Technical field
The present invention relates to the early fire detection alarm field based on image, more particularly to a kind of based on machine learning
Incipient fire image detection alarm method.
Background technique
Image fire detection and an important branch of the alarm technique as digital image processing techniques, currently have become fire
Important research direction calamity prevention and saved.There are more mature image fire detection device, detection system in the market,
In the image fire detection method used mainly include: based on infrared/ultraviolet fire image detection method, based on visible light fire
Image detection method and be based on visible light smog image detection method three classes.The basic principle of these three detection methods is all to utilize
Digital image processing techniques to the picture frame in image be filtered transformation, color detection, noise eliminate, time series comparison,
Image enhancement etc., to effectively identify the flame paid close attention to or smoke characteristics in picture, realize the early warning of fire with
Detection.Representative based on infrared/ultraviolet fire image detection method is embedded image type fire detecting system, by 1 or
Multiple infrared/ultraviolet video cameras, microprocessor, display device and four part of alarm controller are constituted, standard GB/T 15631-
Need have alarming determining lamp on regulation detector in 4.1.1 item in 2008 " extraordinary fire detectors ", it is therefore desirable to common
Video camera, which is modified, is just able to satisfy standard requirements.And the representative based on visible light fire, smog image detection method is distribution
Formula image-type fire alarm system, the system utilize existing video monitoring system, install image recognition software on the server,
Realize that the identification to fire, smog object is alarmed, system input cost is lower.
The above two major classes image fire detection alarm system is existing in the fire-fightings key unit such as bank, storage, chemical industry plant area
More mature application plays an important role in terms of fire prevention and detection, avoids the generation of fire disaster accident.
But for Image Information Processing technology and image detection application aspect, there is also following deficiencies:
1, it is based on infrared/ultraviolet fire image detection method, needs to improve image capture device, otherwise will not be able to satisfy
The requirement of China " extraordinary fire detector " and " Code for design of automatic fire alarm systems " standard, therefore install and use cost
It is high;
2, whether image processing method used by the key point of fire image detection method is is scientific, accurate and reliable, but
Be used by conventional fire image characteristics extraction such as: filtering transformation, color detection, noise eliminate, time series comparison, figure
The methods of image intensifying, the Feature Selection Model established are all based on laboratory environment.Each method model has applicable
Scene, have not yet been reached it is a kind of can satisfy all monitoring scenes, need to comprehensively consider the light at practical application scene, wind,
The numerous disturbing factors of contextual factor etc., actual installation using when need according to live actual environment to select method model
It selects and carries out parameter adjustment, otherwise detection accuracy is difficult to reach standard requirements.And the selection especially parameter of method model is micro-
Tune requires higher professional technique basis, and average skilled worker is difficult to be competent in the project implementation;
3, the construction main target of social unit video monitoring system be monitored by video means keypoint part, important equipment and
Disengaging personnel, for prevention internal institution keypoint part by external destruction, prevention unit important equipment is stolen, prevents unit external people
Member illegally enters our unit.System is generally by each point monitor camera, hard disk video recorder and video management server host
(can be described as video management server, band display function), video management server, which needs to have major function, to be imaged to point
Machine carries out dynamic increase, deletes, transfers image operation, therefore the performance of the video management server host of social unit configuration is all
Will not be very good, the Primary Components such as CPU, memory are all to meet based on system requirements.Conventional fire image characteristics extraction algorithm needs
Sequential frame image is handled in real time, extract the motion profile of objects in images, required calculation resources are larger, such as
Excessively required CPU, memory source will be bigger for fruit dot position video camera, and with present society unit video management server master
From the point of view of the performance of machine, it is difficult to meet the calculation resources demand of fire image feature extraction algorithm, therefore enforcement difficulty is larger.
It is also due to above 3 factors and constrains the practical application of fire image detection technology, cause to be currently based on fire
Image detection alarming product is less in the share of fire detecting and alarm in the market, and the difficulty of popularization and application is larger.
And the appearance of machine learning techniques, especially machine learning in terms of image classification, image recognition maturation with into
Step indicates new thinking and method for the detection and alarm of fire image.Machine learning (Machine Learning, ML) is
One multi-field cross discipline is related to the multiple subjects such as probability theory, statistics, Approximation Theory, convextiry analysis, algorithm complexity theory.
The learning behavior that the mankind were simulated or realized to computer how is specialized in, to obtain new knowledge or skills, is reorganized existing
The structure of knowledge be allowed to constantly improve the performance of itself.Although can not also learn machine learning with current theory knowledge system is
How the specific mechanism of image classification and image recognition to be realized, but machine learning is acquired by image classification, the field of image recognition
Achievement is obvious to all in the industry, therefore combines the existing video monitoring system of social unit, and machine learning is applied to fire
Image detection alarm is an emerging technology research direction of current fire image detection alarm.
Summary of the invention
In order to solve above-mentioned technical problem, the present invention provides a kind of fire image detection report based on machine learning
Alarm method, by with traditional video surveillance system globe area, fire image detection model is mounted on video monitoring server, benefit
Live image acquisition is carried out with the general visible video camera in video monitoring system, video monitoring server is transferred to and carries out fire
The operation of calamity feature, to judge that fire implements alarm.
The purpose of the present invention is what is be achieved through the following technical solutions: a kind of fire image detection report based on machine learning
Alarm method, which is characterized in that including the following four stage: stage one: fire image detection model training stage;Stage two: fire
Calamity image detection model distribution phase;Stage three: fire monitoring alarm stage;Stage four: continue the training stage;
The one fire image detection model training stage of stage: advanced row carries out the collection of original fire data, described
Original fire data includes the picture of various substance flames and smog;Then the original fire data being collected into is loaded into fire
In image machine learning cloud platform, the training of fire image detection model is carried out, training input is divided into 3 classes: flame, smog
And other, wherein fire, smog are defined as fire;
The two fire image detection model distribution phase of stage: fire image machine learning cloud platform is mutual by Internet
Trained fire image detection model is transferred to the video monitoring server for being located at monitoring unit by networking;
The three fire monitoring alarm stage of stage: video monitoring server receives taking the photograph from the monitoring each point of unit
Camera image, timing extraction wherein 1 frame picture are loaded on fire image detection model and predict output, are sentenced according to output result
Whether disconnected is fire, if it is decided that the result is that fire then transfers information to alarm controller and alarms;
Stage four: continue the training stage: the wrong report class fire picture of storage is periodically uploaded to fire figure by video monitoring server
Machine learns cloud platform, and fire image machine learning cloud platform receives the data reported from multiple video monitoring servers
Afterwards, fire image detection model is carried out continuing to train, then repeat second and third, four stages.
The process of the fire image detection model, fire image prediction is as follows:
(1) fire image is predicted:
(1.1), the picture of each point video camera acquisition in video monitoring system is extracted;
(1.2), data prediction is carried out according to pictorial information of optimal models input size (m, m) to (1.1);
(1.3), pretreated multiple pictures are inputted into optimal models, carries out picture classification prediction;
(1.4), if result is concentrated with 1 or 2 outputs after prediction, then it is assumed that fire occurs, carries out alert process;If result
Concentrate only 3 outputs, then it is assumed that fire does not occur;
The process of data preprocessing is as follows: it is assumed that video monitoring system output dimension of picture is (m, n), mode input size
For (d, d), and (m, n) >=d;
(1.2.1) needs to input picture and is converted to square chart, if m=n, without conversion;If m > n, in original image
Right side increases m-n column pixel, and pixel value is RGB (255,255,255), and original image is converted into (m, m) square chart;If m <
N increases n-m column pixel below original image, and pixel value is RGB (255,255,255), and original image is converted into (n, n)
Square chart, picture is represented with (h, h) after conversion;
(1.2.2) indicates that input picture can be cut into integer (d, d) picture, then not to input picture if h%d=0
(h, h) is handled;Otherwise on (h, h) picture right side, lower section, increase d-h%d, row pixel and d-h%d, column pixel, pixel value
For RGB (255,255,255), input dimension of picture and be transformed to (h+d-h%d, h+d-h%d), inputted after conversion picture with (x,
X) it indicates;
(1.2.3) cuts input picture (x, x) according to mode input dimension of picture (d, d), picture number after cutting are as follows:
(x/d)2。
The process of the fire image detection model, the data training of fire image detection model is as follows:
(1), raw flame, smoke data collection are collected;
(2), the size of input data is wanted according to AlexNet, ZFNet, VGG Net, GoogleNet, Inception model
It asks, carries out data prediction;Using 80% data as training data, 20% as test data;
(3), each model output is modified, i.e. Softmax, making each model output is all 3 classification, and 1 represents flame, and 2 represent cigarette
Mist, 3 represent other;
(4), pretreated data are fed respectively and carries out model training to each model, save each mould after training
Type;
(5), test data is fed to each model, the accuracy rate of output model test, comparison accuracy rate selection is directed to this number
According to the model that collection is optimal.
On the one hand the original fire data is originated from fire combustion experiment room, by simulating various substance combustion initial stage ranks
Section extracts the picture of burned flame and smog;On the other hand it is originated from reptile instrument and carries out climbing for flame data from internet
It takes, by manually carrying out examination classification to image data after crawling.
In the fire monitoring alarm stage, alert process personnel verify fire alarm in real time, then carry out if it is true fire alarm subsequent
Processing, is for example reported by mistake, saves fire picture, and is other by picture tag;If it is determined that result is other, but reality has occurred
Fire, alert process personnel need to store fire picture at that time manually, be marked as flame, smog according to image content.
Beneficial effects of the present invention: the present invention is based on the fire image detection alarm methods of machine learning, have " growth "
Characteristic, the fire image data collected on video monitoring server can periodically be uploaded to fire image machine learning cloud platform,
The study that cloud platform periodically carries out fire detection model updates, and model is distributed to video monitoring server after update and is carried out more
Newly, constantly model is adjusted according to the growth of data set, keeps model that can have " growth " characteristic, continuous lift scheme
Recognition accuracy to fire image.Compared with tradition is based on the fire image detection method of fire image feature extraction algorithm,
Specific implementation of the invention not will increase social unit-economy burden, utilize the existing video monitoring system software and hardware of social unit
Equipment is not influencing video monitoring system function using video monitoring system as information collecting device and model carrying platform
Under the premise of expanded the functional application of video monitoring system.It can be to fire image classification mould by formulating flow at regular intervals in the present invention
Type carries out re -training, so that model is made to have " growth " characteristic, increase and the accumulation fire figure of time with monitoring point
As the accuracy of identification of disaggregated model also can be higher and higher.
Detailed description of the invention
Fig. 1 is system architecture diagram of the invention.
Fig. 2 is flow chart of the invention.
Fig. 3 is the data prediction schematic diagram of fire iconic model in the present invention.
Fig. 4 is the data training process schematic diagram of fire iconic model in the present invention.
Fig. 5 is the fire image prediction process schematic of fire iconic model in the present invention.
Specific embodiment
A kind of fire image detection alarm method based on machine learning of the present invention, system architecture schematic diagram such as Fig. 1 institute
Show.Its system architecture is by by monitoring unit video monitoring system, transmission network and fire image machine learning cloud platform three parts
It constitutes.
Monitoring unit video monitoring system installation and deployment are in certain the specific social unit for needing to carry out video monitoring, by multiple
It is deployed in the video camera monitored in point, the hard disk video recorder for being mounted on social unit fire protection control room, has display function
Video monitoring server and alarm controller are constituted.Wherein video camera is ordinary optical video camera, is adopted for monitoring point bit image
Collection;Hard disk video recorder is stored for local monitor point image;Video monitoring server has display function, except with monitoring point
The video monitoring systems basic functions, also carrying fire figure such as position camera configuration, image live preview, picture crawl store function
As detection model, the monitoring picture of periodic monitor storage extracts flame in picture, smoke model feature, discriminates whether to occur
Fire incident, and alarm controller is sent by the fire monitored.Video monitoring server, which is also equipped with, periodically to be collected
Fire reports picture by mistake and uploads fire image machine learning cloud platform function, while it is flat also to receive fire image machine learning cloud
Fire image detection model after the re -training that platform is sent carries out model modification.Alarm controller is for receiving video monitoring
The fire alarm information that server is sent carries out a certain monitoring point of acousto-optic warning operator on duty and sends fire.Internet is mutual
Networking is for connecting the transmission of the information between video monitoring server and fire image machine learning cloud platform.
Fire image machine learning cloud platform is connect with multiple video monitoring servers, and function is received from multiple videos
The wrong report picture that monitoring server uploads, training fire image detection model, and the fire image detection model after training is passed
It is defeated to carry out model modification to video monitoring server.
A kind of fire image detection alarm method based on machine learning of the present invention, flow chart is as shown in Fig. 2, specific step
It is rapid as follows:
Stage one: fire image detection model training stage
In the first stage, the collection of original fire data is carried out first, data have 2, and first, using fire combustion experiment room,
Various substance combustion initial stages are simulated, the picture of burned flame and smog is extracted;Second, using reptile instrument from internet
It is upper to carry out crawling for flame data, it needs manually to carry out examination classification to image data after crawling.Then, the data that will be collected into
It is loaded into fire image machine learning cloud platform, carries out the training of fire image detection model, training input is divided into 3
Class: flame, smog and other, wherein fire, smog are defined as fire.
Stage two: fire image detection model distribution phase
In second stage, fire image machine learning cloud platform passes through the internet Internet for trained fire image
Detection model is transferred to the video monitoring server for being located at monitoring unit.
Stage three: fire monitoring alarm stage
In the phase III, video monitoring server receives the camera review from the monitoring each point of unit, timing extraction
Wherein 1 frame picture is loaded on fire image detection model and predicts output, judges whether it is fire according to output result.If
Determine that alert process personnel verify fire alarm in real time, if it is true fire the result is that fire then transfers information to alarm controller
It is alert then carry out subsequent processing, it for example reports by mistake, saves fire picture, and be other by picture tag.If the decision is that its
He, but fire has occurred for reality, and alert process personnel need to store fire picture at that time manually, be marked as according to image content
Flame, smog.
Stage four: continue the training stage
In fourth stage, the wrong report class fire picture of storage is periodically uploaded to fire image machine learning by video monitoring server
Cloud platform, fire image machine learning cloud platform receives after the data that multiple video monitoring servers report, to fire figure
As detection model carries out continuing to train, then repeat second and third, four stages.
The fire image detection alarm method based on fire image detection model, general design idea and technical background are such as
Under:
Ability of the deep learning model in recent years in image classification field has obtained exponential promotion, on the one hand has benefited from machine
Processing capacity is substantially improved (GPU), on the other hand also has benefited from the data and advanced algorithmic technique of magnanimity.Machine learning neck
The model of area image classification and image recognition is more, such as: AlexNet, ZFNet, VGG Net, GoogleNet, Inception
Excellent achievement is achieved in International image classification contest Deng, these models, then coping with institute either with or without a model
Do some image data set carry out picture classification and identification? answer is negative.This negative answer main cause is caused to exist
Belong to a black box treatment process in machine learning, existing knowledge hierarchy, theory of algorithm can not know machine be how into
The training of row data, it also can not obtain how perception model works, be for measuring the whether effective key index of model
Degree of fitting, only degree of fitting are suitable, just can prove that model be for current data set be suitable and effective.One by training
If model be applied to other data sets must carry out re -training, whether the degree of fitting for considering model again meets current number
According to the accuracy of identification requirement of collection, if model-fitting degree is suitable, prove that model is effectively, otherwise model is exactly invalid
's.
So how a suitable model is chosen in image classification model that is existing, being excellent in, as fire
The image classification model of image detection alarm system, and duration training is carried out, the nicety of grading of lift scheme is that system will solve
A critical problem certainly.
In consideration of it, the process of the data training of fire iconic model is as follows in the present invention:
1) data prediction: for the training time of lift scheme, current existing mode input size is all smaller, such as: VGG
Net input is that 224 × 224, Inception input is 299 × 299.And the output dimension of picture of current video monitoring system is all
Larger, GB50395-2007 " video security monitoring system engineering design code " requires the pixel of the single image of every road image equal
Not less than 352 × 288, and the pixel of the single image of the every road image of video monitoring system was all remote with advances in technology in recent years
Greater than standard requirements.In order to guarantee that the element in picture will not lose in treatment process, the judgement of fire is influenced, it would be desirable to right
Initial picture carries out cutting pretreatment.
The process of data preprocessing of fire iconic model is as shown in Figure 3 in the present invention:
It is assumed that video monitoring system output dimension of picture is (m, n), mode input is having a size of (d, d), and (m, n) >=d;
The first step needs to input picture and is converted to square chart, if m=n, without conversion;If m > n, in original image
Right side increases m-n column pixel, and pixel value is RGB (255,255,255), and original image is converted into (m, m) square chart;If m <
N increases n-m column pixel below original image, and pixel value is RGB (255,255,255), and original image is converted into (n, n)
Square chart.Picture is represented with (h, h) after conversion;
Second step indicates that input picture can be cut into integer (d, d) picture, then not to input picture if h%d=0
(h, h) is handled;Otherwise on (h, h) picture right side, lower section, increase d-h%d, row pixel and d-h%d, column pixel, pixel value
For RGB (255,255,255), input dimension of picture and be transformed to (h+d-h%d, h+d-h%d), inputted after conversion picture with (x,
X) it indicates;
Third step cuts input picture (x, x) according to mode input dimension of picture (d, d), picture number after cutting are as follows:
(x/d)2。
Data prediction plays the role of 3 aspects:
First, original training data mostlys come from internet and test data in lab, flame, smog picture size do not unite
One, data can be pre-processed using this method, size requirement is inputted according to the picture of model, is unified into consistent defeated
Enter;
Second, in fire image detection alarm procedure, the picture of each point video camera shooting is also required to be pre-processed, full
The demand of sufficient mode input;
Third, this picture pretreatment mode will not cause damages to original image content, and 100% retains original image content.
The data training process of fire image model of the present invention chooses optimal figure as shown in figure 4, by data verification precision
Piece disaggregated model.Detailed process is as follows:
The first step collects raw flame, smoke data collection;
Second step, according to AlexNet, ZFNet, VGG Net, GoogleNet, Inception model to the size of input data
It is required that carrying out data prediction;Using 80% data as training data, 20% as test data;
Third step modifies each model output, i.e. Softmax, making each model output is all 3 classification, and 1 represents flame, and 2 represent
Smog, 3 represent other;
Pretreated data are fed respectively and carry out model training to each model, saved after training each by the 4th step
Model;
5th step feeds test data to each model, the accuracy rate of output model test, and comparison accuracy rate selection is for this
The optimal model of data set.
The fire image prediction process of fire iconic model is as shown in Figure 5 in the present invention:
The first step extracts the picture of each point video camera acquisition in video monitoring system;
Second step pre-processes data in the first step according to optimal models input size (m, m);
Pretreated multiple pictures are inputted optimal models, carry out picture classification prediction by third step;
4th step, if result is concentrated with 1 or 2 outputs after prediction, then it is assumed that fire occurs, carries out alert process;If knot
Fruit concentrates only 3 outputs, then it is assumed that fire does not occur.