{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\n\nimport os","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2021-10-25T07:06:27.973595Z","iopub.execute_input":"2021-10-25T07:06:27.973892Z","iopub.status.idle":"2021-10-25T07:06:28.002481Z","shell.execute_reply.started":"2021-10-25T07:06:27.973781Z","shell.execute_reply":"2021-10-25T07:06:28.001535Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import cv2\nfrom keras import layers\nfrom keras.layers import Input, Dense, Activation, ZeroPadding2D, BatchNormalization, Flatten, Conv2D\nfrom keras.layers import AveragePooling2D, MaxPooling2D, Dropout, GlobalMaxPooling2D, GlobalAveragePooling2D\nfrom keras.models import Model \nfrom keras.preprocessing import image\nfrom keras.utils import layer_utils\nfrom keras.utils.data_utils import get_file\nfrom keras.applications.imagenet_utils import preprocess_input\nimport pydot\nfrom IPython.display import SVG\nfrom keras.utils.vis_utils import model_to_dot\nfrom keras.utils.vis_utils import plot_model\nfrom tensorflow.keras.utils import to_categorical\nimport matplotlib.pyplot as plt\nfrom random import shuffle\n","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:06:28.004408Z","iopub.execute_input":"2021-10-25T07:06:28.004827Z","iopub.status.idle":"2021-10-25T07:06:34.486872Z","shell.execute_reply.started":"2021-10-25T07:06:28.004786Z","shell.execute_reply":"2021-10-25T07:06:34.485858Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import zipfile\n\nwith zipfile.ZipFile('../input/dogs-vs-cats-redux-kernels-edition/train.zip','r') as z:\n    z.extractall('.')\n    \nwith zipfile.ZipFile('../input/dogs-vs-cats-redux-kernels-edition/test.zip','r') as z:\n    z.extractall('.')\n","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:06:34.489122Z","iopub.execute_input":"2021-10-25T07:06:34.489573Z","iopub.status.idle":"2021-10-25T07:06:55.770737Z","shell.execute_reply.started":"2021-10-25T07:06:34.489533Z","shell.execute_reply":"2021-10-25T07:06:55.769673Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"IMG_SIZE = 120\nX_Train = []\nY_train = []\nfor i in os.listdir('/kaggle/working/train/'):\n    label = i.split('.')[-3]\n    if label =='cat':\n        label = 0\n    elif label =='dog':\n        label = 1\n    img = cv2.imread('/kaggle/working/train/'+i,cv2.IMREAD_COLOR)\n    img = cv2.resize(img,(IMG_SIZE,IMG_SIZE), interpolation=cv2.INTER_CUBIC)\n    X_Train.append([np.array(img), np.array(label)])\n    \nnp.save('Training_Data.npy', X_Train)\n    ","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:06:55.773222Z","iopub.execute_input":"2021-10-25T07:06:55.773502Z","iopub.status.idle":"2021-10-25T07:08:04.224896Z","shell.execute_reply.started":"2021-10-25T07:06:55.773462Z","shell.execute_reply":"2021-10-25T07:08:04.223959Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"shuffle(X_Train)","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:08:04.228529Z","iopub.execute_input":"2021-10-25T07:08:04.228745Z","iopub.status.idle":"2021-10-25T07:08:04.260354Z","shell.execute_reply.started":"2021-10-25T07:08:04.228720Z","shell.execute_reply":"2021-10-25T07:08:04.259319Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X = np.array([i[0] for i in X_Train]).reshape(-1,IMG_SIZE,IMG_SIZE,3)\nY = np.array([i[1] for i in X_Train])","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:08:04.263379Z","iopub.execute_input":"2021-10-25T07:08:04.263778Z","iopub.status.idle":"2021-10-25T07:08:04.727825Z","shell.execute_reply.started":"2021-10-25T07:08:04.263751Z","shell.execute_reply":"2021-10-25T07:08:04.726844Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.model_selection import train_test_split\nX_train, X_val, Y_train, Y_val = train_test_split(X, Y, test_size=0.1)","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:08:04.729142Z","iopub.execute_input":"2021-10-25T07:08:04.729955Z","iopub.status.idle":"2021-10-25T07:08:05.903688Z","shell.execute_reply.started":"2021-10-25T07:08:04.729915Z","shell.execute_reply":"2021-10-25T07:08:05.902721Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print('Shape of X_train is :', X_train.shape)\nprint('Shape of Y_train is :', Y_train.shape)\nprint('Shape of X_val is :', X_val.shape)\nprint('Shape of Y_val is :', Y_val.shape)","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:08:05.905056Z","iopub.execute_input":"2021-10-25T07:08:05.906340Z","iopub.status.idle":"2021-10-25T07:08:05.915964Z","shell.execute_reply.started":"2021-10-25T07:08:05.906293Z","shell.execute_reply":"2021-10-25T07:08:05.914685Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import matplotlib.pyplot as plt\nplt.figure(figsize=(20,20))\nfor i in range(50):\n    plt.subplot(5, 10, i+1)\n    plt.imshow(X_val[i,:,:,:])\n    plt.title('DOG' if Y_val[i] == 1 else 'CAT')\n    plt.axis('off')\n    ","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:08:05.917739Z","iopub.execute_input":"2021-10-25T07:08:05.918196Z","iopub.status.idle":"2021-10-25T07:08:08.973045Z","shell.execute_reply.started":"2021-10-25T07:08:05.918157Z","shell.execute_reply":"2021-10-25T07:08:08.972102Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def Keras_Model(input_shape):    \n    \n    X_input = Input(input_shape)\n    \n    # First Layer\n    X = Conv2D(64, (3, 3), strides = (1, 1), padding = 'same', name = 'conv0')(X_input) \n    X = BatchNormalization(axis = 3, name = 'bn0')(X)\n    X = Activation('relu')(X) \n    \n    X = Conv2D(64, (3, 3), strides = (1, 1), padding = 'same', name = 'conv1')(X) \n    X = BatchNormalization(axis = 3, name = 'bn1')(X)\n    X = Activation('relu')(X)\n    \n    X = MaxPooling2D((3, 3), name='max_pool_0')(X)\n    X = Dropout(0.3)(X)\n    \n    # Second Layer\n    X = Conv2D(128, (3, 3), strides = (1, 1), padding = 'same', name = 'conv3')(X) \n    X = BatchNormalization(axis = 3, name = 'bn3')(X)\n    X = Activation('relu')(X)\n    \n    X = Conv2D(128, (3, 3), strides = (1, 1), padding = 'same', name = 'conv4')(X) \n    X = BatchNormalization(axis = 3, name = 'bn4')(X)\n    X = Activation('relu')(X)\n    \n    X = Conv2D(128, (3, 3), strides = (1, 1), padding = 'same', name = 'conv5')(X) \n    X = BatchNormalization(axis = 3, name = 'bn5')(X)\n    X = Activation('relu')(X)\n     \n    X = MaxPooling2D((3, 3), name='max_pool_1')(X)\n    X = Dropout(0.3)(X)\n    \n    # Fourth Convolutional Layer\n    X = Conv2D(256, (3, 3), strides = (1, 1), padding = 'same', name = 'conv6')(X) \n    X = BatchNormalization(axis = 3, name = 'bn6')(X)\n    X = Activation('relu')(X)\n    \n    X = Conv2D(256, (3, 3), strides = (1, 1), padding = 'same', name = 'conv7')(X) \n    X = BatchNormalization(axis = 3, name = 'bn7')(X)\n    X = Activation('relu')(X)\n    \n    X = Conv2D(256, (3, 3), strides = (1, 1), padding = 'same', name = 'conv8')(X) \n    X = BatchNormalization(axis = 3, name = 'bn8')(X)\n    X = Activation('relu')(X)\n\n \n    X = MaxPooling2D((3, 3), name='max_pool_2')(X)\n    X = Dropout(0.3)(X)\n    \n    X = Conv2D(512, (3, 3), strides = (1, 1), padding = 'same', name = 'conv10')(X) \n    X = BatchNormalization(axis = 3, name = 'bn10')(X)\n    X = Activation('relu')(X)\n    \n    X = Conv2D(512, (3, 3), strides = (1, 1), padding = 'same', name = 'conv11')(X) \n    X = BatchNormalization(axis = 3, name = 'bn11')(X)\n    X = Activation('relu')(X)\n    \n    X = Conv2D(512, (3, 3), strides = (1, 1), padding = 'same', name = 'conv12')(X) \n    X = BatchNormalization(axis = 3, name = 'bn12')(X)\n    X = Activation('relu')(X)\n\n    \n    X = MaxPooling2D((3, 3), name='max_pool_3')(X)\n    X = Dropout(0.3)(X)\n    \n    # Flatten the data.\n    X = Flatten()(X)\n    # Dense Layer\n    X = Dense(4096, activation='relu', name='fc1')(X)\n    X = Dropout(0.5)(X)\n    X = Dense(1024, activation='relu', name='fc2')(X)\n    X = Dropout(0.5)(X)\n    X = Dense(256, activation='relu', name='fc3')(X)\n    # Using softmax function to get the output\n    X = Dense(1, activation='sigmoid', name='fc4')(X)\n    \n    model = Model(inputs = X_input, outputs = X, name='model')\n    \n    return model","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:08:08.977667Z","iopub.execute_input":"2021-10-25T07:08:08.978059Z","iopub.status.idle":"2021-10-25T07:08:09.012458Z","shell.execute_reply.started":"2021-10-25T07:08:08.978020Z","shell.execute_reply":"2021-10-25T07:08:09.011119Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"Keras_Model = Keras_Model(X_train.shape[1:4])","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:08:09.014705Z","iopub.execute_input":"2021-10-25T07:08:09.015864Z","iopub.status.idle":"2021-10-25T07:08:13.145201Z","shell.execute_reply.started":"2021-10-25T07:08:09.015820Z","shell.execute_reply":"2021-10-25T07:08:13.144117Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from tensorflow.keras.optimizers import Adam\nepochs = 100\nbatch_size =64\nIrate = 0.001\ndecay = Irate / epochs\noptimizer = Adam( epsilon = 1e-108, decay = decay)","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:08:13.146813Z","iopub.execute_input":"2021-10-25T07:08:13.147259Z","iopub.status.idle":"2021-10-25T07:08:13.156946Z","shell.execute_reply.started":"2021-10-25T07:08:13.147215Z","shell.execute_reply":"2021-10-25T07:08:13.155811Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"Keras_Model.compile(loss='binary_crossentropy', optimizer=optimizer, metrics=['accuracy'])","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:08:13.158957Z","iopub.execute_input":"2021-10-25T07:08:13.159365Z","iopub.status.idle":"2021-10-25T07:08:14.046497Z","shell.execute_reply.started":"2021-10-25T07:08:13.159323Z","shell.execute_reply":"2021-10-25T07:08:14.045516Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from keras.callbacks import ReduceLROnPlateau\nlearning_rate_reduction = ReduceLROnPlateau(monitor='val_acc',\n                                           patience = 1,\n                                           verbose = 1,\n                                           factor = 0.5,\n                                           min_lr=0.0000001)","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:08:14.048800Z","iopub.execute_input":"2021-10-25T07:08:14.049885Z","iopub.status.idle":"2021-10-25T07:08:14.058328Z","shell.execute_reply.started":"2021-10-25T07:08:14.049837Z","shell.execute_reply":"2021-10-25T07:08:14.057103Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from keras.callbacks import ModelCheckpoint, Callback, EarlyStopping\nearly_stopping = EarlyStopping(monitor='val_loss', patience=1, verbose=1, mode = 'auto')","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:08:14.060353Z","iopub.execute_input":"2021-10-25T07:08:14.060719Z","iopub.status.idle":"2021-10-25T07:08:14.070106Z","shell.execute_reply.started":"2021-10-25T07:08:14.060676Z","shell.execute_reply":"2021-10-25T07:08:14.068973Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"history = Keras_Model.fit(x = X_train, y = Y_train, batch_size= batch_size,\n                         epochs = epochs, verbose = 1,\n                         validation_data=(X_val, Y_val),\n                         shuffle=True,\n                         steps_per_epoch=None, validation_steps=None,\n                         callbacks = [learning_rate_reduction, early_stopping])","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:08:14.071947Z","iopub.execute_input":"2021-10-25T07:08:14.072490Z","iopub.status.idle":"2021-10-25T07:08:58.845447Z","shell.execute_reply.started":"2021-10-25T07:08:14.072436Z","shell.execute_reply":"2021-10-25T07:08:58.844432Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"preds = Keras_Model.evaluate(X_train, Y_train)\nprint('Loss = '+ str(preds[0]))\nprint('Train set Accuracy = ' + str([preds[1]]))","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:08:58.848729Z","iopub.execute_input":"2021-10-25T07:08:58.848965Z","iopub.status.idle":"2021-10-25T07:10:01.050121Z","shell.execute_reply.started":"2021-10-25T07:08:58.848937Z","shell.execute_reply":"2021-10-25T07:10:01.048821Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"preds_val = Keras_Model.evaluate(X_val, Y_val)\nprint (\"Loss = \" + str(preds_val[0]))\nprint (\"Validation Set Accuracy = \" + str(preds_val[1]))","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:10:01.052056Z","iopub.execute_input":"2021-10-25T07:10:01.052535Z","iopub.status.idle":"2021-10-25T07:10:03.840737Z","shell.execute_reply.started":"2021-10-25T07:10:01.052491Z","shell.execute_reply":"2021-10-25T07:10:03.839742Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"history_dict = history.history\nhistory_dict.keys()","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:10:03.842329Z","iopub.execute_input":"2021-10-25T07:10:03.842730Z","iopub.status.idle":"2021-10-25T07:10:03.853091Z","shell.execute_reply.started":"2021-10-25T07:10:03.842688Z","shell.execute_reply":"2021-10-25T07:10:03.850731Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"val_loss = history_dict['val_loss']\nval_acc = history_dict['val_accuracy']\nloss = history_dict['loss']\nacc = history_dict['accuracy']\nepochs = range(1,len(history_dict['val_loss'])+1)","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:10:03.855758Z","iopub.execute_input":"2021-10-25T07:10:03.856136Z","iopub.status.idle":"2021-10-25T07:10:03.864793Z","shell.execute_reply.started":"2021-10-25T07:10:03.856095Z","shell.execute_reply":"2021-10-25T07:10:03.863338Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.plot(epochs,acc,'b-')\nplt.title('Accuracy of Model')\nplt.xlabel('epochs')\nplt.ylabel('Accuracy')\n\nplt.plot(epochs,val_acc,'b-', color = 'red')\nplt.title('Accuracy of Model')\nplt.xlabel('epochs')\nplt.ylabel('Accuracy')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:10:03.866129Z","iopub.execute_input":"2021-10-25T07:10:03.866723Z","iopub.status.idle":"2021-10-25T07:10:04.152704Z","shell.execute_reply.started":"2021-10-25T07:10:03.866676Z","shell.execute_reply":"2021-10-25T07:10:04.150802Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predicted_val_probability = Keras_Model.predict(X_val, batch_size=64)","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:10:04.154275Z","iopub.execute_input":"2021-10-25T07:10:04.154718Z","iopub.status.idle":"2021-10-25T07:10:05.592236Z","shell.execute_reply.started":"2021-10-25T07:10:04.154675Z","shell.execute_reply":"2021-10-25T07:10:05.590651Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"Y_val_pred_label = np.round(predicted_val_probability)\nl = []\nfor i in range(len(Y_val_pred_label)):\n    if Y_val[i] != Y_val_pred_label[i]:\n        l.append(i)","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:10:05.603150Z","iopub.execute_input":"2021-10-25T07:10:05.603431Z","iopub.status.idle":"2021-10-25T07:10:05.627640Z","shell.execute_reply.started":"2021-10-25T07:10:05.603393Z","shell.execute_reply":"2021-10-25T07:10:05.623118Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"del X_train, Y_train","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:10:05.632475Z","iopub.execute_input":"2021-10-25T07:10:05.632708Z","iopub.status.idle":"2021-10-25T07:10:05.640208Z","shell.execute_reply.started":"2021-10-25T07:10:05.632677Z","shell.execute_reply":"2021-10-25T07:10:05.639165Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"m = []\nfor t in l:\n    if predicted_val_probability[t] >= 0.99:\n        m.append(t)\n    elif predicted_val_probability[t] < 0.01:\n        m.append(t)\n    ","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:10:05.641793Z","iopub.execute_input":"2021-10-25T07:10:05.643613Z","iopub.status.idle":"2021-10-25T07:10:05.684732Z","shell.execute_reply.started":"2021-10-25T07:10:05.643563Z","shell.execute_reply":"2021-10-25T07:10:05.683802Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(35,35))\nc = 1\nfor i in m[:]:\n    plt.subplot(10,5, c)\n    plt.imshow(X_val[i])\n    plt.title('DOG:{}\\nTrue label:{}'.format(predicted_val_probability[i], Y_val[i])\n              if predicted_val_probability[i]>= 0.5 else 'CAT:{}\\nTrue label:{}'.format(predicted_val_probability[i],Y_val[i]))\n    plt.axis('off')\n    c = c+1","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:10:05.686279Z","iopub.execute_input":"2021-10-25T07:10:05.686628Z","iopub.status.idle":"2021-10-25T07:10:05.740720Z","shell.execute_reply.started":"2021-10-25T07:10:05.686562Z","shell.execute_reply":"2021-10-25T07:10:05.739932Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## 터짐","metadata":{}},{"cell_type":"code","source":"del Y_val,X_val, m , l","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:10:05.745035Z","iopub.execute_input":"2021-10-25T07:10:05.747888Z","iopub.status.idle":"2021-10-25T07:10:05.754917Z","shell.execute_reply.started":"2021-10-25T07:10:05.747846Z","shell.execute_reply":"2021-10-25T07:10:05.754039Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_Test_orig = []\nfor i in os.listdir('/kaggle/working/test/'):\n    label = i.split('.')[-2]\n    img = cv2.imread('/kaggle/working/test/'+i, cv2.IMREAD_COLOR)\n    img = cv2.resize(img,(IMG_SIZE,IMG_SIZE), interpolation = cv2.INTER_CUBIC)\n    #img = img / 255\n    X_Test_orig.append([np.array(img), np.array(label)])\n\nnp.save('Test_Data.npy', X_Train)","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:10:05.764588Z","iopub.execute_input":"2021-10-25T07:10:05.765348Z","iopub.status.idle":"2021-10-25T07:10:42.669030Z","shell.execute_reply.started":"2021-10-25T07:10:05.765306Z","shell.execute_reply":"2021-10-25T07:10:42.668014Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_test = np.array([i[0] for i in X_Test_orig]).reshape(-1,IMG_SIZE, IMG_SIZE, 3)\nLabel = np.array([i[1] for i in X_Test_orig])","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:10:42.670658Z","iopub.execute_input":"2021-10-25T07:10:42.670959Z","iopub.status.idle":"2021-10-25T07:10:42.901791Z","shell.execute_reply.started":"2021-10-25T07:10:42.670920Z","shell.execute_reply":"2021-10-25T07:10:42.900773Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"del X_Test_orig","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:10:42.903554Z","iopub.execute_input":"2021-10-25T07:10:42.903938Z","iopub.status.idle":"2021-10-25T07:10:43.451228Z","shell.execute_reply.started":"2021-10-25T07:10:42.903849Z","shell.execute_reply":"2021-10-25T07:10:43.450052Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#X_test = X_test / 255","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:10:43.453091Z","iopub.execute_input":"2021-10-25T07:10:43.453441Z","iopub.status.idle":"2021-10-25T07:10:44.109345Z","shell.execute_reply.started":"2021-10-25T07:10:43.453379Z","shell.execute_reply":"2021-10-25T07:10:44.108296Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#터짐","metadata":{}},{"cell_type":"code","source":"classes = Keras_Model.predict(X_test, batch_size = batch_size)","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:10:44.111231Z","iopub.execute_input":"2021-10-25T07:10:44.111645Z","iopub.status.idle":"2021-10-25T07:10:49.882484Z","shell.execute_reply.started":"2021-10-25T07:10:44.111587Z","shell.execute_reply":"2021-10-25T07:10:49.881479Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"prediction = pd.DataFrame()\nprediction['id'] = Label\nprediction['label'] = classes\n\nprediction.to_csv('submission.csv', index = False)","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:10:49.884003Z","iopub.execute_input":"2021-10-25T07:10:49.884336Z","iopub.status.idle":"2021-10-25T07:10:49.948386Z","shell.execute_reply.started":"2021-10-25T07:10:49.884296Z","shell.execute_reply":"2021-10-25T07:10:49.947546Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"","metadata":{}},{"cell_type":"code","source":"!pip3 install resnet","metadata":{"execution":{"iopub.status.busy":"2021-10-25T07:10:49.951023Z","iopub.execute_input":"2021-10-25T07:10:49.951487Z","iopub.status.idle":"2021-10-25T07:11:03.563316Z","shell.execute_reply.started":"2021-10-25T07:10:49.951433Z","shell.execute_reply":"2021-10-25T07:11:03.562241Z"},"trusted":true},"execution_count":null,"outputs":[]}]}