[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-tobybreckon--fire-detection-cnn":3,"tool-tobybreckon--fire-detection-cnn":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",158594,2,"2026-04-16T23:34:05",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108322,"2026-04-10T11:39:34",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[52,13,15,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":32,"last_commit_at":59,"category_tags":60,"status":17},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[52,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":66,"readme_en":67,"readme_zh":68,"quickstart_zh":69,"use_case_zh":70,"hero_image_url":71,"owner_login":72,"owner_name":73,"owner_avatar_url":74,"owner_bio":75,"owner_company":76,"owner_location":77,"owner_email":78,"owner_twitter":72,"owner_website":79,"owner_url":80,"languages":81,"stars":90,"forks":91,"last_commit_at":92,"license":93,"difficulty_score":94,"env_os":95,"env_gpu":96,"env_ram":97,"env_deps":98,"category_tags":105,"github_topics":106,"view_count":32,"oss_zip_url":78,"oss_zip_packed_at":78,"status":17,"created_at":127,"updated_at":128,"faqs":129,"releases":163},8338,"tobybreckon\u002Ffire-detection-cnn","fire-detection-cnn","real-time fire detection in video imagery using a convolutional neural network (deep learning) - from our ICIP 2018 paper (Dunnings \u002F Breckon) + ICMLA 2019 paper (Samarth \u002F Bhowmik \u002F Breckon)","fire-detection-cnn 是一款基于深度学习的开源工具，专为在视频或静态图像中实时检测火焰而设计。它利用卷积神经网络（CNN）技术，能够在不依赖时间序列信息（即单帧分析）的情况下，快速准确地识别画面中的火情区域。\n\n该工具主要解决了传统火灾检测方法计算量大、难以满足实时性要求，或过度依赖连续帧分析导致延迟的问题。通过采用实验定义的轻量化网络架构（如 FireNet 及多种优化的 Inception 变体），fire-detection-cnn 在保证高准确率（整图检测准确率可达 0.93）的同时，显著降低了计算复杂度。在现代硬件上，其处理速度最高可达每秒 17 帧，实现了效率与精度的良好平衡。\n\n这款工具非常适合计算机视觉开发者、安防系统研究人员以及需要部署实时火灾预警系统的工程师使用。对于希望探索紧凑型神经网络架构的学术研究者而言，其提供的多种模型变体及基于超像素的定位框架也具有重要的参考价值。需要注意的是，项目原版基于 TensorFlow 构建，若需更现代的 PyTorch 支持，官方也指引了后续的更新版本资源。","# Experimentally Defined Convolutional Neural Network Architecture Variants for Non-temporal Real-time Fire Detection\n\n[and subsequent follow on work: _Experimental Exploration of Compact Convolutional Neural Network Architectures\nfor Non-temporal Real-time Fire Detection_]\n\n![Python Build\u002FTest](https:\u002F\u002Fgithub.com\u002Ftobybreckon\u002Ffire-detection-cnn\u002Fworkflows\u002FPython%20Build\u002FTest\u002Fbadge.svg) Tested using Python 3.7.x, [TensorFlow 1.15](https:\u002F\u002Fwww.tensorflow.org\u002Finstall\u002F), [TFLearn 0.3.2](http:\u002F\u002Ftflearn.org\u002F) and [OpenCV 3.x \u002F 4.x](http:\u002F\u002Fwww.opencv.org) (requires opencv extra modules - ximgproc module for superpixel segmentation)\n\n## Architectures:\n![FireNet](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ftobybreckon_fire-detection-cnn_readme_390fb8d9348e.png)\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FireNet architecture (above)\n![InceptionV1-onFire](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ftobybreckon_fire-detection-cnn_readme_a2301bb5976b.png)\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;InceptionV1-OnFire architecture (above)\n![InceptionV3-onFire](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ftobybreckon_fire-detection-cnn_readme_05c22bf91895.png)\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;InceptionV3-OnFire architecture (above)\n![InceptionV4-onFire](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ftobybreckon_fire-detection-cnn_readme_b6338377cb2a.png)\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;InceptionV4-OnFire architecture (above)\n\n\n## New Updated Architecture and Pytorch Models for Fire Detection available -- ![HERE](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ftobybreckon_fire-detection-cnn_readme_2432863ef7ea.png)\n\n## Abstract:\n\n_\"In  this  work  we  investigate  the  automatic  detection  of  fire pixel  regions  in  video  (or  still)  imagery  within  real-time\nbounds without reliance on temporal scene information.  As an extension to prior work in the field, we consider the performance  of  experimentally  defined,  reduced  complexity  deep convolutional neural network (CNN) architectures for this task. Contrary to contemporary trends in the field, our work illustrates\nmaximal accuracy of 0.93 for whole image binary fire detection (1),  with  0.89  accuracy  within  our  superpixel  localization\nframework  can  be  achieved (2),  via  a  network  architecture  of significantly reduced complexity. These reduced architectures\nadditionally  offer  a  3-4  fold  increase  in  computational  performance offering up to 17 fps processing on contemporary\nhardware  independent  of  temporal  information (1).    We  show the  relative  performance  achieved  against  prior  work  using\nbenchmark datasets to illustrate maximally robust real-time fire region detection.\"_\n\n(1) using InceptionV1-OnFire CNN model (2) using SP-InceptionV1-OnFire CNN model\n\n[[Dunnings, Breckon, In Proc. International Conference on Image Processing, IEEE, 2018](https:\u002F\u002Fbreckon.org\u002Ftoby\u002Fpublications\u002Fpapers\u002Fdunnings18fire.pdf)]\n\n_\".... Contrary to contemporary trends in the field, our work illustrates a   maximum   overall   accuracy   of   0.96   for   full   frame   binary fire   detection (3)   and   0.94   for   superpixel   localization (4)  using   an experimentally  defined  reduced  CNN  architecture  based  on  the concept of InceptionV4. We notably achieve a lower false positive rate  of  0.06  compared  to  prior  work  in  the  field  presenting  an efficient, robust and real-time solution for fire region detection.\"_\n\n(3) using InceptionV4-OnFire CNN model (4) using SP-InceptionV4-OnFire CNN model\n\n[[Samarth, Bhowmik, Breckon, In Proc. International Conference on Machine Learning Applications, IEEE, 2019](https:\u002F\u002Fbreckon.org\u002Ftoby\u002Fpublications\u002Fpapers\u002Fsamarth19fire.pdf)]\n\n---\n\n## Reference implementation:\nPut simply, our full-frame binary detection (_FireNet, InceptionV1-OnFire, InceptionV3-OnFire, InceptionV4-OnFire_) architectures determine whether an image frame contains fire globally, whereas the superpixel based approaches (_SP-InceptionV1-OnFire, SP-InceptionV3-OnFire, SP-InceptionV4-OnFire_) breaks down the frame into segments and performs classification on each superpixel segment to provide in-frame localization.\n\nThis respository contains the ```firenet.py``` and ```inceptionVxOnFire.py``` files corresponding to the binary (full-frame) detection models from the paper(s). In addition the ```superpixel-inceptionVxOnFire.py``` file corresponds to the superpixel based in-frame fire localization from the paper(s).\n\n To use these scripts the pre-trained network models must be downloaded using the shell script ```download-models.sh``` which will create an additional ```models``` directory containing the network weight data (on Linux\u002FMacOS). Alternatively, you can manually download the pre-trained network models from [http:\u002F\u002Fdx.doi.org\u002F10.15128\u002Fr19880vq98m](http:\u002F\u002Fdx.doi.org\u002F10.15128\u002Fr19880vq98m) [Dunnings, 2018] + [http:\u002F\u002Fdoi.org\u002F10.15128\u002Fr25x21tf409](http:\u002F\u002Fdoi.org\u002F10.15128\u002Fr25x21tf409) [Samarth, 2019] and unzip them to a directory called  ```models``` in the same place as the python files.\n\nThe superpixel based approach was trained to perform superpixel based fire detection and localization within a given frame as follows:\n  * image frame is split into segments using SLIC superpixel segmentation\n  * a _SP-InceptionVx-OnFire_ convolutional architecture (for _x = 1, 3, 4 for InceptionV1, InceptionV3, InceptionV4_), trained to detect fire in a given superpixel segment, is used on each superpixel.\n  * at run-time (inference), the selected _SP-InceptionVx-OnFire_, network is run on every superpixel from the SLIC segmentation of the image\n\n#### _Which model should I use ?_\n\nFor the **best detection performance (i.e. high true positive rate, low false positive rate) use _InceptionV4-OnFire_** (example: ```inceptionVxOnFire.py -m 4```) which operates at 12 frames per second (fps), for **best throughtput (17 fps) use _FireNet_** (example: ```firenet.py```) which has slightly lesser performance (i.e. lower true positive rate, higher false positive rate).\n\nThe _InceptionV1-OnFire_ and _InceptionV3-OnFire_ offer alternative performance characteristics in terms of detection, false alarm and throughput - (example: ```inceptionVxOnFire.py -m 1``` or ```inceptionVxOnFire.py -m 3```).\n\nThe **_SP-InceptionV4-OnFire_ model offers the best superpixel localization detection performance** of the fire within the image (example: ```superpixel-inceptionVxOnFire.py -m 4```) but at a lower throughput than the alternative, lesser detection performing _SP-InceptionV1-OnFire_ and _SP-InceptionV3-OnFire_ superpixel models (example: ```superpixel-inceptionVxOnFire.py -m 1``` or ```superpixel-inceptionVxOnFire.py -m 3```). For full comparison see most recent paper - [[Samath, 2019](https:\u002F\u002Fbreckon.org\u002Ftoby\u002Fpublications\u002Fpapers\u002Fsamarth19fire.pdf)]\n\n_Caveat:_ **if you need to convert the models** to protocol buffer (.pb) format (used by [OpenCV](http:\u002F\u002Fwww.opencv.org) DNN, [TensorFlow](https:\u002F\u002Fwww.tensorflow.org\u002F), ...) and also tflite (used with [TensorFlow](https:\u002F\u002Fwww.tensorflow.org\u002F)) then use the **_FireNet_** or **_InceptionV1-OnFire_ \u002F _SP-InceptionV1-OnFire_** versions at the moment as, due to a long-standing [issue](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fissues\u002F3628) in TensorFlow with the export (freezing) of the Batch Normalization layers, the protocol buffer (.pb) format and .tflite versions of the _...V3-OnFire_ and _...V4-OnFire_ have significantly lesser performance (which is to be expected, given the approach we use to workaround the problem).\n\n---\n## Fire Detection Datasets:\n\nThe custom dataset used for training and evaluation can be found on [[Durham Collections - Dunnings\u002FBreckon, 2018](https:\u002F\u002Fcollections.durham.ac.uk\u002Fcollections\u002Fr1ww72bb497)] and [[Durham Collections - Samarth\u002FBreckon, 2019](https:\u002F\u002Fcollections.durham.ac.uk\u002Fcollections\u002Fr2jm214p16f)] (together with the trained network models). A direct download link for the dataset is [[Dunnings, 2018 - original data](https:\u002F\u002Fcollections.durham.ac.uk\u002Fdownloads\u002Fr2d217qp536)] and [[Samarth, 2019 - additional data](https:\u002F\u002Fcollections.durham.ac.uk\u002Fdownloads\u002Fr10r967374q)].\n\nIn addition, standard datasets such as [furg-fire-dataset](https:\u002F\u002Fgithub.com\u002Fsteffensbola\u002Ffurg-fire-dataset) were also used for training and evaluation (and are included as a subset within the above datasets for [[Dunnings, 2018 - original data](https:\u002F\u002Fcollections.durham.ac.uk\u002Fdownloads\u002Fr2d217qp536)]).\n\n* DOI for datsets - [http:\u002F\u002Fdoi.org\u002F10.15128\u002Fr2d217qp536](http:\u002F\u002Fdoi.org\u002F10.15128\u002Fr2d217qp536) and [http:\u002F\u002Fdoi.org\u002F10.15128\u002Fr10r967374q](http:\u002F\u002Fdoi.org\u002F10.15128\u002Fr10r967374q).\n\nA download script ```download-dataset.sh``` is also provided which will create an additional ```dataset``` directory containing the training dataset (10.5Gb in size, works on Linux\u002FMacOS).\n\n![](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ftobybreckon_fire-detection-cnn_readme_682d66f2d249.png)\nOriginal frame (left), Frame after superpixel segmentation (middle), Frame after superpixel fire prediction (right)\n\n---\n\n## Instructions to test pre-trained models:\n\nTo download and test the supplied code and pre-trained models (with **TensorFlow 1.x \u002F TFLearn 0.3.2 \u002F OpenCV 4.x** installed) do:\n\n```\n$ git clone https:\u002F\u002Fgithub.com\u002Ftobybreckon\u002Ffire-detection-cnn.git\n$ cd fire-detection-cnn\n$ sh .\u002Fdownload-models.sh\n$ python firenet.py models\u002Ftest.mp4\n$ python inceptionVxOnFire.py -m 1 models\u002Ftest.mp4\n$ python superpixel-inceptionVxOnFire.py -m 1 models\u002Ftest.mp4\n```\n\nwhere ```-m x``` specifies the use of either of the _InceptionV1OnFire, InceptionV3OnFire, InceptionV4OnFire_\nmodels for ```x``` in ```[1,3,4]```. By default it uses _InceptionV1OnFire_ if ```-m``` is not specified.\n\n\nIf by default you have **TensorFlow 2.x** installed on your system, then a workflow to make this repo work on your system is via a Tensorflow 1.x virtual environment (as TFLearn is not supported in TensorFlow 2.0 - this [issue](https:\u002F\u002Fgithub.com\u002Ftflearn\u002Ftflearn\u002Fissues\u002F1121)) is as follows:\n\n```\n$ virtualenv -p python3 ~\u002Fvenv\u002Ftf-1.1.5-gpu\n$ source ~\u002Fvenv\u002Ftf-1.1.5-gpu\u002Fbin\u002Factivate\n$ pip install tensorflow-gpu==1.15\n$ pip install tflearn\n$ pip install opencv-contrib-python\n....\n$ python3 firenet.py models\u002Ftest.mp4\n```\n\n---\n\n## Instructions to use pre-trained models with other frameworks:\n\nTo convert the supplied pre-trained models from TFLearn checkpoint format to protocol buffer (.pb) format (used by [OpenCV](http:\u002F\u002Fwww.opencv.org) DNN, [TensorFlow](https:\u002F\u002Fwww.tensorflow.org\u002F), ...) and also tflite (used with [TensorFlow](https:\u002F\u002Fwww.tensorflow.org\u002F)) do:\n\n\n```\n$ cd converter\n$ python firenet-conversion.py\n$ python inceptionVxOnFire-conversion.py -m 1\n```\n\nThis creates a set of six ```.pb``` and ```.tflite``` files inside the ```converter``` directory (```firenet.xxx``` \u002F ```inceptionv1onfire.xxx```\u002F```sp-inceptionv1onfire.xxx``` for ```xxx``` in ```[pb, tflite]```). The ```inceptionVxOnFire-conversion.py``` can be similarly run with ```-m 3``` and ```-m 4``` to generate the same conversions for the _InceptionV3OnFire_ and _InceptionV4OnFire_ models respectively.\n\nThese alternative format files can then be validated  with the [OpenCV](http:\u002F\u002Fwww.opencv.org) DNN module (OpenCV > 4.1.0-pre) and [TensorFlow](https:\u002F\u002Fwww.tensorflow.org\u002F) against the original (tflearn) version from within the same directory, in order to check that they all produce the same output (up to 3 decimal places) as follows:\n\n```\n$ python firenet-validation.py\nLoad tflearn model from: ..\u002Fmodels\u002FFireNet ...OK\nLoad protocolbuf (pb) model from: firenet.pb ...OK\nLoad tflite model from: firenet.tflite ...OK\nLoad test video from ..\u002Fmodels\u002Ftest.mp4 ...\nframe: 0        : TFLearn (original): [[9.999914e-01 8.576833e-06]]     : Tensorflow .pb (via opencv): [[9.999914e-01 8.576866e-06]]    : TFLite (via tensorflow): [[9.999914e-01 8.576899e-06]]: all equal test - PASS\nframe: 1        : TFLearn (original): [[9.999924e-01 7.609045e-06]]     : Tensorflow .pb (via opencv): [[9.999924e-01 7.608987e-06]]    : TFLite (via tensorflow): [[9.999924e-01 7.608980e-06]]: all equal test - PASS\nframe: 2        : TFLearn (original): [[9.999967e-01 3.373572e-06]]     : Tensorflow .pb (via opencv): [[9.999967e-01 3.373559e-06]]    : TFLite (via tensorflow): [[9.999967e-01 3.373456e-06]]: all equal test - PASS\nframe: 3        : TFLearn (original): [[9.999968e-01 3.165212e-06]]     : Tensorflow .pb (via opencv): [[9.999968e-01 3.165221e-06]]    : TFLite (via tensorflow): [[9.999968e-01 3.165176e-06]]: all equal test - PASS\n...\n```\n\nThis can be similarly repeated with the ```inceptionVxOnFire-validation.py``` scripts with the options ```-m x``` for ```x``` in ```[1,3,4]``` for each of the InceptionVxOnFire models and similarly with the additional option ```-sp``` for each of the superpixel InceptionVxOnFire models (e.g. ```inceptionVxOnFire-validation.py -m 3 -sp``` validates the _InceptionV3OnFire_ superpixel model and so on). N.B. here the superpixel inceptionVxOnFire models are being validated against the whole image frame rather than superpixels just for simply showing consistent output between the original and converted models. Some ```FAIL```cases will be reported against this strict 3 decimal place criteria, but inspection often reveals a mildly larger ~0.1 difference (with the exception of the _...V3-OnFire_ and _...V4-OnFire_ caveat discussed above).\n\n**To convert to to other frameworks** (such as PyTorch, MXNet, Keras, ...) from these tensorflow formats: - please see the extensive deep neural network model conversion tools offered by the [MMdnn](https:\u002F\u002Fgithub.com\u002FMicrosoft\u002FMMdnn) project.\n\n---\n\n## Example video:\n[![Examples](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ftobybreckon_fire-detection-cnn_readme_58856259e255.png)](https:\u002F\u002Fyoutu.be\u002FRcNj8aMDer4)\nVideo Example - click image above to play.\n\n---\n\n## References:\n\nIf you are making use of this work in any way (including our pre-trained models or datasets), _you must please_ reference the following articles in any report, publication, presentation, software release\nor any other associated materials:\n\n[Experimentally defined Convolutional Neural Network Architecture Variants for Non-temporal Real-time Fire Detection](https:\u002F\u002Fbreckon.org\u002Ftoby\u002Fpublications\u002Fpapers\u002Fdunnings18fire.pdf)\n(Dunnings, Breckon), In Proc. International Conference on Image Processing, IEEE, 2018.\n```\n@InProceedings{dunnings18fire,\n  author =     {Dunnings, A. and Breckon, T.P.},\n  title =      {Experimentally defined Convolutional Nerual Network Architecture Variants for Non-temporal Real-time Fire Detection},\n  booktitle =  {Proc. International Conference on Image Processing},\n  pages =      {1558-1562},\n  year =       {2018},\n  month =      {September},\n  publisher =  {IEEE},\n  doi =        {10.1109\u002FICIP.2018.8451657},\n  keywords =   {simplified CNN, deep learning, fire detection, real-time, non-temporal, non-stationary visual fire detection, FireNet, InceptionV1OnFire},\n}\n```\n\n[Experimental Exploration of Compact Convolutional Neural Network Architectures for Non-temporal Real-time Fire Detection](https:\u002F\u002Fbreckon.org\u002Ftoby\u002Fpublications\u002Fpapers\u002Fsamarth19fire.pdf)\n(Samarth, Bhowmik, Breckon), In Proc. International Conference on Machine Learning Applications, IEEE, 2019.\n```\n@InProceedings{samarth19fire,\n  author =    {Samarth, G. and Bhowmik, N. and Breckon, T.P.},\n  title =     {Experimental Exploration of Compact Convolutional Neural Network Architectures for Non-temporal Real-time Fire Detection},\n  booktitle = {Proc. International Conference on Machine Learning Applications},\n  pages =     {653-658},\n  year =      {2019},\n  month =     {December},\n  publisher = {IEEE},\n  doi =       {10.1109\u002FICMLA.2019.00119},\n  keywords =  {fire detection, CNN, deep-learning real-time, non-temporal, InceptionV3OnFire, InceptionV4OnFire},\n}\n```\n\nIn addition the (very permissive) terms of the [LICENSE](LICENSE) must be adhered to.\n\n### Acknowledgements:\n\nAtharva (Art) Deshmukh (Durham University, _github and data set collation for publication_ for [Dunnings\u002FBreckon, 2018] work).\n\n---\n","# 非时序实时火灾检测的实验性卷积神经网络架构变体\n\n[以及后续相关工作：_非时序实时火灾检测的紧凑型卷积神经网络架构实验探索_]\n\n![Python 构建\u002F测试](https:\u002F\u002Fgithub.com\u002Ftobybreckon\u002Ffire-detection-cnn\u002Fworkflows\u002FPython%20Build\u002FTest\u002Fbadge.svg) 本项目使用 Python 3.7.x、[TensorFlow 1.15](https:\u002F\u002Fwww.tensorflow.org\u002Finstall\u002F)、[TFLearn 0.3.2](http:\u002F\u002Ftflearn.org\u002F) 和 [OpenCV 3.x \u002F 4.x](http:\u002F\u002Fwww.opencv.org) 进行测试（需要 OpenCV 的额外模块——用于超像素分割的 ximgproc 模块）。\n\n## 架构：\n![FireNet](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ftobybreckon_fire-detection-cnn_readme_390fb8d9348e.png)\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FireNet 架构（上图）\n![InceptionV1-onFire](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ftobybreckon_fire-detection-cnn_readme_a2301bb5976b.png)\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;InceptionV1-OnFire 架构（上图）\n![InceptionV3-onFire](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ftobybreckon_fire-detection-cnn_readme_05c22bf91895.png)\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;InceptionV3-OnFire 架构（上图）\n![InceptionV4-onFire](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ftobybreckon_fire-detection-cnn_readme_b6338377cb2a.png)\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;InceptionV4-OnFire 架构（上图）\n\n\n## 用于火灾检测的新更新架构及 PyTorch 模型现已发布——![此处](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ftobybreckon_fire-detection-cnn_readme_2432863ef7ea.png)\n\n## 摘要：\n\n“在本工作中，我们研究了在不依赖场景时间信息的情况下，在实时范围内自动检测视频（或静态图像）中火灾像素区域的方法。作为该领域先前工作的扩展，我们考察了为此任务设计的、经过实验验证的低复杂度深度卷积神经网络（CNN）架构的性能。与当前领域的主流趋势不同，我们的研究展示了整张图像二值化火灾检测的最高准确率为 0.93（1），而在我们的超像素定位框架下，准确率可达 0.89（2），且仅需使用显著降低复杂度的网络架构即可实现。这些简化架构还带来了 3–4 倍的计算性能提升，在当代硬件上可独立于时间信息以高达 17 帧\u002F秒的速度进行处理（1）。我们通过基准数据集对比了与先前工作的相对性能，从而证明了所提出的方案在实时火灾区域检测方面的最大鲁棒性。”\n\n(1) 使用 InceptionV1-OnFire CNN 模型 (2) 使用 SP-InceptionV1-OnFire CNN 模型\n\n[[邓宁斯、布雷肯，《国际图像处理会议论文集》，IEEE，2018 年](https:\u002F\u002Fbreckon.org\u002Ftoby\u002Fpublications\u002Fpapers\u002Fdunnings18fire.pdf)]\n\n“……与当前领域的主流趋势相反，我们的研究展示了一种基于 InceptionV4 概念的实验性简化 CNN 架构，在全帧二值化火灾检测方面达到了 0.96 的最高总体准确率（3），在超像素定位方面则达到了 0.94 的准确率（4）。值得注意的是，我们实现了 0.06 的较低假阳性率，优于该领域的先前工作，从而提供了一种高效、鲁棒且实时的火灾区域检测解决方案。”\n\n(3) 使用 InceptionV4-OnFire CNN 模型 (4) 使用 SP-InceptionV4-OnFire CNN 模型\n\n[[萨马特、鲍米克、布雷肯，《国际机器学习应用会议论文集》，IEEE，2019 年](https:\u002F\u002Fbreckon.org\u002Ftoby\u002Fpublications\u002Fpapers\u002Fsamarth19fire.pdf)]\n\n---\n\n## 参考实现：\n简而言之，我们的全帧二分类检测（_FireNet、InceptionV1-OnFire、InceptionV3-OnFire、InceptionV4-OnFire_）架构用于全局判断图像帧中是否存在火焰；而基于超像素的方法（_SP-InceptionV1-OnFire、SP-InceptionV3-OnFire、SP-InceptionV4-OnFire_）则将帧分割成多个区域，并对每个超像素区域进行分类，从而实现火焰的帧内定位。\n\n本仓库包含与论文中的二分类（全帧）检测模型相对应的 ```firenet.py``` 和 ```inceptionVxOnFire.py``` 文件。此外，```superpixel-inceptionVxOnFire.py``` 文件对应于论文中提出的基于超像素的帧内火焰定位方法。\n\n要使用这些脚本，必须通过 shell 脚本 ```download-models.sh``` 下载预训练的网络模型，该脚本会在 Linux\u002FMacOS 系统上创建一个名为 ```models``` 的目录，其中包含网络权重数据。或者，您也可以手动从 [http:\u002F\u002Fdx.doi.org\u002F10.15128\u002Fr19880vq98m](http:\u002F\u002Fdx.doi.org\u002F10.15128\u002Fr19880vq98m) [Dunnings, 2018] 和 [http:\u002F\u002Fdoi.org\u002F10.15128\u002Fr25x21tf409](http:\u002F\u002Fdoi.org\u002F10.15128\u002Fr25x21tf409) [Samarth, 2019] 手动下载预训练的网络模型，并将其解压到与 Python 文件同一目录下的 ```models``` 目录中。\n\n基于超像素的方法经过训练，能够在给定帧内执行超像素级别的火焰检测与定位，具体步骤如下：\n  * 使用 SLIC 超像素分割算法将图像帧分割成多个区域；\n  * 对每个超像素区域应用经过训练的 _SP-InceptionVx-OnFire_ 卷积架构（其中 _x = 1, 3, 4 分别对应 InceptionV1、InceptionV3 和 InceptionV4），该架构专门用于检测单个超像素区域内的火焰；\n  * 在运行时（推理阶段），所选的 _SP-InceptionVx-OnFire_ 网络会依次应用于 SLIC 分割得到的每一个超像素区域。\n\n#### _我应该使用哪个模型？_\n\n若追求**最佳检测性能（即高真正率、低假正率），请使用 _InceptionV4-OnFire_**（示例：```inceptionVxOnFire.py -m 4```），其运行速度为每秒 12 帧；若追求**最佳吞吐量（17 帧\u002F秒），则可使用 _FireNet_**（示例：```firenet.py```），不过其性能稍逊（即真正率较低、假正率较高）。\n\n_InceptionV1-OnFire_ 和 _InceptionV3-OnFire_ 则在检测效果、误报率和吞吐量方面提供了不同的性能权衡——例如，可以分别使用 ```inceptionVxOnFire.py -m 1``` 或 ```inceptionVxOnFire.py -m 3```。\n\n对于**超像素级的火焰定位任务，_SP-InceptionV4-OnFire_ 模型具有最佳的检测性能**（示例：```superpixel-inceptionVxOnFire.py -m 4```），但其吞吐量低于性能稍逊的 _SP-InceptionV1-OnFire_ 和 _SP-InceptionV3-OnFire_ 超像素模型（示例：```superpixel-inceptionVxOnFire.py -m 1``` 或 ```superpixel-inceptionVxOnFire.py -m 3```）。完整对比请参阅最新论文——[[Samarth, 2019](https:\u002F\u002Fbreckon.org\u002Ftoby\u002Fpublications\u002Fpapers\u002Fsamarth19fire.pdf)]。\n\n*注意：* 如果需要将模型转换为协议缓冲区 (.pb) 格式（供 [OpenCV](http:\u002F\u002Fwww.opencv.org) DNN、[TensorFlow](https:\u002F\u002Fwww.tensorflow.org\u002F) 等使用）以及 tflite 格式（用于 [TensorFlow](https:\u002F\u002Fwww.tensorflow.org\u002F)），目前建议使用 _FireNet_ 或 _InceptionV1-OnFire \u002F SP-InceptionV1-OnFire_ 版本。这是因为 TensorFlow 在导出（冻结）批量归一化层时存在一个长期未解决的问题（[issue](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fissues\u002F3628)），导致 _...V3-OnFire_ 和 _...V4-OnFire_ 的协议缓冲区 (.pb) 和 .tflite 版本性能显著下降，这也是我们采用绕过方案处理该问题后的预期结果。\n\n---\n## 火焰检测数据集：\n\n用于训练和评估的自定义数据集可在 [[Durham Collections - Dunnings\u002FBreckon, 2018](https:\u002F\u002Fcollections.durham.ac.uk\u002Fcollections\u002Fr1ww72bb497)] 和 [[Durham Collections - Samarth\u002FBreckon, 2019](https:\u002F\u002Fcollections.durham.ac.uk\u002Fcollections\u002Fr2jm214p16f)] 上找到（连同已训练好的网络模型一同发布）。数据集的直接下载链接分别为 [[Dunnings, 2018 - 原始数据](https:\u002F\u002Fcollections.durham.ac.uk\u002Fdownloads\u002Fr2d217qp536)] 和 [[Samarth, 2019 - 补充数据](https:\u002F\u002Fcollections.durham.ac.uk\u002Fdownloads\u002Fr10r967374q)]。\n\n此外，还使用了诸如 [furg-fire-dataset](https:\u002F\u002Fgithub.com\u002Fsteffensbola\u002Ffurg-fire-dataset) 等标准数据集进行训练和评估，并将其作为子集包含在上述数据集中（[[Dunnings, 2018 - 原始数据](https:\u002F\u002Fcollections.durham.ac.uk\u002Fdownloads\u002Fr2d217qp536)])。\n\n* 数据集 DOI：[http:\u002F\u002Fdoi.org\u002F10.15128\u002Fr2d217qp536](http:\u002F\u002Fdoi.org\u002F10.15128\u002Fr2d217qp536) 和 [http:\u002F\u002Fdoi.org\u002F10.15128\u002Fr10r967374q](http:\u002F\u002Fdoi.org\u002F10.15128\u002Fr10r967374q)。\n\n同时提供了一个下载脚本 ```download-dataset.sh```，它会创建一个名为 ```dataset``` 的目录，其中包含训练数据集（大小约为 10.5GB，在 Linux\u002FMacOS 系统上可用）。\n\n![](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ftobybreckon_fire-detection-cnn_readme_682d66f2d249.png)\n原始帧（左）、超像素分割后的帧（中）、超像素火焰预测后的帧（右）\n\n---\n\n## 预训练模型测试说明：\n\n要下载并测试提供的代码及预训练模型（需安装 **TensorFlow 1.x \u002F TFLearn 0.3.2 \u002F OpenCV 4.x**），请按以下步骤操作：\n\n```\n$ git clone https:\u002F\u002Fgithub.com\u002Ftobybreckon\u002Ffire-detection-cnn.git\n$ cd fire-detection-cnn\n$ sh .\u002Fdownload-models.sh\n$ python firenet.py models\u002Ftest.mp4\n$ python inceptionVxOnFire.py -m 1 models\u002Ftest.mp4\n$ python superpixel-inceptionVxOnFire.py -m 1 models\u002Ftest.mp4\n```\n\n其中，```-m x``` 参数用于指定使用 _InceptionV1OnFire、InceptionV3OnFire、InceptionV4OnFire_ 中的哪一个模型，取值范围为 ```[1,3,4]```。若未指定 ```-m``` 参数，则默认使用 _InceptionV1OnFire_。\n\n如果您系统中默认安装的是 **TensorFlow 2.x**，则可通过搭建 TensorFlow 1.x 虚拟环境来使本项目在您的系统上正常运行（因为 TFLearn 不支持 TensorFlow 2.0——详见此 [issue](https:\u002F\u002Fgithub.com\u002Ftflearn\u002Ftflearn\u002Fissues\u002F1121)），具体流程如下：\n\n```\n$ virtualenv -p python3 ~\u002Fvenv\u002Ftf-1.1.5-gpu\n$ source ~\u002Fvenv\u002Ftf-1.1.5-gpu\u002Fbin\u002Factivate\n$ pip install tensorflow-gpu==1.15\n$ pip install tflearn\n$ pip install opencv-contrib-python\n....\n$ python3 firenet.py models\u002Ftest.mp4\n```\n\n---\n\n## 使用预训练模型与其他框架的说明：\n\n要将提供的 TFLearn 检查点格式的预训练模型转换为协议缓冲区 (.pb) 格式（由 [OpenCV](http:\u002F\u002Fwww.opencv.org) DNN、[TensorFlow](https:\u002F\u002Fwww.tensorflow.org\u002F) 等使用）以及 tflite 格式（用于 [TensorFlow](https:\u002F\u002Fwww.tensorflow.org\u002F)），请执行以下操作：\n\n```\n$ cd converter\n$ python firenet-conversion.py\n$ python inceptionVxOnFire-conversion.py -m 1\n```\n\n这将在 `converter` 目录下生成一组六个 `.pb` 和 `.tflite` 文件（`firenet.xxx` \u002F `inceptionv1onfire.xxx` \u002F `sp-inceptionv1onfire.xxx`，其中 `xxx` 可以是 `[pb, tflite]`）。同样地，可以使用 `-m 3` 和 `-m 4` 运行 `inceptionVxOnFire-conversion.py`，分别为 _InceptionV3OnFire_ 和 _InceptionV4OnFire_ 模型生成相应的转换文件。\n\n然后，可以使用 [OpenCV](http:\u002F\u002Fwww.opencv.org) DNN 模块（OpenCV ≥ 4.1.0-pre）和 [TensorFlow](https:\u002F\u002Fwww.tensorflow.org\u002F) 对这些不同格式的文件与原始的 (tflearn) 版本进行验证，以确保它们在相同目录下产生的输出一致（精确到小数点后三位），具体步骤如下：\n\n```\n$ python firenet-validation.py\n从 ..\u002Fmodels\u002FFireNet 加载 tflearn 模型 ... 成功\n从 firenet.pb 加载 protocolbuf (pb) 模型 ... 成功\n从 firenet.tflite 加载 tflite 模型 ... 成功\n从 ..\u002Fmodels\u002Ftest.mp4 加载测试视频 ...\n帧: 0        : TFLearn（原版）: [[9.999914e-01 8.576833e-06]]     : Tensorflow .pb（通过 opencv）: [[9.999914e-01 8.576866e-06]]    : TFLite（通过 tensorflow）: [[9.999914e-01 8.576899e-06]]: 全部相等 测试 - 通过\n帧: 1        : TFLearn（原版）: [[9.999924e-01 7.609045e-06]]     : Tensorflow .pb（通过 opencv）: [[9.999924e-01 7.608987e-06]]    : TFLite（通过 tensorflow）: [[9.999924e-01 7.608980e-06]]: 全部相等 测试 - 通过\n帧: 2        : TFLearn（原版）: [[9.999967e-01 3.373572e-06]]     : Tensorflow .pb（通过 opencv）: [[9.999967e-01 3.373559e-06]]    : TFLite（通过 tensorflow）: [[9.999967e-01 3.373456e-06]]: 全部相等 测试 - 通过\n帧: 3        : TFLearn（原版）: [[9.999968e-01 3.165212e-06]]     : Tensorflow .pb（通过 opencv）: [[9.999968e-01 3.165221e-06]]    : TFLite（通过 tensorflow）: [[9.999968e-01 3.165176e-06]]: 全部相等 测试 - 通过\n...\n```\n\n同样的方法也可以用于 `inceptionVxOnFire-validation.py` 脚本，只需添加 `-m x` 参数（其中 `x` 可以是 `[1,3,4]`），即可分别对每个 InceptionVxOnFire 模型进行验证。此外，还可以使用 `-sp` 选项来验证超像素版本的 InceptionVxOnFire 模型（例如，`inceptionVxOnFire-validation.py -m 3 -sp` 将验证 _InceptionV3OnFire_ 的超像素模型，以此类推）。需要注意的是，这里对超像素 InceptionVxOnFire 模型的验证是基于整张图像帧，而非单独的超像素区域，目的是展示原始模型与转换后模型之间的一致性。根据严格的小数点后三位精度标准，可能会报告一些 `FAIL` 情况，但仔细检查通常会发现差异很小，大约在 0.1 左右（除了前面提到的 _...V3-OnFire_ 和 _...V4-OnFire_ 的特殊情况）。\n\n**若需将这些 TensorFlow 格式的模型转换为其他框架**（如 PyTorch、MXNet、Keras 等），请参考 [MMdnn](https:\u002F\u002Fgithub.com\u002FMicrosoft\u002FMMdnn) 项目提供的丰富的深度神经网络模型转换工具。\n\n---\n\n## 示例视频：\n[![示例](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ftobybreckon_fire-detection-cnn_readme_58856259e255.png)](https:\u002F\u002Fyoutu.be\u002FRcNj8aMDer4)\n示例视频——点击上方图片即可播放。\n\n---\n\n## 参考文献：\n\n如果您以任何方式使用本工作成果（包括我们的预训练模型或数据集），_务必_在任何报告、出版物、演示文稿、软件发布或其他相关材料中引用以下文章：\n\n[用于非时序实时火灾检测的实验性卷积神经网络架构变体](https:\u002F\u002Fbreckon.org\u002Ftoby\u002Fpublications\u002Fpapers\u002Fdunnings18fire.pdf)\n(Dunnings, Breckon)，IEEE 国际图像处理会议论文集，2018 年。\n```\n@InProceedings{dunnings18fire,\n  author =     {Dunnings, A. and Breckon, T.P.},\n  title =      {Experimentally defined Convolutional Nerual Network Architecture Variants for Non-temporal Real-time Fire Detection},\n  booktitle =  {Proc. International Conference on Image Processing},\n  pages =      {1558-1562},\n  year =       {2018},\n  month =      {September},\n  publisher =  {IEEE},\n  doi =        {10.1109\u002FICIP.2018.8451657},\n  keywords =   {简化 CNN、深度学习、火灾检测、实时、非时序、非平稳视觉火灾检测、FireNet、InceptionV1OnFire},\n}\n```\n\n[用于非时序实时火灾检测的紧凑型卷积神经网络架构的实验探索](https:\u002F\u002Fbreckon.org\u002Ftoby\u002Fpublications\u002Fpapers\u002Fsamarth19fire.pdf)\n(Samarth, Bhowmik, Breckon)，IEEE 国际机器学习应用会议论文集，2019 年。\n```\n@InProceedings{samarth19fire,\n  author =    {Samarth, G. and Bhowmik, N. and Breckon, T.P.},\n  title =     {Experimental Exploration of Compact Convolutional Neural Network Architectures for Non-temporal Real-time Fire Detection},\n  booktitle = {Proc. International Conference on Machine Learning Applications},\n  pages =     {653-658},\n  year =      {2019},\n  month =     {December},\n  publisher = {IEEE},\n  doi =       {10.1109\u002FICMLA.2019.00119},\n  keywords =  {火灾检测、CNN、深度学习实时、非时序、InceptionV3OnFire、InceptionV4OnFire},\n}\n```\n\n此外，还必须遵守 [LICENSE](LICENSE) 中的条款。\n\n### 致谢：\n\nAtharva (Art) Deshmukh（杜伦大学，负责 [Dunnings\u002FBreckon, 2018] 工作的 _GitHub 项目及数据集整理_)。","# fire-detection-cnn 快速上手指南\n\n本项目提供了一系列基于卷积神经网络（CNN）的实时火焰检测架构，支持整帧二分类检测（判断画面中是否有火）和基于超像素的火焰定位（标记火焰具体位置）。\n\n## 环境准备\n\n### 系统要求\n- **操作系统**: Linux 或 macOS (Windows 需自行配置相应环境)\n- **Python 版本**: 推荐 Python 3.7.x\n- **核心依赖**:\n  - TensorFlow 1.15 (注意：本项目基于 TF 1.x，不直接支持 TF 2.x)\n  - TFLearn 0.3.2\n  - OpenCV 3.x \u002F 4.x (必须包含 `opencv-contrib-python` 以支持 `ximgproc` 模块用于超像素分割)\n\n### 前置说明\n由于 `TFLearn` 不再维护且不支持 TensorFlow 2.0+，强烈建议创建独立的虚拟环境来运行此项目，避免污染全局环境。\n\n## 安装步骤\n\n### 1. 克隆项目代码\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Ftobybreckon\u002Ffire-detection-cnn.git\ncd fire-detection-cnn\n```\n\n### 2. 创建并配置虚拟环境 (针对 TensorFlow 1.x)\n如果你的系统默认安装了 TensorFlow 2.x，请执行以下步骤创建兼容环境：\n\n```bash\n# 创建虚拟环境\nvirtualenv -p python3 ~\u002Fvenv\u002Ftf-1.15-gpu\n# 激活环境 (Linux\u002FMac)\nsource ~\u002Fvenv\u002Ftf-1.15-gpu\u002Fbin\u002Factivate\n\n# 安装指定版本的依赖\n# 国内用户建议使用清华源加速下载\npip install -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple tensorflow-gpu==1.15\npip install -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple tflearn\npip install -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple opencv-contrib-python\n```\n\n### 3. 下载预训练模型\n执行官方提供的脚本自动下载模型权重（约几百 MB），脚本会在当前目录生成 `models` 文件夹：\n\n```bash\nsh .\u002Fdownload-models.sh\n```\n*注：如果自动下载失败，可手动从项目发布的 DOI 链接下载并解压到 `models` 目录。*\n\n### 4. (可选) 下载测试数据集\n如需使用官方提供的测试视频或训练数据，可运行：\n```bash\nsh .\u002Fdownload-dataset.sh\n```\n*注意：完整数据集较大（约 10.5GB），仅做推理测试可跳过此步，使用自有视频即可。*\n\n## 基本使用\n\n确保已激活上述创建的虚拟环境，并在项目根目录下操作。\n\n### 场景一：整帧火焰检测 (最快上手)\n判断输入视频或图像中是否包含火焰。\n\n**使用 FireNet 模型 (速度最快，约 17 fps):**\n```bash\npython firenet.py models\u002Ftest.mp4\n```\n\n**使用 InceptionV4-OnFire 模型 (精度最高，约 12 fps):**\n```bash\npython inceptionVxOnFire.py -m 4 models\u002Ftest.mp4\n```\n*参数说明：`-m` 后跟数字选择模型版本，`1`=InceptionV1, `3`=InceptionV3, `4`=InceptionV4。默认为 1。*\n\n### 场景二：超像素火焰定位 (标记火焰区域)\n将画面分割为超像素块，逐块检测并标记火焰具体位置。\n\n**使用 SP-InceptionV4-OnFire 模型 (定位精度最佳):**\n```bash\npython superpixel-inceptionVxOnFire.py -m 4 models\u002Ftest.mp4\n```\n\n### 输入文件替换\n将命令中的 `models\u002Ftest.mp4` 替换为你本地的视频文件路径（如 `.\u002Fmy_video.avi`）或图片文件路径即可对自定义内容进行检测。\n\n### 模型选择建议\n- **追求实时性与吞吐量**: 选用 `firenet.py`。\n- **追求检测准确率**: 选用 `inceptionVxOnFire.py -m 4`。\n- **需要知道火在哪里 (定位)**: 选用 `superpixel-inceptionVxOnFire.py -m 4`。\n\n*注意：若需将模型转换为 `.pb` 或 `.tflite` 格式用于其他框架（如 OpenCV DNN），目前仅推荐转换 `FireNet` 或 `InceptionV1` 系列模型，V3\u002FV4 版本因 TensorFlow 批量归一化层导出问题可能导致性能显著下降。*","某大型物流仓储中心需要在夜间无人值守时，通过现有监控摄像头实时监测仓库内的早期火情，以确保在消防队到达前自动触发喷淋系统。\n\n### 没有 fire-detection-cnn 时\n- **误报率极高**：传统基于颜色或运动检测的算法常将叉车警示灯、夕阳反光或红色货物误判为火焰，导致安保人员频繁无效出勤。\n- **响应延迟严重**：依赖人工轮询监控画面或复杂的云端视频分析，从起火到确认往往需要数分钟，错过了黄金灭火时间。\n- **硬件成本高昂**：为了实现实时分析，必须采购昂贵的专用边缘计算服务器或升级全套热成像设备，预算难以获批。\n- **无法处理复杂光影**：在仓库昏暗且存在移动阴影的环境下，旧算法极易失效，无法区分真实火源与环境干扰。\n\n### 使用 fire-detection-cnn 后\n- **精准识别火源**：利用经过 ICIP 和 ICMLA 论文验证的卷积神经网络架构，fire-detection-cnn 能准确区分火焰与类似颜色的干扰物，将二元检测准确率提升至 93%。\n- **真正的实时响应**：凭借精简的网络结构，该工具在普通硬件上即可达到 17 FPS 的处理速度，能在火灾发生的秒级时间内发出警报并联动喷淋。\n- **利旧降本显著**：无需更换摄像头或购买昂贵硬件，直接复用现有的普通监控视频流和普通工控机即可部署，大幅降低落地成本。\n- **抗干扰能力强**：不依赖时序信息（即单帧即可判断），有效克服了仓库内灯光闪烁、阴影移动等非火灾动态因素的干扰。\n\nfire-detection-cnn 通过将学术界的轻量化深度学习成果转化为工业级应用，以极低的算力成本实现了高准确率、低延迟的实时火灾预警。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ftobybreckon_fire-detection-cnn_de2eb554.png","tobybreckon","Toby Breckon","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Ftobybreckon_4f386a4f.png","Toby Breckon is Professor in Computer Vision & Image Processing within the Department of Engineering & Department of Computer Science at Durham University, UK.","Durham University","UK",null,"https:\u002F\u002Fbreckon.org\u002Ftoby\u002F","https:\u002F\u002Fgithub.com\u002Ftobybreckon",[82,86],{"name":83,"color":84,"percentage":85},"Python","#3572A5",86.7,{"name":87,"color":88,"percentage":89},"Shell","#89e051",13.3,571,173,"2026-04-15T13:35:28","MIT",4,"Linux, macOS","可选（支持 GPU 加速），需安装 tensorflow-gpu==1.15，具体显存和 CUDA 版本未说明（对应 TF 1.15 通常需 CUDA 10.0 和 cuDNN 7.6）","未说明（数据集约 10.5GB，建议预留足够内存）",{"notes":99,"python":100,"dependencies":101},"1. OpenCV 必须包含额外模块（extra modules），特别是 ximgproc 模块用于超像素分割，因此需安装 opencv-contrib-python 而非普通 opencv-python。\n2. 若系统默认安装的是 TensorFlow 2.x，必须创建虚拟环境并强制使用 TensorFlow 1.15，因为 TFLearn 不支持 TF 2.0。\n3. 首次运行需执行脚本下载预训练模型权重。\n4. 若需将模型转换为 .pb 或 .tflite 格式，目前仅推荐 FireNet 或 InceptionV1 系列模型，因 TensorFlow 长期存在的 Batch Normalization 导出问题会导致 V3\u002FV4 模型性能大幅下降。","3.7.x",[102,103,104],"tensorflow==1.15","tflearn==0.3.2","opencv-contrib-python (3.x 或 4.x)",[14,15],[107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126],"machine-learning","computer-vision","object-detection","fire-detector","robot-vision","deep-learning","deep-neural-networks","deep-learning-algorithms","convolutional-neural-networks","convolutional-networks","cnn-for-visual-recognition","cnn-architecture","tensorflow","tensorflow-examples","inceptionv1-onfire","fire-detection","superpixel-segment","network-architecture","firenet","superpixels","2026-03-27T02:49:30.150509","2026-04-17T09:52:33.919717",[130,135,140,145,150,155,159],{"id":131,"question_zh":132,"answer_zh":133,"source_url":134},37303,"模型推理时输入图像的格式要求是什么（颜色通道顺序和数值范围）？","输入图像需要满足以下预处理要求：\n1. 颜色通道顺序：必须是 BGR 格式（而非 RGB）。如果误用 RGB 会导致网络无法正常工作。\n2. 数值范围：输入像素值范围应为 0..255，不需要归一化到 0..1。\n3. 图像尺寸：需调整为 224x224。\n如果在其他框架中使用，请确保在输入网络前进行 BGR 转换并保持 0-255 的整数范围。","https:\u002F\u002Fgithub.com\u002Ftobybreckon\u002Ffire-detection-cnn\u002Fissues\u002F36",{"id":136,"question_zh":137,"answer_zh":138,"source_url":139},37304,"如何解决运行测试脚本时出现的 'No module named tflearn' 错误？","该错误是因为缺少 `tflearn` 依赖包。你需要安装 TensorFlow 的 TFLearn API 接口。\n可以通过以下命令安装（具体版本需匹配你的 TensorFlow 版本）：\npip install tflearn\n或者参考相关教程解决模块导入问题：https:\u002F\u002Fstackoverflow.com\u002Fquestions\u002F40880925\u002Fimporterror-no-module-named-tflearn","https:\u002F\u002Fgithub.com\u002Ftobybreckon\u002Ffire-detection-cnn\u002Fissues\u002F6",{"id":141,"question_zh":142,"answer_zh":143,"source_url":144},37305,"如何将模型转换为 Caffe 格式？转换后性能会有变化吗？","可以使用 MMdnn 项目提供的工具将 .pb 文件转换为 Caffe 模型。\n注意事项：\n1. 原始模型包含 Dropout 和 LRN 层，在转换为 Caffe 用于推理时，通常需要移除或注释掉这些层。\n2. 移除 Dropout 和 LRN 后，推理性能可能会与论文中的结果略有差异。\n3. 如果遇到类似 'NodeDef expected inputs' 的错误，通常是因为 Dropout 层的条件判断节点在转换时不兼容，需要在转换前处理模型结构。","https:\u002F\u002Fgithub.com\u002Ftobybreckon\u002Ffire-detection-cnn\u002Fissues\u002F15",{"id":146,"question_zh":147,"answer_zh":148,"source_url":149},37306,"为什么模型转换为 TFLite 或其他格式后预测结果不一致？","预测结果不一致通常由以下原因导致：\n1. Dropout 层未正确处理：在推理（Inference）阶段，必须确保 Dropout 层被禁用或在导出模型前将其移除\u002F注释掉。训练时的 Dropout 行为会干扰推理输出。\n2. 输入形状错误：确保输入张量形状正确（例如 1x3x224x224），并且数据类型为 float。\n3. 预处理差异：检查不同框架间的图像预处理（如缩放、归一化、通道顺序）是否完全一致。\n建议先使用 OpenCV DNN 模块测试 .pb 文件确认基准结果，再对比转换后的模型。","https:\u002F\u002Fgithub.com\u002Ftobybreckon\u002Ffire-detection-cnn\u002Fissues\u002F31",{"id":151,"question_zh":152,"answer_zh":153,"source_url":154},37307,"如何在 Google Coral USB Accelerator 上使用此模型（TFLite 转换问题）？","将模型转换为 TFLite 格式以供 Coral 使用时，常因 Dropout 层或特定的 TensorFlow 操作报错。\n解决方案：\n1. 确保在导出 .pb 文件前，已在代码中注释掉或移除了 Dropout 层（仅在训练时启用）。\n2. 如果命令行工具 `tflite_convert` 失败，可能需要从源码编译 TensorFlow 以获得完整的算子支持。\n3. 维护者建议在新的 tflite 分支中查找已修复导出问题和训练变量处理的代码。\n4. 输入输出数组名称需指定正确（如 --input_arrays=input --output_arrays=final_result）。","https:\u002F\u002Fgithub.com\u002Ftobybreckon\u002Ffire-detection-cnn\u002Fissues\u002F21",{"id":156,"question_zh":157,"answer_zh":158,"source_url":144},37308,"预训练的 .pb 模型文件是否与论文中的结果一致？","是的，仓库中提供的预训练模型是生成论文结果所使用的模型。\n但是请注意：\n1. 为了在某些框架（如 Caffe 或 OpenCV DNN）中顺利运行，可能需要移除 Dropout 和 LRN 层，这可能导致性能出现细微差异。\n2. 维护者正在计划添加回归测试，以验证模型变更对结果的具体影响。\n3. 如果直接加载 .pb 文件遇到问题，请检查是否需要更新 OpenCV 版本（建议 4.1.0-pre 或更高）以兼容这些模型。",{"id":160,"question_zh":161,"answer_zh":162,"source_url":139},37309,"下载的预训练模型 MD5 校验失败怎么办？","如果遇到 MD5 校验失败（FAILED），说明下载的文件不完整或已损坏。\n解决方法：\n1. 重新下载模型文件，确保网络连接稳定。\n2. 目前项目已更新，支持直接导出为 TensorFlow .pb 格式供 OpenCV DNN 模块使用。请查看仓库主页的 \"Instructions to use pre-trained models with other frameworks\" 章节获取最新脚本。\n3. 确保使用的是支持这些模型的 OpenCV 版本（需从 GitHub 源码编译的 OpenCV 4.1.0-pre 或更新版本，因为标准发行版可能缺少必要的补丁）。",[164],{"id":165,"version":166,"summary_zh":167,"released_at":168},297876,"ICIP-2018","本版本是代码的最终快照，仅包含源自 ICIP 2018 论文 [Dunnings\u002FBreckon, 2018] 的 FireNet 和 InceptionV1-OnFire CNN 模型。\n\n此后，主分支中的后续版本\u002F提交将陆续添加更多模型（来自 ICLMA 2019 论文 [Samarth\u002FBhowmik\u002FDunnings, 2018]）。","2019-12-19T23:33:17"]