Spaces:
Sleeping
Sleeping
File size: 5,516 Bytes
c94e8f4 234f597 c94e8f4 234f597 c94e8f4 234f597 c640bc9 066c36c c640bc9 066c36c c640bc9 066c36c c640bc9 066c36c c640bc9 066c36c c640bc9 066c36c c640bc9 066c36c c640bc9 066c36c c640bc9 066c36c c640bc9 066c36c c640bc9 066c36c c640bc9 066c36c c640bc9 066c36c c640bc9 066c36c c640bc9 066c36c c640bc9 066c36c c640bc9 066c36c c640bc9 066c36c c640bc9 066c36c c640bc9 066c36c c640bc9 066c36c c640bc9 066c36c c640bc9 066c36c c640bc9 066c36c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
---
license: apache-2.0
title: Weapon Detection
sdk: streamlit
emoji: π’
colorFrom: green
colorTo: green
---
# weapon-detection-alert-location-share
This project focuses on enhancing the security of different places, like public areas and banks, by implementing a
robust gun detection and alert system. The system is designed to capture images from an IP camera strategically placed.
within the bank's premises. When a captured image contains an identifiable gun, the system takes
appropriate actions, such as playing alerts or sharing the location of the detected weapons, including knife and guns.
1. **Image Capture:**
Utilizes an IP camera to continuously capture images in real-time within the camera range. Images are processed and
analyzed for potential gun presence.
2. **Gun Detection:**
Employs advanced computer vision algorithms for accurate gun detection in captured images.
The system recognizes various types of firearms and distinguishes them from other objects.
3. Alert Systems:
When a gun is detected, the system triggers immediate alerts.
Alerts can be configured to notify security personnel, law enforcement, and relevant authorities.
# π Technologies
- **Python**
- **FastAPI**
- **Streamlit**
- **YOLO**
- **OpenCV**
- **Docker**
# File Structure
File structure of the project
```angular2html
.
βββ config
βΒ Β βββ config.ini
βββ images
βΒ Β βββ cam_images
βΒ Β βββ th-3711382641.jpg
βββ logs
βΒ Β βββ gun_det.log
βΒ Β βββ ipcam.log
βββ resources
βΒ Β βββ alert
βΒ Β βΒ Β βββ alert.mp3
βΒ Β βββ flag_load_image
βΒ Β βββ image_capturing
βΒ Β βββ models
βΒ Β βββ best.pt
βΒ Β βββ v1
βΒ Β βΒ Β βββ best.pt
βββ src
βΒ Β βββ api
βΒ Β βΒ Β βββ fast_api.py
βΒ Β βΒ Β βββ __init__.py
βΒ Β βββ __init__.py
βΒ Β βββ services
βΒ Β βΒ Β βββ alert_service
βΒ Β βΒ Β βΒ Β βββ alert_service.py
βΒ Β βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βΒ Β βββ __pycache__
βΒ Β βΒ Β βββ entity
βΒ Β βΒ Β βΒ Β βββ entity_config.py
βΒ Β βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βββ image_capture_service
βΒ Β βΒ Β βΒ Β βββ capture_main.py
βΒ Β βΒ Β βΒ Β βββ image_load_main.py
βΒ Β βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βββ weapon_det_service
βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βββ weapon_detection_service.py
βΒ Β βββ utils
βΒ Β βββ __init__.py
βΒ Β βββ __pycache__
βΒ Β βββ settings.py
βββ demos
βΒ Β βββ alert_service_example.py
βΒ Β βββ cam_service_example
βΒ Β βΒ Β βββ start_frame_capturing.py
βΒ Β βΒ Β βββ stop_frame_capturing.py
βΒ Β βββ image_load_service_example
βΒ Β βΒ Β βββ start_image_load_example.py
βΒ Β βΒ Β βββ stop_image_load_example.py
βΒ Β βββ __init__.py
βΒ Β βββ single_image_inference.py
βββ Dockerfiles
βββ app.py
βββ main.py
βββ README.md
βββ requirements.txt
βββ streamlit_app.py
```
## How to Run
1. **Clone the repository:**
```bash
git clone https://github.com/ishworrsubedii/gun-detection-alert.git
cd cd gun-detection
```
2. **Create and activate the Conda environment:**
```bash
conda create -n weapon-detection python=3.10 -y
conda activate gun-detection
```
3. **Install required packages:**
```bash
pip install -r requirements.txt
```
4. **Perform Inference/Prediction:**
```bash
streamlit run streamlit_app.py
```
- We have to run both programs for inference. py for fastapi post request and streamlit for UI for the prediction.
5. **Perform Single Image Inference:**
```bash
streamlit run app.py
```
### Docker
```commandline
docker build -t myapp .
```
Then run the docker container
```commandline
docker myapp
```
# π₯Features
- **Real-time Gun Detection:** The system can detect guns in real-time images captured by an IP camera.
- **Alert System:** The system can send alerts to security personnel and law enforcement when a gun is detected.
# β οΈ Limitations
- The system may not be able to detect guns in low-light conditions or when the weapon is partially obscured.
- Accuracy may vary based on the quality of the images captured by the IP camera.
# Future Work
- One of the future work is to train the model on diverse datasets to improve the model's performance and accuracy.
- Implement and test the system in real-world scenarios using raspberry pi or other edge devices.
- Develop a feature to share the location of detected with the authorities.
# Demo
For single image inference i have used huggingface here you can try it
out [here](https://huggingface.co/spaces/ishworrsubedii/weapon-detection)
![img.png](img.png)
# Recommendations
Your recommendations are highly valuable, and I highly value your insights and suggestions to enhance this project! Feel
free to propose new features, report bugs, or suggest improvements.
# Contributors
Contributions are always welcome! If you'd like to contribute to this project or have any suggestions, please feel free
to reach out or submit a pull request. |