application_vnd.jupyter.stderr_output_1.png
from fastai.vision import ImageDataBunch,Learner

from torch import optim,nn

from torchvision import transforms,models

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import torch

from fastai.vision import ImageDataBunch, Learner
from PIL import Image
import torch
from torch import optim, nn
import cv2 as cv
from torchvision import transforms, models
from torch.utils.data.sampler import SubsetRandomSampler
import numpy as np
PATH = '../input'
df_train = pd.read_csv(PATH + '/train.csv', dtype={'id_code': str, 'diagnosis': int})
norm_values = ([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
dataBunch = ImageDataBunch.from_df(path=PATH, df=df_train, folder='train_images', suffix='.png', size=224, ds_tfms=get_transforms(do_flip=True, max_warp=0), test='test_images', bs=32, device=device).normalize(norm_values)
model = models.resnext101_32x8d(pretrained=True)
for param in model.parameters():
    param.requires_grad = False
fc = nn.Sequential(nn.Dropout(p=0.6), nn.Linear(2048, 500), nn.BatchNorm1d(500), nn.ReLU(), nn.Linear(500, 5), nn.LogSoftmax(dim=1))
model.fc = fc
model.to(device)
learn = Learner(data=dataBunch, model=model, model_dir='/tmp/model', metrics=[accuracy])
print(learn)