Learn practical skills, build real-world projects, and advance your career

Arabic Handwritten Characters images classification, Using ResNets in PyTorch

Training image classifier on single GPU

project_name='project01'

Preparing the Arabic Chars Mnist Dataset

The dataset is composed of 16,800 characters written by 60 participants,The database is partitioned into two sets: a training set (13,440 characters to 480 images per class) and a test set (3,360 characters to 120 images per class) Arabic-Handwritten-Chars.

In this dataset there are no subfolders for each class (each characters in arabic), so we will save the label for each image from image's name and image path to csv file.

import os
import torch
import torchvision
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
from torch.utils.data import DataLoader
import torchvision.transforms as tt
from torch.utils.data import random_split
from torchvision.utils import make_grid
import pandas as pd
from PIL import Image
from torch.utils.data import Dataset
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline

matplotlib.rcParams['figure.facecolor'] = '#ffffff'

Arabic characters are 28 as shown below: