First load necessary packages import pandas as pdimport numpy as npfrom keras.models import Sequentialfrom keras.layers import Dense, Dropout, Conv2Dimport keras.backend as Kimport scipy, imageioimport matplotlib.pyplot as pltfrom PIL import Image%matp…