Skip to main content

Simian

A synthetic data generator for video caption pairs.

docs tests docker PyPI version License stars

Simian creates synthetic data that is usable for generative video and video captioning tasks. The data consists of videos and captions. The videos are generated using Blender, a 3D modeling software.

🖥️ Setup

NOTE: Simian requires Python 3.11.

  1. Install dependences:
pip install -r requirements.txt
  1. Download the datasets:
./scripts/get_data.sh
  1. [OPTIONAL] If you're on a headless Linux server, install Xorg and start it:
sudo apt-get install xserver-xorg -y && \
sudo python3 scripts/start_x_server.py start

📸 Usage

Generating Combinations

python3 -m simian.combiner --count 1000 --seed 42

Generating Videos or Images

Configure the flags as needed:

  • --width and --height are the resolution of the video.
  • --combination_index is the index of the combination to render.
  • --output_dir is the directory to save the rendered video.
  • --hdri_path is the directory containing the background images.
  • --start_frame and --end_frame are the start and end frames of the video.
  • --animation_length is the total number of frames, this as a result controls the how fast the animation will appear.
  • --images adding this will output images instead of video at random frames. Creates multiple images per combination of varying sizes

Or generate all or part of the combination set using the batch.py script:

Generating Videos or Images

To generate a video(s):

python3 -m simian.batch --start_index 0 --end_index 1000 --width 1024 --height 576 --start_frame 1 --end_frame 3 --animation_length 120

To generate an video(s) with your own blend file:

python3 -m simian.batch --start_index 0 --end_index 1000 --width 1024 --height 576 --start_frame 1 --end_frame 3 --animation_length 120 --blend <absolute path to blend file>

To generate an image(s):

python3 -m simian.batch --start_index 0 --end_index 1000 --width 1024 --height 576 --start_frame 1 --end_frame 65 --animation_length 120 --images

You can also generate individually:

# MacOS
python -m simian.render

# Linux
python -m simian.render

## Kitchen sink
python -m simian.render -- --width 1920 --height 1080 --combination_index 0 --output_dir ./renders --hdri_path ./backgrounds --start_frame 1 --end_frame 65

Clean up Captions

Make captions more prompt friendly.

NOTE: Create a .env file and add your OpenAI API key

python3 scripts/rewrite_captions.py

Distributed rendering

Rendering can be distributed across multiple machines using the "simian.py" and "worker.py" scripts.

You will need to set up Redis and obtain Huggingface API key to use this feature.

Set Up Redis

You can make a free Redis account here.

For local testing and multiple local workers, you can use the following script to set up a local instance of Redis:

scripts/setup_redis.sh

Huggingface API Key

You can get a Huggingface API key here.

Now, start your workers

export REDIS_HOST=<myhost>.com
export REDIS_PORT=1337
export REDIS_USER=default
export REDIS_PASSWORD=<somepassword>
export HF_TOKEN=<token>
export HF_REPO_ID=<repo_id>
celery -A simian.worker worker --loglevel=info

You can also build and run the worker with Docker

# build the container
docker build -t simian-worker .

# run the container with .env
docker run --env-file .env simian-worker

# run the container with environment variables
docker run -e REDIS_HOST={myhost} -e REDIS_PORT={port} -e REDIS_USER=default -e REDIS_PASSWORD={some password} -e HF_TOKEN={token} -e HF_REPO_ID={repo_id} simian-worker

Finally, issue work to your task queue

python3 -m simian.distributed --width 1024 --height 576

If you want to use a custom or hosted Redis instance (recommended), you can add the redis details like this:

export REDIS_HOST=<myhost>.com
export REDIS_PORT=1337
export REDIS_USER=default
export REDIS_PASSWORD=<somepassword>

To run all tests

python3 -m simian.tests.__run__

To run tests look into the test folder and run whichever test file you want

python3 -m simian.tests.object_test

📁 Datasets

We are currently using the following datasets: Objaverse

Backgrounds are loaded from: Poly Haven

🦝 Contributing

We welcome contributions! We're especially interested in help adding and refining datasets, improving generation quality, adding new features and dynamics and allowing the project to meet more use cases.

How to contribute

  1. Check out the issues here.
  2. Join our Discord here.
  3. Get in touch with us so we can coordinate on development.
  4. Or, you know, just YOLO a pull request. We're pretty chill.

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

If you use it, please cite us:

@misc{Simian,
  author = {Raccoon Research},
  title = {Simian: A Synthetic Data Generator for Video Caption Pairs},
  year = {2024},
  publisher = {GitHub},
  howpublished = {\url{https://github.com/RaccoonResearch/simian}}
}

Contributors ✨

All Contributors

This project follows the all-contributors specification. Contributions of any kind welcome!

Sponsors

Raccoon Research is sponsored by the following organizations:

Interested in working with us? Join our Discord or post an issue to get in touch.

Metadata

Release files for simian3d 0.0.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simian3d 0.0.14
File Size Uploaded
simian3d-0.0.14.tar.gz 38.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simian3d 0.0.14
File Interpreter ABI Platform
simian3d-0.0.14-py3-none-any.whl Python 3 none any Details

Total release size: 76.7 kB

Release files / simian3d-0.0.14.tar.gz

Download URL simian3d-0.0.14.tar.gz
Size 38.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2f5dad267ffc063c6f8d7902f03036fed04a86e266ef30692f2e6c5aab9bfede
BLAKE2b-256 checksum
How to use checksums
1ab0cfe8fdf68b50d9c5c26ce31550cbac03f6c4cca3e2584b0d54a184267f2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.19

Release files / simian3d-0.0.14-py3-none-any.whl

Download URL simian3d-0.0.14-py3-none-any.whl
Size 38.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e140e2fb2f93bdd55b240955485a2f9ddbe5a65f438223ad87d126fc7d4ee457
BLAKE2b-256 checksum
How to use checksums
0d752ce7b00da85c5482f8112d6bafcd19bcd664ab431540071f9c35b6e67367
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.19

Release history Release notifications | RSS feed

This release

0.0.14 This release

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page