File size: 10,151 Bytes
c9fb4e3 636abfe c9fb4e3 636abfe c9fb4e3 636abfe c9fb4e3 636abfe c9fb4e3 8305ae0 c9fb4e3 cf23e65 c9fb4e3 4073ed7 c9fb4e3 8047130 c9fb4e3 38a7e99 c9fb4e3 8b9c2dd b31513d c9fb4e3 8305ae0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
---
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"](https://arxiv.org/abs/2408.03923) (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=<template_id>
## 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}
}
```
Arxiv: https://arxiv.org/abs/2408.03923
### 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. |