Giter Club home page Giter Club logo

tobybreckon / fire-detection-cnn Goto Github PK

View Code? Open in Web Editor NEW
525.0 19.0 168.0 3.52 MB

real-time fire detection in video imagery using a convolutional neural network (deep learning) - from our ICIP 2018 paper (Dunnings / Breckon) + ICMLA 2019 paper (Samarth / Bhowmik / Breckon)

License: MIT License

Python 86.67% Shell 13.33%
machine-learning computer-vision object-detection fire-detector robot-vision deep-learning deep-neural-networks deep-learning-algorithms convolutional-neural-networks convolutional-networks

fire-detection-cnn's People

Contributors

arvind-iyer avatar atharva333 avatar dependabot[bot] avatar ganeshsamarth avatar tobybreckon avatar

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  avatar  avatar  avatar  avatar  avatar

Watchers

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

fire-detection-cnn's Issues

Model and Data script file is not working. Could you please help me with that.

Describe the issue or your query
Insert a clear and concise description of what the issue is.

Computing Environment (please complete the following information):

  • OS: [e.g. Linux Ubuntu 18.... LTS ]

  • Tensorflow Version: [e.g. 1.x]

  • OpenCV Version: [e.g. 3.4.x]

  • alternative machine learning environment / toolkit (if applicable): [e.g. keras, pytorch + version]

Additional context
Add any other context about the problem here.

Environment problems

Describe the issue or your query
Insert a clear and concise description of what the issue is including any steps to reproduce and/or relevant script output.
I can't run the code. When i run the code 'python firenet.py models/test.mp4', the exceptions occur:
Loaded CNN network weights ... Loaded video ... : cannot connect to X server

Computing Environment (please complete the following information):

  • OS: [e.g. Linux Ubuntu 18.... LTS ] Linux Ubuntu 18

  • Tensorflow Version: [e.g. 1.x] 1.15-gpu

  • OpenCV Version: [e.g. 3.4.x] 4.1.2.30

  • alternative machine learning environment / toolkit (if applicable): [e.g. keras, pytorch + version]

Additional context
Add any other context about the problem here.
Wish for your reply~

Saving Weights After Traning

Describe the issue
< We are trying to improve your work -Firenet. We are training your pretrainied model with our own dataset which is containing fire smoke images. However we do not know with what extention should we save the new weights at the end of traning (in models folder there 3 files named differently but do not know which one is weights of Firenet. So rougly we are using pretrained model and want to improve it.. >.

Computing Environment (please complete the following information):

  • OS:Windows 10 (re- organised for windows from linux)

2019-03-19 19_38_12-Window
.

Plotting Training Results

Describe the issue
< I have re-trained the FireNet with my own dataset, at the end of last epoch (training), I want to see accuracy- epoch, loss - epoch, validation loss - epoch graphs. Tried history= model.fit() but could not plot any graph by using it>.

Computing Environment (please complete the following information):

  • OS: [Windows10 ]

I am using Google Colab for training process

prediction differed after converting the model

Hi, professor! After commented out the dropout layer, I got the tensorflow pb file and the opencv dnn test worked well. Then, I converted the .pb file to mxnet models with MMdnn successfully. But the predictions is inconsistent the opencv dnn test. Before prediction, the image the resized to 224*224. I want to know whether data preprocessing is required. Thank you!

Question about use of LRN

Thank you for publishing the fire detection CNN.

Could you pls comment how important is LRN to achieve the accuracy claimed in your paper? (Perhaps you have tried a variant of a network without LRN).
Original AlexNet paper claimed that dropping LRN decreased accuracy by few percentage points - but that was for the ImageNet set with 1000 classes.

Thanks

Could you please tell me how to train my own model with pretrained models ?

Describe the issue or your query
Insert a clear and concise description of what the issue is including any steps to reproduce and/or relevant script output.

Computing Environment (please complete the following information):

  • OS: [e.g. Linux Ubuntu 18.... LTS ]

  • Tensorflow Version: [e.g. 1.x]

  • OpenCV Version: [e.g. 3.4.x]

  • alternative machine learning environment / toolkit (if applicable): [e.g. keras, pytorch + version]

Additional context
Add any other context about the problem here.

Operation error

hello,I met a problem when I using the command : python superpixel-inceptionV1OnFire.py models/test.mp4 . And it reported problems as follow: File "superpixel-inceptionV1OnFire.py", line 92, in slic = cv2.ximgproc.createSuperpixelSLIC(small_frame, region_size=22)
AttributeError: module 'cv2' has no attribute 'ximgproc' . I got no idea about that ,could you please give me a hand?

Please tell us about your usage ...

If you find our fire detection software, CNN models or dataset useful - please post to let us know how you are making use of it. It's great to hear about it.

e.g.

I am using this for my {high school, college, university} project at ... for ...
I am using this for ... in collaboration with ....
I am using at {company, organization, .... } to ...
...
[If you can't post publicly, consider just emailing - [email protected]]

I know it has already been used for this hackathon and by this team with thermal imagery.

How have you made use of this in your work ? let us know

It helps keep up our motivation to maintain and update the repo.

Just reply to this issue/thread.

reason for 2 separate classes, validation dataset

I really liked reading your paper! It communicates everything very clearly and was a joy to read. The findings will be definitely very useful in my own research. I have a few questions I'd like to ask.

Q1: Given that classes 'fire' and 'no fire' are mutually exclusive; what is the rationale for using two separate outputs? Does it have some benefits over having a single output [0-1] and thresholding it appropriately?

Q2: Could you tell me how do you sample the validation set? I found that the usual technique of randomly sampling 10-20% of the training set doesn't really work for me. Such a random subset of the training set contains images very similar to the ones remaining in the training set and isn't a good measure of out-of-sample error.

Q3: (This might also help answer Q2). My understanding is that you don't use the entire dataset of 365,702 images, but only a subset of 23,408 images. Could you elaborate how do you pick the 6.4% of images you use?

how to use pd to generate pbtxt

Describe the bug
< insert a clear and concise description of what the bug is >.

To Reproduce: (please complete the following information):
< insert steps to reproduce the behavior in the Linux/Unix terminal >

user@hostname[~] ....

Error output received
< insert a clear and concise description of what you expected to happen/see >

Computing Environment (please complete the following information):

  • OS: [e.g. Linux Ubuntu 18.... LTS ]

  • Tensorflow Version: [e.g. 1.x]

  • OpenCV Version: [e.g. 3.4.x]

  • alternative machine learning environment / toolkit (if applicable): [e.g. keras, pytorch + version]

Additional context
< insert any other context about the problem here >.

< if possible provide links to an test images - hosted on pichost/dropbox/google drive or similar open/shared hosting>

Value Error when loading .pb

I am trying to load firenet.pb into a graph using the following code:

with tf.gfile.GFile("./converter/firenet.pb", "rb") as f:
    graph_def = tf.GraphDef()
    graph_def.ParseFromString(f.read())
    graph = tf.import_graph_def(graph_def,name="",input_map=None)

It raises the following ValueError:

ValueError: NodeDef expected inputs '' do not match 1 inputs specified; Op<name=Const; signature= -> output:dtype; attr=value:tensor; attr=dtype:type>; NodeDef: {{node Dropout_1/cond/dropout/random_uniform/max_1}}

I realize that I need to set the input_map to {'Const': tensor}
Could someone help to determine the tensor object ?

Fire Annotation

If I want to annotate the fire position and get the coordinates from the video using FireNet or InceptionV1-OnFire, what should I do?
Thanks !

train from scratch?

hi,

Thanks a lot for the examples. Did you try to train using imagenet data first and then finetune on the fire data?

Model/Dataset Download Issues ..

If you are having any issues with the download of the network models or datasets, first manually check the availability (and/or speed) of access to https://collections.durham.ac.uk where both are hosted before posting an issue - occasionally due to network maintenance or similar the server may be temporarily unavailable; if so try again in +12-24 hours.

Speeds tested as 5Mb/s (UK), 400Kb/s (US), 10Mb/s (locally, Durham University).

Provided download scripts tested and supported on Linux (only). Direct download URL are provided in README.

Known issue (late Sept. 2019, now fixed): the file on the server may be moved to a cache due to popularity of the download. The server issues an http redirect but the scripts (prior to recent update) did not follow these http directive. Now fixed with the addition of -L to the curl command in the download script. Solution: git pull to get latest version of the repo, then retry download script command - see README. If using the direct URL specified, make sure your download tool also follows http redirect directives (most browsers do this automatically).

downloading models get "md5sum: WARNING: 1 computed checksum did NOT match"

Describe the bug

when l run download-models.sh

Downloading pretrained models...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 165 0 165 0 0 11 0 --:--:-- 0:00:14 --:--:-- 39
checking the MD5 checksum for downloaded models...
dunnings-2018-fire-detection-pretrained-models.zip: fail
md5sum: WARNING: 1 computed checksum did NOT match

I get an error when i convert to mxnet using tools offered by the MMdnn project

Hellow, I have got firenet.pb file . When I convert to mxnet model using tools offered by the MMdnn project ,the flowing happens:
raise IOError("Graph doesn't have node [%s]." % name.split(':')[0])
OSError: Graph doesn't have node [data].
the flowing is the environment:
Platform: win10
Python version: 3.6.9
Source framework with version: like Tensorflow 1.14.0 with CPU
Destination framework with version: mxnet 1.5.0 with GPU

I also tried to convert the .pb file to onnx model using MMdnn, the onnx file produced. But Model verification failed:
onnx.onnx_cpp2py_export.checker.ValidationError: Node () has input size 0 not in range [min=2, max=2].

the flowing are the checking codes :
from onnx import checker
import onnx
model_proto = onnx.load_model('firenet.onnx')
checker.check_graph(model_proto.graph)

I do not know how to solve the problem.
Could you please give me some suggestions, thank you!

Previously Asked Questions (PAQ)

A set of collated previously (frequently) asked questions - for things not covered in the existing README or in the full accompanying (peer-reviewed) research papers [Dunnings and Breckon, In Proc. International Conference on Image Processing, IEEE, 2018] and [Samarth, Bhowmik and Breckon, In Proc. International Conference on Machine Learning Applications, IEEE, 2019].

Before posting an issue please check here first (in addition to the README and papers) ...

Q: How many epochs did you train the models for?
A: 150 (2018 for paper models), 30 (for 2019 paper models)

Q: Did you train the network architectures you use from scratch or use transfer learning from another dataset ?
A: Trained from scratch - because the bespoke simplified architectures we defined meant we couldn't simply copy across weights from the larger (original) architecture trained on say ImageNet. Similarly, pre-training these bespoke, simple architectures on a complex task such as ImageNet 1000 class object classification made no sense - they would perform very poorly indeed as they are much simpler, cut-down versions of the original.

Q: How were the labels encoded during training ?
A: The one-hot encoding was made alphabetically with 'fire' being the first class (0) and 'nofire' the second (1) such that:

  • fire= (1,0)
  • nofire = (0,1)

Q: Did you normalize your input pixels to the range 0 -> 1 ( /= 255)?
A: No we didn't - I checked all the original code and it appears this was not done in any of train/validation/test, but I accept it would have been a good idea.
To confirm - all our results are on the basis of inputs in the range 0->255 across all three colour channels. This is a clear oversight it appears. If you do normalize the dataset images for future work it may be better to try (p_normalised = (p
-127.5)/255) for given pixel p, to give you a -/+ normalized input as is common in the default training for this type/generation of network.

Q: When I train a model using {VGG.., ResNet.., DenseNet, ..., some other new very deep/complex net architecture} I don't get the same performance you report. Why is this ?
A: The whole premise of our papers is that simpler network architectures appear to outperform more complex ones for the fire detection task - hence our networks are experimentally defined sub-architectures of larger ones. You are seeing the exact point we make in the papers in action.

Q: Is there code available for network training?
A: No. In order to make the repository easier to maintain only inference code, trained models and the dataset is made available. The models we use are quite basic architectures that can be readily dropped into any mainstream tutorial on how to train a deep convolutional neural network for image classification.

Q: Can I use this with <insert some other tool/framework>?
A: Yes, you are free to do so but tools beyond the listed dependencies of the project (see README) are beyond the scope of what we can immediately provide any help/support on. Details in the README show how to convert the trained models for use with other deep learning frameworks.

Q: Does this network perform smoke detection (after all "there is no smoke without fire")?
A: No. As the name suggests it does fire detection. For smoke detection see this work this repository for example (many others exist).

Q: When I tried your network it doesn't get the fire detection correct all of the time ?
A: see the paper, statistical accuracy is ~93%+, not 100% (as fire detection is more difficult than one may imagine, especially for reducing false positives).

Q: When I use this network on completely different resolution imagery than what it was trained on (in the dataset), I get very different results?
A: The basic principles of machine learning tell us that any machine learning model will perform differently on data that is drawn from a different distribution than the model was trained on. You are seeing this principle in action.

Q: I have this problem .. < insert details > .. with getting this to work under Microsoft Windows. Can your help?
A: Sorry - support is provided for Linux and Unix based operating systems only. Perhaps try using the Linux subsystem for MS Windows or installing Linux.

Q: Did you experiment with and without the use of LRN and/or dropout?
A: Yes, we found the effect of both was negligible in the overall statistical performance of the network. Following best practice to avoid overfitting for network architectures of this type, both are used in the final trained models.

Q: I get an error with one of the import lines in Python or at the line using ximgproc in the superpixel example script. Can you help ?
A: Make sure all of the required dependencies are installed correctly and working including OpenCV with the additional modules built/enabled. You may find a subset of the tools in this test repo useful and also this OpenCV test script.

Q: I am quite new to deep learning and don't really understand part of your architecture. Can you help ?
A: The architectures we use are based on some of the most established, written about and discussed architectures in the field - in fact they are simplified versions of them. Please read the research papers, then read the references from the papers on the key architectures we reference - if you need background please refer to http://www.deeplearningbook.org/.

Q: Did you prepare the validation and test sets in the same way as you described for the training set?
A: Yes - see [Dunnings/Breckon 2018] paper p.4, column 1, para 2, "CNN training and evaluation ...."

Q: Are the accuracy/F/P scores averaged over all predicted fire superpixels or over all images for which superpixels had been classified?

A: No - as this is a binary problem (fire = {1,0}) they are calculated over all the superpixels for which we have ground truth (i.e. labelled as fire/no-fire in the available dataset).
This is done at a per-superpixel in Table 3 (lower) and per-image* in Table 3 (upper) of the [Dunnings/Breckon, 2018] paper for the dataset as set out in the dataset download provided (README.txt in the dataset download steers you to the exact training/test data).

*i.e. if image contains a fire superpixel then image contains a fire (processing on N superpixels, not whole image)

Q: How did you convert the ground truth annotation for images (was it based on bounding boxes?) to ground truth for individual superpixels for training?
A: We don't have ground truth annotation for whole/full images in terms of where the fire is in our own dataset (bounding box or binary mask) - all the image are only globally labelled as containing fire = {true, false}

We then split a subset of these into individual superpixels - all of them (!) - and manually sorted them as {superpixel of fire} and {superpixel not of fire}. As per the dataset (see available download) - each superpixel is stored "in place" in the full image frame (rest of image black, superpixel has original colour). This is used for training.

Q: How did you merge and convert positive superpixels for each image into a bounding rectangle for computing the similarity metric shown in the paper [Dunnings/Breckon, 2018]?
A: We create a binary image (+ve fire superpixels as +1, -ve fire superpixels as 0 - or similar) - we then compute concave contour of this region using the the douglas-peucker algorithm (OpenCV - findContours() - https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm) and then find the min (x,y) and max (x,y) values from this contour. From these 4 min/max x and y values (2 for x, 2 for y) we can compute the bounding rectangle which we then use for the similarity metric (S in our [Dunnings/Breckon, 2018] paper, computed as per ref [23]).

To then generate this similarity metric against images with bounding box ground truth - we used the ground truth annotation available from Steffens et al. [23], not our own dataset (in our [Dunnings/Breckon, 2018] paper S only appears in Table 3 lower against the Steffens et al. dataset).

Q: How do I use this repository code to train my own models ?
A: This repository provides inference / run-time code only, not training code (see earlier). If you wish to train your own model - follow a tutorial in the documentation for your deep machine learning environment of choice (e.g. Tensorflow/Pytorch/TfLearn/Keras/MXNet..) on how to (a) define your own custom model architecture and (b) train a model from using a custom dataset. Subsequently, use this knowledge to define a model architecture matching those described in our code/papers/diagrams and also to train from our fire dataset that you have downloaded (see README.txt file within the dataset download for details on which images to train on).

Q: When I convert / load the model into another deep learning framework the performance seems to differ ? (or it always returns "no fire" or always "fire")
A: Make sure that:

  • your use of one-hot labelling it the same as the one we used for {fire, not fire} (see Q/A above) and not reversed
  • the input pixels are in the original 0->255 range and not rescaled to -1->1 or 0->1 otherwise the network will fail (for frameworks/tools that subtract a mean channel value and rescale using a standard deviation, specify a zero mean and standard deviation of 1 for the input to retain the original 0->255 pixel range)
  • the channel ordering for your image is BGR (as is standard for OpenCV) and not RGB (as is often standard in other frameworks and image loaders) if you are using the FireNet, InceptionV1onFire or InceptionV3OnFire / InceptionV4OnFire binary models. For the superpixel InceptionV3OnFire / InceptionV4OnFire models use RGB channel ordering.

Q: How do I get this to work with TensorFlow 2.0?

A: The only available workflow to make this repo work on your system is via a Tensorflow 1.x virtual environment as TFLearn is not supported via TensorFlow 2.x. Install the required packages for a virtual environment as follows ...

virtualenv --system-site-packages -p python3 ./venv/tf-1.1.5-gpu
source ~/venv/tf-1.1.5-gpu/bin/activate
pip install tensorflow-gpu==1.15
pip install tflearn
....
python3 firenet.py models/test.mp4

This assumes you have opencv installed system wide with the extra modules enabled as required.

Q: In the 2019 paper that you use a 80:20 split for your dataset into training and validation and then have an additional set for cross validation - "An additional set of 2,931 images was used for cross validation." Is this correct, as you appear to have two validation datasets ?
A: Sorry this appears to be an error in the paper and should say "... dataset is split (80:20 split) into two portions for training and validation. An additional set of 2,931 images was used for statistical evaluation (i.e. testing)." It is slightly better stated in the 2018 paper, where the numbers match but we use a 70:30 split instead.

Q: I converted the ...V3/V4-OnFire models to protocolbuf (pb) and tflite using your scripts but the performance seems really bad - what I am doing wrong ? / why is this so ?

A: As per the caveat in the main README - if you need to convert the models to protocol buffer (.pb) format (used by OpenCV DNN, TensorFlow, ...) and also tflite (used with TensorFlow) then use the FireNet or InceptionV1-OnFire / SP-InceptionV1-OnFire versions at the moment as, due to a long-standing issue 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).

An alternative is to perhaps convert from the original format (tensorflow checkpoint) to others (such as PyTorch, MXNet, Keras, ...) using the extensive deep neural network model conversion tools offered by the MMdnn project.

Q: ... ?
A: ...

About training paramters

Describe the issue or your query
Insert a clear and concise description of what the issue is including any steps to reproduce and/or relevant script output.

Computing Environment (please complete the following information):

  • OS: Windows 7 Enterprise

  • Tensorflow Version: Tensorflow-gpu 1.12

  • OpenCV Version: 4.2.0

  • alternative machine learning environment / toolkit (if applicable): [e.g. keras, pytorch + version]

Additional context
I'm trying to reproduce your result of fireNet in your paper but the highest accuracy I got from your testing set is only 91%. I have some questions:

  • Did you use the same optimizer in fireNet.py file to produce that result? (93% as described).
  • Did you use other image processing or augmentation parameters? If the answer is yes, can you provide it?
  • Is it effective if I use this model to classify whether a small flame in a picture, such as a active gas stove in a kitchen? (of course the same data will appear in the training set)
    Thank in advance.

Please add some validation images to the project

Since there are some variables like 0..255 input value range (vs 0..1), potential image resizing issues, and the presence of some training logic in the resulting model, it would be useful to have some images with precisely known expected outcomes.

So if you could add several images of sizes 224x224 with corresponding outcomes [File,NoFire] this would be very useful to people who are trying to run the net to validate their ways of running it.

Thank you,
Yuri

predict problem

Can I put the picture in the code for monitoring the video?
I am not sure if generating a pb file is helpful for image monitoring.

The download training set is inconsistent to paper description

Hi, I have downloaded the training set from the link you provide. The training set includes 6642 fire images and 8456 nofire images. However, they are smaller than the training set for full-frame binary fire detection problem described in your publication. Could you tell me where I can download other images? Thanks a lot.

TFLite model conversion

Describe the bug
After converting the model to .pb file using firenet-to-protobuf I am trying to convert it to TFlite model for inferencing on Google Coral USB accelerator, however while using tflite_convert command line to do so I am encountering the error as mentioned below in the output section and there is no resolution as of yet, is it the dropout layer which is the issue?

To Reproduce: (please complete the following information):

  1. Convert model to pb file using firenet-to-protobuf.py file.
  2. Run tensorflow lite conversion command as 'tflit_convert --graph_def_file='path_to_filr/firenet.pb --output_format=TFLITE --output_file=firenet_v1__new.tflite --input_arrays=input --output_arrays=final_result''

Error output received

pi@raspberrypi:~ $ tflite_convert --graph_def_file=/home/pi/Downloads/FireDetection/code/firenet.pb --output_format=TFLITE --output_file=firenet_v1__new.tflite  --input_arrays=input --output_arrays=final_result
WARNING: Logging before flag parsing goes to stderr.
W0729 04:04:35.524526 3069684432 deprecation_wrapper.py:118] From /usr/local/lib/python3.7/dist-packages/tensorflow/__init__.py:98: The name tf.AUTO_REUSE is deprecated. Please use tf.compat.v1.AUTO_REUSE instead.

W0729 04:04:35.525118 3069684432 deprecation_wrapper.py:118] From /usr/local/lib/python3.7/dist-packages/tensorflow/__init__.py:98: The name tf.AttrValue is deprecated. Please use tf.compat.v1.AttrValue instead.

W0729 04:04:35.525362 3069684432 deprecation_wrapper.py:118] From /usr/local/lib/python3.7/dist-packages/tensorflow/__init__.py:98: The name tf.COMPILER_VERSION is deprecated. Please use tf.version.COMPILER_VERSION instead.

W0729 04:04:35.525576 3069684432 deprecation_wrapper.py:118] From /usr/local/lib/python3.7/dist-packages/tensorflow/__init__.py:98: The name tf.CXX11_ABI_FLAG is deprecated. Please use tf.sysconfig.CXX11_ABI_FLAG instead.

W0729 04:04:35.525793 3069684432 deprecation_wrapper.py:118] From /usr/local/lib/python3.7/dist-packages/tensorflow/__init__.py:98: The name tf.ConditionalAccumulator is deprecated. Please use tf.compat.v1.ConditionalAccumulator instead.

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/tensorflow_core/python/framework/importer.py", line 428, in import_graph_def
    graph._c_graph, serialized, options)  # pylint: disable=protected-access
tensorflow.python.framework.errors_impl.InvalidArgumentError: NodeDef expected inputs '' do not match 1 inputs specified; Op<name=Const; signature= -> output:dtype; attr=value:tensor; attr=dtype:type>; NodeDef: {{node Dropout_1/cond/dropout/random_uniform/max}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/tflite_convert", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/dist-packages/tensorflow_core/lite/python/tflite_convert.py", line 503, in main
    app.run(main=run_main, argv=sys.argv[:1])
  File "/usr/local/lib/python3.7/dist-packages/tensorflow_core/python/platform/app.py", line 40, in run
    _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
  File "/usr/local/lib/python3.7/dist-packages/absl/app.py", line 300, in run
    _run_main(main, args)
  File "/usr/local/lib/python3.7/dist-packages/absl/app.py", line 251, in _run_main
    sys.exit(main(argv))
  File "/usr/local/lib/python3.7/dist-packages/tensorflow_core/lite/python/tflite_convert.py", line 499, in run_main
    _convert_tf1_model(tflite_flags)
  File "/usr/local/lib/python3.7/dist-packages/tensorflow_core/lite/python/tflite_convert.py", line 124, in _convert_tf1_model
    converter = _get_toco_converter(flags)
  File "/usr/local/lib/python3.7/dist-packages/tensorflow_core/lite/python/tflite_convert.py", line 111, in _get_toco_converter
    return converter_fn(**converter_kwargs)
  File "/usr/local/lib/python3.7/dist-packages/tensorflow_core/lite/python/lite.py", line 633, in from_frozen_graph
    _import_graph_def(graph_def, name="")
  File "/usr/local/lib/python3.7/dist-packages/tensorflow_core/python/util/deprecation.py", line 507, in new_func
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/tensorflow_core/python/framework/importer.py", line 432, in import_graph_def
    raise ValueError(str(e))
ValueError: NodeDef expected inputs '' do not match 1 inputs specified; Op<name=Const; signature= -> output:dtype; attr=value:tensor; attr=dtype:type>; NodeDef: {{node Dropout_1/cond/dropout/random_uniform/max}}

Computing Environment (please complete the following information):

  • OS: Raspbian Buster
  • Tensorflow Version: 1.13.1
  • OpenCV Version: 3.2.0

Additional context

Network Architecture

@tobybreckon Hi! Is it possible to seek some clarification on your deep learning network architecture! Thank you so much. Looking forward to hear from you!

Conversion commands listed in README fail: Symbol name "tensorflow.TensorShapeProto" conflicts with the existing symbol "tensorflow.TensorShapeProto"

$ python3.6 firenet-to-protobuf.py 
[libprotobuf ERROR google/protobuf/descriptor_database.cc:173] Symbol name "tensorflow.TensorShapeProto" conflicts with the existing symbol "tensorflow.TensorShapeProto".
[libprotobuf FATAL google/protobuf/descriptor.cc:1379] CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size): 
Abort trap

protobuf-3.9.2,1

Cannot download the datasets or the pretrained models

Describe the issue or your query
Insert a clear and concise description of what the issue is including any steps to reproduce and/or relevant script output.

Computing Environment (please complete the following information):

  • OS: [e.g. Linux Ubuntu 18.... LTS ]

  • Tensorflow Version: [e.g. 1.x]

  • OpenCV Version: [e.g. 3.4.x]

  • alternative machine learning environment / toolkit (if applicable): [e.g. keras, pytorch + version]

Additional context
Add any other context about the problem here.

RuntimeError: dictionary changed size during iteration

Describe the issue or your query
Trying to run python3 firenet.py models/test.mp4 gives me a RuntimeError: dictionary changed size during iteration error.

Computing Environment (please complete the following information):

  • OS: macOS 10.15.5
  • Tensorflow Version: 1.15
  • OpenCV Version: 4.4.0.46

Additional context
I've installed tensorflow==1.15 instead of tensorflow-gpu==1.15 since I'm running on macOS. Not sure if that has been tested before. Thank you!

Tensor flow 2.0 compatibility issue

I'm running tensorflow 2.0 and it throws this error ModuleNotFoundError: No module named 'tensorflow.contrib' when i run the firnet.py. Now I understand that tf.contrib does not exist on tensorflow 2.0. I don't' want to have to downgrade, what can i do?

Computing Environment (please complete the following information):

  • OS: [Ubuntu 19.10]
  • Tensorflow Version: [2.0]
  • OpenCV Version: [4.0.0]

Predictive effect problem

Hello, sir, since your training picture is 224224 pixels, but I tested 100100 and 1000*1000, I found that the effect is not good.
Why is this?
And I have adjusted the size using the cv2.resize() function before the prediction.
I also want to know how big the size of the pictures you train.
Thank you professor!

changing tensor's shape/Keras implementation

Hi
I am going to implement the model on Keras. In concatenate layer, it doesn't let me to concatenate tensors because of different dimensions. Will flattening them affect the network's performance?

  • OS: Linux

  • Tensorflow Version: 1.14.0

  • OpenCV Version: 4.1.1.26

  • Keras version: 2.2.4

Firenet not able to open

Hi!

I am trying to open firenet,

model = construct_firenet (224, 224)
model.load("C:/FireNet",weights_only=True)

but i keep getting this error:

INFO:tensorflow:Restoring parameters from C:/FireNet


DataLossError Traceback (most recent call last)
~\Anaconda3\envs\tensorflow_env\lib\site-packages\tensorflow\python\client\session.py in _do_call(self, fn, *args)
1333 try:
-> 1334 return fn(*args)
1335 except errors.OpError as e:

~\Anaconda3\envs\tensorflow_env\lib\site-packages\tensorflow\python\client\session.py in _run_fn(feed_dict, fetch_list, target_list, options, run_metadata)
1318 return self._call_tf_sessionrun(
-> 1319 options, feed_dict, fetch_list, target_list, run_metadata)
1320

~\Anaconda3\envs\tensorflow_env\lib\site-packages\tensorflow\python\client\session.py in _call_tf_sessionrun(self, options, feed_dict, fetch_list, target_list, run_metadata)
1406 self._session, options, feed_dict, fetch_list, target_list,
-> 1407 run_metadata)
1408

DataLossError: Unable to open table file C:\FireNet: Unknown: NewRandomAccessFile failed to Create/Open: C:\FireNet : Access is denied.
; Input/output error
[[{{node save_34/RestoreV2}} = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/ta`

Labeling the fire in real-time

Thank you so much for the great contribution. I'm working on a smart fire fighting sprinkler that would direct water exactly to the burning area after the detection of fire and I'm using raspberry pi for the processing of the frames. I was wondering if this project can be further edited to have a a bounding box or a contour surrounding the exact location of fire in the frames detected in real-time, not exactly as the output of the "superpixel-inceptionV1OnFire.py". Any suggestions or pieces of advice is appreciated.

models/FireNet file not found

Traceback (most recent call last):
File "firenet.py", line 82, in
model.load(os.path.join("models/FireNet", "firenet"),weights_only=True)
File "/home/proud/.local/lib/python3.8/site-packages/tflearn/models/dnn.py", line 302, in load
self.trainer.restore(model_file, weights_only, **optargs)
File "/home/proud/.local/lib/python3.8/site-packages/tflearn/helpers/trainer.py", line 502, in restore
self.restorer_trainvars.restore(self.session, model_file)
File "/home/proud/.local/lib/python3.8/site-packages/tensorflow/python/training/saver.py", line 1289, in restore
if not checkpoint_management.checkpoint_exists_internal(checkpoint_prefix):
File "/home/proud/.local/lib/python3.8/site-packages/tensorflow/python/training/checkpoint_management.py", line 383, in checkpoint_exists_internal
if file_io.get_matching_files(pathname):
File "/home/proud/.local/lib/python3.8/site-packages/tensorflow/python/lib/io/file_io.py", line 350, in get_matching_files
return get_matching_files_v2(filename)
File "/home/proud/.local/lib/python3.8/site-packages/tensorflow/python/lib/io/file_io.py", line 408, in get_matching_files_v2
for matching_filename in _pywrap_file_io.GetMatchingFiles(
tensorflow.python.framework.errors_impl.NotFoundError: /home/proud/Desktop/fire-detection-cnn-master/models/FireNet; No such file or directory

pre-trained model not in .pb format ...

Error Output:

Downloading pretrained models...
################################################################################################################ 100.0%
checking the MD5 checksum for downloaded models...
dunnings-2018-fire-detection-pretrained-models.zip: FAILED
md5sum: WARNING: 1 computed checksum did NOT match

How to detect a fire on the image ?

Hi everyone
I see file superpixel-inceptionV10Fire.py and I knew it which detect fire. But I would like to expand the issue because All calculator executes on the image which using CPU and I very confuse when I knew it

I have a question? How do I detect fire on the image (a type of Bounding box ???)

Thank for reading
Thai Hoc

Can' find Dunnings annotations

I downloaded the Dunnings dataset, but all I see is images, don't see the labels.
Anyone knows where I can find those?

Error while executing firenet.py- TensorFlow 2.0

while issuing command python3 firenet.py models/test.mp4 got the following error.
All necessary packages are installed.

import tflearn
File "/usr/local/lib/python3.6/dist-packages/tflearn/init.py", line 4, in
from . import config
File "/usr/local/lib/python3.6/dist-packages/tflearn/config.py", line 5, in
from .variables import variable
File "/usr/local/lib/python3.6/dist-packages/tflearn/variables.py", line 7, in
from tensorflow.contrib.framework.python.ops import add_arg_scope as contrib_add_arg_scope
File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/init.py", line 27, in
from tensorflow.contrib import cudnn_rnn
File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/cudnn_rnn/init.py", line 28, in
from tensorflow.contrib.cudnn_rnn.python.ops.cudnn_rnn_ops import CudnnGRU
File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/cudnn_rnn/python/ops/cudnn_rnn_ops.py", line 21, in
from tensorflow.contrib.cudnn_rnn.ops import gen_cudnn_rnn_ops
File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/cudnn_rnn/ops/gen_cudnn_rnn_ops.py", line 940, in
_op_def_lib = _InitOpDefLibrary()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/cudnn_rnn/ops/gen_cudnn_rnn_ops.py", line 365, in _InitOpDefLibrary
_op_def_registry.register_op_list(op_list)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/op_def_registry.py", line 35, in register_op_list
assert _registered_ops[op_def.name] == op_def
AssertionError

Computing Environment (please complete the following information):

  • Linux Ubuntu 17.10
  • Tensorflow Version: 2.0
  • OpenCV Version: 3.3.1

Operation error

hello,I met a problem when I using the command : python superpixel-inceptionV1OnFire.py models/test.mp4 . And it reported problems as follow: File "superpixel-inceptionV1OnFire.py", line 92, in slic = cv2.ximgproc.createSuperpixelSLIC(small_frame, region_size=22)
AttributeError: module 'cv2' has no attribute 'ximgproc' . I got no idea about that ,could you please give me a hand?

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.