{"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":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","papermill":{"duration":0.755715,"end_time":"2023-10-04T15:18:56.737471","exception":false,"start_time":"2023-10-04T15:18:55.981756","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:47:56.793957Z","iopub.execute_input":"2023-10-10T06:47:56.794345Z","iopub.status.idle":"2023-10-10T06:47:57.106726Z","shell.execute_reply.started":"2023-10-10T06:47:56.794322Z","shell.execute_reply":"2023-10-10T06:47:57.105752Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from fastai.vision.all import *\n","metadata":{"papermill":{"duration":6.690085,"end_time":"2023-10-04T15:19:03.433629","exception":false,"start_time":"2023-10-04T15:18:56.743544","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:47:57.108635Z","iopub.execute_input":"2023-10-10T06:47:57.109491Z","iopub.status.idle":"2023-10-10T06:48:04.373260Z","shell.execute_reply.started":"2023-10-10T06:47:57.109456Z","shell.execute_reply":"2023-10-10T06:48:04.372329Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!pip install py7zr\n","metadata":{"papermill":{"duration":11.827153,"end_time":"2023-10-04T15:19:15.266743","exception":false,"start_time":"2023-10-04T15:19:03.439590","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:48:04.374610Z","iopub.execute_input":"2023-10-10T06:48:04.374938Z","iopub.status.idle":"2023-10-10T06:48:16.357527Z","shell.execute_reply.started":"2023-10-10T06:48:04.374896Z","shell.execute_reply":"2023-10-10T06:48:16.356261Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from py7zr import unpack_7zarchive\nimport shutil\nshutil.register_unpack_format('7zip',['.7z'],unpack_7zarchive)","metadata":{"papermill":{"duration":0.131985,"end_time":"2023-10-04T15:19:15.405761","exception":false,"start_time":"2023-10-04T15:19:15.273776","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:48:16.360724Z","iopub.execute_input":"2023-10-10T06:48:16.361124Z","iopub.status.idle":"2023-10-10T06:48:16.488609Z","shell.execute_reply.started":"2023-10-10T06:48:16.361091Z","shell.execute_reply":"2023-10-10T06:48:16.487670Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"shutil.unpack_archive('../input/cifar-10/train.7z', '/kaggle/temp/')\n","metadata":{"papermill":{"duration":43.206919,"end_time":"2023-10-04T15:19:58.619390","exception":false,"start_time":"2023-10-04T15:19:15.412471","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:48:16.489959Z","iopub.execute_input":"2023-10-10T06:48:16.490527Z","iopub.status.idle":"2023-10-10T06:48:59.673709Z","shell.execute_reply.started":"2023-10-10T06:48:16.490495Z","shell.execute_reply":"2023-10-10T06:48:59.672753Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_labels = pd.read_csv(\"../input/cifar-10/trainLabels.csv\", header=\"infer\")\n\nclasses = train_labels['label'].unique()\nprint(classes)","metadata":{"papermill":{"duration":0.058054,"end_time":"2023-10-04T15:19:58.684329","exception":false,"start_time":"2023-10-04T15:19:58.626275","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:48:59.674948Z","iopub.execute_input":"2023-10-10T06:48:59.675279Z","iopub.status.idle":"2023-10-10T06:48:59.739905Z","shell.execute_reply.started":"2023-10-10T06:48:59.675250Z","shell.execute_reply":"2023-10-10T06:48:59.738824Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"if not os.path.exists(\"/kaggle/temp/valid\"):\n    os.mkdir(\"/kaggle/temp/valid\")\n    \nparent_path_train = \"/kaggle/temp/train\"\nparent_path_valid = \"/kaggle/temp/valid\"\n# parent_path_test = \"/kaggle/temp/test\"\n\nfor class1 in classes:\n    path_train = os.path.join(parent_path_train,class1)\n    if not os.path.exists(path_train):\n        os.mkdir(path_train)\n    path_valid = os.path.join(parent_path_valid,class1)\n    if not os.path.exists(path_valid):\n        os.mkdir(path_valid)\nfor (int_ind,row) in train_labels.iterrows():\n    id = str(row[\"id\"])+\".png\"\n    source_path = os.path.join(parent_path_train,id)\n    \n    p=np.random.random()\n    if p<=0.8:\n        target_path = os.path.join(parent_path_train,row[\"label\"],id)\n        os.replace(source_path, target_path)\n    else:\n        target_path = os.path.join(parent_path_valid,row[\"label\"],id)\n        os.replace(source_path, target_path)","metadata":{"papermill":{"duration":5.879384,"end_time":"2023-10-04T15:20:04.570204","exception":false,"start_time":"2023-10-04T15:19:58.690820","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:48:59.744711Z","iopub.execute_input":"2023-10-10T06:48:59.745113Z","iopub.status.idle":"2023-10-10T06:49:06.170264Z","shell.execute_reply.started":"2023-10-10T06:48:59.745074Z","shell.execute_reply":"2023-10-10T06:49:06.169372Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dls=ImageDataLoaders.from_folder(path='/kaggle/temp',\n                            train='train', valid='valid',item_tfms=Resize(224),bs=128)","metadata":{"papermill":{"duration":7.875666,"end_time":"2023-10-04T15:20:12.452983","exception":false,"start_time":"2023-10-04T15:20:04.577317","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:06.171491Z","iopub.execute_input":"2023-10-10T06:49:06.172014Z","iopub.status.idle":"2023-10-10T06:49:13.228579Z","shell.execute_reply.started":"2023-10-10T06:49:06.171982Z","shell.execute_reply":"2023-10-10T06:49:13.227626Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"os.listdir('/kaggle/temp')","metadata":{"papermill":{"duration":0.016761,"end_time":"2023-10-04T15:20:12.477134","exception":false,"start_time":"2023-10-04T15:20:12.460373","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:13.230010Z","iopub.execute_input":"2023-10-10T06:49:13.230338Z","iopub.status.idle":"2023-10-10T06:49:13.237638Z","shell.execute_reply.started":"2023-10-10T06:49:13.230309Z","shell.execute_reply":"2023-10-10T06:49:13.236714Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dls.show_batch()","metadata":{"papermill":{"duration":1.492178,"end_time":"2023-10-04T15:20:13.976315","exception":false,"start_time":"2023-10-04T15:20:12.484137","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:13.241812Z","iopub.execute_input":"2023-10-10T06:49:13.242324Z","iopub.status.idle":"2023-10-10T06:49:14.691498Z","shell.execute_reply.started":"2023-10-10T06:49:13.242295Z","shell.execute_reply":"2023-10-10T06:49:14.690692Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"learn = vision_learner(dls, resnet50, metrics=accuracy)\n","metadata":{"papermill":{"duration":1.264781,"end_time":"2023-10-04T15:20:15.254879","exception":false,"start_time":"2023-10-04T15:20:13.990098","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:14.692390Z","iopub.execute_input":"2023-10-10T06:49:14.692690Z","iopub.status.idle":"2023-10-10T06:49:17.749275Z","shell.execute_reply.started":"2023-10-10T06:49:14.692664Z","shell.execute_reply":"2023-10-10T06:49:17.748187Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"learn.lr_find()\n","metadata":{"papermill":{"duration":85.221411,"end_time":"2023-10-04T15:21:40.490013","exception":false,"start_time":"2023-10-04T15:20:15.268602","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:17.750470Z","iopub.execute_input":"2023-10-10T06:49:17.750794Z","iopub.status.idle":"2023-10-10T06:49:27.429959Z","shell.execute_reply.started":"2023-10-10T06:49:17.750767Z","shell.execute_reply":"2023-10-10T06:49:27.427008Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"learn.fit_one_cycle(10, 0.003)\n","metadata":{"papermill":{"duration":3125.902388,"end_time":"2023-10-04T16:13:46.406294","exception":false,"start_time":"2023-10-04T15:21:40.503906","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.431165Z","iopub.status.idle":"2023-10-10T06:49:27.432309Z","shell.execute_reply.started":"2023-10-10T06:49:27.432055Z","shell.execute_reply":"2023-10-10T06:49:27.432081Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"learn.unfreeze()\n","metadata":{"papermill":{"duration":0.024088,"end_time":"2023-10-04T16:13:46.444714","exception":false,"start_time":"2023-10-04T16:13:46.420626","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.433801Z","iopub.status.idle":"2023-10-10T06:49:27.434589Z","shell.execute_reply.started":"2023-10-10T06:49:27.434322Z","shell.execute_reply":"2023-10-10T06:49:27.434346Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"learn.lr_find()\n","metadata":{"papermill":{"duration":63.469505,"end_time":"2023-10-04T16:14:49.927932","exception":false,"start_time":"2023-10-04T16:13:46.458427","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.436014Z","iopub.status.idle":"2023-10-10T06:49:27.436787Z","shell.execute_reply.started":"2023-10-10T06:49:27.436545Z","shell.execute_reply":"2023-10-10T06:49:27.436568Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"learn.fit_one_cycle(15, lr_max=slice(1e-6,3e-5))\n","metadata":{"papermill":{"duration":6259.251099,"end_time":"2023-10-04T17:59:09.195101","exception":false,"start_time":"2023-10-04T16:14:49.944002","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.438188Z","iopub.status.idle":"2023-10-10T06:49:27.438951Z","shell.execute_reply.started":"2023-10-10T06:49:27.438721Z","shell.execute_reply":"2023-10-10T06:49:27.438744Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"shutil.unpack_archive('/kaggle/input/cifar-10/test.7z','/kaggle/temp/test')\nshutil.unregister_unpack_format('7zip')","metadata":{"papermill":{"duration":822.467733,"end_time":"2023-10-04T18:12:51.678207","exception":false,"start_time":"2023-10-04T17:59:09.210474","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.440325Z","iopub.status.idle":"2023-10-10T06:49:27.441141Z","shell.execute_reply.started":"2023-10-10T06:49:27.440894Z","shell.execute_reply":"2023-10-10T06:49:27.440917Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"learn.save('/kaggle/working/vision')","metadata":{"papermill":{"duration":0.554947,"end_time":"2023-10-04T18:12:52.248817","exception":false,"start_time":"2023-10-04T18:12:51.693870","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.442577Z","iopub.status.idle":"2023-10-10T06:49:27.443359Z","shell.execute_reply.started":"2023-10-10T06:49:27.443131Z","shell.execute_reply":"2023-10-10T06:49:27.443153Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(os.listdir('/kaggle/temp/test/test'))","metadata":{"papermill":{"duration":0.168333,"end_time":"2023-10-04T18:12:52.432845","exception":false,"start_time":"2023-10-04T18:12:52.264512","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.444799Z","iopub.status.idle":"2023-10-10T06:49:27.445576Z","shell.execute_reply.started":"2023-10-10T06:49:27.445316Z","shell.execute_reply":"2023-10-10T06:49:27.445339Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"path='/kaggle/temp/test/test'\nf=os.listdir(path)\nnew=[str(path)+'/'+s for s in f]","metadata":{"papermill":{"duration":0.219199,"end_time":"2023-10-04T18:12:52.667883","exception":false,"start_time":"2023-10-04T18:12:52.448684","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.446950Z","iopub.status.idle":"2023-10-10T06:49:27.447793Z","shell.execute_reply.started":"2023-10-10T06:49:27.447544Z","shell.execute_reply":"2023-10-10T06:49:27.447568Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_dl=learn.dls.test_dl(new)\n","metadata":{"papermill":{"duration":0.029719,"end_time":"2023-10-04T18:12:52.713487","exception":false,"start_time":"2023-10-04T18:12:52.683768","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.449191Z","iopub.status.idle":"2023-10-10T06:49:27.450021Z","shell.execute_reply.started":"2023-10-10T06:49:27.449773Z","shell.execute_reply":"2023-10-10T06:49:27.449797Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"class_score,y=learn.get_preds(dl=test_dl)\n","metadata":{"papermill":{"duration":863.115058,"end_time":"2023-10-04T18:27:15.843508","exception":false,"start_time":"2023-10-04T18:12:52.728450","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.451416Z","iopub.status.idle":"2023-10-10T06:49:27.452234Z","shell.execute_reply.started":"2023-10-10T06:49:27.451988Z","shell.execute_reply":"2023-10-10T06:49:27.452012Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"class_score","metadata":{"papermill":{"duration":0.048336,"end_time":"2023-10-04T18:27:15.908453","exception":false,"start_time":"2023-10-04T18:27:15.860117","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.453653Z","iopub.status.idle":"2023-10-10T06:49:27.454382Z","shell.execute_reply.started":"2023-10-10T06:49:27.454152Z","shell.execute_reply":"2023-10-10T06:49:27.454174Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"class_score = np.argmax(class_score, axis=1)\n","metadata":{"papermill":{"duration":0.062689,"end_time":"2023-10-04T18:27:15.987578","exception":false,"start_time":"2023-10-04T18:27:15.924889","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.455780Z","iopub.status.idle":"2023-10-10T06:49:27.456623Z","shell.execute_reply.started":"2023-10-10T06:49:27.456341Z","shell.execute_reply":"2023-10-10T06:49:27.456365Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"class_score[1].item()\n","metadata":{"papermill":{"duration":0.027484,"end_time":"2023-10-04T18:27:16.031814","exception":false,"start_time":"2023-10-04T18:27:16.004330","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.457987Z","iopub.status.idle":"2023-10-10T06:49:27.458829Z","shell.execute_reply.started":"2023-10-10T06:49:27.458571Z","shell.execute_reply":"2023-10-10T06:49:27.458597Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"class_score","metadata":{"papermill":{"duration":0.026108,"end_time":"2023-10-04T18:27:16.074412","exception":false,"start_time":"2023-10-04T18:27:16.048304","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.460154Z","iopub.status.idle":"2023-10-10T06:49:27.460857Z","shell.execute_reply.started":"2023-10-10T06:49:27.460652Z","shell.execute_reply":"2023-10-10T06:49:27.460673Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"classScore=class_score.tolist()","metadata":{"papermill":{"duration":0.026851,"end_time":"2023-10-04T18:27:16.116619","exception":false,"start_time":"2023-10-04T18:27:16.089768","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.461957Z","iopub.status.idle":"2023-10-10T06:49:27.462707Z","shell.execute_reply.started":"2023-10-10T06:49:27.462516Z","shell.execute_reply":"2023-10-10T06:49:27.462545Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(classScore)","metadata":{"papermill":{"duration":0.024251,"end_time":"2023-10-04T18:27:16.155776","exception":false,"start_time":"2023-10-04T18:27:16.131525","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.463971Z","iopub.status.idle":"2023-10-10T06:49:27.464742Z","shell.execute_reply.started":"2023-10-10T06:49:27.464495Z","shell.execute_reply":"2023-10-10T06:49:27.464516Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"learn.dls.vocab","metadata":{"papermill":{"duration":0.023199,"end_time":"2023-10-04T18:27:16.193933","exception":false,"start_time":"2023-10-04T18:27:16.170734","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.466069Z","iopub.status.idle":"2023-10-10T06:49:27.466818Z","shell.execute_reply.started":"2023-10-10T06:49:27.466589Z","shell.execute_reply":"2023-10-10T06:49:27.466611Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"classes={0:'airplane',1:'automobile',2:'bird',3:'cat',4:'deer',5:'dog',6:'frog',7:'horse',8:'ship',9:'truck'}","metadata":{"papermill":{"duration":0.023925,"end_time":"2023-10-04T18:27:16.232856","exception":false,"start_time":"2023-10-04T18:27:16.208931","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.468143Z","iopub.status.idle":"2023-10-10T06:49:27.468902Z","shell.execute_reply.started":"2023-10-10T06:49:27.468672Z","shell.execute_reply":"2023-10-10T06:49:27.468695Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predicted_classes=np.empty(shape=300000,dtype=np.dtype('U20'))","metadata":{"papermill":{"duration":0.026492,"end_time":"2023-10-04T18:27:16.274204","exception":false,"start_time":"2023-10-04T18:27:16.247712","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.470201Z","iopub.status.idle":"2023-10-10T06:49:27.470965Z","shell.execute_reply.started":"2023-10-10T06:49:27.470728Z","shell.execute_reply":"2023-10-10T06:49:27.470749Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ind=0\nfor i in (classScore):\n    predicted_classes[ind]=classes[i]\n    ind=ind+1","metadata":{"papermill":{"duration":0.114451,"end_time":"2023-10-04T18:27:16.403901","exception":false,"start_time":"2023-10-04T18:27:16.289450","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.472283Z","iopub.status.idle":"2023-10-10T06:49:27.473058Z","shell.execute_reply.started":"2023-10-10T06:49:27.472812Z","shell.execute_reply":"2023-10-10T06:49:27.472834Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predicted_classes","metadata":{"papermill":{"duration":0.023692,"end_time":"2023-10-04T18:27:16.443071","exception":false,"start_time":"2023-10-04T18:27:16.419379","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.474489Z","iopub.status.idle":"2023-10-10T06:49:27.475256Z","shell.execute_reply.started":"2023-10-10T06:49:27.475022Z","shell.execute_reply":"2023-10-10T06:49:27.475049Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"directory = '/kaggle/temp/test/test'\nImageId = [ (''.join(filter(str.isdigit, name ))) for name in os.listdir(directory)]","metadata":{"papermill":{"duration":0.35029,"end_time":"2023-10-04T18:27:16.808007","exception":false,"start_time":"2023-10-04T18:27:16.457717","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.476619Z","iopub.status.idle":"2023-10-10T06:49:27.477357Z","shell.execute_reply.started":"2023-10-10T06:49:27.477126Z","shell.execute_reply":"2023-10-10T06:49:27.477148Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission  = pd.DataFrame({\n    \"id\": ImageId,\n    \"label\": predicted_classes\n})\n# submission.sort_values(by=[\"ImageId\"], inplace = True)\nsubmission.to_csv(\"submission.csv\", index=False)\ndisplay(submission.head(3))\ndisplay(submission.tail(3))","metadata":{"papermill":{"duration":0.402926,"end_time":"2023-10-04T18:27:17.226340","exception":false,"start_time":"2023-10-04T18:27:16.823414","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.478688Z","iopub.status.idle":"2023-10-10T06:49:27.479478Z","shell.execute_reply.started":"2023-10-10T06:49:27.479214Z","shell.execute_reply":"2023-10-10T06:49:27.479236Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission['id']=submission['id'].astype(int)\n","metadata":{"papermill":{"duration":0.055704,"end_time":"2023-10-04T18:27:17.304061","exception":false,"start_time":"2023-10-04T18:27:17.248357","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.480802Z","iopub.status.idle":"2023-10-10T06:49:27.481702Z","shell.execute_reply.started":"2023-10-10T06:49:27.481482Z","shell.execute_reply":"2023-10-10T06:49:27.481504Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission.to_csv('submission.csv', index=False)","metadata":{"papermill":{"duration":0.33999,"end_time":"2023-10-04T18:27:17.659203","exception":false,"start_time":"2023-10-04T18:27:17.319213","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.483006Z","iopub.status.idle":"2023-10-10T06:49:27.483814Z","shell.execute_reply.started":"2023-10-10T06:49:27.483580Z","shell.execute_reply":"2023-10-10T06:49:27.483602Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"im = Image.open('/kaggle/temp/test/test/134190.png')\nim.to_thumb(254,254)\n","metadata":{"papermill":{"duration":0.025668,"end_time":"2023-10-04T18:27:17.700819","exception":false,"start_time":"2023-10-04T18:27:17.675151","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-10-10T06:49:27.485156Z","iopub.status.idle":"2023-10-10T06:49:27.485944Z","shell.execute_reply.started":"2023-10-10T06:49:27.485699Z","shell.execute_reply":"2023-10-10T06:49:27.485720Z"},"trusted":true},"execution_count":null,"outputs":[]}]}