--- license: mit task_categories: - image-classification - object-detection language: - en tags: - computer-vision - polygons - shapes - synthetic-data - image-generation pretty_name: Shape Polygons Dataset size_categories: - 10K Sample 1 Sample 2 Sample 3 Sample 4 ## Usage ### Loading with Hugging Face Datasets ```python from datasets import load_dataset # Load the dataset dataset = load_dataset("your-username/shape-polygons-dataset") # Access train and test splits train_data = dataset["train"] test_data = dataset["test"] # Get a sample sample = train_data[0] print(f"Vertices: {sample['vertices']}, Size: {sample['size']:.2f}") ``` ### Loading with Pandas ```python import pandas as pd from PIL import Image import os # Load metadata train_metadata = pd.read_csv("train/metadata.csv") test_metadata = pd.read_csv("test/metadata.csv") # Load an image img_path = os.path.join("train/images", train_metadata.iloc[0]["filename"]) image = Image.open(img_path) image.show() # Filter by number of vertices (e.g., triangles only) triangles = train_metadata[train_metadata["vertices"] == 3] print(f"Number of triangles: {len(triangles)}") ``` ### PyTorch DataLoader Example ```python import torch from torch.utils.data import Dataset, DataLoader from PIL import Image import pandas as pd import os class PolygonDataset(Dataset): def __init__(self, root_dir, split="train", transform=None): self.root_dir = root_dir self.split = split self.transform = transform self.metadata = pd.read_csv(os.path.join(root_dir, split, "metadata.csv")) def __len__(self): return len(self.metadata) def __getitem__(self, idx): row = self.metadata.iloc[idx] img_path = os.path.join(self.root_dir, self.split, "images", row["filename"]) image = Image.open(img_path).convert("RGB") if self.transform: image = self.transform(image) # Number of vertices as classification label (0-5 for 3-8 vertices) label = row["vertices"] - 3 return image, label # Create dataset and dataloader dataset = PolygonDataset("path/to/dataset", split="train") dataloader = DataLoader(dataset, batch_size=32, shuffle=True) ``` ## Use Cases 1. **Beginner-Friendly ML Projects**: Simple dataset for learning image classification 2. **Shape Recognition Systems**: Training models to identify geometric shapes 3. **Property Regression**: Predicting continuous values (size, angle, position) 4. **Multi-Task Learning**: Combining classification and regression objectives 5. **Data Augmentation Research**: Studying effects of synthetic data on model performance 6. **Benchmark Dataset**: Evaluating new architectures on a controlled, balanced dataset ## License This dataset is released under the [MIT License](LICENSE). ## Citation If you use this dataset in your research, please cite it as: ```bibtex @dataset{shape_polygons_dataset, title={Shape Polygons Dataset}, year={2024}, url={https://huggingface.co/datasets/your-username/shape-polygons-dataset}, note={A synthetic dataset of 70,000 polygon images for computer vision tasks} } ``` ## Contributing Contributions are welcome! Feel free to: - Report issues - Suggest improvements - Submit pull requests ## Contact For questions or feedback, please open an issue on the repository.