{"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 \nimport os\nimport cv2\nimport tensorflow as tf\nimport matplotlib.pyplot as plt\nfrom PIL import Image\nimport albumentations as A\n\nfrom sklearn.metrics import f1_score, classification_report\nimport pickle\nfrom sklearn.model_selection import StratifiedKFold\nfrom numpy import array\nfrom random import shuffle, seed","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","id":"dcO2IxLbiqQY","execution":{"iopub.status.busy":"2021-07-06T23:46:03.684264Z","iopub.execute_input":"2021-07-06T23:46:03.684705Z","iopub.status.idle":"2021-07-06T23:46:10.382689Z","shell.execute_reply.started":"2021-07-06T23:46:03.684625Z","shell.execute_reply":"2021-07-06T23:46:10.381822Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"list_paths = []\nfor subdir, dirs, files in os.walk(\"../input\"):\n    for file in files:\n        filepath = subdir + os.sep + file\n        list_paths.append(filepath)\n        \nlist_train = [filepath for filepath in list_paths if \"train/\" in filepath]\nseed(420)\nshuffle(list_train)\nlist_test = [filepath for filepath in list_paths if \"test/\" in filepath]","metadata":{"id":"sBo5sya-iqQc","execution":{"iopub.status.busy":"2021-07-06T23:46:10.384118Z","iopub.execute_input":"2021-07-06T23:46:10.384463Z","iopub.status.idle":"2021-07-06T23:46:16.294514Z","shell.execute_reply.started":"2021-07-06T23:46:10.384425Z","shell.execute_reply":"2021-07-06T23:46:16.293683Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"list_train[:5]","metadata":{"id":"jBtM1tHSiqQd","outputId":"8882c860-ec87-41a2-a108-d9df494ed841","execution":{"iopub.status.busy":"2021-07-06T23:46:16.296234Z","iopub.execute_input":"2021-07-06T23:46:16.296598Z","iopub.status.idle":"2021-07-06T23:46:16.304223Z","shell.execute_reply.started":"2021-07-06T23:46:16.296564Z","shell.execute_reply":"2021-07-06T23:46:16.303438Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def get_class_from_path(filepath):\n    return os.path.dirname(filepath).split(os.sep)[-1]","metadata":{"id":"6oa-5IQtiqQf","execution":{"iopub.status.busy":"2021-07-06T23:46:16.305866Z","iopub.execute_input":"2021-07-06T23:46:16.306521Z","iopub.status.idle":"2021-07-06T23:46:16.312715Z","shell.execute_reply.started":"2021-07-06T23:46:16.306351Z","shell.execute_reply":"2021-07-06T23:46:16.31178Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"labels = [get_class_from_path(filepath) for filepath in list_train]","metadata":{"id":"ThwZsJumiqQf","execution":{"iopub.status.busy":"2021-07-06T23:46:16.314023Z","iopub.execute_input":"2021-07-06T23:46:16.314692Z","iopub.status.idle":"2021-07-06T23:46:16.326731Z","shell.execute_reply.started":"2021-07-06T23:46:16.314661Z","shell.execute_reply":"2021-07-06T23:46:16.325735Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"labels[:5]","metadata":{"id":"HD66I9YLiqQf","outputId":"5dc9f71c-bdce-45f1-b3a4-c81c1a54a112","execution":{"iopub.status.busy":"2021-07-06T23:46:16.328314Z","iopub.execute_input":"2021-07-06T23:46:16.328956Z","iopub.status.idle":"2021-07-06T23:46:16.338092Z","shell.execute_reply.started":"2021-07-06T23:46:16.328921Z","shell.execute_reply":"2021-07-06T23:46:16.3373Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data = pd.DataFrame(labels, columns=['class'])\ntrain_data['path'] = list_train\ntrain_data.head()","metadata":{"id":"l9eW-fUviqQg","outputId":"04489323-7159-4f67-d683-04f8e815362f","execution":{"iopub.status.busy":"2021-07-06T23:46:16.340996Z","iopub.execute_input":"2021-07-06T23:46:16.341254Z","iopub.status.idle":"2021-07-06T23:46:16.366321Z","shell.execute_reply.started":"2021-07-06T23:46:16.341223Z","shell.execute_reply":"2021-07-06T23:46:16.365451Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data['class'].value_counts().sort_values().plot(kind='bar')","metadata":{"id":"MORnNa2JiqQi","outputId":"ca3b1270-a133-4f9e-b70c-7cd6d8731f99","execution":{"iopub.status.busy":"2021-07-06T23:46:16.370834Z","iopub.execute_input":"2021-07-06T23:46:16.371088Z","iopub.status.idle":"2021-07-06T23:46:16.554639Z","shell.execute_reply.started":"2021-07-06T23:46:16.371066Z","shell.execute_reply":"2021-07-06T23:46:16.553693Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X = train_data['path']\ny = train_data['class']","metadata":{"id":"UmClv0eQiqQi","execution":{"iopub.status.busy":"2021-07-06T23:46:16.556643Z","iopub.execute_input":"2021-07-06T23:46:16.556982Z","iopub.status.idle":"2021-07-06T23:46:16.561557Z","shell.execute_reply.started":"2021-07-06T23:46:16.556947Z","shell.execute_reply":"2021-07-06T23:46:16.560603Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"splitter = StratifiedKFold(n_splits=5, random_state=42, shuffle=True)\nsplits = list(splitter.split(X=X, y=y))","metadata":{"id":"M60WPl4SiqQj","execution":{"iopub.status.busy":"2021-07-06T23:46:16.563246Z","iopub.execute_input":"2021-07-06T23:46:16.563713Z","iopub.status.idle":"2021-07-06T23:46:16.578269Z","shell.execute_reply.started":"2021-07-06T23:46:16.563677Z","shell.execute_reply":"2021-07-06T23:46:16.577463Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y.shape","metadata":{"id":"yP5qjuQTiqQj","outputId":"a46bfd77-215c-4077-8501-74dd58651717","execution":{"iopub.status.busy":"2021-07-06T23:46:16.579669Z","iopub.execute_input":"2021-07-06T23:46:16.580256Z","iopub.status.idle":"2021-07-06T23:46:16.587255Z","shell.execute_reply.started":"2021-07-06T23:46:16.580218Z","shell.execute_reply":"2021-07-06T23:46:16.58623Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y = pd.get_dummies(y)\ny.head()","metadata":{"id":"YCiaU66DiqQk","outputId":"4bf7be7a-cbfb-47c9-e0e4-3ad34f9479f9","execution":{"iopub.status.busy":"2021-07-06T23:46:16.588914Z","iopub.execute_input":"2021-07-06T23:46:16.589309Z","iopub.status.idle":"2021-07-06T23:46:16.606687Z","shell.execute_reply.started":"2021-07-06T23:46:16.589248Z","shell.execute_reply":"2021-07-06T23:46:16.605961Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dict_map = {\"0\": \"HTC-1-M7\", \n            \"1\": \"LG-Nexus-5x\", \n            \"2\": \"Motorola-Droid-Maxx\", \n            \"3\": \"Motorola-Nexus-6\", \n            \"4\": \"Motorola-X\", \n            \"5\": \"Samsung-Galaxy-Note3\",\n            \"6\": \"Samsung-Galaxy-S4\",\n            \"7\": \"Sony-NEX-7\",\n            \"8\": \"iPhone-4s\",\n            \"9\": \"iPhone-6\"}","metadata":{"id":"l7n6ZreuiqQk","execution":{"iopub.status.busy":"2021-07-06T23:46:16.607579Z","iopub.execute_input":"2021-07-06T23:46:16.607981Z","iopub.status.idle":"2021-07-06T23:46:16.61407Z","shell.execute_reply.started":"2021-07-06T23:46:16.607946Z","shell.execute_reply":"2021-07-06T23:46:16.61314Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def open_image(img_path):\n    image = cv2.imread(img_path)\n    image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)\n    return image","metadata":{"id":"2CCRFsD5iqQl","execution":{"iopub.status.busy":"2021-07-06T23:46:16.615262Z","iopub.execute_input":"2021-07-06T23:46:16.615803Z","iopub.status.idle":"2021-07-06T23:46:16.621337Z","shell.execute_reply.started":"2021-07-06T23:46:16.615766Z","shell.execute_reply":"2021-07-06T23:46:16.620273Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"SHAPE = 512\n\ntrain_augmentations = A.Compose([A.RandomCrop(height=SHAPE,width=SHAPE),\n                                 A.RandomGamma(gamma_limit=(80, 120), p=0.8),\n                                 A.JpegCompression(quality_lower=70, quality_upper=90, p=0.9),\n                                 A.GridDistortion(interpolation=cv2.INTER_CUBIC, p=0.9)\n                                 ])\n\nteste_augmentations = A.Compose([A.CenterCrop(height=SHAPE,width=SHAPE)                              \n                                 ])","metadata":{"id":"vNXtb6FUiqQl","execution":{"iopub.status.busy":"2021-07-06T23:46:16.622572Z","iopub.execute_input":"2021-07-06T23:46:16.623048Z","iopub.status.idle":"2021-07-06T23:46:16.631355Z","shell.execute_reply.started":"2021-07-06T23:46:16.622995Z","shell.execute_reply":"2021-07-06T23:46:16.630486Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"class CameraDataset(tf.keras.utils.Sequence):\n    def __init__(self, X_set, y_set, batch_size, augmenter=None, test=False, *args, **kwargs):\n        \n        self.batch_size = batch_size\n        self.x_set = X_set\n        self.y_set = y_set\n        self.test = test\n        self.augmenter = augmenter\n        \n    def __len__(self):\n        return int(len(self.x_set) / self.batch_size)\n    \n    \n    def __getitem__(self, index):\n        X = self.x_set[index * self.batch_size : (index + 1) * self.batch_size]        \n        y = self.y_set[index * self.batch_size : (index + 1) * self.batch_size]\n        \n        X = [(self.augmenter(image=open_image(x))['image']) for x in X]\n        \n        if self.test:\n            return np.array(X)\n        \n        return np.array(X), y.values","metadata":{"id":"3ppMFlmiiqQm","execution":{"iopub.status.busy":"2021-07-06T23:46:16.632806Z","iopub.execute_input":"2021-07-06T23:46:16.634516Z","iopub.status.idle":"2021-07-06T23:46:16.644351Z","shell.execute_reply.started":"2021-07-06T23:46:16.634482Z","shell.execute_reply":"2021-07-06T23:46:16.643455Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_dataset = CameraDataset(X, y, batch_size=8, augmenter=train_augmentations)","metadata":{"id":"7_5V1Nj6iqQn","execution":{"iopub.status.busy":"2021-07-06T23:46:16.647113Z","iopub.execute_input":"2021-07-06T23:46:16.647352Z","iopub.status.idle":"2021-07-06T23:46:16.653162Z","shell.execute_reply.started":"2021-07-06T23:46:16.647329Z","shell.execute_reply":"2021-07-06T23:46:16.652346Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_set, y_set = train_dataset.__getitem__(50)","metadata":{"id":"JI3nF2RHiqQo","execution":{"iopub.status.busy":"2021-07-06T23:46:16.655289Z","iopub.execute_input":"2021-07-06T23:46:16.655589Z","iopub.status.idle":"2021-07-06T23:46:18.446515Z","shell.execute_reply.started":"2021-07-06T23:46:16.655556Z","shell.execute_reply":"2021-07-06T23:46:18.445673Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_set[0].shape","metadata":{"id":"6hF83IR9iqQo","outputId":"209d1aca-208d-45bb-e29b-113ecd0a1962","execution":{"iopub.status.busy":"2021-07-06T23:46:18.447787Z","iopub.execute_input":"2021-07-06T23:46:18.448114Z","iopub.status.idle":"2021-07-06T23:46:18.455573Z","shell.execute_reply.started":"2021-07-06T23:46:18.448082Z","shell.execute_reply":"2021-07-06T23:46:18.454543Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_set[0]","metadata":{"id":"-sekgQXoiqQo","outputId":"c3e67a8d-7267-4a05-bb3a-0c4840ae7b12","execution":{"iopub.status.busy":"2021-07-06T23:46:18.456964Z","iopub.execute_input":"2021-07-06T23:46:18.457322Z","iopub.status.idle":"2021-07-06T23:46:18.464649Z","shell.execute_reply.started":"2021-07-06T23:46:18.457287Z","shell.execute_reply":"2021-07-06T23:46:18.463739Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.imshow(x_set[3])","metadata":{"id":"jRosfbPXiqQp","outputId":"91d12fc6-3e8f-483c-8b2c-3d835be8a440","execution":{"iopub.status.busy":"2021-07-06T23:46:18.465947Z","iopub.execute_input":"2021-07-06T23:46:18.466358Z","iopub.status.idle":"2021-07-06T23:46:18.633003Z","shell.execute_reply.started":"2021-07-06T23:46:18.466317Z","shell.execute_reply":"2021-07-06T23:46:18.63218Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def build_model():\n    base_model = tf.keras.applications.DenseNet201(weights='imagenet', include_top=False, input_shape=[SHAPE, SHAPE, 3])\n    base_model.trainable = True\n    inputs =tf.keras.layers.Input(shape=(SHAPE,SHAPE,3))\n    x = tf.keras.applications.densenet.preprocess_input(inputs)\n    x = base_model(x, training=True)\n    x = tf.keras.layers.GlobalAveragePooling2D()(x)\n    x = tf.keras.layers.Dense(64, activation='relu')(x)\n    x = tf.keras.layers.Dropout(0.3)(x)\n    x = tf.keras.layers.Dense(32, activation='relu')(x)\n    x = tf.keras.layers.Dropout(0.3)(x)\n    outputs = tf.keras.layers.Dense(10, activation='softmax')(x)\n\n    model =tf.keras.Model(inputs=inputs, outputs=outputs)\n\n    model.compile(optimizer=tf.keras.optimizers.Adam(lr=1e-4), loss='categorical_crossentropy', metrics=['accuracy'])\n\n    model.summary() \n    return model","metadata":{"id":"Aywspy-liqQp","execution":{"iopub.status.busy":"2021-07-06T23:46:18.634046Z","iopub.execute_input":"2021-07-06T23:46:18.634339Z","iopub.status.idle":"2021-07-06T23:46:18.643703Z","shell.execute_reply.started":"2021-07-06T23:46:18.634308Z","shell.execute_reply":"2021-07-06T23:46:18.642605Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.model_selection import train_test_split\n\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42, shuffle=True, stratify=y)\n\ntrain_dataset = CameraDataset(X_train, y_train, batch_size=10,augmenter=train_augmentations)\nval_dataset = CameraDataset(X_test, y_test, batch_size=10,augmenter=teste_augmentations)","metadata":{"id":"4xJs9aO3oNh4","execution":{"iopub.status.busy":"2021-07-06T23:46:18.648145Z","iopub.execute_input":"2021-07-06T23:46:18.648504Z","iopub.status.idle":"2021-07-06T23:46:18.706243Z","shell.execute_reply.started":"2021-07-06T23:46:18.64847Z","shell.execute_reply":"2021-07-06T23:46:18.705507Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model = build_model()","metadata":{"id":"iWk54FjwO_OB","execution":{"iopub.status.busy":"2021-07-06T23:46:18.707895Z","iopub.execute_input":"2021-07-06T23:46:18.708249Z","iopub.status.idle":"2021-07-06T23:46:28.239773Z","shell.execute_reply.started":"2021-07-06T23:46:18.708216Z","shell.execute_reply":"2021-07-06T23:46:28.238967Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"file_path = \"weights.best.hdf5\"\n\ncheckpoint = tf.keras.callbacks.ModelCheckpoint(file_path, monitor=\"val_accuracy\", save_best_only=True, mode='max')\n\nreduce_lr = tf.keras.callbacks.ReduceLROnPlateau(monitor=\"val_accuracy\", factor=0.9, patience=2, min_lr=1e-6, mode=\"max\", verbose=True)\n\nearly_stopping = tf.keras.callbacks.EarlyStopping(monitor=\"val_accuracy\", patience=5, mode=\"max\", verbose=True)\n\ncallbacks_list = [checkpoint, reduce_lr, early_stopping]\n\nhistory = model.fit(train_dataset, validation_data=val_dataset, epochs=100, batch_size=10, callbacks=callbacks_list)","metadata":{"id":"IE3mrj0uqGHw","outputId":"200ee3df-6631-443c-ca96-7637007d0ff7","execution":{"iopub.status.busy":"2021-07-06T23:46:28.241039Z","iopub.execute_input":"2021-07-06T23:46:28.241362Z","iopub.status.idle":"2021-07-06T23:59:10.788509Z","shell.execute_reply.started":"2021-07-06T23:46:28.241329Z","shell.execute_reply":"2021-07-06T23:59:10.787605Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_submission = pd.read_csv('../input/sp-society-camera-model-identification/sample_submission.csv')\nsample_submission.head()","metadata":{"id":"q7rIVBen5L4r","execution":{"iopub.status.busy":"2021-07-07T00:01:42.571099Z","iopub.execute_input":"2021-07-07T00:01:42.57145Z","iopub.status.idle":"2021-07-07T00:01:42.593669Z","shell.execute_reply.started":"2021-07-07T00:01:42.571419Z","shell.execute_reply":"2021-07-07T00:01:42.592886Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_test = '../input/sp-society-camera-model-identification/test/test/' + sample_submission['fname']","metadata":{"id":"I71hhaDd54V1","execution":{"iopub.status.busy":"2021-07-07T00:01:42.596276Z","iopub.execute_input":"2021-07-07T00:01:42.596538Z","iopub.status.idle":"2021-07-07T00:01:42.603339Z","shell.execute_reply.started":"2021-07-07T00:01:42.596515Z","shell.execute_reply":"2021-07-07T00:01:42.602601Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_test[:5]","metadata":{"id":"u7VUDzqAuKVJ","execution":{"iopub.status.busy":"2021-07-07T00:01:42.606558Z","iopub.execute_input":"2021-07-07T00:01:42.60686Z","iopub.status.idle":"2021-07-07T00:01:42.614323Z","shell.execute_reply.started":"2021-07-07T00:01:42.606828Z","shell.execute_reply":"2021-07-07T00:01:42.613419Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def read_and_array(filepath):\n    im_array = np.array(Image.open((filepath)), dtype=\"uint8\")\n    pil_im = Image.fromarray(im_array)\n    new_array = np.array(pil_im)\n    return new_array","metadata":{"id":"t6icVzxS6rG4","execution":{"iopub.status.busy":"2021-07-07T00:01:42.615954Z","iopub.execute_input":"2021-07-07T00:01:42.616413Z","iopub.status.idle":"2021-07-07T00:01:42.622042Z","shell.execute_reply.started":"2021-07-07T00:01:42.616363Z","shell.execute_reply":"2021-07-07T00:01:42.621098Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"file_path = \"weights.best.hdf5\"\nmodel = tf.keras.models.load_model(file_path)\ntest_dataset = CameraDataset(X_test, sample_submission['camera'], test=True, augmenter=teste_augmentations, batch_size=10, shuffle=False)\npred_mean = model.predict(test_dataset)\n# X_test = np.array([read_and_array(filepath) for filepath in X_test])\n# pred_mean = model.predict(X_test)","metadata":{"id":"ighrzBmHqaFC","execution":{"iopub.status.busy":"2021-07-07T00:01:42.625999Z","iopub.execute_input":"2021-07-07T00:01:42.626318Z","iopub.status.idle":"2021-07-07T00:03:09.057817Z","shell.execute_reply.started":"2021-07-07T00:01:42.626294Z","shell.execute_reply":"2021-07-07T00:03:09.056893Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"labels_test=[]\nfor item in pred_mean.argmax(axis=1):\n    labels_test.append(dict_map[str(item)])","metadata":{"id":"p-JoHZcTqVfS","execution":{"iopub.status.busy":"2021-07-07T00:03:09.061347Z","iopub.execute_input":"2021-07-07T00:03:09.061633Z","iopub.status.idle":"2021-07-07T00:03:09.071136Z","shell.execute_reply.started":"2021-07-07T00:03:09.061607Z","shell.execute_reply":"2021-07-07T00:03:09.0703Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pred_mean.argmax(axis=1)[:10]","metadata":{"id":"xoTqrRQUlZGN","execution":{"iopub.status.busy":"2021-07-07T00:03:09.072872Z","iopub.execute_input":"2021-07-07T00:03:09.073241Z","iopub.status.idle":"2021-07-07T00:03:09.08417Z","shell.execute_reply.started":"2021-07-07T00:03:09.073206Z","shell.execute_reply":"2021-07-07T00:03:09.083287Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"labels_test[:10]","metadata":{"id":"gQh7XRbEl3Ma","execution":{"iopub.status.busy":"2021-07-07T00:03:09.086211Z","iopub.execute_input":"2021-07-07T00:03:09.086594Z","iopub.status.idle":"2021-07-07T00:03:09.093805Z","shell.execute_reply.started":"2021-07-07T00:03:09.08656Z","shell.execute_reply":"2021-07-07T00:03:09.09294Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_submission['camera'] = labels_test\nsample_submission.head()","metadata":{"id":"W16SuUPFmAk7","execution":{"iopub.status.busy":"2021-07-07T00:03:09.094992Z","iopub.execute_input":"2021-07-07T00:03:09.095684Z","iopub.status.idle":"2021-07-07T00:03:09.107933Z","shell.execute_reply.started":"2021-07-07T00:03:09.095648Z","shell.execute_reply":"2021-07-07T00:03:09.107005Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"  sample_submission['camera'].value_counts()","metadata":{"id":"HO4DFP6UsBaR","execution":{"iopub.status.busy":"2021-07-07T00:03:09.108921Z","iopub.execute_input":"2021-07-07T00:03:09.109154Z","iopub.status.idle":"2021-07-07T00:03:09.121106Z","shell.execute_reply.started":"2021-07-07T00:03:09.109132Z","shell.execute_reply":"2021-07-07T00:03:09.12033Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_submission.to_csv(\"submission.csv\", index=False)","metadata":{"id":"mcSR_8gpfx5G","execution":{"iopub.status.busy":"2021-07-07T00:03:09.123734Z","iopub.execute_input":"2021-07-07T00:03:09.123971Z","iopub.status.idle":"2021-07-07T00:03:09.428244Z","shell.execute_reply.started":"2021-07-07T00:03:09.12395Z","shell.execute_reply":"2021-07-07T00:03:09.427425Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_submission['camera'].value_counts().sort_values().plot(kind='bar')","metadata":{"id":"KXk1itbSfxvj","execution":{"iopub.status.busy":"2021-07-07T00:03:09.430251Z","iopub.execute_input":"2021-07-07T00:03:09.430738Z","iopub.status.idle":"2021-07-07T00:03:09.589834Z","shell.execute_reply.started":"2021-07-07T00:03:09.4307Z","shell.execute_reply":"2021-07-07T00:03:09.588912Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"id":"w-Y1XMuc5m5U"},"execution_count":null,"outputs":[]}]}