{"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":"from fastai.vision.all import *\nimport cv2","metadata":{"execution":{"iopub.status.busy":"2023-10-29T06:25:26.343239Z","iopub.execute_input":"2023-10-29T06:25:26.343661Z","iopub.status.idle":"2023-10-29T06:25:26.351278Z","shell.execute_reply.started":"2023-10-29T06:25:26.343632Z","shell.execute_reply":"2023-10-29T06:25:26.349755Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# setting up data directory\npath = Path('/kaggle/input/UBC-OCEAN')\nPath.BASE_PATH = path\npath.ls()","metadata":{"execution":{"iopub.status.busy":"2023-10-29T06:25:26.863094Z","iopub.execute_input":"2023-10-29T06:25:26.863529Z","iopub.status.idle":"2023-10-29T06:25:26.874639Z","shell.execute_reply.started":"2023-10-29T06:25:26.863497Z","shell.execute_reply":"2023-10-29T06:25:26.872611Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Trainig data and its describution**","metadata":{}},{"cell_type":"code","source":"df = pd.read_csv(path/'train.csv')\ndf.head()","metadata":{"execution":{"iopub.status.busy":"2023-10-29T06:25:27.957624Z","iopub.execute_input":"2023-10-29T06:25:27.959678Z","iopub.status.idle":"2023-10-29T06:25:27.977465Z","shell.execute_reply.started":"2023-10-29T06:25:27.95961Z","shell.execute_reply":"2023-10-29T06:25:27.975454Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['label'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-10-29T06:25:28.547295Z","iopub.execute_input":"2023-10-29T06:25:28.549151Z","iopub.status.idle":"2023-10-29T06:25:28.559023Z","shell.execute_reply.started":"2023-10-29T06:25:28.549058Z","shell.execute_reply":"2023-10-29T06:25:28.556983Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Destribution ratio is approx: 5 : 3 : 2.5 : 1 : 1**","metadata":{}},{"cell_type":"markdown","source":"# Lets see all images carefully","metadata":{}},{"cell_type":"markdown","source":"## image vs thumbnai1","metadata":{}},{"cell_type":"code","source":"%%time \nid1, label, w, h, tma = df.iloc[0]\nprint(f\"ram require to load {label} is {(w*h*3*8)/(1024*1024*1024):.2f} GB\")\nprint(f\"is tma: {tma}\")\nimg_path = os.path.join(path/'train_images', str(id1)+'.png')\nimg = cv2.imread(img_path)\nimage = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) \nplt.imshow(image)\nplt.title(label)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-10-29T06:25:31.179244Z","iopub.execute_input":"2023-10-29T06:25:31.179674Z","iopub.status.idle":"2023-10-29T06:26:32.315615Z","shell.execute_reply.started":"2023-10-29T06:25:31.179641Z","shell.execute_reply":"2023-10-29T06:26:32.314597Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time \nid1, label, w, h, tma = df.iloc[0]\nprint(f\"ram require to load {label} is {(w*h*3*8)/(1024*1024*1024):.2f} GB\")\nprint(f\"is tma: {tma}\")\nimg_path = os.path.join(path/'train_thumbnails', str(id1)+'_thumbnail.png')\nimg = cv2.imread(img_path)\nimage = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) \nplt.imshow(image)\nplt.title(label)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-10-29T06:32:01.04972Z","iopub.execute_input":"2023-10-29T06:32:01.050179Z","iopub.status.idle":"2023-10-29T06:32:02.221774Z","shell.execute_reply.started":"2023-10-29T06:32:01.05014Z","shell.execute_reply":"2023-10-29T06:32:02.220791Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## image vs thumbnail2 ","metadata":{}},{"cell_type":"code","source":"%%time \nid1, label, w, h, tma = df.iloc[7]\nprint(f\"ram require to load {label} is {(w*h*3*8)/(1024*1024*1024):.2f} GB\")\nprint(f\"is tma: {tma}\")\nimg_path = os.path.join(path/'train_images', str(id1)+'.png')\nimg = cv2.imread(img_path)\nimage = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) \nplt.imshow(image)\nplt.title(label)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-10-29T06:26:34.263759Z","iopub.execute_input":"2023-10-29T06:26:34.264059Z","iopub.status.idle":"2023-10-29T06:27:32.472161Z","shell.execute_reply.started":"2023-10-29T06:26:34.264035Z","shell.execute_reply":"2023-10-29T06:27:32.470645Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time \nid1, label, w, h, tma = df.iloc[7]\nprint(f\"ram require to load {label} is {(w*h*3*8)/(1024*1024*1024):.2f} GB\")\nprint(f\"is tma: {tma}\")\nimg_path = os.path.join(path/'train_thumbnails', str(id1)+'_thumbnail.png')\nimg = cv2.imread(img_path)\nimage = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) \nplt.imshow(image)\nplt.title(label)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-10-29T06:33:15.837739Z","iopub.execute_input":"2023-10-29T06:33:15.838475Z","iopub.status.idle":"2023-10-29T06:33:16.786253Z","shell.execute_reply.started":"2023-10-29T06:33:15.838435Z","shell.execute_reply":"2023-10-29T06:33:16.784595Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Image vs thumbnail3","metadata":{}},{"cell_type":"code","source":"%%time \nid1, label, w, h, tma = df.iloc[9]\nprint(f\"ram require to load {label} is {(w*h*3*8)/(1024*1024*1024):.2f} GB\")\nprint(f\"is tma: {tma}\")\nimg_path = os.path.join(path/'train_images', str(id1)+'.png')\nimg = cv2.imread(img_path)\nimage = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) \nplt.imshow(image)\nplt.title(label)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-10-29T06:27:32.473584Z","iopub.execute_input":"2023-10-29T06:27:32.473943Z","iopub.status.idle":"2023-10-29T06:28:42.73286Z","shell.execute_reply.started":"2023-10-29T06:27:32.473915Z","shell.execute_reply":"2023-10-29T06:28:42.731926Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time \nid1, label, w, h, tma = df.iloc[9]\nprint(f\"ram require to load {label} is {(w*h*3*8)/(1024*1024*1024):.2f} GB\")\nprint(f\"is tma: {tma}\")\nimg_path = os.path.join(path/'train_thumbnails', str(id1)+'_thumbnail.png')\nimg = cv2.imread(img_path)\nimage = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) \nplt.imshow(image)\nplt.title(label)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-10-29T06:34:06.118829Z","iopub.execute_input":"2023-10-29T06:34:06.119271Z","iopub.status.idle":"2023-10-29T06:34:07.262141Z","shell.execute_reply.started":"2023-10-29T06:34:06.119239Z","shell.execute_reply":"2023-10-29T06:34:07.260571Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# image vs thumbnail4","metadata":{}},{"cell_type":"code","source":"%%time \nid1, label, w, h, tma = df.iloc[10]\nprint(f\"ram require to load {label} is {(w*h*3*8)/(1024*1024*1024):.2f} GB\")\nprint(f\"is tma: {tma}\")\nimg_path = os.path.join(path/'train_images', str(id1)+'.png')\nimg = cv2.imread(img_path)\nimage = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) \nplt.imshow(image)\nplt.title(label)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-10-29T06:28:42.734308Z","iopub.execute_input":"2023-10-29T06:28:42.735574Z","iopub.status.idle":"2023-10-29T06:29:30.591302Z","shell.execute_reply.started":"2023-10-29T06:28:42.73552Z","shell.execute_reply":"2023-10-29T06:29:30.589905Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time \nid1, label, w, h, tma = df.iloc[10]\nprint(f\"ram require to load {label} is {(w*h*3*8)/(1024*1024*1024):.2f} GB\")\nprint(f\"is tma: {tma}\")\nimg_path = os.path.join(path/'train_thumbnails', str(id1)+'_thumbnail.png')\nimg = cv2.imread(img_path)\nimage = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) \nplt.imshow(image)\nplt.title(label)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-10-29T06:34:40.466093Z","iopub.execute_input":"2023-10-29T06:34:40.467212Z","iopub.status.idle":"2023-10-29T06:34:41.496186Z","shell.execute_reply.started":"2023-10-29T06:34:40.467153Z","shell.execute_reply":"2023-10-29T06:34:41.494911Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}