问题描述
错误:
Exception: Can't infer the type of your targets.
It's either because your data source is empty or because your labeling function raised an error.
代码:
from fastai import *
from fastai.vision import *
class URL:
MURDERHORNETS = f"https://superdata.quinniboi10.repl.co/MurderHornetimages"
path = untar_data(URL.MURDERHORNETS)
'''
path = untar_data(URLs.PETS)
files = get_image_files(path)
import PIL
img = PIL.Image.open(files[0])
img
'''
fnames = get_image_files(path)
fnames[:5]
np.random.seed (2)
pat = r'/([^/]+)_\d+\.(png|jpg|jpeg)$'
data = ImageDataBunch.from_folder(path,train=path,test=None,valid_pct=0.2,ds_tfms=get_transforms(),size=160)
data.normalize (imagenet_stats)
data.show_batch(rows=3,figsize=(7,6))
print (data.classes)
len (data.classes),data.c
learn = cnn_learner(data,models.resnet50,metrics=error_rate)
learn.fit_one_cycle(5)
learn.save ('stage-1')
数据集is here,don't comment on the name,I don't know why that is what I chose :/
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)