# 正確安裝STRIVE完整環境 Setting Up STRIVE Environment This guide provides step-by-step instructions to set up the STRIVE environment, ensuring compatibility and successful installation. STRIVE is a codebase for the CVPR 2022 paper "Generating Useful Accident-Prone Driving Scenarios via a Learned Traffic Prior." ## Prerequisites - Ubuntu 18.04 - Python 3.6 - CUDA 11.1 ### Important Note !!! Before installing the requirements, you **must** install `opencv-python==4.6.0.66`. Failure to do so may lead to issues with the nuScenes devkit and incorrect OpenCV installation, preventing successful setup. ## Steps to Set Up the Environment ### 1. Create and Activate a Virtual Environment First, create a virtual environment named `strive_env` and activate it: ```bash python3 -m venv strive_env source strive_env/bin/activate ``` ### 2. Update Pip Upgrade pip to ensure you have the latest version: ```bash pip install --upgrade pip ``` ### 3. Install Numpy Install numpy with the specified version: ```bash pip install numpy==1.19.5 ``` ### 4. Install OpenCV Install the specific version of OpenCV to avoid compatibility issues: ```bash pip install opencv-python==4.6.0.66 ``` ### 5. Install Remaining Dependencies Install the remaining dependencies from the `requirements.txt` file. Note that the exact versions in the requirements file are crucial for compatibility: ```bash pip install -r requirements.txt ``` ## Download and Prepare the nuScenes Dataset Download the nuScenes dataset (only the metadata is required) and the map expansion. Place them in a directory named `data` following the structure below(this is the correct file structure): ``` data/nuscenes/trainval |______ v1.0-trainval |___________*.json |______ maps |___________ basemap |___________ expansion |___________ prediction |___________ *.png ``` ## Download Technique !! Download MiniSet, Map expansion1.3 and or choose between whole data (25gb up) can make the dataset structure complete. ## Training and Testing the Traffic Model ### Training To train the traffic model from scratch on the car and truck categories, run: ```bash python src/train_traffic.py --config ./configs/train_traffic.cfg ``` ### Testing Evaluate performance and visualize samples after training: ```bash python src/test_traffic.py --config ./configs/test_traffic.cfg --ckpt path/to/model.pth ``` ## Further Information For more information and results, check out the [project page](https://nv-tlabs.github.io/STRIVE/). ## Contact bob020416cs.13@nycu.edu.tw