Dataset Viewer (First 5GB)
Auto-converted to Parquet
Search is not available for this dataset
text
stringlengths
1.69k
102M
id
stringlengths
22
24
file_path
stringclasses
53 values
{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.7.10","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"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":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"execution_count":38,"outputs":[{"name":"stdout","text":"/kaggle/input/wineuci/Wine.csv\n","output_type":"stream"}]},{"cell_type":"markdown","source":"Wine recognition dataset from UC Irvine. Great for testing out different classifiers\n\nLabels:\n\n\"name\" - Number denoting a specific wine class\n\nNumber of instances of each wine class:\n\n- Class 1 - 59\n\n- Class 2 - 71\n\n- Class 3 - 48\n\nFeatures:\n\n1. Alcohol\n2. Malic acid\n3. Ash\n4. Alcalinity of ash\n5. Magnesium\n6. Total phenols\n7. Flavanoids\n8. Nonflavanoid phenols\n9. Proanthocyanins\n10. Color intensity\n11. Hue\n12. OD280/OD315 of diluted wines\n13. Proline","metadata":{}},{"cell_type":"code","source":"import torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nimport torchvision\nimport torchvision.transforms\nimport random\nfrom sklearn.model_selection import train_test_split","metadata":{"trusted":true},"execution_count":34,"outputs":[]},{"cell_type":"code","source":"print(torch.__version__)","metadata":{"trusted":true},"execution_count":35,"outputs":[{"name":"stdout","text":"1.7.0\n","output_type":"stream"}]},{"cell_type":"code","source":"device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')\nprint(device)","metadata":{"trusted":true},"execution_count":36,"outputs":[{"name":"stdout","text":"cpu\n","output_type":"stream"}]},{"cell_type":"code","source":"data = pd.read_csv('/kaggle/input/wineuci/Wine.csv', header=None)","metadata":{"trusted":true},"execution_count":39,"outputs":[]},{"cell_type":"code","source":"data.head()","metadata":{"trusted":true},"execution_count":45,"outputs":[{"execution_count":45,"output_type":"execute_result","data":{"text/plain":" class alcohol malic_acid ash alcalinity_of_ash magnesium \\\n0 1 14.23 1.71 2.43 15.6 127 \n1 1 13.20 1.78 2.14 11.2 100 \n2 1 13.16 2.36 2.67 18.6 101 \n3 1 14.37 1.95 2.50 16.8 113 \n4 1 13.24 2.59 2.87 21.0 118 \n\n total_phenols flavanoids nonflavanoid_phenols proanthocyanins \\\n0 2.80 3.06 0.28 2.29 \n1 2.65 2.76 0.26 1.28 \n2 2.80 3.24 0.30 2.81 \n3 3.85 3.49 0.24 2.18 \n4 2.80 2.69 0.39 1.82 \n\n color_intensity hue OD280_OD315 proline \n0 5.64 1.04 3.92 1065 \n1 4.38 1.05 3.40 1050 \n2 5.68 1.03 3.17 1185 \n3 7.80 0.86 3.45 1480 \n4 4.32 1.04 2.93 735 ","text/html":"<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>class</th>\n <th>alcohol</th>\n <th>malic_acid</th>\n <th>ash</th>\n <th>alcalinity_of_ash</th>\n <th>magnesium</th>\n <th>total_phenols</th>\n <th>flavanoids</th>\n <th>nonflavanoid_phenols</th>\n <th>proanthocyanins</th>\n <th>color_intensity</th>\n <th>hue</th>\n <th>OD280_OD315</th>\n <th>proline</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>1</td>\n <td>14.23</td>\n <td>1.71</td>\n <td>2.43</td>\n <td>15.6</td>\n <td>127</td>\n <td>2.80</td>\n <td>3.06</td>\n <td>0.28</td>\n <td>2.29</td>\n <td>5.64</td>\n <td>1.04</td>\n <td>3.92</td>\n <td>1065</td>\n </tr>\n <tr>\n <th>1</th>\n <td>1</td>\n <td>13.20</td>\n <td>1.78</td>\n <td>2.14</td>\n <td>11.2</td>\n <td>100</td>\n <td>2.65</td>\n <td>2.76</td>\n <td>0.26</td>\n <td>1.28</td>\n <td>4.38</td>\n <td>1.05</td>\n <td>3.40</td>\n <td>1050</td>\n </tr>\n <tr>\n <th>2</th>\n <td>1</td>\n <td>13.16</td>\n <td>2.36</td>\n <td>2.67</td>\n <td>18.6</td>\n <td>101</td>\n <td>2.80</td>\n <td>3.24</td>\n <td>0.30</td>\n <td>2.81</td>\n <td>5.68</td>\n <td>1.03</td>\n <td>3.17</td>\n <td>1185</td>\n </tr>\n <tr>\n <th>3</th>\n <td>1</td>\n <td>14.37</td>\n <td>1.95</td>\n <td>2.50</td>\n <td>16.8</td>\n <td>113</td>\n <td>3.85</td>\n <td>3.49</td>\n <td>0.24</td>\n <td>2.18</td>\n <td>7.80</td>\n <td>0.86</td>\n <td>3.45</td>\n <td>1480</td>\n </tr>\n <tr>\n <th>4</th>\n <td>1</td>\n <td>13.24</td>\n <td>2.59</td>\n <td>2.87</td>\n <td>21.0</td>\n <td>118</td>\n <td>2.80</td>\n <td>2.69</td>\n <td>0.39</td>\n <td>1.82</td>\n <td>4.32</td>\n <td>1.04</td>\n <td>2.93</td>\n <td>735</td>\n </tr>\n </tbody>\n</table>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"data.shape","metadata":{"trusted":true},"execution_count":46,"outputs":[{"execution_count":46,"output_type":"execute_result","data":{"text/plain":"(178, 14)"},"metadata":{}}]},{"cell_type":"code","source":"data.columns = ['class',\n 'alcohol',\n 'malic_acid',\n 'ash',\n 'alcalinity_of_ash',\n 'magnesium',\n 'total_phenols',\n 'flavanoids',\n 'nonflavanoid_phenols',\n 'proanthocyanins',\n 'color_intensity',\n 'hue',\n 'OD280_OD315',\n 'proline']","metadata":{"trusted":true},"execution_count":47,"outputs":[]},{"cell_type":"code","source":"data.head()","metadata":{"trusted":true},"execution_count":48,"outputs":[{"execution_count":48,"output_type":"execute_result","data":{"text/plain":" class alcohol malic_acid ash alcalinity_of_ash magnesium \\\n0 1 14.23 1.71 2.43 15.6 127 \n1 1 13.20 1.78 2.14 11.2 100 \n2 1 13.16 2.36 2.67 18.6 101 \n3 1 14.37 1.95 2.50 16.8 113 \n4 1 13.24 2.59 2.87 21.0 118 \n\n total_phenols flavanoids nonflavanoid_phenols proanthocyanins \\\n0 2.80 3.06 0.28 2.29 \n1 2.65 2.76 0.26 1.28 \n2 2.80 3.24 0.30 2.81 \n3 3.85 3.49 0.24 2.18 \n4 2.80 2.69 0.39 1.82 \n\n color_intensity hue OD280_OD315 proline \n0 5.64 1.04 3.92 1065 \n1 4.38 1.05 3.40 1050 \n2 5.68 1.03 3.17 1185 \n3 7.80 0.86 3.45 1480 \n4 4.32 1.04 2.93 735 ","text/html":"<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>class</th>\n <th>alcohol</th>\n <th>malic_acid</th>\n <th>ash</th>\n <th>alcalinity_of_ash</th>\n <th>magnesium</th>\n <th>total_phenols</th>\n <th>flavanoids</th>\n <th>nonflavanoid_phenols</th>\n <th>proanthocyanins</th>\n <th>color_intensity</th>\n <th>hue</th>\n <th>OD280_OD315</th>\n <th>proline</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>1</td>\n <td>14.23</td>\n <td>1.71</td>\n <td>2.43</td>\n <td>15.6</td>\n <td>127</td>\n <td>2.80</td>\n <td>3.06</td>\n <td>0.28</td>\n <td>2.29</td>\n <td>5.64</td>\n <td>1.04</td>\n <td>3.92</td>\n <td>1065</td>\n </tr>\n <tr>\n <th>1</th>\n <td>1</td>\n <td>13.20</td>\n <td>1.78</td>\n <td>2.14</td>\n <td>11.2</td>\n <td>100</td>\n <td>2.65</td>\n <td>2.76</td>\n <td>0.26</td>\n <td>1.28</td>\n <td>4.38</td>\n <td>1.05</td>\n <td>3.40</td>\n <td>1050</td>\n </tr>\n <tr>\n <th>2</th>\n <td>1</td>\n <td>13.16</td>\n <td>2.36</td>\n <td>2.67</td>\n <td>18.6</td>\n <td>101</td>\n <td>2.80</td>\n <td>3.24</td>\n <td>0.30</td>\n <td>2.81</td>\n <td>5.68</td>\n <td>1.03</td>\n <td>3.17</td>\n <td>1185</td>\n </tr>\n <tr>\n <th>3</th>\n <td>1</td>\n <td>14.37</td>\n <td>1.95</td>\n <td>2.50</td>\n <td>16.8</td>\n <td>113</td>\n <td>3.85</td>\n <td>3.49</td>\n <td>0.24</td>\n <td>2.18</td>\n <td>7.80</td>\n <td>0.86</td>\n <td>3.45</td>\n <td>1480</td>\n </tr>\n <tr>\n <th>4</th>\n <td>1</td>\n <td>13.24</td>\n <td>2.59</td>\n <td>2.87</td>\n <td>21.0</td>\n <td>118</td>\n <td>2.80</td>\n <td>2.69</td>\n <td>0.39</td>\n <td>1.82</td>\n <td>4.32</td>\n <td>1.04</td>\n <td>2.93</td>\n <td>735</td>\n </tr>\n </tbody>\n</table>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"data.shape","metadata":{"trusted":true},"execution_count":49,"outputs":[{"execution_count":49,"output_type":"execute_result","data":{"text/plain":"(178, 14)"},"metadata":{}}]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}
0060/654/60654915.ipynb
s3://data-agents/kaggle-outputs/sharded/011_00060.jsonl.gz
{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "incoming-headline", "metadata": { "_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19", "_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5", "execution": { "iopub.execute_input": "2021-04-23T10:07:31.332836Z", "iopub.status.busy": "2021-04-23T10:07:31.331673Z", "iopub.status.idle": "2021-04-23T10:07:31.362326Z", "shell.execute_reply": "2021-04-23T10:07:31.363206Z" }, "papermill": { "duration": 0.045049, "end_time": "2021-04-23T10:07:31.363607", "exception": false, "start_time": "2021-04-23T10:07:31.318558", "status": "completed" }, "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/kaggle/input/hubmap-kidney-segmentation/sample_submission.csv\n", "/kaggle/input/hubmap-kidney-segmentation/HuBMAP-20-dataset_information.csv\n", "/kaggle/input/hubmap-kidney-segmentation/train.csv\n", "/kaggle/input/hubmap-kidney-segmentation/test/aa05346ff.tiff\n", "/kaggle/input/hubmap-kidney-segmentation/test/sample_submission.csv\n", "/kaggle/input/hubmap-kidney-segmentation/test/3589adb90-anatomical-structure.json\n", "/kaggle/input/hubmap-kidney-segmentation/test/2ec3f1bb9.tiff\n", "/kaggle/input/hubmap-kidney-segmentation/test/3589adb90.tiff\n", "/kaggle/input/hubmap-kidney-segmentation/test/d488c759a-anatomical-structure.json\n", "/kaggle/input/hubmap-kidney-segmentation/test/57512b7f1-anatomical-structure.json\n", "/kaggle/input/hubmap-kidney-segmentation/test/d488c759a.tiff\n", "/kaggle/input/hubmap-kidney-segmentation/test/57512b7f1.tiff\n", "/kaggle/input/hubmap-kidney-segmentation/test/aa05346ff-anatomical-structure.json\n", "/kaggle/input/hubmap-kidney-segmentation/test/2ec3f1bb9-anatomical-structure.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/0486052bb-anatomical-structure.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/4ef6695ce-anatomical-structure.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/e79de561c-anatomical-structure.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/095bf7a1f.tiff\n", "/kaggle/input/hubmap-kidney-segmentation/train/0486052bb.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/095bf7a1f-anatomical-structure.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/b9a3865fc.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/26dc41664.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/afa5e8098.tiff\n", "/kaggle/input/hubmap-kidney-segmentation/train/e79de561c.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/8242609fa-anatomical-structure.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/e79de561c.tiff\n", "/kaggle/input/hubmap-kidney-segmentation/train/4ef6695ce.tiff\n", "/kaggle/input/hubmap-kidney-segmentation/train/cb2d976f4-anatomical-structure.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/0486052bb.tiff\n", "/kaggle/input/hubmap-kidney-segmentation/train/b9a3865fc-anatomical-structure.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/aaa6a05cc.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/b9a3865fc.tiff\n", "/kaggle/input/hubmap-kidney-segmentation/train/aaa6a05cc.tiff\n", "/kaggle/input/hubmap-kidney-segmentation/train/2f6ecfcdf-anatomical-structure.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/2f6ecfcdf.tiff\n", "/kaggle/input/hubmap-kidney-segmentation/train/afa5e8098-anatomical-structure.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/54f2eec69.tiff\n", "/kaggle/input/hubmap-kidney-segmentation/train/8242609fa.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/4ef6695ce.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/c68fe75ea.tiff\n", "/kaggle/input/hubmap-kidney-segmentation/train/54f2eec69.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/cb2d976f4.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/1e2425f28.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/26dc41664-anatomical-structure.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/8242609fa.tiff\n", "/kaggle/input/hubmap-kidney-segmentation/train/afa5e8098.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/1e2425f28.tiff\n", "/kaggle/input/hubmap-kidney-segmentation/train/c68fe75ea-anatomical-structure.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/b2dc8411c-anatomical-structure.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/b2dc8411c.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/1e2425f28-anatomical-structure.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/c68fe75ea.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/b2dc8411c.tiff\n", "/kaggle/input/hubmap-kidney-segmentation/train/54f2eec69-anatomical-structure.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/cb2d976f4.tiff\n", "/kaggle/input/hubmap-kidney-segmentation/train/aaa6a05cc-anatomical-structure.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/095bf7a1f.json\n", "/kaggle/input/hubmap-kidney-segmentation/train/26dc41664.tiff\n", "/kaggle/input/hubmap-kidney-segmentation/train/2f6ecfcdf.json\n" ] } ], "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", "\n", "import numpy as np # linear algebra\n", "import 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", "\n", "import os\n", "for 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" ] }, { "cell_type": "code", "execution_count": 2, "id": "excess-illinois", "metadata": { "execution": { "iopub.execute_input": "2021-04-23T10:07:31.389235Z", "iopub.status.busy": "2021-04-23T10:07:31.388582Z", "iopub.status.idle": "2021-04-23T10:07:39.163777Z", "shell.execute_reply": "2021-04-23T10:07:39.162948Z" }, "papermill": { "duration": 7.789972, "end_time": "2021-04-23T10:07:39.163928", "exception": false, "start_time": "2021-04-23T10:07:31.373956", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "# Libraries\n", "import cv2\n", "import datetime\n", "import gc\n", "import glob\n", "import math\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import os\n", "import pandas as pd\n", "import skimage.morphology\n", "import sys\n", "import tensorflow as tf\n", "import tifffile" ] }, { "cell_type": "code", "execution_count": 3, "id": "narrow-morris", "metadata": { "execution": { "iopub.execute_input": "2021-04-23T10:07:39.186993Z", "iopub.status.busy": "2021-04-23T10:07:39.186373Z", "iopub.status.idle": "2021-04-23T10:07:39.189208Z", "shell.execute_reply": "2021-04-23T10:07:39.188712Z" }, "papermill": { "duration": 0.015793, "end_time": "2021-04-23T10:07:39.189356", "exception": false, "start_time": "2021-04-23T10:07:39.173563", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "\n", "#root_annot_path = '../input/hubmap-kidney-segmentation/train'\n", "#dset_info_path = '../input/hubmap-kidney-segmentation/HuBMAP-20-dataset_information.csv'" ] }, { "cell_type": "code", "execution_count": 4, "id": "brown-things", "metadata": { "execution": { "iopub.execute_input": "2021-04-23T10:07:39.213083Z", "iopub.status.busy": "2021-04-23T10:07:39.212018Z", "iopub.status.idle": "2021-04-23T10:07:39.215379Z", "shell.execute_reply": "2021-04-23T10:07:39.214823Z" }, "papermill": { "duration": 0.016661, "end_time": "2021-04-23T10:07:39.215519", "exception": false, "start_time": "2021-04-23T10:07:39.198858", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "#dset_info = pd.read_csv(dset_info_path)\n", "#dset_info.head()" ] }, { "cell_type": "code", "execution_count": 5, "id": "pending-quantum", "metadata": { "execution": { "iopub.execute_input": "2021-04-23T10:07:39.240143Z", "iopub.status.busy": "2021-04-23T10:07:39.239456Z", "iopub.status.idle": "2021-04-23T10:07:39.242919Z", "shell.execute_reply": "2021-04-23T10:07:39.242410Z" }, "papermill": { "duration": 0.017887, "end_time": "2021-04-23T10:07:39.243079", "exception": false, "start_time": "2021-04-23T10:07:39.225192", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "#Parameters\n", "base_path = '../input/hubmap-kidney-segmentation'\n", "\n", "plot_full_image = True\n", "\n", "# Number of glomeruli to display for each image\n", "num_glom_display = 5\n", "\n", "# Number of glomberuli to save as tiff files.\n", "num_glom_save = 5\n", "\n", "glob_scale = 0.25\n" ] }, { "cell_type": "code", "execution_count": 6, "id": "prime-premises", "metadata": { "execution": { "iopub.execute_input": "2021-04-23T10:07:39.271915Z", "iopub.status.busy": "2021-04-23T10:07:39.270866Z", "iopub.status.idle": "2021-04-23T10:07:39.274510Z", "shell.execute_reply": "2021-04-23T10:07:39.273861Z" }, "papermill": { "duration": 0.021739, "end_time": "2021-04-23T10:07:39.274649", "exception": false, "start_time": "2021-04-23T10:07:39.252910", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "def rle_to_image(rle_mask, image_shape):\n", " \"\"\"\n", " Converts an rle string to an image represented as a numpy array.\n", " Reference: https://www.kaggle.com/paulorzp/rle-functions-run-lenght-encode-decode\n", "\n", " :param rle_mask: string with rle mask.\n", " :param image_shape: (width, height) of array to return\n", " :return: Image as a numpy array. 1 = mask, 0 = background.\n", " \"\"\"\n", "\n", " # Processing\n", " s = rle_mask.split()\n", " starts, lengths = [np.asarray(x, dtype=int) for x in (s[0:][::2], s[1:][::2])]\n", " starts -= 1\n", " ends = starts + lengths\n", " image = np.zeros(image_shape[0] * image_shape[1], dtype=np.uint8)\n", " for lo, hi in zip(starts, ends):\n", " image[lo:hi] = 1\n", " \n", " return image.reshape(image_shape).T" ] }, { "cell_type": "code", "execution_count": 7, "id": "exterior-found", "metadata": { "execution": { "iopub.execute_input": "2021-04-23T10:07:39.299404Z", "iopub.status.busy": "2021-04-23T10:07:39.298509Z", "iopub.status.idle": "2021-04-23T10:07:39.303813Z", "shell.execute_reply": "2021-04-23T10:07:39.304415Z" }, "papermill": { "duration": 0.020066, "end_time": "2021-04-23T10:07:39.304613", "exception": false, "start_time": "2021-04-23T10:07:39.284547", "status": "completed" }, "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "sample_submission.csv\n", "HuBMAP-20-dataset_information.csv\n", "train.csv\n", "test\n", "train\n" ] } ], "source": [ "#Directory Contents\n", "print('\\n'.join(os.listdir(base_path)))" ] }, { "cell_type": "code", "execution_count": 8, "id": "excessive-viewer", "metadata": { "execution": { "iopub.execute_input": "2021-04-23T10:07:39.330877Z", "iopub.status.busy": "2021-04-23T10:07:39.330209Z", "iopub.status.idle": "2021-04-23T10:07:39.336539Z", "shell.execute_reply": "2021-04-23T10:07:39.335936Z" }, "papermill": { "duration": 0.021572, "end_time": "2021-04-23T10:07:39.336678", "exception": false, "start_time": "2021-04-23T10:07:39.315106", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "# Training Images\n", "train_files = sorted(glob.glob(os.path.join(base_path, 'train/*.tiff')))\n", "test_files=sorted(glob.glob(os.path.join(base_path,'test/*.tiff')))" ] }, { "cell_type": "code", "execution_count": 9, "id": "athletic-permission", "metadata": { "execution": { "iopub.execute_input": "2021-04-23T10:07:39.363012Z", "iopub.status.busy": "2021-04-23T10:07:39.362169Z", "iopub.status.idle": "2021-04-23T10:07:39.366972Z", "shell.execute_reply": "2021-04-23T10:07:39.366409Z" }, "papermill": { "duration": 0.019932, "end_time": "2021-04-23T10:07:39.367130", "exception": false, "start_time": "2021-04-23T10:07:39.347198", "status": "completed" }, "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "no of test files:5\n", "../input/hubmap-kidney-segmentation/test/2ec3f1bb9.tiff\n", "../input/hubmap-kidney-segmentation/test/3589adb90.tiff\n", "../input/hubmap-kidney-segmentation/test/57512b7f1.tiff\n", "../input/hubmap-kidney-segmentation/test/aa05346ff.tiff\n", "../input/hubmap-kidney-segmentation/test/d488c759a.tiff\n" ] } ], "source": [ "print(f'no of test files:{len(test_files)}')\n", "print('\\n'.join(test_files))" ] }, { "cell_type": "code", "execution_count": 10, "id": "established-chess", "metadata": { "execution": { "iopub.execute_input": "2021-04-23T10:07:39.394700Z", "iopub.status.busy": "2021-04-23T10:07:39.393995Z", "iopub.status.idle": "2021-04-23T10:07:39.397696Z", "shell.execute_reply": "2021-04-23T10:07:39.397091Z" }, "papermill": { "duration": 0.019312, "end_time": "2021-04-23T10:07:39.397842", "exception": false, "start_time": "2021-04-23T10:07:39.378530", "status": "completed" }, "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "no of train files:15\n", "../input/hubmap-kidney-segmentation/train/0486052bb.tiff\n", "../input/hubmap-kidney-segmentation/train/095bf7a1f.tiff\n", "../input/hubmap-kidney-segmentation/train/1e2425f28.tiff\n", "../input/hubmap-kidney-segmentation/train/26dc41664.tiff\n", "../input/hubmap-kidney-segmentation/train/2f6ecfcdf.tiff\n", "../input/hubmap-kidney-segmentation/train/4ef6695ce.tiff\n", "../input/hubmap-kidney-segmentation/train/54f2eec69.tiff\n", "../input/hubmap-kidney-segmentation/train/8242609fa.tiff\n", "../input/hubmap-kidney-segmentation/train/aaa6a05cc.tiff\n", "../input/hubmap-kidney-segmentation/train/afa5e8098.tiff\n", "../input/hubmap-kidney-segmentation/train/b2dc8411c.tiff\n", "../input/hubmap-kidney-segmentation/train/b9a3865fc.tiff\n", "../input/hubmap-kidney-segmentation/train/c68fe75ea.tiff\n", "../input/hubmap-kidney-segmentation/train/cb2d976f4.tiff\n", "../input/hubmap-kidney-segmentation/train/e79de561c.tiff\n" ] } ], "source": [ "print(f'no of train files:{len(train_files)}')\n", "print('\\n'.join(train_files))" ] }, { "cell_type": "code", "execution_count": null, "id": "stylish-denver", "metadata": { "papermill": { "duration": 0.011193, "end_time": "2021-04-23T10:07:39.420413", "exception": false, "start_time": "2021-04-23T10:07:39.409220", "status": "completed" }, "tags": [] }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.10" }, "papermill": { "default_parameters": {}, "duration": 17.872642, "end_time": "2021-04-23T10:07:40.867454", "environment_variables": {}, "exception": null, "input_path": "__notebook__.ipynb", "output_path": "__notebook__.ipynb", "parameters": {}, "start_time": "2021-04-23T10:07:22.994812", "version": "2.3.3" } }, "nbformat": 4, "nbformat_minor": 5 }
0060/655/60655339.ipynb
s3://data-agents/kaggle-outputs/sharded/011_00060.jsonl.gz
{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.7.10","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"from keras.models import load_model\nmobileNet_model = load_model('../input/project-dataset/mobilenet.h5')\ndenseNet_model = load_model('../input/project-dataset/dn.h5')\ninceptionv2_model = load_model('../input/project-dataset/InceptionV2.h5')","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"execution_count":1,"outputs":[{"name":"stderr","text":"/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/layers/core.py:1059: UserWarning: keras_applications.inception_resnet_v2 is not loaded, but a Lambda layer uses it. It may cause errors.\n , UserWarning)\n","output_type":"stream"}]},{"cell_type":"code","source":"import cv2\nimg = cv2.imread('../input/data/images_001/images/00000001_000.png')\nwidth = int(img.shape[1]*0.125)\nheight = int(img.shape[0]*0.125)\nsample_image = cv2.resize(img, (width, height), interpolation = cv2.INTER_AREA)\nprint(sample_image.shape)","metadata":{"trusted":true},"execution_count":15,"outputs":[{"name":"stdout","text":"(128, 128, 3)\n","output_type":"stream"}]},{"cell_type":"code","source":"width = int(img.shape[1]*0.250)\nheight = int(img.shape[0]*0.250)\nsample_image2 = cv2.resize(img, (width, height), interpolation = cv2.INTER_AREA)\nprint(sample_image2.shape)","metadata":{"trusted":true},"execution_count":16,"outputs":[{"name":"stdout","text":"(256, 256, 3)\n","output_type":"stream"}]},{"cell_type":"code","source":"sample_image = sample_image.reshape((1, 128,128,3))\nsample_image2 = sample_image2.reshape((1, 256, 256, 3))","metadata":{"trusted":true},"execution_count":17,"outputs":[]},{"cell_type":"code","source":"x = mobileNet_model.predict(sample_image)\ny = denseNet_model.predict(sample_image)\nz = inceptionv2_model.predict(sample_image2)","metadata":{"trusted":true},"execution_count":18,"outputs":[]},{"cell_type":"code","source":"x, y, z","metadata":{"trusted":true},"execution_count":19,"outputs":[{"execution_count":19,"output_type":"execute_result","data":{"text/plain":"(array([[0.07986271, 0.03561983, 0.15918896, 0.03192964, 0.00512472,\n 0.01145586, 0.01515445, 0.03167853, 0.00570634, 0.00545636,\n 0.01720202, 0.05966124, 0.04281765, 0.0007855 ]], dtype=float32),\n array([[0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0.]],\n dtype=float32),\n array([[0.39746416, 0.14425632, 0.45816693, 0.20315418, 0.45175254,\n 0.12854195, 0.17797846, 0.67967546, 0.44837207, 0.32607815,\n 0.37333906, 0.2640996 , 0.08744562]], dtype=float32))"},"metadata":{}}]},{"cell_type":"code","source":"def disease(arr):\n max_val = arr[0]\n for i in range(arr.size):\n if arr[i] > max_val:\n max_val = arr[i]\n index = i\n \n print(\"Disease:\",disease_name[index],\"Index:\", index, \"Probability:\",max_val)","metadata":{"trusted":true},"execution_count":12,"outputs":[]},{"cell_type":"code","source":"arr1 = x[0]\narr2 = y[0]\narr3 = z[0]","metadata":{"trusted":true},"execution_count":20,"outputs":[]},{"cell_type":"code","source":"disease_name = [\"Atelectasis\",\"Cardiomegaly\",\"Effusion\",\"Infiltration\",\"Mass\",\"Nodule\",\"Pneumonia\",\"Pneumothorax\",\"Consolidation\",\"Edema\",\"Emphysema\",\"Fibrosis\",\"Pleural Thickening\",\"Hernia\"]","metadata":{"trusted":true},"execution_count":8,"outputs":[]},{"cell_type":"code","source":"disease(arr1)\ndisease(arr2)\ndisease(arr3)","metadata":{"trusted":true},"execution_count":21,"outputs":[{"name":"stdout","text":"Disease: Effusion Index: 2 Probability: 0.15918896\nDisease: Pneumothorax Index: 7 Probability: 1.0\nDisease: Pneumothorax Index: 7 Probability: 0.67967546\n","output_type":"stream"}]}]}
0060/655/60655995.ipynb
s3://data-agents/kaggle-outputs/sharded/011_00060.jsonl.gz
"{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"id\": \"inclus(...TRUNCATED)
0060/656/60656316.ipynb
s3://data-agents/kaggle-outputs/sharded/011_00060.jsonl.gz
"{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"id\": \"likely-organic\",\n \"metada(...TRUNCATED)
0060/656/60656794.ipynb
s3://data-agents/kaggle-outputs/sharded/011_00060.jsonl.gz
"{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"id\": \"amateur-transfer\",\n \"meta(...TRUNCATED)
0060/656/60656816.ipynb
s3://data-agents/kaggle-outputs/sharded/011_00060.jsonl.gz
"{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"id\": \"irish-designation\",\n \"met(...TRUNCATED)
0060/656/60656934.ipynb
s3://data-agents/kaggle-outputs/sharded/011_00060.jsonl.gz
"{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"id\": \"indepe(...TRUNCATED)
0060/657/60657540.ipynb
s3://data-agents/kaggle-outputs/sharded/011_00060.jsonl.gz
"{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"id\": \"dense-(...TRUNCATED)
0060/657/60657616.ipynb
s3://data-agents/kaggle-outputs/sharded/011_00060.jsonl.gz
"{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"id\": \"honest(...TRUNCATED)
0060/657/60657839.ipynb
s3://data-agents/kaggle-outputs/sharded/011_00060.jsonl.gz
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
20