def Load_pickle(): pickle = Pickle() label = pickle.load_label_pickle("label_pickle") feature = pickle.load_feature_pickle("feature_pickle") return feature,label
epochs = 1000 batch_size = 40 model.fit(feature, label, batch_size=batch_size, epochs=epochs, validation_split=0.2, callbacks=callbacks) if __name__ == "__main__": pickle = Pickle() ## loading dataset label = pickle.load_label_pickle("label_pickle") feature = pickle.load_feature_pickle("feature_pickle") # converting numbers btw 0-1 and converting format to float50 for count in range(len(feature)): feature[count] = feature[count] / 255.0 feature[count] = feature[count].astype("float32") ## convertin feature and label to numpy array feature = numpy.array(feature).reshape(-1, 48, 48, 1) label = numpy.array(label) cnn_model(feature, label)