Your browser doesn't support speech here. You can still read everything, or try Chrome, Edge or Safari.
Course 7 of 11 · Intermediate → Advanced
Self-Driving Cars
Build an autonomous car and test it in simulation. Vehicle models and control, sensors, lane and object detection, segmentation and depth trained from scratch on simulator data, localisation and sensor fusion, path planning, reinforcement learning and safety testing, all in a driving simulator in your browser.
How this course works
Welcome
- Level: Intermediate → Advanced. You need: Python, Maths for AI and Machine Learning. Deep Learning and Computer Vision for the perception topics.
- No car or hardware needed: everything is tested in a driving simulator that runs in the page. You write the car's brain in Python, press Run and watch it drive.
- Before you start: Python, Maths for AI and Machine Learning. The perception topics also use Deep Learning and Computer Vision.
- Pick a topic from the sidebar; they go in order. Press ▶ Play this topic to hear a lesson read aloud, or 🔊 Explain on one section.
- Topics climb from Beginner to Intermediate · Maths, Advanced and Code; use the Show chips to hide levels you don't need. Most have a Watch it animation, Try it demos and runnable code examples, and every topic ends with a quiz: answer it to mark the topic done ✓.
- Stuck? Press 💬 Ask the AI tutor: a small free AI model that runs on your own device and answers from the course.
- Progress is saved in this browser and shared across all the courses on this site.
Learning path: 🐍 Python → 🗄️ SQL & Databases → ∑ Maths for AI → 📈 Machine Learning → 🧠 Deep Learning → 👁️ Computer Vision → 🚗 Self-Driving Cars → 💬 Natural Language Processing → ✨ Generative AI & LLM Apps → 🚀 Flask & Deployment → 🔬 Becoming an AI Researcher
Part 1: How a self-driving car works
1. Self-Driving Cars: Start HereHow a self-driving car works, from sensors to the steering wheel; the levels of automation; why the industry tests in simulation; the simulator you will use all course; and the full course plan.2. The Simulator: Run Your CodeWhere your code goes and how the simulator runs it: write control(car) in Python, press Run, and watch your car drive a lap. In this page, with nothing to install, or on your own computer with the same results.3. How a Car Moves: The Bicycle ModelDescribe a car with a few numbers, predict how it moves with the kinematic bicycle model, see why steering angle sets the turning radius, and learn the limits that matter for control: steering rate, grip and understeer.4. Control: PID SteeringFeedback control from first principles: measure the error, steer to reduce it, and tune the proportional, derivative and integral terms by watching the car. Then write your own PID controller in Python and drive a full lap.5. Better Steering: Pure Pursuit, Stanley & MPCControllers that use the geometry of the road ahead: pure pursuit chases a point on the path, Stanley corrects heading and offset at the front axle, and speed planning slows the car before bends. Then an introduction to model predictive control.
Part 2: Seeing the road
6. Sensors and the Camera ModelWhat each sensor on a self-driving car measures and where it fails, how a camera turns the 3D world into pixels (the pinhole model, intrinsics and extrinsics), the car's camera in the simulator with perfect labels, and turning the camera view into a bird's-eye view.7. Recording a Labelled Driving DatasetWhy self-driving teams use simulated data, what labels a perception model needs, recording your own dataset in the simulator with weather and steering variety, and loading it in Python. Every model you train in Part 2 is trained on data you record here.8. Finding Lanes the Classic WayA complete lane finder without machine learning: a bird's-eye view, colour thresholds for white and yellow paint, a histogram and sliding windows to trace each line, and a curve fit. Then drive a full lap using only the camera, and find where hand-written rules break.9. Traffic-Light Classifier: Your First CNN from ScratchBuild the perception step that reads traffic lights: crop each light from your recorded data, design a small convolutional network, train it from scratch in PyTorch with class weights and augmentation, check it by weather, export it, and load it into the simulator so the car stops at red lights using your network.10. Object Detection: Cars, Pedestrians and LightsFind every car, pedestrian and traffic light in the camera image with one network: grid-based detection in the style of YOLO, building targets from your labelled boxes, a loss with four parts, non-maximum suppression, precision and recall per class, and running your trained detector live in the simulator.11. A U-Net for Lanes, Road and DistanceOne network that labels every pixel (own lane, other lane, markings, vehicles, pedestrians, lights) and estimates how far away each pixel is: semantic segmentation, the encoder–decoder and its skip connections, class weights for rare pixels, IoU per class, depth from one camera, and driving laps steered by your own U-Net.12. Tracking Objects Between FramesDetections are a fresh guess every frame; driving needs objects that persist, with an identity and a velocity. Match detections to tracks with IoU, smooth and predict them with a constant-velocity Kalman filter, survive missed frames, and estimate the distance and time to collision with the car ahead.13. Driving by Imitation: Camera to SteeringSkip lanes and boxes entirely: train a network that maps the camera image straight to a steering angle by copying a driver (behaviour cloning, as in NVIDIA's PilotNet). See why a low test error is not enough, why the car drifts off the road, and how recovery data fixes it.14. Robustness and Running Models LiveA model that works on your test set can still fail on the road. Measure performance by condition, understand the gap between simulation and reality, fine-tune instead of starting over, and make a model fast and small enough for a car: the time budget, 8-bit weights and what they cost.
Part 3: Knowing where you are
15. Kalman Filters: Combining Uncertain SensorsA car must know where it is to within a few tens of centimetres, but GPS is metres off and dead reckoning drifts. Learn how the Kalman filter combines a motion prediction with noisy measurements, step by step from one dimension to the extended Kalman filter, and use it to track the car around the course, through a tunnel with no GPS.16. Particle Filters: Localising Against a MapWhen the car could be in several places at once, a single bell curve is not enough. Represent the belief with thousands of guesses, move them, weigh them by how well they explain what the car sees, and resample. Localise from scratch against a map of known poles, and recover when the car is "kidnapped".17. Sensor Fusion and MappingFuse GPS, motion sensors and landmark sightings in one filter, then let the car build its own map with a 2D lidar: occupancy grids and log-odds, why a map is only as good as the positions used to build it, and how SLAM and loop closure solve both at once.
Part 4: Deciding what to do
18. Path Planning: A*, Hybrid A* and ParkingHow a car finds a way from here to there around obstacles: search on a grid with Dijkstra and A*, why heuristics make it fast, why grid paths are not drivable, and hybrid A*, the planner that parked Stanford's car in the DARPA Urban Challenge, finding real manoeuvres with reversing into a bay and parallel parking.19. Behaviour Planning and Predicting Other Road UsersDecide what to do in traffic: follow the car ahead at a safe time gap with the Intelligent Driver Model, choose when a lane change is worth it and safe with MOBIL, organise decisions with a state machine, predict where other cars will be, and brake in an emergency using time to collision.20. Reinforcement Learning: Learning to Drive by Trial and ErrorInstead of copying a driver, let the car learn from rewards: states, actions and rewards, Q-learning and exploration, train an agent in your browser that learns to keep its lane, then train a deep Q-network to drive in motorway traffic in Colab, and see why rewards are hard to get right.
Part 5: Making it safe
21. Safety and Testing: How Do You Know It Is Safe?Why test driving alone can never prove a self-driving car is safe, how teams test instead (simulation, scenarios, closed tracks, shadow mode), how to search for failures rather than wait for them, what the main safety standards ask for, safety rules you can check at run time, and how the law is changing.22. Capstone: Your Self-Driving Car Against 20 ScenariosPut the whole course together. Write the decision-making and control of a complete self-driving car in Python, driving on perception outputs like the ones your networks produce, and test it against 20 scenarios: three tracks, four kinds of weather, traffic, traffic lights, pedestrians, a broken-down car, a car pulling out and a runner in the road. Pass all 20.23. Your Complete Car: The Full Code, and Driving in CARLADownload your whole self-driving car as one Python project: your drive() function, your perception networks, a camera model, lane finding, detection, traffic-light reading and tracking, in plain NumPy. Check it on your recordings, then put it in CARLA, a full 3D driving simulator, and retrain your networks on CARLA's images.
Part 6: Modern perception (advanced)
24. Real Datasets, Transfer Learning and mAPMove from the simulator to real roads: the public driving datasets (KITTI, BDD100K, nuScenes, Waymo), measuring a detector properly with average precision and COCO mAP, and why starting from a pretrained network beats training from scratch. Fine-tune a pretrained YOLO on your recordings, then on KITTI.25. Depth from Cameras: Stereo and Self-SupervisedHow far away is everything? Measure depth with two cameras by matching pixels, see why the error grows with the square of the distance, discover how a network can learn depth from a single camera with no depth labels at all, and test a depth foundation model.26. Lidar and 3D Object DetectionA lidar measures distance with lasers, millions of points a second. Explore a simulated 32-laser lidar, detect objects the classic way (remove the ground, cluster, fit boxes), see where that breaks, then detect cars and pedestrians with a learned bird's-eye-view network, and train a PointPillars-style detector on KITTI's real lidar.27. Bird's-Eye View: Many Cameras and Sensor FusionModern self-driving cars fuse many cameras into one map seen from above. Mount four cameras on the car, see why flat-ground projection smears every car, lift pixels into 3D with depth as Lift-Splat-Shoot does, paint lidar points with camera classes, and train Lift-Splat-Shoot in Colab on four-camera recordings.28. Learning to Predict Other Road UsersWhere will that car be in 3 seconds? Learn why one predicted path is not enough, train networks that predict several possible futures with probabilities, measure them with minADE, minFDE and miss rate, and build a transformer predictor in Colab.29. The Frontier: End-to-End, World Models and Vision-LanguageWhere self-driving research is heading: whole stacks trained end to end, world models that imagine the future, vision-language models that explain a scene in words, and the problem underneath them all, knowing when the network does not know. Measure uncertainty yourself and question a vision-language model about a road scene.
When you finish