{"id":25543847,"url":"https://github.com/kernferm/cctv-yolo","last_synced_at":"2026-02-07T09:30:18.220Z","repository":{"id":273750708,"uuid":"920759743","full_name":"KernFerm/cctv-yolo","owner":"KernFerm","description":"This project provides a real-time object detection system using YOLO (You Only Look Once) models and BetterCam for efficient video stream capture. It supports any YOLO version, allowing flexibility for various detection needs.","archived":false,"fork":false,"pushed_at":"2025-01-22T18:28:40.000Z","size":6117,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T19:26:52.116Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KernFerm.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-22T18:14:41.000Z","updated_at":"2025-01-22T18:28:44.000Z","dependencies_parsed_at":"2025-01-22T19:36:57.037Z","dependency_job_id":null,"html_url":"https://github.com/KernFerm/cctv-yolo","commit_stats":null,"previous_names":["kernferm/cctv-yolo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KernFerm%2Fcctv-yolo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KernFerm%2Fcctv-yolo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KernFerm%2Fcctv-yolo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KernFerm%2Fcctv-yolo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KernFerm","download_url":"https://codeload.github.com/KernFerm/cctv-yolo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239799928,"owners_count":19699117,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-20T07:38:34.658Z","updated_at":"2026-02-07T09:30:18.158Z","avatar_url":"https://github.com/KernFerm.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YOLO Real-time Object Detection with BetterCam\n\nThis project provides a real-time object detection system using **YOLO (You Only Look Once)** models and **BetterCam** for efficient video stream capture. It supports any YOLO version, allowing flexibility for various detection needs. \n\n## Features\n- **Dynamic YOLO Model Support**: Easily switch between YOLOv5, YOLOv8, or other YOLO models.\n- **Efficient Video Capture**: Utilizes BetterCam for low-latency, high-quality frame capture.\n- **Configurable Settings**: Adjust thresholds, resolutions, and model paths via a configuration file.\n- **Real-time Performance**: Processes video streams in real-time with bounding box visualization.\n\n## How It Works\n1. **Video Input**: Captures video frames using BetterCam.\n2. **Object Detection**: Performs object detection on resized low-resolution frames.\n3. **Visualization**: Scales the detection results back to the original resolution and overlays bounding boxes on the video.\n\n---\n# READ AND FOLLOW DIRECTIONS IN THE README.MD to AVOID ISSUES\n---\n\n## Installation\n\n### Prerequisites\n- Python 3.11 or higher\n- use the `install_python.bat` to install python 3.11.6\n- A compatible YOLO model (e.g., `yolov5n.pt`, `yolov8n.pt`)\n- A GPU with CUDA support (optional, but recommended)\n\n### Dependencies\nInstall the required Python packages:\n```\npip install ultralytics opencv-python numpy gradio torch bettercam cupy-cuda11x onnx onnxruntime-gpu onnx-simplifier onnxruntime\n```\n\n## Configuration\n\n- Create a `config.py` file in the project directory to define your settings:\n\n```\n# config.py\n\n# YOLO Model Configuration\nMODEL_PATH = 'yolov8n.pt'  # Specify the YOLO model version (e.g., yolov5n, yolov8n, etc.)\nCONF_THRESHOLD = 0.25      # Confidence threshold for object detection\nIOU_THRESHOLD = 0.45       # Intersection-over-Union (IOU) threshold for non-max suppression\n\n# ONNX Model Configuration (Optional)\nONNX_MODEL_PATH = 'model.onnx'  # Path to ONNX model file (leave empty if not using ONNX)\n\n# Resolution Settings\nLOW_RES_WIDTH = 320        # Low-resolution width for faster inference\nLOW_RES_HEIGHT = 180       # Low-resolution height\nCAM_RESOLUTION = (1280, 720)  # Camera resolution (width, height)\n\n# Performance Settings\nMAX_DETECTIONS = 100       # Maximum number of detections per frame\nUSE_GPU = True             # Set to False to force CPU inference\n```\n\n## Usage\n\n1. click the green button to download the zip file.\n\n2. make sure to install the requirements needed to run the project.\n\n3. run the program\n\n```\npython main.py\n```\n- Open the Gradio interface in your browser. The live video stream will display with object detection results.\n\n## Customization\n\n- To switch YOLO models, update the `MODEL_PATH` in `config.py`.\n\n- Adjust detection thresholds (`CONF_THRESHOLD` and `IOU_THRESHOLD`) in `config.py` for your use case.\n\n- Change resolutions (`LOW_RES_WIDTH`, `LOW_RES_HEIGHT`, `CAM_RESOLUTION`) to optimize performance.\n\n\n## Supported YOLO Versions\n- YOLOv5\n- YOLOv7\n- YOLOv8\n\n## Contributions\n\nContributions are welcome! If you have ideas for improvement, feel free to submit a pull request or open an issue.\n\n# Screenshot\n\u003cimg src=\"https://github.com/KernFerm/cctv-yolo/blob/main/image.png\" alt=\"pic\" width=\"700\"\u003e\n\n\n\n## License\nThis project is licensed under the `MIT License`.\n\n\n## Acknowledgments\n\n- [Ultralytics](https://ultralytics.com/) for the YOLO models.\n\n- [BetterCam](https://github.com/RootKit-Org/BetterCam) for efficient video capture.\n\n- [Gradio](https://gradio.app/) for the user-friendly interface.\n\n- Forked from [SanshruthR/CCTV_YOLO](https://github.com/SanshruthR/CCTV_YOLO)\n\n\n### 1. **Download the NVIDIA CUDA Toolkit 11.8**\n\nFirst, download the CUDA Toolkit 11.8 from the official NVIDIA website:\n\n👉 [Nvidia CUDA Toolkit 11.8 - DOWNLOAD HERE](https://developer.nvidia.com/cuda-11-8-0-download-archive)\n\n### 2. **Install the CUDA Toolkit**\n\n- After downloading, open the installer (`.exe`) and follow the instructions provided by the installer.\n- Make sure to select the following components during installation:\n  - CUDA Toolkit\n  - CUDA Samples\n  - CUDA Documentation (optional)\n\n### 3. **Verify the Installation**\n\n- After the installation completes, open the `cmd.exe` terminal and run the following command to ensure that CUDA has been installed correctly:\n```\nnvcc --version\n```\nThis will display the installed CUDA version.\n\n### **4. Install Cupy**\nRun the following command in your terminal to install Cupy:\n```\npip install cupy-cuda11x\n```\n\n## 5. CUDNN Installation 🧩\nDownload cuDNN (CUDA Deep Neural Network library) from the NVIDIA website:\n\n👉 [Download CUDNN](https://developer.nvidia.com/downloads/compute/cudnn/secure/8.9.6/local_installers/11.x/cudnn-windows-x86_64-8.9.6.50_cuda11-archive.zip/). (Requires an NVIDIA account – it's free).\n\n## 6. Unzip and Relocate 📁➡️\nOpen the `.zip` cuDNN file and move all the folders/files to the location where the CUDA Toolkit is installed on your machine, typically:\n\n```\nC:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.8\n```\n\n\n## 7. Get TensorRT 8.6 GA 🔽\nDownload [TensorRT 8.6 GA](https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/secure/8.6.1/zip/TensorRT-8.6.1.6.Windows10.x86_64.cuda-11.8.zip).\n\n## 8. Unzip and Relocate 📁➡️\nOpen the `.zip` TensorRT file and move all the folders/files to the CUDA Toolkit folder, typically located at:\n\n```\nC:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.8\n```\n\n\n## 9. Python TensorRT Installation 🎡\nOnce all the files are copied, run the following command to install TensorRT for Python:\n\n```\npip install \"C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.8\\python\\tensorrt-8.6.1-cp311-none-win_amd64.whl\"\n```\n\n🚨 **Note:** If this step doesn’t work, double-check that the `.whl` file matches your Python version (e.g., `cp311` is for Python 3.11). Just locate the correct `.whl` file in the `python` folder and replace the path accordingly.\n\n## 10. Set Your Environment Variables 🌎\nAdd the following paths to your environment variables:\n- `system path`\n```\nC:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.8\\lib\nC:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.8\\libnvvp\nC:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.8\\bin\n```\n\n# Setting Up CUDA 11.8 with cuDNN on Windows\n\nOnce you have CUDA 11.8 installed and cuDNN properly configured, you need to set up your environment via `cmd.exe` to ensure that the system uses the correct version of CUDA (especially if multiple CUDA versions are installed).\n\n## Steps to Set Up CUDA 11.8 Using `cmd.exe`\n\n### 1. Set the CUDA Path in `cmd.exe`\n\nYou need to add the CUDA 11.8 binaries to the environment variables in the current `cmd.exe` session.\n\nOpen `cmd.exe` and run the following commands:\n- DO each one `Separately`\n```\nset PATH=C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.8\\bin;%PATH%\nset PATH=C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.8\\libnvvp;%PATH%\nset PATH=C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.8\\extras\\CUPTI\\lib64;%PATH%\n```\nThese commands add the CUDA 11.8 binary, lib, and CUPTI paths to your system's current session. Adjust the paths as necessary depending on your installation directory.\n\n2. Verify the CUDA Version\nAfter setting the paths, you can verify that your system is using CUDA 11.8 by running:\n```\nnvcc --version\n```\nThis should display the details of CUDA 11.8. If it shows a different version, check the paths and ensure the proper version is set.\n\n3. **Set the Environment Variables for a Persistent Session**\nIf you want to ensure CUDA 11.8 is used every time you open `cmd.exe`, you can add these paths to your system environment variables permanently:\n\n1. Open `Control Panel` -\u003e `System` -\u003e `Advanced System Settings`.\nClick on `Environment Variables`.\nUnder `System variables`, select `Path` and click `Edit`.\nAdd the following entries at the top of the list:\n```\nC:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.8\\bin\nC:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.8\\libnvvp\nC:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.8\\extras\\CUPTI\\lib64\n```\nThis ensures that CUDA 11.8 is prioritized when running CUDA applications, even on systems with multiple CUDA versions.\n\n4. **Set CUDA Environment Variables for cuDNN**\nIf you're using cuDNN, ensure the `cudnn64_8.dll` is also in your system path:\n```\nset PATH=C:\\tools\\cuda\\bin;%PATH%\n```\nThis should properly set up CUDA 11.8 to be used for your projects via `cmd.exe`.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkernferm%2Fcctv-yolo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkernferm%2Fcctv-yolo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkernferm%2Fcctv-yolo/lists"}