{"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"},"colab":{"name":"DL_Application_Planesnet_CNN.ipynb","provenance":[{"file_id":"1GuinfW8s8JE4N0CzT792xiw0yqaRTJS4","timestamp":1648436816591},{"file_id":"1IrvtfkBGUpea56SI2FHsJ5xgOqEFlz7R","timestamp":1648436787091}],"collapsed_sections":[]}},"nbformat_minor":0,"nbformat":4,"cells":[{"cell_type":"code","source":[""],"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2021-11-24T12:19:43.092646Z","iopub.execute_input":"2021-11-24T12:19:43.09335Z","iopub.status.idle":"2021-11-24T12:19:46.085199Z","shell.execute_reply.started":"2021-11-24T12:19:43.093264Z","shell.execute_reply":"2021-11-24T12:19:46.084508Z"},"trusted":true,"id":"r-UmqOmZIJMf"},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":["## CNN classifier for the planesnet data"],"metadata":{"id":"_9aqwCIad4pS"}},{"cell_type":"code","source":["## import packages\n","\n","import numpy as np # linear algebra\n","import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n","import matplotlib.pyplot as plt\n","from sklearn.model_selection import train_test_split\n","from sklearn.preprocessing import MinMaxScaler\n","from keras.models import Sequential, Model\n","from tensorflow.keras.layers import Conv2D, MaxPooling2D, Dense, Activation, Dropout, Flatten\n","from tensorflow.keras.layers import BatchNormalization\n","\n","from tensorflow.keras.optimizers import Adam\n","from keras.callbacks import LearningRateScheduler\n","from keras.regularizers import l2, l1\n","import math\n"],"metadata":{"id":"6Al4ArJ5d21l"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["## Mount drive folder\n","from google.colab import drive\n","\n","drive.mount('/content/drive')"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"iKat3xvMIsN7","executionInfo":{"status":"ok","timestamp":1648435557018,"user_tz":240,"elapsed":771,"user":{"displayName":"Guray Erus","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GiGnBNnSM10DAl86Xzx2wV9MnzBNDvcAv6FeVBn=s64","userId":"15374812584437350386"}},"outputId":"90b717b3-4bad-445e-a9c9-841f634787c8"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount(\"/content/drive\", force_remount=True).\n"]}]},{"cell_type":"code","source":["## Read data in json format\n","data = pd.read_json('/content/drive/MyDrive/CommonFiles/MUSA650-Data/planesnet.json')"],"metadata":{"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","execution":{"iopub.status.busy":"2021-11-24T12:19:46.086133Z","iopub.execute_input":"2021-11-24T12:19:46.086408Z","iopub.status.idle":"2021-11-24T12:19:52.796249Z","shell.execute_reply.started":"2021-11-24T12:19:46.086358Z","shell.execute_reply":"2021-11-24T12:19:52.795603Z"},"trusted":true,"id":"tUGZwlGzIJMm"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["## View the dataframe\n","data.head()"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":206},"id":"2hWPtM8HLnIH","executionInfo":{"status":"ok","timestamp":1648435565755,"user_tz":240,"elapsed":215,"user":{"displayName":"Guray Erus","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GiGnBNnSM10DAl86Xzx2wV9MnzBNDvcAv6FeVBn=s64","userId":"15374812584437350386"}},"outputId":"4d0115b1-0f7d-4527-c2e6-28c5bd0ff0d7"},"execution_count":null,"outputs":[{"output_type":"execute_result","data":{"text/plain":[" data labels \\\n","0 [206, 195, 187, 183, 177, 175, 174, 193, 198, ... 1 \n","1 [215, 209, 200, 196, 192, 197, 205, 168, 155, ... 1 \n","2 [204, 214, 220, 219, 213, 205, 198, 193, 199, ... 1 \n","3 [179, 174, 179, 178, 173, 170, 168, 168, 168, ... 1 \n","4 [222, 222, 218, 214, 208, 205, 207, 206, 206, ... 1 \n","\n"," locations scene_ids \n","0 [-118.40497658522878, 33.940618514147936] 20170620_175442_0e30 \n","1 [-122.392469714, 37.6176425378] 20161212_180859_0e30 \n","2 [-122.397578597, 37.6209247852] 20170524_181349_0e2f \n","3 [-122.214849831, 37.7203378331] 20161110_180707_0e1f \n","4 [-117.862173435, 33.6796854072] 20160813_184932_0c64 "],"text/html":["\n","
\n"," | data | \n","labels | \n","locations | \n","scene_ids | \n","
---|---|---|---|---|
0 | \n","[206, 195, 187, 183, 177, 175, 174, 193, 198, ... | \n","1 | \n","[-118.40497658522878, 33.940618514147936] | \n","20170620_175442_0e30 | \n","
1 | \n","[215, 209, 200, 196, 192, 197, 205, 168, 155, ... | \n","1 | \n","[-122.392469714, 37.6176425378] | \n","20161212_180859_0e30 | \n","
2 | \n","[204, 214, 220, 219, 213, 205, 198, 193, 199, ... | \n","1 | \n","[-122.397578597, 37.6209247852] | \n","20170524_181349_0e2f | \n","
3 | \n","[179, 174, 179, 178, 173, 170, 168, 168, 168, ... | \n","1 | \n","[-122.214849831, 37.7203378331] | \n","20161110_180707_0e1f | \n","
4 | \n","[222, 222, 218, 214, 208, 205, 207, 206, 206, ... | \n","1 | \n","[-117.862173435, 33.6796854072] | \n","20160813_184932_0c64 | \n","