!pip install efficientnet-pytorch
from fastai import *
from fastai.vision import *
from efficientnet_pytorch import EfficientNet
path = untar_data(URLs.PETS)
path_anno = path/'annotations'
path_img = path/'images'
fnames = get_image_files(path_img)
pat = r'/([^/]+)_\d+.jpg$'
data = ImageDataBunch.from_name_re(path_img, fnames, pat, ds_tfms=get_transforms(), size=224, bs=32
).normalize(imagenet_stats)
model = EfficientNet.from_name('efficientnet-b0')
model._fc = nn.Linear(1280, data.c)
learn = Learner(data, model)
#b7 2560
fastai使用efficinentnet
最新推荐文章于 2020-11-12 18:52:43 发布