An autonomous driving system using YOLOv8 for object detection and semantic segmentation for lane detection in the CARLA simulator.
- YOLOv8 object detection for vehicles, pedestrians, and traffic signs
- Semantic segmentation for precise lane detection
- Intelligent safety assessment and emergency response
- Adaptive vehicle control with object awareness
- GPU acceleration support
- Real-time performance monitoring
- Python 3.8+
- CARLA Simulator 0.9.13+
- NVIDIA GPU with CUDA support (recommended)
python setup_modern_cv.py
pip install -r requirements.txt
mkdir models data logs outputs
- Start CARLA simulator
- Run the system:
python src/main.py
- 'q' or ESC: Quit
- 'r': Reset controllers
- 's': Show statistics
- 'p': Performance metrics
- 'h': Help
The system consists of three main components:
- ModernLaneDetector: YOLOv8 object detection and UNet semantic segmentation
- ModernVehicleController: Adaptive PID control with safety features
- CarlaConnector: Enhanced CARLA interface with robust error handling
- yolov8n: Fastest, lowest accuracy
- yolov8s: Balanced performance
- yolov8m: Better accuracy
- yolov8l: High accuracy
- yolov8x: Best accuracy
# Adjust in lane_detection.py
lane_detector.yolo_model = YOLO('yolov8s.pt')
# Adjust in vehicle_controller.py
vehicle_controller.kp_steer = 0.003
vehicle_controller.base_speed = 35.0
- Vehicles: cars, motorcycles, buses, trucks
- Pedestrians: people detection
- Traffic signs: stop signs, traffic lights
- Ego lane: current driving lane
- Adjacent lanes: neighboring lanes
- Road boundaries: road edges
- Drivable area: safe driving regions
- Emergency braking for critical situations
- Adaptive speed control based on safety assessment
- Object avoidance steering adjustments
- Continuous lane center tracking
CARLA Connection Issues:
- Ensure CARLA simulator is running
- Check host/port configuration
Performance Issues:
- Use smaller YOLO model (yolov8n)
- Enable GPU acceleration
- Reduce image resolution
Detection Issues:
- Verify model files are downloaded
- Check lighting conditions in CARLA
- Adjust confidence thresholds
The system is modular and extensible. Key files:
src/lane_detection.py
: Computer vision pipelinesrc/vehicle_controller.py
: Vehicle control logicsrc/carla_connector.py
: CARLA interfacesrc/main.py
: Main application loop
This is a work in progress implementing modern computer vision techniques for autonomous driving research and development.