---
# System prepended metadata

title: Acceleration of Scenario Generation in CARLA

---

# Acceleration of Scenario Generation in CARLA

## The participants
**戴嬿玲 310554008
鮑邦元 310553052
黃冠倫 310551039**
## Introduction/motivation
The data collection of road scneario is usually conducted naturalistically. The problem of such way is that it is hard to collect data with more critical situaions due to the nature of long-tailed distribution in real life. Thus, more works tend to generate safety-critical scenarios using generative model.
![](https://i.imgur.com/Oc7OWPR.png =100%x)

Some works apply evolutionary algorithm to approach more safety-critical data. A powerful and efficient sampler is usually required in this way becase we would need to sample hundreds of thousand samples in one experiment.
- ***Evolutionary Algorithm only takes samples we care.***
![](https://i.imgur.com/QRcrDGz.png =50%x)

Here, we will use the framework in [[1]](https://arxiv.org/abs/1811.00145) as method of safety-critical scenario generation and choose CARLA simulator as our scenario rendering software. CARLA is a high-fidelity simulator and is able to render traffic scenarios. To render a scenario in CARLA takes at least around few seconds. If we want to scale up to hundreds of thousand scenario samples, CARLA simulator would take tons of months to generate samples.
![](https://i.imgur.com/SXZSVQM.png =40%x)




## Statement of the problem

- Accelertating scenario generation in CARLA simulator.
    We would like to accelerate the redering process in CARLA simulator whether using a parallel rendering or accelerating the rendering process.

## Proposed approaches
- Parallel Sampler
![](https://i.imgur.com/DGJQ2FJ.png)

    - Optimizer: to send the scenario distribution to sampler, to receive the collected result of scenarios
    - Sample Distributer: to distribute parameterized scenarios
    - Scenario Runner: to render scenarios with CARLA, to send the scenarios' result
    - Data Collector: to collect results from Scenario Runner, to send batch result to Optimizer

## Language selection
- Language: Python
- Libaray:ZMQ (original paper)
    - ZMQ: An open-source universal messaging library
![](https://i.imgur.com/medFRyx.png =20%x)


## Related work
- Possible Solutions
    We look for possible solutions in ZMQ library.
    - Divide and Conquer - Parallel Pipeline
     ![](https://i.imgur.com/Fr1svug.png)

    - Load Balancing Broker
    ![](https://i.imgur.com/eGzMwvS.png)


## Statement of expected results
- Speedup at least 10x or more.
    We would like to make the whole generation process take from months to days to even hours.
![](https://i.imgur.com/PJjmkMm.png =20%x)
<br/><br/>

## A timetable
| Timeline | Plan |
| -------- | ---- |
| week 1 | Profiling |
| week 2 | Implementation |
| week 3 | Experiment |
| week 4 | Analysis |

## References
[1] [Scalable End-to-End Autonomous Vehicle Testing via Rare-event Simulation](https://arxiv.org/abs/1811.00145)
[2] [ZMQ documentation](https://zguide.zeromq.org/)


