|
--- |
|
dataset_info: |
|
features: |
|
- name: image |
|
dtype: image |
|
- name: label |
|
dtype: |
|
class_label: |
|
names: |
|
'0': A |
|
'1': B |
|
'2': C |
|
'3': D |
|
'4': E |
|
'5': F |
|
'6': G |
|
'7': H |
|
'8': I |
|
'9': J |
|
'10': K |
|
'11': L |
|
'12': M |
|
'13': 'N' |
|
'14': O |
|
'15': P |
|
'16': Q |
|
'17': R |
|
'18': S |
|
'19': T |
|
'20': U |
|
'21': V |
|
'22': W |
|
'23': X |
|
'24': 'Y' |
|
'25': Z |
|
splits: |
|
- name: train |
|
num_bytes: 22453522 |
|
num_examples: 26000 |
|
- name: test |
|
num_bytes: 2244964.8 |
|
num_examples: 2600 |
|
download_size: 8149945 |
|
dataset_size: 24698486.8 |
|
task_categories: |
|
- image-classification |
|
language: |
|
- en |
|
size_categories: |
|
- 1K<n<10K |
|
--- |
|
# Dataset Card for "letter_recognition" |
|
|
|
Images in this dataset was generated using the script defined below. The original dataset in CSV format and more information of the original dataset is available at [A-Z Handwritten Alphabets in .csv format](https://www.kaggle.com/datasets/sachinpatel21/az-handwritten-alphabets-in-csv-format). |
|
|
|
|
|
```python |
|
import os |
|
import pandas as pd |
|
import matplotlib.pyplot as plt |
|
|
|
CHARACTER_COUNT = 26 |
|
|
|
data = pd.read_csv('./A_Z Handwritten Data.csv') |
|
mapping = {str(i): chr(i+65) for i in range(26)} |
|
|
|
def generate_dataset(folder, end, start=0): |
|
if not os.path.exists(folder): |
|
os.makedirs(folder) |
|
print(f"The folder '{folder}' has been created successfully!") |
|
else: |
|
print(f"The folder '{folder}' already exists.") |
|
|
|
for i in range(CHARACTER_COUNT): |
|
dd = data[data['0']==i] |
|
for j in range(start, end): |
|
ddd = dd.iloc[j] |
|
x = ddd[1:].values |
|
x = x.reshape((28, 28)) |
|
plt.axis('off') |
|
plt.imsave(f'{folder}/{mapping[str(i)]}_{j}.jpg', x, cmap='binary') |
|
|
|
generate_dataset('./train', 1000) |
|
generate_dataset('./test', 1100, 1000) |
|
``` |