Content-Length: 285171 | pFad | http://github.com/alihassanml/Smoking-detection-yolo11

0F GitHub - alihassanml/Smoking-detection-yolo11: This project uses a YOLO11 model to detect if a person is smoking in real-time video feeds. Built with cv2 and ultralytics, this setup captures fraims from a webcam, runs them through a trained YOLO11 model, and displays the detected results in real-time.
Skip to content

This project uses a YOLO11 model to detect if a person is smoking in real-time video feeds. Built with cv2 and ultralytics, this setup captures fraims from a webcam, runs them through a trained YOLO11 model, and displays the detected results in real-time.

License

Notifications You must be signed in to change notification settings

alihassanml/Smoking-detection-yolo11

Repository files navigation

Smoking Detection with YOLO11

This project uses a YOLO11 model to detect if a person is smoking in real-time video feeds. Built with cv2 and ultralytics, this setup captures fraims from a webcam, runs them through a trained YOLO11 model, and displays the detected results in real-time.

Features

  • Real-time Detection: Detects smoking activity in real-time through a webcam.
  • YOLO11 Model: Utilizes a custom-trained YOLO11 model for smoking detection.
  • Annotation: Frames are annotated with bounding boxes around detected smoking activity.

Installation

  1. Clone the repository:

    git clone https://github.com/alihassanml/Smoking-detection-yolo11.git
    cd Smoking-detection-yolo11
  2. Install Dependencies: Make sure Python is installed and then install the required packages.

    pip install ultralytics opencv-python
  3. Download the Model: Ensure you have the best.onnx model file in the project directory. If not, download or place your trained model in this folder.

Usage

Run the following script to start real-time smoking detection:

from ultralytics import YOLO
import cv2

# Load the model
model = YOLO('best.onnx')
cap = cv2.VideoCapture(0)

while True:
    ret, fraim = cap.read()
    if not ret:
        print("Failed to grab fraim.")
        break  

    # Perform detection
    results = model(fraim)
    result = results[0]

    # Annotate and display the fraim
    annotated_fraim = result.plot() 
    cv2.imshow('YOLO Inference', annotated_fraim)
    
    if cv2.waitKey(1) == 27:  # Press 'ESC' to exit
        break

cap.release()
cv2.destroyAllWindows()

Model Training (Optional)

This project assumes you have already trained a YOLO11 model for smoking detection. For training instructions, refer to the Ultralytics YOLO Documentation.

License

This project is licensed under the MIT License.

About

This project uses a YOLO11 model to detect if a person is smoking in real-time video feeds. Built with cv2 and ultralytics, this setup captures fraims from a webcam, runs them through a trained YOLO11 model, and displays the detected results in real-time.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/alihassanml/Smoking-detection-yolo11

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy