With using YOLOv7 on video cameras detecting the occupancy time (with belongings, without human) of the seats in the library
![image](https://private-user-images.githubusercontent.com/58108789/296591104-13d2e3fe-6267-461d-a22e-45fe0fc92dcf.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQzODQxMTksIm5iZiI6MTcyNDM4MzgxOSwicGF0aCI6Ii81ODEwODc4OS8yOTY1OTExMDQtMTNkMmUzZmUtNjI2Ny00NjFkLWEyMmUtNDVmZTBmYzkyZGNmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIzVDAzMzAxOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTJhZmMxMTkwZGJiZDQ4MjExZDViZDg0YmRmODU1MTFhMWUyMzAxYTcxN2Y0Yjg5NTVkMzBlZDJiM2ViOWVhZWImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.gbdVgflDYaz3kG-NTCst_G0fpE3j9OC4_iIJImdAR64)
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 [email protected]
- 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