{"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\n\nroot = '/kaggle/input/paddy-disease-classification'\nfiles = os.listdir(root)\n\ntrain_dir = os.listdir(os.path.join(root, 'train_images'))\ntest_dir = os.listdir(os.path.join(root, 'test_images'))\n\nprint(train_dir)\nprint(files)\nprint(len(test_dir))\n\ntrain_df = pd.read_csv(os.path.join(root, 'train.csv'))\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":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-08-01T18:46:00.731083Z","iopub.execute_input":"2022-08-01T18:46:00.731526Z","iopub.status.idle":"2022-08-01T18:46:00.763960Z","shell.execute_reply.started":"2022-08-01T18:46:00.731494Z","shell.execute_reply":"2022-08-01T18:46:00.762349Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(train_df[100:200])","metadata":{"execution":{"iopub.status.busy":"2022-08-01T18:46:04.401274Z","iopub.execute_input":"2022-08-01T18:46:04.401733Z","iopub.status.idle":"2022-08-01T18:46:04.414993Z","shell.execute_reply.started":"2022-08-01T18:46:04.401676Z","shell.execute_reply":"2022-08-01T18:46:04.413814Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df['label'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-08-01T18:46:07.640951Z","iopub.execute_input":"2022-08-01T18:46:07.641454Z","iopub.status.idle":"2022-08-01T18:46:07.654945Z","shell.execute_reply.started":"2022-08-01T18:46:07.641411Z","shell.execute_reply":"2022-08-01T18:46:07.653510Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = train_df\n\ndf.shape","metadata":{"execution":{"iopub.status.busy":"2022-08-01T18:46:10.372366Z","iopub.execute_input":"2022-08-01T18:46:10.372884Z","iopub.status.idle":"2022-08-01T18:46:10.383040Z","shell.execute_reply.started":"2022-08-01T18:46:10.372843Z","shell.execute_reply":"2022-08-01T18:46:10.381576Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.preprocessing import LabelEncoder\n\nle = LabelEncoder()\ndf['label_n'] = le.fit_transform(df['label'])\n\ndf['label_n'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-08-01T18:46:14.168438Z","iopub.execute_input":"2022-08-01T18:46:14.168972Z","iopub.status.idle":"2022-08-01T18:46:14.186833Z","shell.execute_reply.started":"2022-08-01T18:46:14.168932Z","shell.execute_reply":"2022-08-01T18:46:14.185801Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.hist(column='label_n')","metadata":{"execution":{"iopub.status.busy":"2022-08-01T18:46:18.091255Z","iopub.execute_input":"2022-08-01T18:46:18.091762Z","iopub.status.idle":"2022-08-01T18:46:18.287336Z","shell.execute_reply.started":"2022-08-01T18:46:18.091724Z","shell.execute_reply":"2022-08-01T18:46:18.285752Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"label = train_df[train_df['image_id'] == '104800.jpg'].reset_index()\nprint(label)","metadata":{"execution":{"iopub.status.busy":"2022-08-01T18:46:45.625321Z","iopub.execute_input":"2022-08-01T18:46:45.625841Z","iopub.status.idle":"2022-08-01T18:46:45.640726Z","shell.execute_reply.started":"2022-08-01T18:46:45.625804Z","shell.execute_reply":"2022-08-01T18:46:45.639706Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from torch.utils.data import Dataset\n\nclass PaddyDataset(Dataset):\n    def __init__(self, df, train_dir):\n        super().__init__()\n        ","metadata":{},"execution_count":null,"outputs":[]}]}