NameError 'np' is not defined after importing np_utils
Y_train = np_utils.to_categorical(y_train, n_classes)
Y_test = np_utils.to_categorical(y_test, n_classes)

please update code line as np_utils not np.utils