--- language: - en license: mit task_categories: - image-classification - object-detection tags: - synthetic - geometry - computer-vision - float16 pretty_name: Geometric Shape Dataset size_categories: - 100K Shape Class Count Description Examples (50x50) Circle 150,000 Randomly scaled ellipses and perfect circles. Triangle 150,000 3-sided polygons with dynamic edge stretching. Rectangle 150,000 4-sided orthogonal shapes (squares and rectangles). Pentagon 150,000 5-sided regular and dynamically stretched polygons. Parallelogram 150,000 4-sided shapes with forced shear (strictly non-rectangular). Line 150,000 Straight linear segments of varying lengths and angles. Total 900,000 Note: For all samples, you can go to Files and Versions, then click each shape folders to view shape samples ## 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. * **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 50x50 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: * **Chunked Parquet Files:** The dataset is split into smaller, highly compressed `.parquet` chunks. * **Flattened Arrays:** Parquet does not natively support 2D/3D matrix cells, so the `50x50` images are safely flattened into `1D` arrays of length `2500`. (They can be instantly reshaped during training). * **Pre-Shuffled:** The shapes are heavily shuffled *within* each chunk before saving. If you stream this dataset, you will not get 150,000 circles followed by 150,000 triangles. 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` to fetch data on the fly. Don't forget to reshape the 1D flat array back to `50x50`. ```python from datasets import load_dataset import numpy as np # Load dataset without downloading to disk iterable_dataset = load_dataset("OmerTurk1/GeometricShapeDataset", 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: # 1. Extract and convert to numpy array flat_image = np.array(data["image"], dtype=np.float16) # 2. Reshape back to 50x50 matrix image_matrix = flat_image.reshape(50, 50) label = data["label"] print(f"Label: {label} | Shape: {image_matrix.shape}") # Feed to your model (train_step) break ``` ### 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 dataset to your local Hugging Face cache dataset = load_dataset("OmerTurk1/GeometricShapeDataset", split="train") # Accessing a specific index and reshaping 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}") ```