{"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 matplotlib.pyplot as plt\nimport seaborn as sns\n\nfrom tqdm import tqdm\nfrom PIL import Image\nimport random\nimport cv2","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-09-07T07:21:19.827061Z","iopub.execute_input":"2022-09-07T07:21:19.827406Z","iopub.status.idle":"2022-09-07T07:21:19.833122Z","shell.execute_reply.started":"2022-09-07T07:21:19.827379Z","shell.execute_reply":"2022-09-07T07:21:19.831893Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv(\"../input/datathonindoml-2022/train_labels.csv\")\ncolumns = 4\nrows = 1\n\nclass_dictionary = {\n    0:'memo',\n    1:'form',\n    2:'email',\n    3:'handwritten',\n    4:'advertisement',\n    5:'scientific_report',\n    6:'scientific_publication',\n    7:'specification',\n    8:'file_folder',\n    9:'news_article',\n    10:'budget',\n    11:'invoice',\n    12:'presentation',\n    13:'questionaire',\n    14:'resume',\n    15:'letter'\n}","metadata":{"execution":{"iopub.status.busy":"2022-09-07T07:21:20.272888Z","iopub.execute_input":"2022-09-07T07:21:20.273429Z","iopub.status.idle":"2022-09-07T07:21:20.287473Z","shell.execute_reply.started":"2022-09-07T07:21:20.273401Z","shell.execute_reply":"2022-09-07T07:21:20.286072Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def display_samples(image_id):\n    file_ids = df[df['label']==image_id].sample(10)['id'].values\n\n    fig=plt.figure(figsize=(35, 45))\n\n    for index in range(columns*rows):\n        img = cv2.imread(\"/kaggle/input/datathonindoml-2022/train/train/\"+str(file_ids[index])+'.tif', cv2.IMREAD_GRAYSCALE)\n        fig.add_subplot(rows, columns, index+1,label='this is a label')\n        plt.imshow(img,cmap='gray')\n        plt.axis('off');","metadata":{"execution":{"iopub.status.busy":"2022-09-07T07:47:27.372503Z","iopub.execute_input":"2022-09-07T07:47:27.372872Z","iopub.status.idle":"2022-09-07T07:47:27.380152Z","shell.execute_reply.started":"2022-09-07T07:47:27.372846Z","shell.execute_reply":"2022-09-07T07:47:27.378942Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(class_dictionary[0].upper(),end='\\n')\ndisplay_samples(0)","metadata":{"execution":{"iopub.status.busy":"2022-09-07T07:47:51.425086Z","iopub.execute_input":"2022-09-07T07:47:51.425854Z","iopub.status.idle":"2022-09-07T07:47:52.236526Z","shell.execute_reply.started":"2022-09-07T07:47:51.425828Z","shell.execute_reply":"2022-09-07T07:47:52.235761Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(class_dictionary[1].upper(),end='\\n')\ndisplay_samples(1)","metadata":{"execution":{"iopub.status.busy":"2022-09-07T07:48:14.270419Z","iopub.execute_input":"2022-09-07T07:48:14.271567Z","iopub.status.idle":"2022-09-07T07:48:15.093650Z","shell.execute_reply.started":"2022-09-07T07:48:14.271515Z","shell.execute_reply":"2022-09-07T07:48:15.092819Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(class_dictionary[2].upper(),end='\\n')\ndisplay_samples(2)","metadata":{"execution":{"iopub.status.busy":"2022-09-07T07:48:25.410905Z","iopub.execute_input":"2022-09-07T07:48:25.411431Z","iopub.status.idle":"2022-09-07T07:48:26.227230Z","shell.execute_reply.started":"2022-09-07T07:48:25.411407Z","shell.execute_reply":"2022-09-07T07:48:26.226355Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(class_dictionary[3].upper(),end='\\n')\ndisplay_samples(3)","metadata":{"execution":{"iopub.status.busy":"2022-09-07T07:48:36.750200Z","iopub.execute_input":"2022-09-07T07:48:36.750694Z","iopub.status.idle":"2022-09-07T07:48:37.544838Z","shell.execute_reply.started":"2022-09-07T07:48:36.750668Z","shell.execute_reply":"2022-09-07T07:48:37.543849Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(class_dictionary[4].upper(),end='\\n')\ndisplay_samples(4)","metadata":{"execution":{"iopub.status.busy":"2022-09-07T07:50:00.465015Z","iopub.execute_input":"2022-09-07T07:50:00.465352Z","iopub.status.idle":"2022-09-07T07:50:01.364604Z","shell.execute_reply.started":"2022-09-07T07:50:00.465327Z","shell.execute_reply":"2022-09-07T07:50:01.362980Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(class_dictionary[5].upper(),end='\\n')\ndisplay_samples(5)","metadata":{"execution":{"iopub.status.busy":"2022-09-07T07:50:01.366601Z","iopub.execute_input":"2022-09-07T07:50:01.366956Z","iopub.status.idle":"2022-09-07T07:50:02.222724Z","shell.execute_reply.started":"2022-09-07T07:50:01.366929Z","shell.execute_reply":"2022-09-07T07:50:02.221082Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(class_dictionary[6].upper(),end='\\n')\ndisplay_samples(6)","metadata":{"execution":{"iopub.status.busy":"2022-09-07T07:50:02.224271Z","iopub.execute_input":"2022-09-07T07:50:02.224586Z","iopub.status.idle":"2022-09-07T07:50:03.480548Z","shell.execute_reply.started":"2022-09-07T07:50:02.224560Z","shell.execute_reply":"2022-09-07T07:50:03.479286Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(class_dictionary[7].upper(),end='\\n')\ndisplay_samples(7)","metadata":{"execution":{"iopub.status.busy":"2022-09-07T07:50:03.483399Z","iopub.execute_input":"2022-09-07T07:50:03.483748Z","iopub.status.idle":"2022-09-07T07:50:04.332201Z","shell.execute_reply.started":"2022-09-07T07:50:03.483723Z","shell.execute_reply":"2022-09-07T07:50:04.330580Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(class_dictionary[8].upper(),end='\\n')\ndisplay_samples(8)","metadata":{"execution":{"iopub.status.busy":"2022-09-07T07:50:04.334467Z","iopub.execute_input":"2022-09-07T07:50:04.334933Z","iopub.status.idle":"2022-09-07T07:50:05.114987Z","shell.execute_reply.started":"2022-09-07T07:50:04.334900Z","shell.execute_reply":"2022-09-07T07:50:05.113822Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(class_dictionary[9].upper(),end='\\n')\ndisplay_samples(9)","metadata":{"execution":{"iopub.status.busy":"2022-09-07T07:50:05.116404Z","iopub.execute_input":"2022-09-07T07:50:05.116653Z","iopub.status.idle":"2022-09-07T07:50:06.007472Z","shell.execute_reply.started":"2022-09-07T07:50:05.116630Z","shell.execute_reply":"2022-09-07T07:50:06.005670Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(class_dictionary[10].upper(),end='\\n')\ndisplay_samples(10)","metadata":{"execution":{"iopub.status.busy":"2022-09-07T07:50:06.009095Z","iopub.execute_input":"2022-09-07T07:50:06.009417Z","iopub.status.idle":"2022-09-07T07:50:06.806315Z","shell.execute_reply.started":"2022-09-07T07:50:06.009388Z","shell.execute_reply":"2022-09-07T07:50:06.805327Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(class_dictionary[11].upper(),end='\\n')\ndisplay_samples(11)","metadata":{"execution":{"iopub.status.busy":"2022-09-07T07:50:06.807398Z","iopub.execute_input":"2022-09-07T07:50:06.808474Z","iopub.status.idle":"2022-09-07T07:50:07.621337Z","shell.execute_reply.started":"2022-09-07T07:50:06.808444Z","shell.execute_reply":"2022-09-07T07:50:07.620531Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(class_dictionary[12].upper(),end='\\n')\ndisplay_samples(12)","metadata":{"execution":{"iopub.status.busy":"2022-09-07T07:50:07.622339Z","iopub.execute_input":"2022-09-07T07:50:07.623855Z","iopub.status.idle":"2022-09-07T07:50:08.442018Z","shell.execute_reply.started":"2022-09-07T07:50:07.623776Z","shell.execute_reply":"2022-09-07T07:50:08.440658Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(class_dictionary[13].upper(),end='\\n')\ndisplay_samples(13)","metadata":{"execution":{"iopub.status.busy":"2022-09-07T07:50:08.445686Z","iopub.execute_input":"2022-09-07T07:50:08.446123Z","iopub.status.idle":"2022-09-07T07:50:09.266175Z","shell.execute_reply.started":"2022-09-07T07:50:08.446090Z","shell.execute_reply":"2022-09-07T07:50:09.264397Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(class_dictionary[14].upper(),end='\\n')\ndisplay_samples(14)","metadata":{"execution":{"iopub.status.busy":"2022-09-07T07:50:09.268403Z","iopub.execute_input":"2022-09-07T07:50:09.268745Z","iopub.status.idle":"2022-09-07T07:50:10.157518Z","shell.execute_reply.started":"2022-09-07T07:50:09.268715Z","shell.execute_reply":"2022-09-07T07:50:10.156845Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(class_dictionary[15].upper(),end='\\n')\ndisplay_samples(15)","metadata":{"execution":{"iopub.status.busy":"2022-09-07T07:50:10.158535Z","iopub.execute_input":"2022-09-07T07:50:10.159047Z","iopub.status.idle":"2022-09-07T07:50:10.993397Z","shell.execute_reply.started":"2022-09-07T07:50:10.159020Z","shell.execute_reply":"2022-09-07T07:50:10.992651Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}