{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":16017,"databundleVersionId":708189,"sourceType":"competition"}],"dockerImageVersionId":30732,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import torch\nfrom torch.utils.data import DataLoader, Dataset\nimport torchvision\nfrom torch.utils.data.sampler import SubsetRandomSampler\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport pandas as pd","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2024-06-27T11:31:05.094056Z","iopub.execute_input":"2024-06-27T11:31:05.094551Z","iopub.status.idle":"2024-06-27T11:31:05.100770Z","shell.execute_reply.started":"2024-06-27T11:31:05.094519Z","shell.execute_reply":"2024-06-27T11:31:05.099459Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"class TrainKannadaMNIST(Dataset):\n    def __init__(self,file_path):\n        self.data=pd.read_csv(file_path)\n    \n    def __len__(self):\n        return len(self.data)\n    \n    def __getitem__(self, index):\n        image=self.data.iloc[index,1:].values.astype(np.uint8).reshape((28,28,1))\n        label=self.data.iloc[index,0]\n        return image,label","metadata":{"execution":{"iopub.status.busy":"2024-06-27T11:59:14.975741Z","iopub.execute_input":"2024-06-27T11:59:14.976205Z","iopub.status.idle":"2024-06-27T11:59:14.983902Z","shell.execute_reply.started":"2024-06-27T11:59:14.976171Z","shell.execute_reply":"2024-06-27T11:59:14.982548Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"class TestKannadaMNIST(Dataset):\n    def __init__(self,file_path):\n        self.data=pd.read_csv(file_path)\n    \n    def __len__(self):\n        return len(self.data)\n    \n    def __getitem__(self, index):\n        image=self.data.iloc[index,0:].values.astype(np.uint8).reshape((28,28,1))\n        return image\n        ","metadata":{"execution":{"iopub.status.busy":"2024-06-27T11:49:18.113484Z","iopub.execute_input":"2024-06-27T11:49:18.113965Z","iopub.status.idle":"2024-06-27T11:49:18.121831Z","shell.execute_reply.started":"2024-06-27T11:49:18.113932Z","shell.execute_reply":"2024-06-27T11:49:18.120262Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data=TrainKannadaMNIST('/kaggle/input/Kannada-MNIST/train.csv')\ntest_data=TestKannadaMNIST('/kaggle/input/Kannada-MNIST/test.csv')","metadata":{"execution":{"iopub.status.busy":"2024-06-27T11:59:19.030594Z","iopub.execute_input":"2024-06-27T11:59:19.031017Z","iopub.status.idle":"2024-06-27T11:59:24.311895Z","shell.execute_reply.started":"2024-06-27T11:59:19.030984Z","shell.execute_reply":"2024-06-27T11:59:24.310867Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_loader=torch.utils.data.DataLoader(train_data,batch_size=20)\ntest_loader=torch.utils.data.DataLoader(test_data,batch_size=20)","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}