DriverTrac/install_rpi.sh
2025-11-25 12:29:43 +05:30

59 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
# Raspberry Pi Installation Script
# This script helps install dependencies on Raspberry Pi with proper error handling
set -e # Exit on error
echo "🚗 Driver DSMS ADAS - Raspberry Pi Installation"
echo "================================================"
echo ""
# Check Python version
PYTHON_VERSION=$(python3 --version 2>&1 | awk '{print $2}' | cut -d. -f1,2)
PYTHON_MAJOR=$(echo $PYTHON_VERSION | cut -d. -f1)
PYTHON_MINOR=$(echo $PYTHON_VERSION | cut -d. -f2)
echo "📋 System Information:"
echo " Python: $(python3 --version)"
echo " Architecture: $(uname -m)"
echo " OS: $(cat /etc/os-release | grep PRETTY_NAME | cut -d'"' -f2)"
echo ""
# Check if virtual environment exists
if [ ! -d "venv" ]; then
echo "📦 Creating virtual environment..."
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip setuptools wheel
else
echo "✓ Virtual environment exists"
source venv/bin/activate
fi
echo ""
echo "📦 Installing base requirements (without MediaPipe)..."
pip install -r requirements_rpi.txt
echo ""
echo "✅ MediaPipe NOT required!"
echo " The application uses OpenCV only - smooth and reliable!"
echo ""
echo "✅ Installation complete!"
echo ""
echo "📝 Verification:"
python3 -c "import cv2; print(f' ✓ OpenCV {cv2.__version__}')" 2>/dev/null || echo " ✗ OpenCV not found"
python3 -c "import streamlit; print(f' ✓ Streamlit {streamlit.__version__}')" 2>/dev/null || echo " ✗ Streamlit not found"
python3 -c "import torch; print(f' ✓ PyTorch {torch.__version__}')" 2>/dev/null || echo " ✗ PyTorch not found"
python3 -c "from ultralytics import YOLO; print(' ✓ YOLO ready')" 2>/dev/null || echo " ✗ YOLO not found"
echo " ✓ MediaPipe NOT needed - using OpenCV only!"
echo ""
echo "🚀 To run the application:"
echo " source venv/bin/activate"
echo " streamlit run src/poc_demo.py --server.port 8501 --server.address 0.0.0.0"
echo ""
echo "Or use: ./run_poc.sh"
echo ""