With using YOLOv7 on video cameras detecting the occupancy time (with belongings, without human) of the seats in the library
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
- 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)
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
Contact me for any problem and question asumansaree@gmail.com
- https://github.com/RizwanMunawar/yolov7-object-tracking
- Anish Aralikatti et al 2020 J. Phys.: Conf. Ser. 1706 012149
- Redmon J, Divvala S, Girshick R and Farhadi A You Only Look Once: Unified, Real-Time Object Detection 2016IEEE Conference on Computer Vision and Pattern Recognition (Las Vegas) pp 779-788
- COCO 2017 dataset: http://cocodataset.org