Datasets:
Update README.md
Browse files
README.md
CHANGED
@@ -816,7 +816,7 @@ The Crello dataset has 3 splits: train, validation, and test. The current split
|
|
816 |
|
817 |
### Visualization
|
818 |
|
819 |
-
Each example can be visualized in the following approach. Note the following does not guarantee a similar appearance to the original template.
|
820 |
|
821 |
```python
|
822 |
import io
|
@@ -847,13 +847,14 @@ def render(features: datasets.Features, example: Dict[str, Any], max_size: float
|
|
847 |
width = example["width"][index] * canvas_width
|
848 |
height = example["height"][index] * canvas_height
|
849 |
rect = skia.Rect.MakeXYWH(left, top, width, height)
|
|
|
850 |
|
851 |
angle = example["angle"][index]
|
852 |
with skia.AutoCanvasRestore(canvas):
|
853 |
if angle != 0:
|
854 |
degree = 180. * angle / np.pi
|
855 |
canvas.rotate(degree, left + width / 2., top + height / 2.)
|
856 |
-
canvas.drawImageRect(image, rect)
|
857 |
|
858 |
image = surface.makeImageSnapshot()
|
859 |
with io.BytesIO() as f:
|
@@ -928,6 +929,10 @@ We do not re-distribute the original files as we are not allowed by terms.
|
|
928 |
|
929 |
### Releases
|
930 |
|
|
|
|
|
|
|
|
|
931 |
3.0: v3 release (Feb 13, 2023)
|
932 |
|
933 |
- Migrate to Hugging Face Hub.
|
|
|
816 |
|
817 |
### Visualization
|
818 |
|
819 |
+
Each example can be visualized in the following approach using [`skia-python`](https://kyamagu.github.io/skia-python/). Note the following does not guarantee a similar appearance to the original template. Currently, the quality of text rendering is far from perfect.
|
820 |
|
821 |
```python
|
822 |
import io
|
|
|
847 |
width = example["width"][index] * canvas_width
|
848 |
height = example["height"][index] * canvas_height
|
849 |
rect = skia.Rect.MakeXYWH(left, top, width, height)
|
850 |
+
paint = skia.Paint(Alphaf=example["opacity"][index], AntiAlias=True)
|
851 |
|
852 |
angle = example["angle"][index]
|
853 |
with skia.AutoCanvasRestore(canvas):
|
854 |
if angle != 0:
|
855 |
degree = 180. * angle / np.pi
|
856 |
canvas.rotate(degree, left + width / 2., top + height / 2.)
|
857 |
+
canvas.drawImageRect(image, rect, paint=paint)
|
858 |
|
859 |
image = surface.makeImageSnapshot()
|
860 |
with io.BytesIO() as f:
|
|
|
929 |
|
930 |
### Releases
|
931 |
|
932 |
+
3.1: v3 release (Feb 16, 2023)
|
933 |
+
|
934 |
+
- Fix a bug that ignores newline characters in some of the texts
|
935 |
+
|
936 |
3.0: v3 release (Feb 13, 2023)
|
937 |
|
938 |
- Migrate to Hugging Face Hub.
|