--- pretty_name: English Characters Image Dataset license: mit language: en --- # English Characters Image Dataset (A-Z, a-z, 0-9) This dataset contains high-resolution (128x128 pixels) grayscale images of English characters, including uppercase letters (A-Z), lowercase letters (a-z), and digits (0-9). Each character is available in 80,000 to 100,000 unique font styles, making it one of the most comprehensive resources for character-level image modeling. --- ![image/gif](/static-proxy?url=https%3A%2F%2Fcdn-uploads.huggingface.co%2Fproduction%2Fuploads%2F666c3d6489e21df7d4a02805%2Fphal2bDh0c1lAej9JmFo8.gif) ## Dataset Description The images in this dataset have been generated by rendering over **85,000 unique fonts** collected from various sources on the internet. Each character (e.g., 'A', 'b', '5') has its own ZIP file. When extracted, it contains tens of thousands of stylized grayscale images of that character, all uniformly resized to **128x128 pixels**. This dataset is ideal for projects involving: - Training **conditional diffusion models** to generate text or characters. - Building **OCR systems** or **character classification models**. - Exploring **font-based generative models** or **representation learning** at the character level. Unlike similar datasets that offer only 32x32 images with limited variation in style, this dataset provides significantly higher resolution and diversity, enabling more robust model training and experimentation. --- ## Motivations and Use Cases The initial motivation for creating this dataset was to train a **diffusion-based generative model** capable of rendering high-quality text in various styles. The idea is to first train models on individual characters (the smallest building blocks of language) before scaling to full text generation. Another potential use case is in **text recognition or classification** tasks. Having access to such a wide range of styles can help models generalize better to the vast number of font variations present across real-world images on the internet. ### Important Note This dataset is **not fully cleaned**. Some fonts generate symbolic or decorative representations instead of standard characters. While these instances are relatively rare, they may affect certain use cases where strict visual similarity to the character is required. --- ## Folder Structure Each ZIP file (e.g., `A.zip`, `7.zip`, `Z.zip`) contains a folder of grayscale PNG images, all sized at 128x128 pixels. After extraction: ``` A/ ├── font_001_A.png ├── font_002_A.png ... ``` --- ## How to Use This Dataset You can easily download and extract any character’s ZIP file from the Hugging Face Hub using the `huggingface_hub` library. ### Installation (if needed) ```bash pip install huggingface_hub ``` ### Python Code to Download and Extract a Character Folder ```python from huggingface_hub import hf_hub_download import zipfile import os def download_and_extract(character: str, repo_id: str, dest_root: str = "/content/extracted"): os.makedirs(dest_root, exist_ok=True) zip_filename = f"{character}.zip" zip_path = hf_hub_download(repo_id=repo_id, filename=zip_filename, repo_type="dataset") extract_path = os.path.join(dest_root, character) os.makedirs(extract_path, exist_ok=True) with zipfile.ZipFile(zip_path, 'r') as zip_ref: zip_ref.extractall(extract_path) return extract_path ``` ### Example Usage ```python extracted_path = download_and_extract( character="A", repo_id="Mayank022/English_Characters_Images" ) ``` You can then use `extracted_path` as the data source for your training loop or dataset class. --- ### Download All Characters (0-9, A-Z) ```python chars = [str(i) for i in range(10)] + [chr(c) for c in range(65, 91)] # '0'-'9' + 'A'-'Z' for ch in chars: download_and_extract(character=ch, repo_id="Mayank022/English_Characters_Images") ``` --- ## Final Notes This dataset is part of an ongoing effort to support high-quality text generation and recognition research using generative models like diffusion. Contributions and feedback are welcome to help improve and expand the dataset further.