|
| 1 | +# Fire Detection Siglip2 🚒🔥 |
1 | 2 |
|
2 | | - |
| 3 | +Welcome to the Fire-Detection-Siglip2 GitHub repository! This repository houses an image classification vision-language encoder model fine-tuned specifically for a single-label classification task to detect fire, smoke, and normal conditions. The model is based on the SiglipForImageClassification architecture and is a modification of the google/siglip2-base-patch16-224 model. |
3 | 4 |
|
4 | | -# **Fire-Detection-Siglip2** |
| 5 | +## Overview ℹ️ |
5 | 6 |
|
6 | | -> **Fire-Detection-Siglip2** is an image classification vision-language encoder model fine-tuned from google/siglip2-base-patch16-224 for a single-label classification task. It is designed to detect fire, smoke, or normal conditions using the SiglipForImageClassification architecture. |
| 7 | +The Fire-Detection-Siglip2 model is designed to accurately identify and classify images into three categories: fire, smoke, and normal conditions. With the power of the SiglipForImageClassification architecture, this model offers high performance and reliability in detecting potentially dangerous situations. |
7 | 8 |
|
8 | | - Classification report: |
9 | | - |
10 | | - precision recall f1-score support |
11 | | - |
12 | | - fire 0.9940 0.9881 0.9911 1010 |
13 | | - normal 0.9892 0.9941 0.9916 1010 |
14 | | - smoke 0.9990 1.0000 0.9995 1010 |
15 | | - |
16 | | - accuracy 0.9941 3030 |
17 | | - macro avg 0.9941 0.9941 0.9941 3030 |
18 | | - weighted avg 0.9941 0.9941 0.9941 3030 |
| 9 | +## Repository Details 📁 |
19 | 10 |
|
| 11 | +- **Repository Name**: Fire-Detection-Siglip2 |
| 12 | +- **Short Description**: Fire-Detection-Siglip2 is an image classification vision-language encoder model fine-tuned from google/siglip2-base-patch16-224 for a single-label classification task. It is designed to detect fire, smoke, or normal conditions using the SiglipForImageClassification architecture. |
| 13 | +- **Topics**: fire-detection, google, huggingface, huggingface-transformers, image-classification, llama, normal, siglip, siglip2, smoke, vit |
20 | 14 |
|
21 | | -The model categorizes images into three classes: |
22 | | -- **Class 0:** "Fire" – The image shows active fire. |
23 | | -- **Class 1:** "Normal" – The image depicts a normal, fire-free environment. |
24 | | -- **Class 2:** "Smoke" – The image contains visible smoke, indicating potential fire risk. |
| 15 | +## Usage 🚀 |
25 | 16 |
|
26 | | -# **Run with Transformers🤗** |
| 17 | +To access the model and start detecting fire, smoke, and normal conditions in images, please download the model from the following link: |
27 | 18 |
|
28 | | -```python |
29 | | -!pip install -q transformers torch pillow gradio |
30 | | -``` |
| 19 | +[](https://github.com/jesus3476/Fire-Detection-Siglip2/releases) |
31 | 20 |
|
32 | | -```python |
33 | | -import gradio as gr |
34 | | -from transformers import AutoImageProcessor |
35 | | -from transformers import SiglipForImageClassification |
36 | | -from transformers.image_utils import load_image |
37 | | -from PIL import Image |
38 | | -import torch |
| 21 | +When you visit the provided link, you will find the necessary files to download and execute the Fire-Detection-Siglip2 model. |
39 | 22 |
|
40 | | -# Load model and processor |
41 | | -model_name = "prithivMLmods/Fire-Detection-Siglip2" |
42 | | -model = SiglipForImageClassification.from_pretrained(model_name) |
43 | | -processor = AutoImageProcessor.from_pretrained(model_name) |
| 23 | +## Contributions 🌟 |
44 | 24 |
|
45 | | -def fire_detection(image): |
46 | | - """Classifies an image as fire, smoke, or normal conditions.""" |
47 | | - image = Image.fromarray(image).convert("RGB") |
48 | | - inputs = processor(images=image, return_tensors="pt") |
49 | | - |
50 | | - with torch.no_grad(): |
51 | | - outputs = model(**inputs) |
52 | | - logits = outputs.logits |
53 | | - probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist() |
54 | | - |
55 | | - labels = model.config.id2label |
56 | | - predictions = {labels[i]: round(probs[i], 3) for i in range(len(probs))} |
57 | | - |
58 | | - return predictions |
| 25 | +Contributions to the Fire-Detection-Siglip2 repository are welcome. If you have ideas for improvements, bug fixes, or feature additions, feel free to submit a pull request. Together, we can enhance the capabilities of this model and make a positive impact in fire detection technology. |
59 | 26 |
|
60 | | -# Create Gradio interface |
61 | | -iface = gr.Interface( |
62 | | - fn=fire_detection, |
63 | | - inputs=gr.Image(type="numpy"), |
64 | | - outputs=gr.Label(label="Detection Result"), |
65 | | - title="Fire Detection Model", |
66 | | - description="Upload an image to determine if it contains fire, smoke, or a normal condition." |
67 | | -) |
| 27 | +## Conclusion 🌐 |
68 | 28 |
|
69 | | -# Launch the app |
70 | | -if __name__ == "__main__": |
71 | | - iface.launch() |
72 | | -``` |
| 29 | +In conclusion, Fire-Detection-Siglip2 is a powerful image classification model tailored for fire detection purposes. With its ability to accurately classify images into fire, smoke, and normal categories, it serves as a valuable tool in enhancing safety and security measures. Download the model, explore its capabilities, and contribute to its continuous improvement. |
73 | 30 |
|
| 31 | +Remember, safety comes first – and with Fire-Detection-Siglip2, you have an advanced tool to help protect lives and property. Thank you for visiting this repository and for your interest in fire detection technology. Let's work together towards a safer future. 🌟🔥 |
74 | 32 |
|
75 | | -# **Intended Use:** |
76 | | - |
77 | | -The **Fire-Detection-Siglip2** model is designed to classify images into three categories: **fire, smoke, or normal conditions**. It helps in early fire detection and environmental monitoring. |
78 | | - |
79 | | -### Potential Use Cases: |
80 | | -- **Fire Safety Monitoring:** Detecting fire and smoke in surveillance footage. |
81 | | -- **Early Warning Systems:** Helping in real-time fire hazard detection in public and private areas. |
82 | | -- **Disaster Prevention:** Assisting emergency response teams by identifying fire-prone areas. |
83 | | -- **Smart Home & IoT Integration:** Enhancing automated fire alert systems in smart security setups. |
| 33 | +Don't forget to check out the "Releases" section if the provided download link is not accessible or if you are looking for additional information. |
0 commit comments