A comprehensive computer vision project featuring face recognition, object detection, and image processing algorithms. This project integrates multiple vision tasks into a unified Streamlit web application.
This repository contains three main tasks, each demonstrating different computer vision techniques:
- Face Recognition System (Folder
1/) - YOLO Object Detection (Folder
2/) - Image Processing Algorithms (Folder
3/)
A complete face recognition pipeline using OpenCV's YuNet face detector and SFace face recognizer, combined with an SVM classifier.
-
Buoc1 (
1/Buoc1/get_face.py): Face detection and extraction from video stream- Real-time face detection from IP camera
- Automatic face alignment and cropping
- Saves detected faces to dataset folder
-
Buoc2 (
1/Buoc2/Training.py): Model training- Extracts 128-dimensional face embeddings using SFace
- Trains LinearSVC classifier on face embeddings
- Saves trained model (
svc.pkl) for recognition
-
Buoc3 (
1/Buoc3/predict.py): Real-time face recognition- Live face recognition from video stream
- Displays recognized person names in real-time
- Visualizes face landmarks and bounding boxes
face_detection_yunet_2023mar.onnx: Face detection modelface_recognition_sface_2021dec.onnx: Face recognition/embedding modelsvc.pkl: Trained SVM classifier
- Face images organized by person in
1/image/directory - Currently includes: DaiLong, MinhHieu, MinhHoang, VanThang, caothang
# Step 1: Collect face images
cd 1/Buoc1
python get_face.py --video http://192.168.0.100:8080/video
# Step 2: Train the classifier
cd ../Buoc2
python Training.py
# Step 3: Run face recognition
cd ../Buoc3
python predict.py --video http://192.168.0.101:8080/videoYOLO v8-based object detection system for fruit recognition.
- Training Script (
2/train_yolo.py): Custom YOLO model training - GUI Application (
2/yolo_detector_gui.py): Tkinter-based desktop application- Image upload and prediction
- Real-time object detection with bounding boxes
- Confidence score display
- SauRieng (Durian)
- Tao (Apple)
- ThanhLong (Dragon Fruit)
- Chuoi (Banana)
- Kiwi
- Training data:
2/data/TraiCayx5-640x640_OK/- Train set: 288 images
- Validation set: 72 images
- Raw images:
2/data/TraiCayScratch/ - Model:
2/model/best.onnx
# Train YOLO model
cd 2
python train_yolo.py
# Run GUI application
python yolo_detector_gui.pyComprehensive collection of image processing algorithms organized into three chapters.
-
Point Operations:
- Negative transformation
- Logarithmic transformation
- Power-law (gamma) transformation
- Piecewise linear transformation
-
Histogram Processing:
- Histogram visualization
- Histogram equalization (grayscale & color)
- Local histogram equalization
- Histogram statistics-based enhancement
-
Spatial Filtering:
- Smoothing filters (Box, Gaussian)
- Median filter
- Sharpening filters (Laplacian, Unsharp masking)
- Gradient computation
- FFT spectrum visualization
- Frequency domain filtering
- Moire pattern removal
- Motion blur simulation
- Interference removal
- Erosion
- Dilation
- Boundary extraction
- Contour detection and visualization
cd 3
python test_c3_4_9.pyA unified web interface (streamlit/app.py) that integrates all three tasks:
-
Face Recognition (
NhαΊn diα»n khuΓ΄n mαΊ·t)- Image upload
- Video upload
- Real-time webcam streaming (WebRTC)
-
Object Detection (
NhαΊn diα»n Δα»i tượng)- Fruit detection using YOLO model
- Real-time prediction with confidence scores
-
Image Processing (
Xα» lΓ½ αΊ£nh sα»)- Interactive UI for all Chapter 3, 4, and 9 operations
- Before/after image comparison
- Export processed images
-
Handwriting OCR (
Δα»c chα»― viαΊΏt tay)- Handwritten text recognition using LSTM-based model
cd streamlit
pip install -r requirements.txt
streamlit run app.pyThe app will be available at http://localhost:8501
Yolo-Vision-Hub/
βββ 1/ # Face Recognition Task
β βββ Buoc1/ # Face collection
β β βββ get_face.py
β β βββ get_face - Copy.py
β βββ Buoc2/ # Training
β β βββ Training.py
β βββ Buoc3/ # Prediction
β β βββ predict.py
β βββ image/ # Face dataset
β β βββ caothang/
β β βββ DaiLong/
β β βββ MinhHieu/
β β βββ MinhHoang/
β β βββ VanThang/
β βββ model/ # Pre-trained models
β βββ face_detection_yunet_2023mar.onnx
β βββ face_recognition_sface_2021dec.onnx
β βββ svc.pkl
β
βββ 2/ # YOLO Object Detection
β βββ data/ # Training dataset
β β βββ TraiCayScratch/ # Raw images
β β βββ TraiCayx5-640x640_OK/ # Processed dataset
β βββ model/ # YOLO model
β β βββ best.onnx
β βββ train_yolo.py # Training script
β βββ train_yolo_v8n(2).ipynb
β βββ yolo_detector_gui.py # GUI application
β βββ yolo2.py
β
βββ 3/ # Image Processing
β βββ chapter3.py # Basic enhancement
β βββ chapter4.py # Frequency domain
β βββ chapter9.py # Morphology
β βββ test_c3_4_9.py # Test script
β βββ image_test/ # Test images
β
βββ 4/ # OCR Model Training
β βββ data_test/
β βββ model/
β β βββ best_model.h5
β βββ train.ipynb
β
βββ streamlit/ # Web application
βββ app.py # Main Streamlit app
βββ chapter3.py, chapter4.py, chapter9.py
βββ face_recognition_utils.py
βββ video_processor.py
βββ stream_processor.py
βββ ocr_utils.py
βββ requirements.txt
βββ model/ # All models
βββ best_model.h5 # OCR model
βββ best.onnx # YOLO model
βββ face_detection_yunet_2023mar.onnx
βββ face_recognition_sface_2021dec.onnx
βββ svc.pkl # Face recognition classifier
opencv-python/opencv-contrib-python- Computer vision operationsnumpy- Numerical operationsscikit-learn- Machine learning (SVM classifier)ultralytics- YOLO v8 implementationjoblib- Model serialization
streamlit- Web application frameworkstreamlit-webrtc- Real-time video streamingkeras/tensorflow- Deep learning (OCR model)
# Install core dependencies
pip install opencv-python opencv-contrib-python numpy scikit-learn ultralytics joblib
# Install Streamlit dependencies
cd streamlit
pip install -r requirements.txt- Collect face data: Run
1/Buoc1/get_face.pywith your IP camera - Train model: Execute
1/Buoc2/Training.pyto train the SVM classifier - Recognize faces: Use
1/Buoc3/predict.pyfor real-time recognition
- Train model: Use
2/train_yolo.pyor the Jupyter notebook - Run GUI: Launch
2/yolo_detector_gui.pyfor desktop application - Use in Streamlit: Access through the web interface
- Import functions from
chapter3.py,chapter4.py, orchapter9.py - Use the Streamlit web interface for interactive processing
- Or run
test_c3_4_9.pyfor batch processing
- Face Recognition: OpenCV DNN (YuNet + SFace) + SVM
- Object Detection: YOLO v8 (Ultralytics)
- Image Processing: OpenCV + NumPy
- Web Interface: Streamlit + WebRTC
- OCR: LSTM-based neural network (Keras/TensorFlow)
This project is for educational and research purposes.
Demo by HieuDuong
- YuNet Face Detector: OpenCV Zoo
- SFace Face Recognizer: OpenCV Zoo
- YOLO v8: Ultralytics
- IP camera URLs need to be configured in the scripts
- Model paths may need adjustment based on your system
- Ensure all model files are present in the respective
model/directories - For best results, use high-quality images and proper lighting conditions