/Library-Seat-Occupancy-Detection

With using YOLOv7 on video cameras detecting the occupancy time (with belongings, without human) of the seats in the library

Primary LanguageJupyter Notebook

Project Description

With using YOLOv7 on video cameras detecting the occupancy time (with belongings, without human) of the seats in the library

image

Detailed explanation about the project is in this document: https://docs.google.com/document/d/1pJ2VXuCuY54If5JJqTePYmlqCHkCWHwM6suYYAaN2k4/edit?usp=sharing

Development Environment is Google Colab. Here is the ready-to use Colab Notebook Open In Colab

System Architecture

image

How to Run (Colab)

  • Set your Colab environment with GPU
  • Mount Google Drive (optional). Due to Colab deletes the uploaded files at some point, it is better to upload them once to the Drive and mount the Drive to Notebook. from google.colab import drive drive.mount ("/content/drive")
  • Clone the repository $ !git clone https://github.com/asumansaree/Library-Seat-Occupancy-Detection.git
  • Change the working directory $ %cd "Library-Seat-Occupancy-Detection"
  • Install requirements $ !pip install -r requirements.txt
  • Run the python code with optional arguments and weights. 0: class id for human, 56: class id for chair $ !python detect_and_track.py
    --weights yolov7.pt
    --source "/content/drive/MyDrive/ImageProcessing/seatOccupancyDetectionMiniTrainVideo.mp4"
    --conf-thres 0.4
    --classes 0 56
    --name "YOLOV7_Library_Seat_Detection"
  • To display the video, you have to made this conversion $ path = "/content/Library-Seat-Occupancy-Detection/runs/detect/YOLOV7_Library_Seat_Detection/" !ffmpeg -i {path + "seatOccupancyDetectionMiniTrainVideo.mp4"} -vcodec libx264 {path + "display.mp4"} from IPython.display import HTML from base64 import b64encode mp4 = open(path + 'display.mp4', 'rb').read() data_url = "data:video/mp4;base64," + b64encode(mp4).decode() HTML(""" """ % data_url)

Sample Output

Output file will be created in the "/content/Library-Seat-Occupancy-Detection/runs/detect/YOLOV7_Library_Seat_Detection/{video.mp4}" Output is in the mp4 format. For demonstration purposes in pdf document, it is included as image

ImageProcessing_ProjectReport_AsumanSareERGUT-09

Contact

Contact me for any problem and question asumansaree@gmail.com

References