Learn practical skills, build real-world projects, and advance your career
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load in 
!pip install torchsummary
!pip install efficientnet_pytorch
import time
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

# Input data files are available in the "../input/" directory.
# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory
from sklearn import metrics
from torchvision import transforms
from torch.utils.data import DataLoader
from torch.utils.data.dataset import Dataset
import pandas as pd
import numpy as np
from torch.utils.data.sampler import SubsetRandomSampler
import cv2
import os
import torchvision
import shutil
from torch.autograd import Variable
import torch
from torch import nn
import torch.nn.functional as F
import torchvision.models as models
from torchsummary import summary
from efficientnet_pytorch import EfficientNet
import torch.optim as optim
from tqdm.autonotebook import tqdm
# Any results you write to the current directory are saved as output.
Requirement already satisfied: torchsummary in /usr/local/lib/python3.6/dist-packages (1.5.1) Collecting efficientnet_pytorch Downloading https://files.pythonhosted.org/packages/06/ff/881afd965c46b11fc6f3c8316de9e08d37fc3b71056dbab861b76faee6ca/efficientnet_pytorch-0.1.0-py3-none-any.whl Requirement already satisfied: torch in /usr/local/lib/python3.6/dist-packages (from efficientnet_pytorch) (1.1.0) Requirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (from torch->efficientnet_pytorch) (1.16.4) Installing collected packages: efficientnet-pytorch Successfully installed efficientnet-pytorch-0.1.0
/usr/local/lib/python3.6/dist-packages/tqdm/autonotebook/__init__.py:14: TqdmExperimentalWarning: Using `tqdm.autonotebook.tqdm` in notebook mode. Use `tqdm.tqdm` instead to force console mode (e.g. in jupyter console) " (e.g. in jupyter console)", TqdmExperimentalWarning)
# For google colab upload the kaggle.json api file which can be downloaded from kaggle
!pip install -i https://test.pypi.org/simple/ supportlib
import supportlib.gettingdata as getdata
getdata.kaggle()
!kaggle datasets download -d puneet6060/intel-image-classification
Looking in indexes: https://test.pypi.org/simple/ Collecting supportlib Downloading https://test-files.pythonhosted.org/packages/c7/e8/a44bb606fca2603f0c79e8593fe0f6f1626dee5bad5177afb9ee260fd223/supportlib-0.1.0-py3-none-any.whl Installing collected packages: supportlib Successfully installed supportlib-0.1.0
Saving kaggle.json to kaggle.json Downloading intel-image-classification.zip to /content 96% 329M/344M [00:02<00:00, 109MB/s] 100% 344M/344M [00:02<00:00, 130MB/s]
getdata.zipextract('/content/intel-image-classification.zip')
getdata.zipextract('/content/seg_pred.zip')
getdata.zipextract('/content/seg_test.zip')
getdata.zipextract('/content/seg_train.zip')

Dataset loading using torchvision module