CARLARain is an autonomous driving simulator framework that supports the simulation of rainy scenes in complex lighting environments. Based on CARLA, it realizes the environmental simulation, vehicle simulation, and pedestrian simulation of driving scenarios. In combination with HRIGNet and CRIGNet, it introduces controllable and realistic rainy scene simulation in complex lighting environments. This framework can build a rich rainy scene simulation training environment for autonomous driving visual perception algorithms, covering diverse time periods and lighting conditions, and meeting the requirements of multiple tasks such as semantic segmentation, instance segmentation, depth estimation, and object detection in autonomous driving scenarios.
configs
:Configuration filesCarRain
:CARLA client code, used to obtain the background RGB images, semantic segmentation maps, instance segmentation maps, depth maps, and object bounding boxes of CARLA simulationsCRIGNet
:CRIGNet code, used to generate low-resolution rain streak imagesRainControlNet
:RainControlNet code, used to expand low-resolution rain streak images into high-resolution rain streak imagesHRIGNet
:HRIGNet code, used to generate rainy scene images based on background RGB images and rain streak imagesdata
:Output data path
- CARLA: Download the CARLA server, create a new
carla
conda environment and configure the CARLA client library. - ControlNet:
cd RainControlNet && conda env create -f environment.yaml
- HRIGNet:
cd HRIGNet && conda env create -f environment.yaml
- All model weight files can be obtained here: BaiduCloud (Extraction code: i4zi)
- CRIGNet model weights: Download
CRIGNet/00000-crig_fastgan_g1w0.5_rainTrainL_256-FastGAN
and extract it toCRIGNet/log_raintrainl_256
- RainControlNet model weights: Download
RainControlNet/crig_hint256-128_out512_4xgrad_1e-4-2024-10-05-T07-21-55
and extract it toRainControlNet/logs
- HRIGNet model weights: Download
HRIGNet/2023-10-19T19-31-52_blender-gdm-rainlayer-hw512-f4-em3
and2023-10-21T21-50-57_blender-hrig-rainlayer+masked-gdm512-hw512-hybrid-unet128-em3
and extract them toHRIGNet/logs
- Refer to
configs/seqTest.yaml
, and for detailed explanations of the content, see Docs/config.md
-
Run the CARLA server:
- In the CARLA directory, execute
./CarlaUE4.sh -RenderOffScreen -quality-level=Epic
- Configure
serverIP
andserverPort
inCarRain/config.py
- In the CARLA directory, execute
-
Activate the conda environment:
conda activate carla
-
Run the CARLA client to obtain background RGB images, semantic segmentation maps, instance segmentation maps, depth maps, and object bounding boxes:
python CarRain/main.py -c configs/seqTest.yaml
-
Obtain object detection data:
python CarRain/isToDetect.py -c configs/seqTest.yaml
-
Obtain videos:
python CarRain/seqToVideo.py -c configs/seqTest.yaml
You can choose to obtain rain streak images as rain layer masks using existing methods, or generate rain streak images using CRIGNet + RainControlNet provided here.
-
Existing methods:
- weather-particle-simulator:https://github.com/astra-vision/weather-particle-simulator
- Download RainMask, select the rain streak images with the desired resolution and intensity, and place them in
data/rain
-
CRIGNet + RainControlNet:
-
Use CRIGNet to obtain low-resolution rain streak images:
conda activate hrig
cd CRIGNet&&python gen_rain_mask.py -c../configs/seqTest.yaml&&cd..
-
Use RainControlNet to obtain high-resolution rain streak images:
conda activate control
cd RainControlNet&&python upscale_rain_mask.py -c../configs/seqTest.yaml&&cd..
-
- Use HRIGNet to obtain rainy images:
conda activate hrig
cd HRIGNet&&python predict_car.py -c../configs/seqTownsCombineTest.yaml
Based on CARLARain, we constructed an autonomous driving rainy - scene image dataset. We utilized eight different built-in scenarios provided by CARLA and set the time to three periods: daytime, evening, and night, to simulate driving scenarios under different lighting conditions. In terms of vehicle and pedestrian simulation, 100 vehicles and 500 pedestrians were randomly placed in each scene. The resolution of the rendered images is 2048×1024.
This dataset includes eight different scenarios. Each scenario contains three time periods, and each time period consists of 1000 frames of samples. Each sample includes RGB images of clear autonomous driving scenes, semantic segmentation images, instance segmentation images, depth images, rain-streak images, rainy RGB images, and object bounding-box data. The dataset is divided into a training set and a test set according to the scenarios. The training set includes seven scenarios, and the test set includes one scenario.
The dataset can be downloaded from CARLARain-Dataset (Extraction code: i4zi)
Dataset Type | Scene | Time | Frame | Sample Count | Image Type |
---|---|---|---|---|---|
Trainset | 7 | 3 | 1000 | 21000 | Scene RGB image, semantic segmentation image, instance segmentation image, depth image, rain streak image, rainy RGB image, object bounding box |
Testset | 1 | 3 | 1000 | 3000 |
Background | Rainy | Depth | Semantic Segmentation | Instance Segmentation |
---|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
The CARLARain code is distributed under the MIT License.
- CARLA:https://github.com/carla-simulator/carla
- HRIGNet:https://kb824999404.github.io/HRIG/
- CRIGNet:https://doi.org/10.1007/978-981-97-5597-4_8
- ControlNet:https://github.com/lllyasviel/ControlNet
- Rain Rendering:https://github.com/cv-rits/rain-rendering/