--- language: - en license: cdla-permissive-2.0 size_categories: - n<1K dataset_info: features: - name: id dtype: string - name: canvas_width dtype: int64 - name: canvas_height dtype: int64 - name: num_frames dtype: int64 - name: num_sprites dtype: int64 - name: matrix sequence: sequence: sequence: float32 - name: opacity sequence: sequence: float32 - name: texture sequence: image splits: - name: val num_bytes: 19533468.0 num_examples: 154 - name: test num_bytes: 19297578.0 num_examples: 145 download_size: 35711401 dataset_size: 38831046.0 configs: - config_name: default data_files: - split: val path: data/val-* - split: test path: data/test-* tags: - animation - sprites - graphics --- # Crello Animation ## Table of Contents - [Crello Animation](#crello-animation) - [Table of Contents](#table-of-contents) - [Dataset Description](#dataset-description) - [Dataset Summary](#dataset-summary) - [Usage](#usage) - [Supported Tasks](#supported-tasks) - [Dataset Structure](#dataset-structure) - [Data Instances](#data-instances) - [Data Splits](#data-splits) - [Visualization](#visualization) - [Dataset Creation](#dataset-creation) - [Curation Rationale](#curation-rationale) - [Source](#source) - [Initial Data Collection and Normalization](#initial-data-collection-and-normalization) - [Who are the source language producers?](#who-are-the-source-language-producers) - [Personal and Sensitive Information](#personal-and-sensitive-information) - [Considerations for Using the Data](#considerations-for-using-the-data) - [Social Impact of Dataset](#social-impact-of-dataset) - [Discussion of Biases](#discussion-of-biases) - [Other Known Limitations](#other-known-limitations) - [Additional Information](#additional-information) - [Dataset Curators](#dataset-curators) - [Licensing Information](#licensing-information) - [Citation Information](#citation-information) - [Contributions](#contributions) ## Dataset Description - **Paper:** Fast Sprite Decomposition from Animated Graphics - **Point of Contact:** [Tomoyuki Suzuki](https://github.com/tomoyukun) ### Dataset Summary The Crello Animation dataset is a collection of animated graphics. Animated graphics are videos composed of multiple sprites, with each sprite rendered by animating a texture. The textures are static images, and the animations involve time-varying affine warping and opacity. The original templates were collected from [create.vista.com](https://create.vista.com/) and converted to a low-resolution format suitable for machine learning analysis. ### Usage ```python import datasets dataset = datasets.load_dataset("cyberagent/crello-animation") ``` ### Supported Tasks Sprite decomposition task is studied in Suzuki et al., "Fast Sprite Decomposition from Animated Graphics" (to be published in ECCV 2024). ## Dataset Structure ### Data Instances Each instance has the following attributes. | Attribute | Type | Shape | Description | | ------------- | ------- | ---------------------------- | -------------------------------------- | | id | string | () | Template ID from crello.com | | canvas_width | int64 | () | Canvas pixel width | | canvas_height | int64 | () | Canvas pixel height | | num_frames | int64 | () | The number of frames | | num_sprites | int64 | () | The number of sprites | | texture | image | (num_sprites) | List of textures (256x256 RGBA images) | | matrix | float32 | (num_sprites, num_frames, 9) | List of time-varying warping matrices | | opacity | float32 | (num_sprites, num_frames) | List of time-varying opacities | NOTE: - The `matrix` is normalized to a canonical space taking coordinates in the range [-1, 1], assuming rendering with PyTorch functions (see [Visualization](#visualization) for details). - Currently, the `num_frames` is fixed to 50, which corresponds to 5 seconds at 10 fps. - The first sprite in each example is the static background, and its `matrix` and `opacity` are always the identity matrix and 1, respectively. ### Data Splits The Crello Animation dataset has val and test split. Note that the dataset is primarily intended for evaluation purposes rather than training since it is not large. | Split | Count | | ----- | ----- | | val | 154 | | test | 145 | ### Visualization Each example can be rendered using PyTorch functions as follows. We plan to add rendering example code using libraries other than PyTorch, such as [skia-python](https://kyamagu.github.io/skia-python/). ```python import datasets import numpy as np import torch from einops import rearrange, repeat from PIL import Image def render_layers( textures: torch.Tensor, matrices: torch.Tensor, opacities: torch.Tensor, canvas_height: int, canvas_width: int ): """Render multiple layers using PyTorch functions.""" tex_expand = repeat(textures, "l h w c -> (l t) c h w", t=matrices.shape[1]) grid = torch.nn.functional.affine_grid( torch.linalg.inv(matrices.reshape(-1, 3, 3))[:, :2], (tex_expand.shape[0], tex_expand.shape[1], canvas_height, canvas_width), align_corners=True, ) tex_warped = torch.nn.functional.grid_sample(tex_expand, grid, align_corners=True) tex_warped = rearrange(tex_warped, "(l t) c h w -> l t h w c", l=len(textures)) tex_warped[..., -1] = tex_warped[..., -1] * opacities[:, :, None, None] return tex_warped def alpha_blend_torch(fg: torch.Tensor, bg: torch.Tensor, norm_value: float = 255.0) -> torch.Tensor: """Blend two images as torch.Tensor.""" fg_alpha = fg[..., 3:4] / norm_value bg_alpha = bg[..., 3:4] / norm_value alpha = fg_alpha + bg_alpha * (1 - fg_alpha) fg_rgb = fg[..., :3] bg_rgb = bg[..., :3] rgb = fg_rgb * fg_alpha + bg_rgb * bg_alpha * (1 - fg_alpha) return torch.cat([rgb, alpha * norm_value], dim=-1) def render( textures: torch.Tensor, matrices: torch.Tensor, opacities: torch.Tensor, canvas_height: int, canvas_width: int ) -> torch.Tensor: """Render example using PyTorch functions.""" layers = render_layers(textures, matrices, opacities, canvas_height, canvas_width) backdrop = layers[0] for layer in layers[1:]: backdrop = alpha_blend_torch(layer, backdrop) return backdrop ds = datasets.load_dataset("cyberagent/crello-animation") example = ds["val"][0] canvas_height = example["canvas_height"] canvas_width = example["canvas_width"] matrices_tr = torch.tensor(example["matrix"]) opacities_tr = torch.tensor(example["opacity"]) textures_tr = torch.tensor(np.array([np.array(t) for t in example["texture"]])).float() frames_tr = render(textures_tr, matrices_tr, opacities_tr, canvas_height, canvas_width) frames = [Image.fromarray(frame_np.astype(np.uint8)) for frame_np in frames_tr.numpy()] ``` ## Dataset Creation ### Curation Rationale The Crello Animation is created with the aim of promoting general machine-learning research on animated graphics, such as sprite decomposition. ### Source Data #### Initial Data Collection and Normalization The dataset is initially scraped from the former `crello.com` and pre-processed to the above format. #### Who are the source language producers? While [create.vista.com](https://create.vista.com/) owns those templates, the templates seem to be originally created by a specific group of design studios. ### Personal and Sensitive Information The dataset does not contain any personal information about the creator but may contain a picture of people in the design template. ## Considerations for Using the Data ### Social Impact of Dataset This dataset is constructed for general machine-learning research on animated graphics. If used effectively, it is expected to contribute to the development of technologies that support creative tasks by designers, such as sprite decomposition. ### Discussion of Biases The templates contained in the dataset reflect the biases appearing in the source data, which could present gender biases in specific design categories. ### Other Known Limitations Due to the unknown data specification of the source data, textures and animation parameters do not necessarily accurately reproduce the original design templates. The original template is accessible at the following URL if still available. https://create.vista.com/artboard/?template= ## Additional Information ### Dataset Curators The Crello Animation dataset was developed by [Tomoyuki Suzuki](https://github.com/tomoyukun). ### Licensing Information The origin of the dataset is [create.vista.com](https://create.vista.com) (formally, `crello.com`). The distributor ("We") do not own the copyrights of the original design templates. By using the Crello dataset, the user of this dataset ("You") must agree to the [VistaCreate License Agreements](https://create.vista.com/faq/legal/licensing/license_agreements/). The dataset is distributed under [CDLA-Permissive-2.0 license](https://cdla.dev/permissive-2-0/). NOTE: We do not re-distribute the original files as we are not allowed by terms. ### Citation Information To be published in ECCV 2024. ``` @inproceedings{suzuki2024fast, title={Fast Sprite Decomposition from Animated Graphics}, author={Suzuki, Tomoyuki and Kikuchi, Kotaro and Yamaguchi, Kota}, booktitle={ECCV}, year={2024} } ``` ### Releases 1.0.0: v1 release (July 9, 2024) ### Acknowledgments Thanks to [Kota Yamaguchi](https://github.com/kyamagu) for providing the [Crello dataset](https://huggingface.co/datasets/cyberagent/crello) that served as a valuable reference for this project.