GithubHelp home page GithubHelp logo

polarbearwyy / smoke-detection Goto Github PK

View Code? Open in Web Editor NEW
95.0 8.0 33.0 15.02 MB

Smoke Detection based on neural network for Alysa

License: GNU General Public License v3.0

Python 27.00% Jupyter Notebook 73.00%

smoke-detection's Introduction

Smoke-Detection

A smoke detector based on image and video.
Early warning of fire disaster is one of the important usage of smoke detection. Smoke detector which based on video or image can avoid interference of environmental especially in open or lager spaces and outdoor environments.Generally speaking, video based smoke detection methods distinguish smoke from non-smoke objects based on some distinctive features such as motion, edge, color and texture.


Requirements

  • Python3
  • numpy
  • sklearn
  • skimage
  • opencv
  • TensorFlow
  • Keras

烟雾数据集

本文中所使用数据集大部分为中科大火灾实验室所收集

由于中科大火灾实验室网站不稳定,因此将使用数据传到test8 Google Drive

文中所使用算法

HOG特征、LBP特征 + SVM分类器

  • 文件名:Smoke_Detection_HOG_and_LBP_with_SVM

使用skimage库中hog特征、lbp特征提取图片边缘、纹理特征,结合sklearn中的svm分类器进行分类。判断图片中是否包含烟雾
计算结果如下所示:

全连接神经网络 + SVM分类器

  • 文件名:Smoke_Detection_with_One_Hidden_Layer
    使用tensorflow搭建一个具有单隐层的神经网络,提取图片深度特征,再结合svm进一步提高准确率

使用VGG16迁移学习

  • 文件名:Smoke_Detection_VGG16_with_SVM_and_Fully_Connected_Network
    使用在ImageNet上预训练的VGG16进行迁移学习,使用VGG16的卷积层作为特征提取器,SVM作为分类器/finetune最后的全连接层,作为烟雾检测
    计算结果如下所示:

特征融合模型

  • 文件名:smoke_detection_with_feature_fusion
    结合HOG特征、LBP特征和VGG16所`提取的深度特征进行烟雾检测
    网络结构图如下图所示
    其中input1为hog特征,input2为lbp直方图特征、input3为VGG16深度特征,将三个特征均压缩为128维后进行拼接,然后再输入到一个全连接神经网络中进行分类。
    计算结果如下图所示:
  • HOG
  • LBP
  • VGG16
  • 最终结果

将烟雾检测模型用于树莓派

  • 文件名:Smoke_Detection_MobileNet
  • 文件名:raspberry_pi
    使用MobileNet模型,在电脑上进行FineTune并保存模型,在树莓派上直接读取训练好的模型参数
    计算结果如下所示:

其他程序

HOG/LBP特征可视化

  • 文件名:show_hog_lbp_feature_map

爬虫

  • 文件名:spider
    使用requests和bs4库从百度图片爬取制定关键字图片作为数据集

使用方法

安装所需库,将数据集文件夹和py代码放如同一目录下python xxx.py即可运行

+-- smoke_detection
|   +-- smoke_dataset
|       +--set1_48_data.npy
|       +--set1_48_label.npy
|       +--set2_48_data.npy
|       +--set2_48_label.npy
|       +--set3_48_data.npy
|       +--set3_48_label.npy
|       +--set4_48_data.npy
|       +--set4_48_label.npy
|   +-- test8
|       +--000001.png
|       +--000002.png
|       +--...
|   +-- Smoke_Detection_xxx.py

Sorry.

smoke-detection's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

smoke-detection's Issues

帮帮忙

Using TensorFlow backend.
Traceback (most recent call last):
File "D:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\IPython\core\interactiveshell.py", line 3331, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
runfile('C:/Projects/Python/DeepLearning/smoke_detection/python_files/Smoke_Detection_VGG16_with_SVM_and_Fully_Connected_Network.py', wdir='C:/Projects/Python/DeepLearning/smoke_detection/python_files')
File "C:\Program Files\JetBrains\PyCharm 2019.3.3\plugins\python\helpers\pydev_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "C:\Program Files\JetBrains\PyCharm 2019.3.3\plugins\python\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Projects/Python/DeepLearning/smoke_detection/python_files/Smoke_Detection_VGG16_with_SVM_and_Fully_Connected_Network.py", line 72, in
training_set_vgg16_features.append(model_vgg16.predict(x).reshape((77512, )))# 计算该张图片的特征
ValueError: cannot reshape array of size 50176 into shape (25088,)

npy文件是如何生成的

您好,非常感谢代码分享,对于我的帮助是极大的。
+--set1_48_data.npy
| +--set1_48_label.npy
| +--set2_48_data.npy
| +--set2_48_label.npy
| +--set3_48_data.npy
| +--set3_48_label.npy
| +--set4_48_data.npy
| +--set4_48_label.npy

请问这些npy文件是代码生成的还是需要自己前往某个地址下载,如果需要自行下载,可以分享一个链接嘛?

非常感谢。

数据集问题

首先 谢谢您的开源代码 学到很多 有一个小问题 test8中的数据集我可以下载 就是那个一千张图片 但是关于smoke dataset 里面的npy结尾文件的数据集我没有找到 请问这个是在哪里下载的 您有分享到google 云上么

关于数据集的shape

您好 我跑您的程序 在测试集输入那里是224224 reshape的时候却是77512 请问差的2倍是应该加到列上还是行上
还有就是在应用训练好的模型检测视频时,feature = model_vgg16.predict(x).reshape((1, 7
7*512))这句话显示并不能装得下50176个数

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.