这是我第一次尝试用cns做一些事情,所以我可能做了一些非常愚蠢的事情-但是我不知道我错在哪里。。。在
这个模型似乎学习得很好,但是验证精度没有提高(甚至在第一个纪元之后),而且验证损失实际上随着时间的推移而增加。看起来我不是太适合(在1个时代之后?)-我们必须换个方式走吗。在
我正在训练一个CNN网络-我有大约10万张不同植物的图片(1000个班级),我想微调ResNet50来创建一个多类分类器。图片大小不一,我是这样加载的:from keras.preprocessing import image
def path_to_tensor(img_path):
# loads RGB image as PIL.Image.Image type
img = image.load_img(img_path, target_size=(IMG_HEIGHT, IMG_HEIGHT))
# convert PIL.Image.Image type to 3D tensor with shape (IMG_HEIGHT, IMG_HEIGHT, 3)
x = image.img_to_array(img)
# convert 3D tensor to 4D tensor with shape (1, IMG_HEIGHT, IMG_HEIGHT, 3) and return 4D tensor
return np.expand_dims(x, axis=0)
def paths_to_tensor(img_paths):
list_of_tensors = [path_to_tensor(img_path) for img_path in img_paths] #can use tqdm(img_paths) for data
return np.vstack(