{"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 tensorflow as tf\nfrom zipfile import ZipFile \nimport keras.backend as K\nfrom sklearn.model_selection import train_test_split\nimport matplotlib.pyplot as plt\nimport os","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2021-07-10T09:57:44.19142Z","iopub.execute_input":"2021-07-10T09:57:44.191786Z","iopub.status.idle":"2021-07-10T09:57:46.155236Z","shell.execute_reply.started":"2021-07-10T09:57:44.191712Z","shell.execute_reply":"2021-07-10T09:57:46.154392Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_zip = \"/kaggle/input/carvana-image-masking-challenge/train.zip\"\nwith ZipFile(train_zip, 'r') as zip_: \n    zip_.extractall('/kaggle/working')","metadata":{"execution":{"iopub.status.busy":"2021-07-10T09:57:46.156627Z","iopub.execute_input":"2021-07-10T09:57:46.156975Z","iopub.status.idle":"2021-07-10T09:57:52.911406Z","shell.execute_reply.started":"2021-07-10T09:57:46.156943Z","shell.execute_reply":"2021-07-10T09:57:52.910513Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_mask_zip = \"/kaggle/input/carvana-image-masking-challenge/train_masks.zip\"\nwith ZipFile(train_mask_zip, 'r') as zip_: \n    zip_.extractall('/kaggle/working')","metadata":{"execution":{"iopub.status.busy":"2021-07-10T09:57:52.913338Z","iopub.execute_input":"2021-07-10T09:57:52.913727Z","iopub.status.idle":"2021-07-10T09:57:53.967576Z","shell.execute_reply.started":"2021-07-10T09:57:52.913686Z","shell.execute_reply":"2021-07-10T09:57:53.966666Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Train set:  \", len(os.listdir(\"/kaggle/working/train\")))\nprint(\"Train masks:\", len(os.listdir(\"/kaggle/working/train_masks\")))","metadata":{"execution":{"iopub.status.busy":"2021-07-10T09:57:53.972Z","iopub.execute_input":"2021-07-10T09:57:53.972347Z","iopub.status.idle":"2021-07-10T09:57:53.986201Z","shell.execute_reply.started":"2021-07-10T09:57:53.972313Z","shell.execute_reply":"2021-07-10T09:57:53.985029Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"car_ids = []\npaths = []\nfor dirname, _, filenames in os.walk('/kaggle/working/train'):\n    for filename in filenames:\n        path = os.path.join(dirname, filename)    \n        paths.append(path)\n        \n        car_id = filename.split(\".\")[0]\n        car_ids.append(car_id)\n\nd = {\"id\": car_ids, \"car_path\": paths}\ndf = pd.DataFrame(data = d)\ndf = df.set_index('id')\ndf","metadata":{"execution":{"iopub.status.busy":"2021-07-10T09:57:53.987516Z","iopub.execute_input":"2021-07-10T09:57:53.987854Z","iopub.status.idle":"2021-07-10T09:57:54.028298Z","shell.execute_reply.started":"2021-07-10T09:57:53.98782Z","shell.execute_reply":"2021-07-10T09:57:54.02738Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"car_ids = []\nmask_path = []\nfor dirname, _, filenames in os.walk('/kaggle/working/train_masks'):\n    for filename in filenames:\n        path = os.path.join(dirname, filename)\n        mask_path.append(path)\n        \n        car_id = filename.split(\".\")[0]\n        car_id = car_id.split(\"_mask\")[0]\n        car_ids.append(car_id)\n\n        \nd = {\"id\": car_ids,\"mask_path\": mask_path}\nmask_df = pd.DataFrame(data = d)\nmask_df = mask_df.set_index('id')\nmask_df","metadata":{"execution":{"iopub.status.busy":"2021-07-10T09:57:54.029695Z","iopub.execute_input":"2021-07-10T09:57:54.03004Z","iopub.status.idle":"2021-07-10T09:57:54.066085Z","shell.execute_reply.started":"2021-07-10T09:57:54.030005Z","shell.execute_reply":"2021-07-10T09:57:54.065153Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df[\"mask_path\"] = mask_df[\"mask_path\"]\ndf","metadata":{"execution":{"iopub.status.busy":"2021-07-10T09:57:54.068719Z","iopub.execute_input":"2021-07-10T09:57:54.069084Z","iopub.status.idle":"2021-07-10T09:57:54.083791Z","shell.execute_reply.started":"2021-07-10T09:57:54.069048Z","shell.execute_reply":"2021-07-10T09:57:54.082636Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#data augmentation function\n\nimage_size = [256, 256]\nOUTPUT_CHANNELS = 3\n# increase the diversity for dataset by the flip left to right images way to decrease overfiting\ndef augmentation(input_image, mask_image):\n    \n    # create the random number if it > 0.5 then flip_left_right images\n    if tf.random.uniform(()) > 0.5:\n        input_image = tf.image.flip_left_right(input_image) \n        mask_image = tf.image.flip_left_right(mask_image)\n    \n    return input_image, mask_image","metadata":{"execution":{"iopub.status.busy":"2021-07-10T09:57:54.085673Z","iopub.execute_input":"2021-07-10T09:57:54.086096Z","iopub.status.idle":"2021-07-10T09:57:54.092886Z","shell.execute_reply.started":"2021-07-10T09:57:54.08606Z","shell.execute_reply":"2021-07-10T09:57:54.09196Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Preprocessing function\n\ndef preprocess(car_path, mask_path):\n    input_image = tf.io.read_file(car_path) # read content of images\n    \n    input_image = tf.image.decode_jpeg(input_image, channels=OUTPUT_CHANNELS) # car = np.array(Image.open(car_path).convert('RGB'))\n    # Decode a JPEG-encoded image to a uint8 tensor.\n    # The attr channels indicates the desired number of color channels for the decoded image.\n    #Accepted values are:\n    #0: Use the number of channels in the JPEG-encoded image.\n    #1: output a grayscale image.\n    #3: output an RGB image.\n    \n    input_image = tf.image.resize(input_image, image_size) # change the size of images follow the require size \n    input_image = tf.cast(input_image, tf.float32) / 255.0 # Casts a tensor to a new type and make the idensity of pixels in range [0;1]\n    \n    \n    mask_image = tf.io.read_file(mask_path)\n    mask_image = tf.image.decode_jpeg(mask_image, channels=OUTPUT_CHANNELS)\n    mask_image = tf.image.resize(mask_image, image_size)\n    mask_image = mask_image[:, :, :1]\n    mask_image = tf.math.sign(mask_image) # if idensity of pixel = 0 then it = 0 , if > 0 then it = 1 and < 0 then it = -1\n    \n    input_image, mask_image = augmentation(input_image, mask_image)\n    \n    return input_image, mask_image","metadata":{"execution":{"iopub.status.busy":"2021-07-10T09:57:54.094381Z","iopub.execute_input":"2021-07-10T09:57:54.095014Z","iopub.status.idle":"2021-07-10T09:57:54.104185Z","shell.execute_reply.started":"2021-07-10T09:57:54.094979Z","shell.execute_reply":"2021-07-10T09:57:54.103098Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"","metadata":{}},{"cell_type":"markdown","source":"","metadata":{}},{"cell_type":"code","source":"#create_dataset function\n\ndef create_dataset(df, train = False):\n    if not train:\n        ds = tf.data.Dataset.from_tensor_slices((df[\"car_path\"].values, df[\"mask_path\"].values)) # make the tensor dataset include in 2 struct [car_path;mask_path]\n        ds = ds.map(preprocess, num_parallel_calls=tf.data.AUTOTUNE) # Parallelizing data extraction\n        \n    else:\n        ds = tf.data.Dataset.from_tensor_slices((df[\"car_path\"].values, df[\"mask_path\"].values))\n        ds = ds.map(preprocess, num_parallel_calls=tf.data.AUTOTUNE)\n        ds = ds.map(augmentation, num_parallel_calls=tf.data.AUTOTUNE)\n        \n    return ds","metadata":{"execution":{"iopub.status.busy":"2021-07-10T09:57:54.105756Z","iopub.execute_input":"2021-07-10T09:57:54.106228Z","iopub.status.idle":"2021-07-10T09:57:54.118423Z","shell.execute_reply.started":"2021-07-10T09:57:54.106193Z","shell.execute_reply":"2021-07-10T09:57:54.117633Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# we will split the dataset into train and test\n\ntrain_df, valid_df = train_test_split(df, random_state=42, test_size=.25) # chose random that the number of train_df = 75% df and 25% df for vaid_df\ntrain = create_dataset(train_df, train = True) # create the train set\nvalid = create_dataset(valid_df) # create the validation set\n\nTRAIN_LENGTH = len(train_df) # 3816\nBATCH_SIZE = 16\nBUFFER_SIZE = 1000\n\ntrain_loader = train.cache().shuffle(BUFFER_SIZE).batch(BATCH_SIZE).repeat()\n# (train_data # some tf.data.Dataset, likely in the form of tuples (x, y)\n# .cache() # caches the dataset in memory (avoids having to reapply preprocessing transformations to the input)\n# .shuffle(BUFFER_SIZE) # shuffle the samples to have always a random order of samples fed to the network\n# .batch(BATCH_SIZE) # batch samples in chunks of size BATCH_SIZE (except the last one, that may be smaller)\n# .repeat()) # repeat forever, meaning the dataset will keep producing batches and never terminate running out of data.\n\ntrain_loader= train_loader.prefetch(buffer_size=tf.data.AUTOTUNE)\n# Prefetching overlaps the preprocessing and model execution of a training step. While the model is executing training step s,the input pipeline is reading the data for step s+1. Doing so reduces the step time to the maximum (as opposed to the sum) of the training and the time it takes to extract the data.\n\nval_loader = valid.batch(BATCH_SIZE) \n","metadata":{"execution":{"iopub.status.busy":"2021-07-10T09:57:54.119616Z","iopub.execute_input":"2021-07-10T09:57:54.119954Z","iopub.status.idle":"2021-07-10T09:57:54.952592Z","shell.execute_reply.started":"2021-07-10T09:57:54.119921Z","shell.execute_reply":"2021-07-10T09:57:54.951746Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataiter = iter(val_loader)\ncars, masks = next(dataiter)","metadata":{"execution":{"iopub.status.busy":"2021-07-10T09:57:54.953747Z","iopub.execute_input":"2021-07-10T09:57:54.954078Z","iopub.status.idle":"2021-07-10T09:57:55.350974Z","shell.execute_reply.started":"2021-07-10T09:57:54.954046Z","shell.execute_reply":"2021-07-10T09:57:55.350137Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def display(display_list):\n    plt.figure(figsize=(15, 15))\n\n    title = ['Input Image', 'True Mask', 'Predicted Mask']\n\n    for i in range(len(display_list)):\n        plt.subplot(1, len(display_list), i+1)\n        plt.title(title[i])\n        plt.imshow(tf.keras.preprocessing.image.array_to_img(display_list[i])) # Converts a 3D Numpy array to a PIL Image instance\n        plt.axis('off') \n    plt.show()   \nfor i in range(1):\n    for image, mask in valid.take(1):\n            sample_image, sample_mask = image, mask\n            display([sample_image, sample_mask])\n        \n   \n        \n        ","metadata":{"execution":{"iopub.status.busy":"2021-07-10T09:57:55.354154Z","iopub.execute_input":"2021-07-10T09:57:55.355491Z","iopub.status.idle":"2021-07-10T09:57:56.243365Z","shell.execute_reply.started":"2021-07-10T09:57:55.355455Z","shell.execute_reply":"2021-07-10T09:57:56.242468Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Model\nimport torch\nimport torch.nn as nn\nimport torchvision.transforms.functional as TF\n\nclass DoubleConv(nn.Module):\n    def __init__(self, in_channels, out_channels):\n        super(DoubleConv, self).__init__()\n        self.conv = nn.Sequential(\n            nn.Conv2d(in_channels, out_channels, 3, 1, 1, bias=False),\n            nn.BatchNorm2d(out_channels),\n            nn.ReLU(inplace=True),\n            nn.Conv2d(out_channels, out_channels, 3, 1, 1, bias=False),\n            nn.BatchNorm2d(out_channels),\n            nn.ReLU(inplace=True),\n        )\n\n    def forward(self, x):\n        return self.conv(x)\n\nclass UNET(nn.Module):\n    def __init__(self, in_channels=3, out_channels=1, features=[64, 128, 256, 512]):\n        super(UNET, self).__init__()\n        self.ups = nn.ModuleList() # Holds submodules in a list\n        self.downs = nn.ModuleList()\n        self.pool = nn.MaxPool2d(kernel_size=2, stride=2)\n\n        #down part of Unet\n        for feature in features:\n            self.downs.append(DoubleConv(in_channels, feature)) # add Doubleconv in list downs \n            in_channels = feature # example with 1 -> 64 -> 64 => DoubleConv(1,64) and in_channels = 64 , features=[64, 128, 256, 512]\n\n        #Up part of Unet\n        for feature in reversed(features): # The reversed() method returns the reversed iterator of the given sequence. It is the same as the iter() method but in reverse order\n            self.ups.append(\n                # Transposed convolution that help us encode the previous feature maps into the more details feature \n                nn.ConvTranspose2d(\n                    feature*2, feature, kernel_size=2, stride=2,\n                )\n            )\n            self.ups.append(DoubleConv(feature*2, feature))\n\n        self.bottleneck = DoubleConv(features[-1], features[-1]*2) # features[-1] = 512 \n        self.final_conv = nn.Conv2d(features[0], out_channels, kernel_size=1) # features[0] = 64 \n\n    def forward(self, x):\n        skip_connections = [] # make to copy and crop in Unet\n\n        for down in self.downs:\n            x = down(x)\n            skip_connections.append(x)\n            x = self.pool(x)\n\n        x = self.bottleneck(x)\n        skip_connections = skip_connections[::-1] # [::-1] = list[<start>:<stop>:<step>]\n\n        for idx in range(0, len(self.ups),2):\n            x = self.ups[idx](x)\n            skip_connection=skip_connections[idx//2] # // chia lam tron\n\n            if x.shape != skip_connection.shape:\n                x = TF.resize(x, size=skip_connection.shape[2:]) # [2:] = reshape hight and width\n\n            concat_skip = torch.cat((skip_connection, x), dim=1)\n            x = self.ups[idx+1](concat_skip)\n\n        return  self.final_conv(x)","metadata":{"execution":{"iopub.status.busy":"2021-07-10T09:59:55.571499Z","iopub.execute_input":"2021-07-10T09:59:55.571824Z","iopub.status.idle":"2021-07-10T09:59:55.58631Z","shell.execute_reply.started":"2021-07-10T09:59:55.571796Z","shell.execute_reply":"2021-07-10T09:59:55.585126Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# utils\nimport torchvision\n\n# Monitoring the process when running model\ndef save_checkpoint(state, filename='my_checkpoint.pth.tar'):\n    print(\"=> Saving checkpoint\")\n    torch.save(state, filename)\n\ndef load_checkpoint(checkpoint, model):\n    print(\"=> Loading checkpoint\")\n    model.load_state_dict(checkpoint[\"state_dict\"])\n\ndef check_accuracy(loader, model, device=\"cuda\"):\n    num_correct = 0\n    num_pixels = 0\n    dice_score = 0\n    model.eval()\n\n    with torch.no_grad():\n        for x, y in loader:\n            x = x.to(device)\n            y = y.to(device).unsqueeze(1)\n            preds = torch.sigmoid(model(x))\n            preds = (preds > 0.5).float()\n            num_correct += (preds == y).sum()\n            num_pixels += torch.numel(preds)\n            dice_score += (2*(preds*y).sum()) / ((preds +y).sum() + 1e-8)\n    print(f\"Got {num_correct}/{num_pixels} with acc {num_correct/num_pixels*100:.2f}\")\n    print(f\"Dice score: {dice_score/len(loader)}\")\n    model.train()\n\n\ndef save_predictions_as_imgs(loader, model, folder=\"saved_image/\", device=\"cuda\"):\n    model.eval()\n    for idx, (x, y) in enumerate(loader):\n        x = x.to(device=device)\n        with torch.no_grad():\n            preds = torch.sigmoid(model(x))\n            preds = (preds > 0.5).float()\n            torchvision.utils.saved_image(\n            preds, f\"{folder}/pred_{idx}.png\")\n    torchvision.utils.saved_image(y.unsqueeze(1), f\"{folder}/pred_{idx}.png\")\n\n    model.train()","metadata":{"execution":{"iopub.status.busy":"2021-07-10T09:57:56.854469Z","iopub.execute_input":"2021-07-10T09:57:56.854797Z","iopub.status.idle":"2021-07-10T09:57:56.86606Z","shell.execute_reply.started":"2021-07-10T09:57:56.854765Z","shell.execute_reply":"2021-07-10T09:57:56.865146Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import torch \nimport albumentations as A\nfrom albumentations.pytorch import ToTensor\nfrom tqdm import tqdm\nimport torch.nn as nn\nimport torch.optim as optim\n\n\ndef train_fn(loader, model, optimizer, loss_fn, scaler):\n    # # tqdm là một tiện ích của python, từ này có nghĩa là “tiến trình” trong tiếng Ả Rập (taqadum, تقدّم) . Trong python, nó giúp hiển thị các vòng lặp dưới dạng một giao diện tiến độ một cách thông minh – chỉ cần bọc bất kỳ vòng lặp nào bằng tqdm và bạn không phải lo cài đặt hiển thị tiến trình cho nó nữa.\n    loop = tqdm(loader)\n\n    for batch_idx, (data, targets) in enumerate(loop):\n        data = data.to(DEVICE)\n        targets = targets.float().unsqueeze(1).to(DEVICE) # unsqueeze()Returns a new tensor with a dimension of size one inserted at the specified position and targets is real output\n\n\n        # forward\n        with torch.cuda.amp.autocast():\n            predictions = model(data)\n            loss = loss_fn(predictions, targets)\n\n        # backward\n        optimizer.zero_grad()\n        # Python can be used to optimize parameters in a model to best fit data, increase profitability of a potential engineering design\n        scaler.scale(loss).backward()\n        scaler.step(optimizer)\n        scaler.update()\n\n        # update tqdm loop\n        loop.set_postfix(loss=loss.item())","metadata":{"execution":{"iopub.status.busy":"2021-07-10T09:57:56.867421Z","iopub.execute_input":"2021-07-10T09:57:56.867971Z","iopub.status.idle":"2021-07-10T09:57:57.201303Z","shell.execute_reply.started":"2021-07-10T09:57:56.867934Z","shell.execute_reply":"2021-07-10T09:57:57.200455Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Train\nimport torch \nimport albumentations as A\nfrom albumentations.pytorch import ToTensor\nfrom tqdm import tqdm\nimport torch.nn as nn\nimport torch.optim as optim\n\n\n# Hyperparameters etc.\nLEARNING_RATE = 1e-4\nDEVICE = \"cuda\" if torch.cuda.is_available() else \"cpu\"\nBATCH_SIZE = 16\nNUM_EPOCHS = 3\nNUM_WORKERS = 2\nIMAGE_HEIGHT = 256  # 1280 originally\nIMAGE_WIDTH = 256 # 1918 originally\nPIN_MEMORY = True\nLOAD_MODEL = False\n\n\n\n\n\nmodel = UNET(in_channels=3, out_channels=1).to(DEVICE)\nloss_fn = nn.BCEWithLogitsLoss()\noptimizer = optim.Adam(model.parameters(), lr=LEARNING_RATE)\n\nif LOAD_MODEL:\n    load_checkpoint(torch.load(\"my_checkpoint.pth.tar\"), model)\n\n\nscaler = torch.cuda.amp.GradScaler()\n\nfor epoch in range(NUM_EPOCHS):\n    train_fn(train_loader, model, optimizer, loss_fn, scaler)\n\n    # save model\n    checkpoint = {\n        \"state_dict\": model.state_dict(),\n        \"optimizer\":optimizer.state_dict(),\n    }\n    save_checkpoint(checkpoint)\n\n    # check accuracy\n    check_accuracy(val_loader, model, DEVICE)\n\n    # print some examples to a folder\n    save_predictions_as_imgs(val_loader, model, folder=\"saved_images/\", device=DEVICE)\n\n","metadata":{"execution":{"iopub.status.busy":"2021-07-10T10:07:50.172998Z","iopub.execute_input":"2021-07-10T10:07:50.173339Z","iopub.status.idle":"2021-07-10T10:08:12.015581Z","shell.execute_reply.started":"2021-07-10T10:07:50.173307Z","shell.execute_reply":"2021-07-10T10:08:12.012179Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ma","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model = UNET(in_channels=3, out_channels=1).to(DEVICE)\nmodel","metadata":{"execution":{"iopub.status.busy":"2021-07-10T09:58:22.461137Z","iopub.status.idle":"2021-07-10T09:58:22.461542Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pip install torchsummary","metadata":{"execution":{"iopub.status.busy":"2021-07-10T08:39:20.215736Z","iopub.execute_input":"2021-07-10T08:39:20.216118Z","iopub.status.idle":"2021-07-10T08:39:27.378178Z","shell.execute_reply.started":"2021-07-10T08:39:20.216085Z","shell.execute_reply":"2021-07-10T08:39:27.377106Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from torchsummary import summary","metadata":{"execution":{"iopub.status.busy":"2021-07-10T08:39:45.194397Z","iopub.execute_input":"2021-07-10T08:39:45.194762Z","iopub.status.idle":"2021-07-10T08:39:45.202446Z","shell.execute_reply.started":"2021-07-10T08:39:45.194726Z","shell.execute_reply":"2021-07-10T08:39:45.201666Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"summary(model, (3, 256, 256), 1,'cuda')","metadata":{"execution":{"iopub.status.busy":"2021-07-10T08:40:18.555181Z","iopub.execute_input":"2021-07-10T08:40:18.555525Z","iopub.status.idle":"2021-07-10T08:40:19.44111Z","shell.execute_reply.started":"2021-07-10T08:40:18.555473Z","shell.execute_reply":"2021-07-10T08:40:19.440313Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"execution":{"iopub.status.busy":"2021-07-10T08:41:19.541641Z","iopub.execute_input":"2021-07-10T08:41:19.54199Z","iopub.status.idle":"2021-07-10T08:41:19.548326Z","shell.execute_reply.started":"2021-07-10T08:41:19.541958Z","shell.execute_reply":"2021-07-10T08:41:19.546925Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"execution":{"iopub.status.busy":"2021-07-10T08:41:42.776286Z","iopub.execute_input":"2021-07-10T08:41:42.776644Z","iopub.status.idle":"2021-07-10T08:41:42.782404Z","shell.execute_reply.started":"2021-07-10T08:41:42.776611Z","shell.execute_reply":"2021-07-10T08:41:42.781363Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model.to(DEVICE)\n","metadata":{"execution":{"iopub.status.busy":"2021-07-10T09:22:47.719945Z","iopub.execute_input":"2021-07-10T09:22:47.720267Z","iopub.status.idle":"2021-07-10T09:22:47.730119Z","shell.execute_reply.started":"2021-07-10T09:22:47.720235Z","shell.execute_reply":"2021-07-10T09:22:47.72912Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"execution":{"iopub.status.busy":"2021-07-10T08:42:09.812182Z","iopub.execute_input":"2021-07-10T08:42:09.812532Z","iopub.status.idle":"2021-07-10T08:42:09.821941Z","shell.execute_reply.started":"2021-07-10T08:42:09.812479Z","shell.execute_reply":"2021-07-10T08:42:09.82095Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"execution":{"iopub.status.busy":"2021-07-10T08:42:35.357223Z","iopub.execute_input":"2021-07-10T08:42:35.357565Z","iopub.status.idle":"2021-07-10T08:42:35.360995Z","shell.execute_reply.started":"2021-07-10T08:42:35.357532Z","shell.execute_reply":"2021-07-10T08:42:35.360188Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"execution":{"iopub.status.busy":"2021-07-10T08:43:13.276885Z","iopub.execute_input":"2021-07-10T08:43:13.277216Z","iopub.status.idle":"2021-07-10T08:43:13.286521Z","shell.execute_reply.started":"2021-07-10T08:43:13.277184Z","shell.execute_reply":"2021-07-10T08:43:13.284046Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"execution":{"iopub.status.busy":"2021-07-10T08:43:24.28899Z","iopub.execute_input":"2021-07-10T08:43:24.289344Z","iopub.status.idle":"2021-07-10T08:43:24.301138Z","shell.execute_reply.started":"2021-07-10T08:43:24.289302Z","shell.execute_reply":"2021-07-10T08:43:24.300206Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"execution":{"iopub.status.busy":"2021-07-10T08:51:27.547683Z","iopub.execute_input":"2021-07-10T08:51:27.54812Z","iopub.status.idle":"2021-07-10T08:51:49.98357Z","shell.execute_reply.started":"2021-07-10T08:51:27.548081Z","shell.execute_reply":"2021-07-10T08:51:49.979882Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}