Firescrew - 在 RTSP 网络摄像机上更快地发现移动物体,比咖啡上瘾的猫还快!
Firescrew is a cutting-edge application written in Go that enables real-time object and motion detection from an RTSP network camera. It leverages advanced image processing techniques and machine learning models to identify specific objects such as cars, people, and more.
Things added/fixed in last 3 days:
- Added CoreML YoloV8s (Mac only)
- Added MQTT/Webhook/ScriptHook/Slack support!
- Added ffprobe timeout/Fixed MQTT port in template/Added docs page
- Added inference statistics and much more!
- Fixed Coral TPU model detection
- Performance updates for model adapters
- Discord server has been added
- Docker image will now fetch latest binaries from github at runtime
- Fixed ffprobe ftps parsing/Added resolution/fps bypass parametersdocker run --rm -it -p 8080:8080 8fforg/firescrew:latest demo# Point your browser to http://localhost:8080
WebUI Supports natural language processing for searching events, here are some of the examples:
todaytoday 8amyesterday 3pmaugust 15th 10amlast friday 2pmfrom/to and between/and rangesfrom july 7th 5pm to july 7th 6pmlast tuesday between 1pm and 2pmpeople cars today between 10am and 1pmfront cars todaydocker pull 8fforg/firescrew:latestFirescrew leverages the capabilities of ffmpeg to ensure optimal performance and broad compatibility, you will need to install it before use.
apt-get install ffmpeg
pip3 install ultralytics
curl -o firescrew -L https://github.com/8ff/firescrew/releases/download/latest/firescrew.linux.amd64 && chmod +x firescrewGenerate config
# Store template config in config.json
docker run --rm -it 8fforg/firescrew:latest -t > config.jsonRun
# Run with config.json and mount media folder for persistent storage
docker run --rm -v $(pwd)/media:/media -v $(pwd)/config.json:/config.json -it 8fforg/firescrew:latest /config.jsonServing from Docker
# Serve from ./media on port 8080 (./media must be defined in config.json)
docker run --rm -p 8080:8080 -it -v $(pwd)/media:/media 8fforg/firescrew:latest -s /media :8080Using Coral TPU with Docker
lsusb | grep Google
# Take Bus and Device from the output of the above command and replace [bus] and [device] in the below command
docker run -d --device=/dev/bus/usb/[bus]/[device] -v config.json:config.json 8fforg/firescrew:latestHelp menu
root@debian:~docker run --rm -it 8fforg/firescrew:latest -h
Usage: firescrew [configfile]
-t, --template, t Prints the template config to stdout
-h, --help, h Prints this help message
-s, --serve, s Starts the web server, requires: [path] [addr]
-v, --version, v Prints the version
-update, --update, update Updates firescrew to the latest versionCreate a template config file
./firescrew -t > config.jsonStart object detection
./firescrew config.jsonStarting WebUI
./firescrew -s rec/hi :8080This will start a demo stream at rtsp://localhost:8553/lo and rtsp://localhost:8554/hi
cd demoStream && ./startDemoStream.shUsage: firescrew [configfile]
-t, --template, t Prints the template config to stdout
-h, --help, h Prints this help message
-s, --serve, s Starts the web server, requires: [path] [addr]
-v, --version, v Prints the version
-update, --update, update Updates firescrew to the latest versionYOLOV8S Running CUDA 11.8 on RTX 4090Min Time: 16.369294ms, Max Time: 1.748422882s, Avg Time: 20.55754ms, Count: 500
50th: 16.787455ms, 90th: 17.206168ms, 99th: 27.898232msYOLOV8S Running CUDA 11.8 on RTX 3090Min Time: 15.337001ms, Max Time: 1.931347977s, Avg Time: 28.308399ms, Count: 500
50th: 24.313751ms, 90th: 25.290932ms, 99th: 34.881259msYOLOV8S Running CoreML on M1 MacMin Time: 32.435875ms, Max Time: 53.711166ms, Avg Time: 35.725131ms, Count: 500
50th: 35.232417ms, 90th: 37.851167ms, 99th: 44.405792msYOLOV8S Running CPU on Core i5-8500T @ 2.10GHzMin Time: 103.251637ms, Max Time: 308.058517ms, Avg Time: 120.917971ms, Count: 500
50th: 116.531572ms, 90th: 126.291139ms, 99th: 230.462122msDocker image already includes everything you need to get started but if you choose to run manually and use YoloV8 model, you will need to install the Ultralytics dependencies. You can do this by running the following command:
pip3 install ultralyticsThis command installs the Ultralytics package which includes the necessary dependencies for the YOLOv8 model. If you encounter any problems during the installation, or you're looking for more advanced setup instructions, please refer to the Ultralytics Quick Start Guide. Note: Make sure you have Python and pip (or pip3) installed on your system before running these commands. Ensure that your Python environment is properly set up and is compatible with the YOLOv8 model requirements.
If you choose to use the EdgeTPU model via the Python adapter for faster and more accurate detection, you will need to install the Ultralytics dependencies. You can do this by running the following command:
pip3 install pycoral numpy PillowThis has been tested working on M1/M2 MacOS 13.4.1, it works when using python3.10 and not 3.11
git clone https://github.com/8ff/firescrew && cd firescrew/assets
pip3.10 install coremltools Pillow
./objectDetectServerCoreML.pyNow in your config.json file set "networkObjectDetectServer": "", addr:8555 where addr is the ip of your machine running the above script
Firescrew supports two different RTSP camera streams: a low resolution stream (deviceUrl) and a high resolution stream (hiResDeviceUrl). These streams are used for different purposes and should be set up accordingly.
The deviceUrl should be set to a low resolution video feed, typically around 640x360. This stream is used for motion detection. Note that the resolution of this stream significantly impacts the CPU usage. A higher resolution will lead to more CPU usage, so it is recommended to keep this stream at a lower resolution.
The hiResDeviceUrl should be set to a high resolution video feed, such as 1080p or higher. This stream is used to store video clips of motion events. As this stream is not used for motion detection, it can handle higher resolutions, enabling the capture of more detail in the recorded video clips.
Firescrew uses tcp for RTSP streams by default to avoid lost frames. If you camera does not support tcp - please open an issue and we will add support for it.
Firescrew uses a JSON configuration file for its settings. Here is a brief explanation of the various configuration parameters:
…Firescrew's performance has been meticulously examined and optimized to ensure the fastest and most reliable object detection. The key aspects of this examination include comparing different RTSP feed methods and evaluating various model object detections. Here are the details:
Motion detection system operates in two stages to optimize resource usage and deliver accurate results:
Event-Based Motion Check:
Pixel Change Threshold:
objectAreaThreshold is used to determine significant changes between frames.Object Detection:
The project continues to evolve, with a focus on enhancing performance and lowering resource consumption for an even more efficient and robust motion detection solution.
Three different methods for parsing RTSP feeds were tested:
Among these, using the FFmpeg command was found to be the fastest and most compatible between RTSP feeds. This approach not only delivered superior speed but also ensured broad compatibility across different types of RTSP feeds.
Two primary models were examined for object detection:
The comparison clearly revealed that YOLOv8 outperformed the Golang MobileNET in both speed and quality. The detection was faster, and the quality of object identification was much better with YOLOv8.
Based on these comprehensive performance tests, Firescrew has adopted the use of the FFmpeg command for RTSP feed handling and the YOLOv8 model for object detection. This decision ensures the delivery of a fast, accurate, and high-quality solution for real-time object and motion detection. Additionally, the implementation of a network model adapter allows the support of any desired model detection, providing flexibility and adaptability for various use cases.
git clone https://github.com/8ff/f暂无开放 Issues,或尚未同步最近议题。