Learning to Drive by Watching YouTube Videos: Action-Conditioned Contrastive Policy Pretraining

Qihang Zhang, Zhenghao Peng, Bolei Zhou

Abstract

Deep visuomotor policy learning, which aims to map raw visual observation to action, achieves promising results in control tasks such as robotic manipulation and autonomous driving. However, it requires a huge number of online interactions with the training environment, which limits its real-world application. Compared to the popular unsupervised feature learning for visual recognition, feature pretraining for visuomotor control tasks is much less explored. In this work, we aim to pretrain policy representations for driving tasks by watching hours-long uncurated YouTube videos. Specifically, we train an inverse dynamic model with a small amount of labeled data and use it to predict action labels for all the YouTube video frames. A new contrastive policy pretraining method is then developed to learn action-conditioned features from the video frames with pseudo action labels. Experiments show that the resulting action-conditioned features obtain substantial improvements for the downstream reinforcement learning and imitation learning tasks, outperforming the weights pretrained from previous unsupervised learning methods and ImageNet pretrained weight.

Introduction

Deep visuomotor policy learning aims to map raw visual observations directly to actions, showing great promise in autonomous driving. However, these models typically require extensive online interaction or massive amounts of expert demonstrations, both of which are costly. While vast quantities of unlabeled driving videos exist on platforms like YouTube, they lack the action labels necessary for standard supervised learning. Furthermore, generic unsupervised features often fail to capture the subtle, policy-relevant cues—such as traffic lights or lane markings—essential for driving.

Overview of the ACO pipeline, illustrating the transition from uncurated real-world videos to pretrained policies for downstream tasks.

Methodology

The researchers propose Action-Conditioned Contrastive Policy Pretraining (ACO), a three-stage pipeline to bridge this gap.

  1. Inverse Dynamics Model (IDM): A small model is first trained on a labeled dataset (NuScenes) to predict steering actions between consecutive frames. By using optical flow as input, the IDM learns to predict actions while remaining robust to visual variations like lighting and weather.
  2. Pseudo-Labeling: This IDM is applied to over 120 hours of uncurated YouTube driving footage to generate "pseudo-action" labels for every frame.
  3. Action-Conditioned Contrastive Learning (ACO): The core framework uses these labels in a dual-objective contrastive learning setup. It combines standard Instance Contrastive Pairs (ICP) to learn visual discriminability with a novel Action Contrastive Pairs (ACP) objective. ACP pulls together representations of different images if their predicted pseudo-actions are similar, forcing the model to learn functionally relevant features.
The ACO architecture details the dual-branch approach, utilizing both instance-based and action-conditioned contrastive losses to refine policy representations.

Datasets

  • YouTube Driving Dataset: A new collection of 134 videos (1.3 million frames) from 68 cities globally, covering diverse environments.
  • NuScenes: Used for initial IDM training.
  • CARLA Simulator: Used for downstream evaluation of Imitation Learning (IL) and Reinforcement Learning (RL).
  • CULane: Used to test feature generalizability for lane detection.

Key Results

ACO demonstrates significant performance gains across various benchmarks:

  • Imitation Learning: In the CARLA simulator, ACO achieved a 96% success rate, significantly outperforming ImageNet-pretrained weights (90.7%) and standard MoCo (80.7%).
  • Data Efficiency: ACO maintained a 30.7% success rate with only 10% of training data, whereas baseline models failed completely.
  • Reinforcement Learning: Using ACO-pretrained weights for PPO training led to a 7% improvement in route completion over other baselines.
  • Feature Visualization: t-SNE visualizations confirm that ACO features naturally cluster by driving action (e.g., left turn vs. straight), whereas standard unsupervised features do not.

Discussion and Future Work

While effective, the current model assumes a single action per frame, which may not capture the multi-modal nature of driving, such as a driver choosing between turning or going straight at a junction. Future work aims to incorporate action distributions and explore ways to reconcile geometric augmentations (like horizontal flipping) with action-conditioned learning, as flipping an image can contradict its original action label. Finally, bridging the sim-to-real gap by testing these policies on real-world robotic platforms remains a key next step.

Summary updated

BibTeX
@inproceedings{zhang2022learning,
  author = {Qihang Zhang and Zhenghao Peng and Bolei Zhou},
  title = {{Learning to Drive by Watching YouTube Videos: Action-Conditioned Contrastive Policy Pretraining}},
  booktitle = {European Conference on Computer Vision},
  year = {2022},
  url = {https://openreview.net/forum?id=-ufuNgvcmDoa},
}
Figure