Datasets:
|
Download README.md from OmerTurk1/GeometricShapeDataset: direct link, hf CLI and curl.
- Browser
- Download file 10.4 kB
-
https://huggingface.co/datasets/OmerTurk1/GeometricShapeDataset/resolve/main/README.md
- Command line
-
hf download hf://datasets/OmerTurk1/GeometricShapeDataset/README.md
-
curl -L -o README.md https://huggingface.co/datasets/OmerTurk1/GeometricShapeDataset/resolve/main/README.md
10.4 kB
| language: | |
| - en | |
| license: mit | |
| task_categories: | |
| - image-classification | |
| tags: | |
| - synthetic | |
| - geometry | |
| - computer-vision | |
| configs: | |
| - config_name: 30x30 | |
| data_files: | |
| - split: train | |
| path: "30x30/train/*.parquet" | |
| - split: test | |
| path: "30x30/test/*.parquet" | |
| - config_name: 40x40 | |
| data_files: | |
| - split: train | |
| path: "40x40/train/*.parquet" | |
| - split: test | |
| path: "40x40/test/*.parquet" | |
| - config_name: 50x50 | |
| data_files: | |
| - split: train | |
| path: "50x50/train/*.parquet" | |
| - split: test | |
| path: "50x50/test/*.parquet" | |
| # Geometric Shape Dataset | |
| ## Introduction to Dataset | |
| The **Geometric Shape Dataset** is a large-scale, synthetically generated computer vision dataset containing **1,680,000** instances of various geometric shapes and lines. It is designed for training image classification, feature extraction, and pattern recognition models across different scales. | |
| The dataset is available in three distinct resolution configurations: **30x30, 40x40, and 50x50** (560,000 images per resolution). | |
| Instead of clean, binary pixel representations, this dataset introduces complex mathematical variations: every shape features dynamic scaling, random rotations, varied boundary thickness, and a unique distance-based "halo" noise gradient. Additionally, a global background noise is applied to the entire canvas. Values are strictly normalized between `0.0` and `1.0`. | |
| ## Shapes Distribution | |
| The dataset is perfectly balanced. It contains 7 distinct classes, distributed equally across the 1,680,000 samples (240,000 images per class in total, or 80,000 per class per resolution). | |
| <table style="width: 100%; text-align: left; border-collapse: collapse;"> | |
| <thead> | |
| <tr> | |
| <th>Shape Class</th> | |
| <th>Count</th> | |
| <th>Description</th> | |
| <th style="text-align: center;">Examples (50x50)</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <tr> | |
| <td><strong>Circle</strong></td> | |
| <td>240,000</td> | |
| <td>Randomly scaled ellipses and perfect circles.</td> | |
| <td style="white-space: nowrap; text-align: center;"> | |
| <img src="50x50/samples/circular/0000001.png" width="50" height="50" style="display: inline-block; margin: 2px; border-radius: 4px;"> | |
| <img src="50x50/samples/circular/0000002.png" width="50" height="50" style="display: inline-block; margin: 2px; border-radius: 4px;"> | |
| <img src="50x50/samples/circular/0000003.png" width="50" height="50" style="display: inline-block; margin: 2px; border-radius: 4px;"> | |
| </td> | |
| </tr> | |
| <tr> | |
| <td><strong>Triangle</strong></td> | |
| <td>240,000</td> | |
| <td>3-sided polygons with dynamic edge stretching.</td> | |
| <td style="white-space: nowrap; text-align: center;"> | |
| <img src="50x50/samples/triangular/0000001.png" width="50" height="50" style="display: inline-block; margin: 2px; border-radius: 4px;"> | |
| <img src="50x50/samples/triangular/0000002.png" width="50" height="50" style="display: inline-block; margin: 2px; border-radius: 4px;"> | |
| <img src="50x50/samples/triangular/0000003.png" width="50" height="50" style="display: inline-block; margin: 2px; border-radius: 4px;"> | |
| </td> | |
| </tr> | |
| <tr> | |
| <td><strong>Rectangle</strong></td> | |
| <td>240,000</td> | |
| <td>4-sided orthogonal shapes (squares and rectangles).</td> | |
| <td style="white-space: nowrap; text-align: center;"> | |
| <img src="50x50/samples/rectangular/0000001.png" width="50" height="50" style="display: inline-block; margin: 2px; border-radius: 4px;"> | |
| <img src="50x50/samples/rectangular/0000002.png" width="50" height="50" style="display: inline-block; margin: 2px; border-radius: 4px;"> | |
| <img src="50x50/samples/rectangular/0000003.png" width="50" height="50" style="display: inline-block; margin: 2px; border-radius: 4px;"> | |
| </td> | |
| </tr> | |
| <tr> | |
| <td><strong>Pentagon</strong></td> | |
| <td>240,000</td> | |
| <td>5-sided regular and dynamically stretched polygons.</td> | |
| <td style="white-space: nowrap; text-align: center;"> | |
| <img src="50x50/samples/pentagonal/0000001.png" width="50" height="50" style="display: inline-block; margin: 2px; border-radius: 4px;"> | |
| <img src="50x50/samples/pentagonal/0000002.png" width="50" height="50" style="display: inline-block; margin: 2px; border-radius: 4px;"> | |
| <img src="50x50/samples/pentagonal/0000003.png" width="50" height="50" style="display: inline-block; margin: 2px; border-radius: 4px;"> | |
| </td> | |
| </tr> | |
| <tr> | |
| <td><strong>Hexagon</strong></td> | |
| <td>240,000</td> | |
| <td>6-sided regular and dynamically stretched polygons.</td> | |
| <td style="white-space: nowrap; text-align: center;"> | |
| <img src="50x50/samples/hexagonal/0000001.png" width="50" height="50" style="display: inline-block; margin: 2px; border-radius: 4px;"> | |
| <img src="50x50/samples/hexagonal/0000002.png" width="50" height="50" style="display: inline-block; margin: 2px; border-radius: 4px;"> | |
| <img src="50x50/samples/hexagonal/0000003.png" width="50" height="50" style="display: inline-block; margin: 2px; border-radius: 4px;"> | |
| </td> | |
| </tr> | |
| <tr> | |
| <td><strong>Parallelogram</strong></td> | |
| <td>240,000</td> | |
| <td>4-sided shapes with forced shear (strictly non-rectangular).</td> | |
| <td style="white-space: nowrap; text-align: center;"> | |
| <img src="50x50/samples/parallelogram/0000001.png" width="50" height="50" style="display: inline-block; margin: 2px; border-radius: 4px;"> | |
| <img src="50x50/samples/parallelogram/0000002.png" width="50" height="50" style="display: inline-block; margin: 2px; border-radius: 4px;"> | |
| <img src="50x50/samples/parallelogram/0000003.png" width="50" height="50" style="display: inline-block; margin: 2px; border-radius: 4px;"> | |
| </td> | |
| </tr> | |
| <tr> | |
| <td><strong>Line</strong></td> | |
| <td>240,000</td> | |
| <td>Curved Quadratic Bezier lines mimicking imperfect hand-drawn strokes.</td> | |
| <td style="white-space: nowrap; text-align: center;"> | |
| <img src="50x50/samples/line/0000001.png" width="50" height="50" style="display: inline-block; margin: 2px; border-radius: 4px;"> | |
| <img src="50x50/samples/line/0000002.png" width="50" height="50" style="display: inline-block; margin: 2px; border-radius: 4px;"> | |
| <img src="50x50/samples/line/0000003.png" width="50" height="50" style="display: inline-block; margin: 2px; border-radius: 4px;"> | |
| </td> | |
| </tr> | |
| <tr> | |
| <td><strong>Total</strong></td> | |
| <td><strong>1,680,000</strong></td> | |
| <td></td> | |
| <td></td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| Note: For all samples, you can go to Files and Versions, then click into the respective resolution's `samples` folders. | |
| ## Dataset Characteristics & Generation Details | |
| To prevent models from easily memorizing shapes, several advanced data augmentation techniques were mathematically baked into the generation process: | |
| * **Float16 Precision:** Continuous pixel values rather than 8-bit integers, preserving the exact mathematical noise distribution. | |
| * **Curved Strokes:** Lines are generated using Bezier curves with varying bend amounts, perfectly simulating the imperfections of human drawing. | |
| * **Dynamic Thickness:** The solid boundaries of the shapes randomly vary between 1, 2, or 3 pixels. | |
| * **Halo Noise Gradient:** A localized noise layer surrounds the shape, inversely proportional to the distance from the solid boundary (fading out over a 4-pixel radius). | |
| * **Global Noise:** A uniform random noise between `-0.1` and `0.1` applied globally (clipped to stay within `[0, 1]`). | |
| * **Safety Scaling:** Bounding boxes guarantee that no shape clips outside the canvas boundaries, even under extreme rotation or shear. | |
| ## Storage Structure | |
| To optimize both disk space and loading speeds, the dataset is architected with modern streaming in mind: | |
| * **Configurations by Resolution:** Choose between `30x30`, `40x40`, or `50x50` subsets right from the Hugging Face viewer. | |
| * **Chunked Parquet Files:** The dataset is split into smaller, highly compressed `.parquet` chunks (5,600 images per chunk). | |
| * **Flattened Arrays:** Parquet does not natively support 2D/3D matrix cells, so the images are safely flattened into `1D` arrays. Depending on the configuration, the array length will be `900` (for 30x30), `1600` (for 40x40), or `2500` (for 50x50). They can be instantly reshaped during training. | |
| * **Pre-Shuffled:** The shapes are heavily shuffled *within* each chunk before saving. You will receive perfectly mixed, heterogeneous batches starting from the very first megabyte. | |
| ## How to Use | |
| Because of the chunked Parquet structure, you can either download the entire dataset or use **Iterable Streaming** (lazy loading) to train models without consuming any hard drive space. | |
| ### 1. Streaming Mode | |
| Use `streaming=True` and specify the `name` argument (e.g., `"50x50"`) to fetch data on the fly. Don't forget to reshape the 1D flat array back to a 2D matrix matching your chosen resolution. | |
| ```python | |
| from datasets import load_dataset | |
| import numpy as np | |
| # Load dataset configuration "50x50" without downloading to disk | |
| iterable_dataset = load_dataset("OmerTurk1/GeometricShapeDataset", name="50x50", split="train", streaming=True) | |
| # You can add a buffer shuffle for even more randomness during training | |
| shuffled_dataset = iterable_dataset.shuffle(buffer_size=10000, seed=42) | |
| for data in shuffled_dataset: | |
| # Extract and convert to numpy array | |
| flat_image = np.array(data["image"], dtype=np.float16) | |
| # Reshape back to 50x50 matrix (Change to 30, 30 if using the 30x30 config) | |
| image_matrix = flat_image.reshape(50, 50) | |
| label = data["label"] | |
| print(f"Label: {label} | Shape: {image_matrix.shape}") | |
| # Rest is up to you | |
| ``` | |
| ### 2. Standard Download | |
| If you have enough RAM and want to load the entire dataset into memory: | |
| ```python | |
| from datasets import load_dataset | |
| import numpy as np | |
| # This will download the 30x30 dataset configuration to your local Hugging Face cache | |
| dataset = load_dataset("OmerTurk1/GeometricShapeDataset", name="30x30", split="train") | |
| # Reshape back to 50x50 matrix (Change to 30, 30 if using the 30x30 config) | |
| first_image = np.array(dataset[0]["image"], dtype=np.float16).reshape(50, 50) | |
| first_label = dataset[0]["label"] | |
| print(f"First image is a {first_label} with shape {first_image.shape}") | |
| # Rest is up to you | |
| ``` |