Skip to content

zakharteshukov/visionProject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vision Project - Real-time Object Recognition

A plug-and-play object recognition system using your MacBook M2 Pro's built-in camera. This project uses OpenCV for camera access and YOLOv8 (You Only Look Once) for real-time object detection.

Features

  • 🎥 Real-time object detection using your MacBook's camera
  • 🚀 Fast and efficient YOLOv8 model (optimized for Apple Silicon)
  • 📊 Displays bounding boxes, labels, and confidence scores
  • 💾 Save frames with detected objects
  • ⌨️ Interactive controls

Quick Start

1. Install Dependencies

cd visionProject
pip install -r requirements.txt

Note: On first run, YOLOv8 will automatically download the model weights (~6MB for nano model).

2. Run the Application

python object_recognition.py

3. Controls

  • 'q' - Quit the application
  • 's' - Save current frame as an image
  • 'r' - Toggle object detection on/off

How It Works

  1. Camera Access: Uses OpenCV to access your MacBook's built-in camera
  2. Object Detection: YOLOv8 model processes each frame to detect objects
  3. Visualization: Draws bounding boxes and labels around detected objects
  4. Real-time Processing: Optimized for smooth real-time performance on M2 Pro

Model Options

The default uses YOLOv8n (nano) for fastest performance. You can change the model size in object_recognition.py:

recognizer = ObjectRecognizer(model_size='n')  # Options: 'n', 's', 'm', 'l', 'x'
  • 'n' (nano) - Fastest, ~6MB, good for real-time
  • 's' (small) - Balanced, ~22MB
  • 'm' (medium) - Better accuracy, ~52MB
  • 'l' (large) - High accuracy, ~87MB
  • 'x' (xlarge) - Best accuracy, ~136MB

Requirements

  • Python 3.8+
  • macOS (tested on MacBook M2 Pro)
  • Camera permissions (granted automatically on first run)

Troubleshooting

Camera not working?

  • Make sure no other application is using the camera
  • Grant camera permissions in System Settings > Privacy & Security > Camera

Slow performance?

  • Use the nano model ('n') for fastest performance
  • Close other applications using the camera
  • Reduce camera resolution in the code if needed

Model download issues?

  • Ensure you have an internet connection for the first run
  • The model will be cached after first download

What Objects Can It Detect?

YOLOv8 can detect 80 different object classes including:

  • People, animals (cats, dogs, birds, etc.)
  • Vehicles (cars, trucks, buses, motorcycles, etc.)
  • Electronics (cell phones, laptops, keyboards, etc.)
  • Furniture (chairs, couches, tables, etc.)
  • Sports equipment (sports balls, skateboards, etc.)
  • And many more!

Example Output

The application will display:

  • Live video feed from your camera
  • Bounding boxes around detected objects
  • Object labels and confidence scores
  • Frame counter and status information

License

This project is open source and available for personal and educational use.

About

Real-time object recognition system using YOLOv8 and OpenCV

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages