AI Gun Detection - 1

AI Gun Detection

Real-time gun detection using Frigate NVR with AI-accelerated video analysis on edge devices

Beginner10minSecurity
Securitygun-detectionfrigatenvrai

What This Solution Does

Security cameras are everywhere, but someone still has to watch them 24/7 to spot a threat. This solution adds AI-powered gun detection to your existing cameras — the system watches every frame and alerts you the moment a gun appears.

Core Value

BenefitDetails
Instant detectionAI scans every video frame in real-time, no human fatigue
Works offlineRuns entirely on local hardware, no cloud dependency, no data leaves your network
Easy to set upOne-click deployment, starts with demo videos so you can see it working immediately
Hardware flexibleChoose NVIDIA Jetson (GPU) or reComputer R2000 + Hailo (NPU) based on your needs

Use Cases

ScenarioHow It Works
School safetyInstall IP cameras at entrances, get instant alerts when a gun is detected
Retail securityMonitor store cameras 24/7, automatically flag gun-related events with recordings
Office buildingAdd gun detection to existing CCTV system, integrate alerts via MQTT
Public venuesReal-time monitoring across multiple cameras with centralized web dashboard

Prerequisites

Camera Connection

  • IP cameras: Connect via RTSP URL (rtsp://user:pass@ip/stream)
  • USB cameras: Plug and play, auto-detected by device

Output Integration

  • MQTT: Configure broker address + topic
  • Webhook: Configure callback URL
  • Screenshot storage: Configure local directory

Camera Placement Tips

  • Mount at entrances, hallways, and other key locations
  • Ensure clear view of target areas, keep camera stable

Deployment Comparison

OptionAccelerationRecommended StreamsDevice PriceCost per Stream
reComputer R2000 + HailoHailo NPU~2 streams$350$175/stream
reComputer J3011 (Jetson entry)TensorRT GPU~2 streams$630$315/stream
reComputer J4012 (Jetson multi) ⭐TensorRT GPU~6 streams$1000$150/stream (best value)
reComputer J5012 (Jetson high-end)TensorRT GPU~9 streams$2500$300/stream

Choose based on your stream count needs: R2000+Hailo or J3011 for few cameras; J4012 for best multi-stream value; J5012 for high frame rate / many streams.

Usage Requirements

rtsp

IP camera RTSP stream for surveillance

Deployment Options

Download & Install

Preset: NVIDIA Jetson {#jetson}

Real-time gun detection using Frigate NVR with TensorRT GPU acceleration on NVIDIA Jetson.

DevicePurpose
NVIDIA Jetson (reComputer)Edge AI with TensorRT GPU acceleration
IP Camera (optional)RTSP video source for monitoring

What you'll get:

  • Real-time gun detection with bounding boxes and confidence scores
  • Web dashboard for live monitoring and event review
  • Automatic recording and snapshots when guns are detected
  • MQTT integration for alerts and automation

Requirements: Docker + NVIDIA Container Toolkit on target device

Step 1: Initialize Cameras {#init_cameras_jetson type=manual required=false}

Set up your IP cameras and obtain RTSP stream URLs.

Wiring

  1. Connect your IP camera to the same network as the deployment device
  2. Find the camera's IP address (check your router's DHCP client list, or use the manufacturer's tool)
  3. Access the camera's web management interface (usually http://<camera-ip>)
  4. Enable RTSP streaming in the camera settings (usually enabled by default)
  5. Note down the RTSP URL for your camera

Common RTSP URL formats:

  • Hikvision: rtsp://admin:password@<ip>:554/Streaming/Channels/101 (main stream) or /102 (sub stream)
  • Dahua: rtsp://admin:password@<ip>:554/cam/realmonitor?channel=1&subtype=0 (main) or &subtype=1 (sub)
  • Generic ONVIF: Use the camera's ONVIF discovery tool to find the stream URL

Tip: Use the sub stream (lower resolution) for detection to reduce CPU/GPU load, and the main stream for recording.

You can test your RTSP URL with VLC: Media > Open Network Stream > paste the URL.

Troubleshooting

IssueSolution
Cannot access camera web interfaceVerify camera IP with ping <camera-ip>. Check if camera and computer are on the same subnet
RTSP stream not workingVerify RTSP is enabled in camera settings. Try with VLC first. Check username/password
Camera not found on networkPower cycle the camera. Check Ethernet cable connection. Try manufacturer's discovery tool (e.g., Hikvision SADP, Dahua ConfigTool)

Step 2: Deploy Frigate {#deploy_frigate_jetson type=docker_deploy required=true config=devices/jetson.yaml}

Deploy Frigate NVR with TensorRT-accelerated gun detection to your NVIDIA Jetson.

Target: Remote Deployment {#jetson_remote type=remote config=devices/jetson.yaml default=true}

Deploy to a remote NVIDIA Jetson device via SSH.

Wiring

  1. Connect Jetson to the same network as your computer
  2. Enter the Jetson's IP address and SSH credentials
  3. Optionally enter your RTSP camera URLs (up to 2 cameras)
  4. Click Deploy to start installation

Note: First startup takes 5-10 minutes — the system downloads and compiles the gun detection model for TensorRT optimization.

Deployment Complete

  1. Open http://<device-ip>:5000 in your browser
  2. You'll see two demo cameras detecting guns in sample videos
  3. If you provided RTSP URLs, your cameras will also appear with gun detection enabled

To modify camera configuration later, SSH into the device and edit:

cd ~/gun-detection-frigate
nano config/config.yml
docker compose restart

Troubleshooting

IssueSolution
NVIDIA runtime not foundInstall NVIDIA Container Toolkit: sudo apt install nvidia-container-toolkit && sudo systemctl restart docker
Port 5000 already in useStop existing services: docker stop $(docker ps -q --filter publish=5000)
Model compilation slowFirst startup needs 5-10 min for TensorRT optimization, subsequent starts are instant
Container keeps restartingCheck logs: docker logs frigate — likely GPU memory or driver issue
RTSP camera not showingVerify RTSP URL works with VLC. Edit config/config.yml on the device and restart: docker compose restart

Target: Local Deployment {#jetson_local type=local config=devices/jetson_local.yaml}

Deploy directly on the current machine (requires NVIDIA GPU).

Wiring

  1. Ensure Docker and NVIDIA Container Toolkit are installed
  2. Click Deploy to start installation

Note: First startup takes 5-10 minutes for TensorRT model compilation.

Deployment Complete

  1. Open http://localhost:5000 in your browser
  2. You'll see two demo cameras detecting guns in sample videos

To add RTSP cameras, edit the config file and restart:

cd ~/gun-detection-frigate
nano config/config.yml
docker compose restart

Troubleshooting

IssueSolution
NVIDIA runtime not foundInstall NVIDIA Container Toolkit: sudo apt install nvidia-container-toolkit && sudo systemctl restart docker
Port 5000 already in useStop existing services: docker stop $(docker ps -q --filter publish=5000)
Container keeps restartingCheck logs: docker logs frigate — likely GPU memory or driver issue

Preset: reComputer R2000 + Hailo {#r2000_hailo}

Real-time gun detection using Frigate NVR with Hailo AI accelerator on reComputer R2000.

DevicePurpose
reComputer R2000 + HailoEdge AI with Hailo NPU acceleration
IP Camera (optional)RTSP video source for monitoring

What you'll get:

  • Real-time gun detection with bounding boxes and confidence scores
  • Web dashboard for live monitoring and event review
  • Automatic recording and snapshots when guns are detected
  • MQTT integration for alerts and automation

Requirements: Docker on target device · Hailo AI accelerator installed

Step 1: Initialize Cameras {#init_cameras_r2000 type=manual required=false}

Set up your IP cameras and obtain RTSP stream URLs.

Wiring

  1. Connect your IP camera to the same network as the deployment device
  2. Find the camera's IP address (check your router's DHCP client list, or use the manufacturer's tool)
  3. Access the camera's web management interface (usually http://<camera-ip>)
  4. Enable RTSP streaming in the camera settings (usually enabled by default)
  5. Note down the RTSP URL for your camera

Common RTSP URL formats:

  • Hikvision: rtsp://admin:password@<ip>:554/Streaming/Channels/101 (main stream) or /102 (sub stream)
  • Dahua: rtsp://admin:password@<ip>:554/cam/realmonitor?channel=1&subtype=0 (main) or &subtype=1 (sub)
  • Generic ONVIF: Use the camera's ONVIF discovery tool to find the stream URL

Tip: Use the sub stream (lower resolution) for detection to reduce CPU/GPU load, and the main stream for recording.

You can test your RTSP URL with VLC: Media > Open Network Stream > paste the URL.

Troubleshooting

IssueSolution
Cannot access camera web interfaceVerify camera IP with ping <camera-ip>. Check if camera and computer are on the same subnet
RTSP stream not workingVerify RTSP is enabled in camera settings. Try with VLC first. Check username/password
Camera not found on networkPower cycle the camera. Check Ethernet cable connection. Try manufacturer's discovery tool (e.g., Hikvision SADP, Dahua ConfigTool)

Step 2: Deploy Frigate {#deploy_frigate_r2000 type=docker_deploy required=true config=devices/r2000_hailo.yaml}

Deploy Frigate NVR with Hailo-accelerated gun detection to your reComputer R2000.

Target: Remote Deployment {#r2000_remote type=remote config=devices/r2000_hailo.yaml default=true}

Deploy to a remote reComputer R2000 via SSH.

Wiring

  1. Ensure Hailo AI Kit is installed (check with ls /dev/hailo*)
  2. Connect the device to the same network as your computer
  3. Enter the device's IP address and SSH credentials
  4. Optionally enter your RTSP camera URLs (up to 2 cameras)
  5. Click Deploy to start installation

Note: The deployment will automatically check and install the required HailoRT 4.21.0 driver if needed (may take 5-10 minutes on first run). At least 4 GB of free disk space is required.

Deployment Complete

  1. Open http://<device-ip>:5000 in your browser
  2. You'll see two demo cameras detecting guns in sample videos
  3. If you provided RTSP URLs, your cameras will also appear with gun detection enabled

To modify camera configuration later, SSH into the device and edit:

cd ~/gun-detection-frigate
nano config/config.yml
docker compose restart

Troubleshooting

IssueSolution
Hailo device not foundCheck Hailo is properly seated in M.2 slot: ls /dev/hailo* should show /dev/hailo0
HailoRT version mismatchFrigate requires HailoRT 4.21.0. Check: dpkg -l hailort. Install: curl -sfL https://raw.githubusercontent.com/blakeblackshear/frigate/dev/docker/hailo8l/user_installation.sh | sudo bash then reboot
Insufficient disk spaceNeed at least 4 GB free. Run docker system prune -a and sudo apt clean to free space
Port 5000 already in useStop existing services: docker stop $(docker ps -q --filter publish=5000)
Container keeps restartingCheck logs: docker logs frigate-hailo — likely Hailo driver issue
RTSP camera not showingVerify RTSP URL works with VLC. Edit config/config.yml on the device and restart: docker compose restart

Target: Local Deployment {#r2000_local type=local config=devices/r2000_hailo_local.yaml}

Deploy directly on the current machine (requires Hailo AI accelerator).

Wiring

  1. Ensure Docker is installed and Hailo device is accessible (ls /dev/hailo*)
  2. Click Deploy to start installation

Note: At least 4 GB of free disk space is required for the Frigate Docker image.

Deployment Complete

  1. Open http://localhost:5000 in your browser
  2. You'll see two demo cameras detecting guns in sample videos

To add RTSP cameras, edit the config file and restart:

nano config/config.yml
docker compose restart

Troubleshooting

IssueSolution
Hailo device not foundCheck Hailo is properly seated: ls /dev/hailo* should show /dev/hailo0
Port 5000 already in useStop existing services: docker stop $(docker ps -q --filter publish=5000)
Container keeps restartingCheck logs: docker logs frigate-hailo — likely Hailo driver issue

Deployment Complete

Congratulations! Frigate gun detection system is now running.

Quick Verification

  1. Open the Frigate dashboard in your browser (URL shown after deployment)
  2. Check the Birdseye view for all-camera overview
  3. Verify gun detections appear with bounding boxes on demo videos
  4. Click on events to see recorded snapshots with timestamps

Adding or Modifying Cameras

To add more RTSP cameras or change existing ones, SSH into the device and edit the configuration:

cd ~/gun-detection-frigate
nano config/config.yml

Add camera entries under cameras::

  my_camera:
    enabled: true
    ffmpeg:
      inputs:
        - path: rtsp://admin:password@192.168.1.100:554/Streaming/Channels/101
          roles:
            - detect
            - record
    detect:
      width: 1920
      height: 1080
      fps: 5
    objects:
      track:
        - gun

Common RTSP URL formats:

  • Hikvision: rtsp://admin:password@<ip>:554/Streaming/Channels/101
  • Dahua: rtsp://admin:password@<ip>:554/cam/realmonitor?channel=1&subtype=0

Then restart Frigate:

docker compose restart

Next Steps

  • Configure notification alerts via MQTT (broker runs on port 1883)
  • Adjust detection thresholds in config/config.yml (objects.filters.gun.threshold)
  • Set up recording retention policies (record.retain.days)
  • Frigate Documentation
Contact Us
We Are Glad to Be Your Hardware Partner !
Have you used our products before?