This is the final project of my subject, Introduction to Computer Vision. I built a web application to detect people in images using Histogram of Oriented Gradients (HOG) for extracting features and Support Vector Machine (SVM) for classifying.
In addition, I also built a detection using Yolov4 darknet53.
- Frontend: Bootstrap
- Backend: Flask
-
HOG & SVM
- Train SVM model with HOG descriptor
- Load positive and negative image with size 64x128, convert to grayscale and get label of them
- Get HOG feature vector of each image
- Fit to LinearSVM model
- Detect with SVM model
- Resize image to suitable size
- Use pyramid multi-scale to generate images with downscale size
- Use sliding window with size 64x128 to slide through all the pyramid images
- Get HOG feature vector at each window, use model to detect that feature belongs to class positive or negative. Save that window if it is a positive window
- Apply Non-Maximum Suppression (NMS) to remove the window overlapped over thresh.
- Draw rectangles
- Train SVM model with HOG descriptor
-
Yolov4
Just build and detect model following the guide. In this app, I loaded yolo architecture using cv2.dnn darknet.
To start server test, you can run:
python app/app.py
Just drag and drop or click in upload image area to select an image. After that, the person detected image will be returned.
- If my project is useful for you, please mark ⭐ it on Github and share it with your friends. Thank you!
- Have any questions? Open an issue on this project.
- Training HOG with SVM: @RashadGarayev
- Training Yolo: @pjreddie