DriveGAN_code: A Two-Stage Neural Driving Simulator You Can Actually Run
Code release for DriveGAN (CVPR 2021)
At a glance
- What is it?
- DriveGAN_code is the PyTorch release for the CVPR 2021 DriveGAN paper, a controllable neural simulator that learns to render driving scenes in pixel space. The code is usable but the two-stage training pipeline and licensing restrictions demand careful planning.
- Who is it for?
- Adopt DriveGAN_code if you are a researcher or engineer who needs a fully differentiable neural simulator for driving scenes and can accept a two-stage training pipeline with pretrained checkpoints. Do not adopt it for commercial work, because the NVIDIA Source Code License and the CC BY-NC 4.0 dataset prohibit commercial use.
- Can I use it commercially?
- Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
- Is it still maintained?
- Probably not. The repository last received commits 61 months ago, on November 11, 2021.
- What is it written in?
- Mainly CSS, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 22, 2026, and from our analysis. They are not legal advice.
Star history
- nv-tlabs/DriveGAN_code100 ★ · +0
| Repository | 2026-08-18 | 2026-11-22 |
|---|---|---|
| nv-tlabs/DriveGAN_code | 100 | 100 |
0 Stars in the last 96 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
What DriveGAN Solves and Who It Is For
The project targets a specific pain point in robotics and autonomous driving research: hand-crafted simulators are expensive to build and cannot easily capture the full visual complexity of real roads. DriveGAN learns to simulate a dynamic environment directly in pixel space, from unannotated sequences of frames and their associated action pairs. The key claim is controllability without supervision. The model disentangles components such as steering, weather, and the location of non-player objects, so an agent can change those factors at inference time. This is aimed at researchers who need a differentiable simulator for training or verifying driving policies, not at production teams looking for a drop-in replacement for CARLA or similar tools. The code release is a research artifact, and the README frames it as a companion to the CVPR 2021 paper.
The Two-Stage Architecture: VAE-GAN Then Dynamics Engine
The repository implements a two-stage pipeline. Stage 1 is a VAE-GAN, adapted from the stylegan2-pytorch implementation. It learns a latent representation of driving scenes. The README calls this stage 'VAE-GAN' and you train it on raw image data, then use the learned model to encode the dataset into a compressed form. Stage 2 is the Dynamics Engine, which takes the encoded data and learns how the latent space changes in response to actions. The two stages are trained separately, and you can skip Stage 1 if you download precomputed encoded data and a pretrained VAE-GAN checkpoint. This separation is a practical choice: it lets you reuse the VAE-GAN for different dynamics models, but it also doubles the training effort if you start from scratch. The data flow is clear from the scripts: train.sh for Stage 1, encode.sh to produce encoded data, then train.sh again for Stage 2 with a different argument set.
Getting It Running: Commands and Config Keys
The README gives concrete commands. Clone the repository, then install dependencies with pip install -r requirements.txt. For Stage 1, download {0-5}.tar.gz from the provided Google Drive link, extract them, and rename the extracted directories to data1 through data6. The command is tar -xvzf {0-5}.tar.gz followed by mv 6405x data{1-6}. Then run ./scripts/train.sh with a comma-separated list of data directories. The script references a log_dir, which you can monitor with TensorBoard. After training, run ./scripts/encode.sh with the path to the saved model and the data directories. For Stage 2, either use the precomputed encoded_data.tar.gz or run train.sh again. To play with a trained model, run ./scripts/play/server.sh with the dynamics engine path, a port, and the VAE-GAN path. The server runs on localhost, and you control the vehicle with w, a, s, d keys. The README also links to a Colab notebook contributed by @virtualramblas, which is useful if you do not have a local GPU setup.
The Interactive Playback and Control Interface
One of the most distinctive features is the browser-based interface. After starting server.sh, you navigate to localhost:{port} and can steer a vehicle in a simulated scene. The controls are simple: w speeds up, s slows down, a steers left, d steers right. There are also buttons for changing content, such as weather or object placement. Refreshing the webpage samples a new scene. This is a low-friction way to test the model's controllability without writing evaluation scripts. The README notes it was tested on Chrome, so other browsers may not work. The interface relies on Semantic UI, which is a straightforward dependency, but it is a web stack that adds a layer of complexity if you plan to integrate the simulator into a headless training loop. The server approach is a demo, not a Python API, so programmatic control would require reading the server code.
Limitations and Failure Modes
The most obvious limitation is the license. The codebase and trained models are under the NVIDIA Source Code License, and the dataset is CC BY-NC 4.0. That means non-commercial use only for the data, and the NVIDIA license has its own restrictions. For any commercial robotics work, this is a hard stop. Another limitation is the training pipeline's complexity. The README says the code is tested on Ubuntu 18.04 and Python 3.6.9, which is an old environment. Modern Python versions may break dependencies, and you will likely need to adjust requirements. The data is hosted on Google Drive, which can be unreliable for large downloads. The README does not mention GPU memory requirements, but StyleGAN2-based models are known to be memory-hungry, so a single consumer GPU may not suffice. Finally, the model operates in pixel space, which means it is not a physics-based simulator. It can hallucinate unrealistic scenes, especially for edge cases like rare weather conditions. The paper claims high quality, but the code release does not include evaluation metrics or benchmarks to verify that on your own data.
Alternatives and How They Differ
The most direct alternative is CARLA, which is mentioned in the README as the source of the dataset. CARLA is a hand-crafted simulator that provides a physics engine, sensor models, and a Python API. DriveGAN is a learned simulator that generates images directly, without an explicit physics model. The difference is fundamental: CARLA gives you ground-truth state and deterministic control, while DriveGAN is stochastic and differentiable. If you need precise control over vehicle dynamics or sensor noise, CARLA is the right choice. If you need a fully differentiable simulator for end-to-end learning, DriveGAN is a research option. Another alternative is to use the StyleGAN2 codebase directly and train your own latent space, but that would require implementing the dynamics engine yourself. The README credits StyleGAN2 for the VAE-GAN, so you can think of DriveGAN as a specialized wrapper around that architecture.
Maintenance and Upgrade Costs
The repository was last pushed at an unknown date, and there are no recent releases listed. The README does not mention any ongoing maintenance. This is a CVPR 2021 code release, so you should expect it to be a snapshot, not a living project. The license file includes multiple third-party licenses: StyleGAN2, Lpips, and Semantic UI. You will need to keep those licenses intact if you redistribute the code. Upgrading to newer PyTorch versions may require changes to the custom ops from StyleGAN2. The code uses custom CUDA operations, which are known to be sensitive to PyTorch version changes. Budget time for dependency pinning and potential recompilation. The dataset is fixed, so if you want to train on your own data, you will need to modify the data loading scripts, which are not documented in the README. The maintenance cost is high relative to the feature set, but that is typical for research code.
Editorial conclusion
Adopt DriveGAN_code if you are a researcher or engineer who needs a fully differentiable neural simulator for driving scenes and can accept a two-stage training pipeline with pretrained checkpoints. Do not adopt it for commercial work, because the NVIDIA Source Code License and the CC BY-NC 4.0 dataset prohibit commercial use. Before you start, verify that your Python version is compatible (the README tests on 3.6.9), confirm you have enough GPU memory for the StyleGAN2-based VAE-GAN, and check whether the Google Drive links are still active. The code is a research artifact, not a production tool, so budget time for debugging and adapting to your own data.
Frequently asked questions
What is DriveGAN?
A high quality neural simulator that learns to simulate a dynamic environment directly in pixel space from unannotated sequences of frames and their action pairs. It achieves controllability by disentangling components without supervision, and because it is differentiable it supports re-simulation of a video sequence with different actions.
What are the two training stages in DriveGAN_code?
Stage one is a VAE-GAN that learns a latent representation of driving frames, after which the dataset is encoded with that model. Stage two trains the dynamics engine on the encoded data rather than on pixels. Either stage can be skipped by downloading the corresponding checkpoint instead.
Can I skip training and just run DriveGAN_code?
Yes. The README says to download the simulator checkpoint and the VAE-GAN checkpoint, then run the play server script with the dynamics engine path, a port and the VAE-GAN model path, and open that port in a browser.
What are the controls in the DriveGAN web interface?
The keyboard controls are w to speed up, s to slow down, a to steer left and d to steer right. There are additional buttons for changing scene contents, and refreshing the page samples a new scene. The interface was tested on Chrome.
What licence applies to the DriveGAN code and data?
The codebase and trained models are distributed under the NVIDIA source code licence, while the dataset, which is derived from the Carla simulator, is distributed under a Creative Commons Attribution-NonCommercial 4.0 International licence. Four further licence files at the repository root cover code borrowed from other projects.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/nv-tlabs-drivegan-code)Star history chart for your README
[](https://hysenlabs.com/projects/nv-tlabs-drivegan-code)Was this useful?