Simple 2D dataset of bouncing balls
Install the python dependancies (pip install -r requirements.txt
) and imagemagick
To generate a dataset of N videos, run:
python src/generate_dataset.py N my_dataset_name
This will create a directory my_dataset_name
with a directory per simulation:
.
└── my_dataset_name
├── config.yaml
├── 0000
│ ├── config.yaml
│ ├── positions.csv
│ ├── frame_000.png
│ ...
│ ├── frame_099.png
│ └── simulation.gif
....
└── N
└── ...
Each sequence contains a config.yaml
file recording the simulation parameters.
Made of 3 components:
-
Script which generates a dataset of unique simulation parameters (
generate_dataset.py
). Editparameter_space
to define which parameters the dataset is created over. -
Script which takes in the simulation parameters (radius,speed,initial position, etc..), and calculates the position of the ball(s) at each timestep. (
simulate.py
) -
Script which takes the position and draws the ball(s) as an image
E.g.
./drawCircle.sh 10 50 frame_0.png
will draw a circle at (10,50)(images are 64x64)
There are also optional utility scripts to apply random obscuring objects (random_masking.sh
), and random blurs (random_blurring.sh
) to a generated dataset.
- White circle on black background
- Ball bounces off image edges
- Vary physical properties:
- Starting position
- Ball radius
- Initial direction
- Initial speed
- Gravity
- Ball mass (only relevent for ball-ball collisions)
- Random ball intensity jitter
- Random ball colour/background color
- Add random ball jitter
- Add gausian blur
- Add multiple balls