Learn practical skills, build real-world projects, and advance your career
from google.colab import drive
drive.mount('/content/drive')
Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount("/content/drive", force_remount=True).
import cv2
import numpy as np
from tensorflow.keras.utils import to_categorical
from glob import glob

from tensorflow.keras.models import Model

from tensorflow.keras.layers import Dense
from tensorflow.keras.layers import Flatten
from tensorflow.keras.layers import Conv2D
from tensorflow.keras.layers import Lambda
from tensorflow.keras.layers import BatchNormalization, Dropout
from tensorflow.keras.layers import Activation
from tensorflow.keras.layers import Concatenate
from tensorflow.keras.layers import MaxPooling2D
from tensorflow.keras.layers import AveragePooling2D
from tensorflow.keras.layers import Input


from tensorflow.keras import backend

from tensorflow.keras.optimizers import Adam,RMSprop,SGD

from sklearn.metrics import classification_report
from sklearn.metrics import confusion_matrix
from sklearn.metrics import accuracy_score
from sklearn.model_selection import KFold
AD_path = '/content/drive/MyDrive/AD'
LMCI_path = '/content/drive/MyDrive/LMCI'
NC_path = '/content/drive/MyDrive/NC'
#epoch should be 300 also batch size can be 20
epochs = 10
batch_size = 50
#Use glob to pull the images
ADfiles = glob( AD_path +'/*' )
LMCIfiles = glob( LMCI_path +'/*' )
NCfiles = glob( NC_path + '/*' )

AD_labels = []
LMCI_labels = []
NC_labels = []

AD_images=[]
LMCI_images=[]
NC_images=[]

all_images=[]
all_labels=[]

acc_per_fold = []
loss_per_fold = []