Python Fastai 1.0.x使用torchvision模型

Python Fastai 1.0.x使用torchvision模型,python,fast-ai,torchvision,Python,Fast Ai,Torchvision,有人能给我举一个例子,说明如何在fastai中使用torchvision模型而不进行修改(即不进行create\u cnn所做的网络修改)?我已经试过了,但是得到了运行时错误:大小不匹配。我认为alexnet输入大小应该是224,所以不确定如何调试 data = ImageDataBunch.from_name_re(path_img, get_image_files(path/'images'),

有人能给我举一个例子,说明如何在fastai中使用torchvision模型而不进行修改(即不进行
create\u cnn
所做的网络修改)?我已经试过了,但是得到了
运行时错误:大小不匹配
。我认为alexnet输入大小应该是224,所以不确定如何调试

data = ImageDataBunch.from_name_re(path_img, 
                                   get_image_files(path/'images'), 
                                   r'/([^/]+)_\d+.jpg$', 
                                   ds_tfms=None, size=224, bs=16)

learn = create_cnn(data, models.alexnet, metrics=error_rate, 
                   custom_head=models.alexnet(num_classes=data.c).classifier)

print(learn.summary())