yolov7-object-blurring
yolov7-object-blurring copied to clipboard
YOLOv7 Object Blurring Using PyTorch and OpenCV
yolov7-object-blurring
Steps to run Code
- Clone the repository.
git clone https://github.com/RizwanMunawar/yolov7-object-blurring.git
- Goto the cloned folder.
cd yolov7-object-blurring
- Create a virtual envirnoment (Recommended, If you dont want to disturb python packages)
### For Linux Users
python3 -m venv yolov7objblurring
source yolov7objblurring/bin/activate
### For Window Users
python3 -m venv yolov7objblurring
cd yolov7objblurring
cd Scripts
activate
cd ..
cd ..
- Upgrade pip with mentioned command below.
pip install --upgrade pip
- Install requirements with mentioned command below.
pip install -r requirements.txt
- Download yolov7 object detection weights from link and move them to the working directory {yolov7-object-blurring}
- Run the code with mentioned command below.
#if you want to change source file
python detect_and_blur.py --weights yolov7.pt --source "your video.mp4" --blurratio 20
#for specific class (person or 0 classes)
python detect_and_blur.py --weights yolov7.pt --source "your video.mp4" -classes 0 --blurratio 50
#hide-detected-bounding-boxes
python detect_and_blur.py --weights yolov7.pt --source "your video.mp4" -classes 0 --blurratio 50 --hidedetarea
- Output file will be created in the working-dir/runs/detect/exp with original filename.
Results
Objects Blurred A | Objects Blurred B | Objects Blurred Hide detected area |
![]() |
![]() |
![]() |
References
- https://github.com/WongKinYiu/yolov7
- https://opencv.org/
My Medium Articles
- https://medium.com/augmented-startups/yolov7-training-on-custom-data-b86d23e6623
- https://medium.com/augmented-startups/roadmap-for-computer-vision-engineer-45167b94518c
- https://medium.com/augmented-startups/yolor-or-yolov5-which-one-is-better-2f844d35e1a1
- https://medium.com/augmented-startups/train-yolor-on-custom-data-f129391bd3d6
- https://medium.com/augmented-startups/develop-an-analytics-dashboard-using-streamlit-e6282fa5e0f
- https://chr043416.medium.com/setup-transfer-learning-toolkit-with-docker-on-ubuntu-a9b0198bae7
- https://medium.com/nerd-for-tech/object-detection-and-image-classification-helps-in-retail-analytics-46acc434daa0
For more details, you can reach out to me on Medium or can connect with me on LinkedIn