ValueError: Expect x to be a non-empty array or dataset (Tensor Flow lite model maker on Collab)

半腔热情 提交于 2020-08-06 05:03:13

问题


I am following this tutorial on creating a custom Model using TensorFlow lite Model Maker on Collab.

import pathlib
path = pathlib.Path('/content/employee_pics') 
count = len(list(path.glob('*/*.jpg')))
count

data = ImageClassifierDataLoader.from_folder(path)
train_data, test_data = data.split(0.5)

I have an issue with step 2:

model = image_classifier.create(train_data)

I get an error: ValueError: Expect x to be a non-empty array or dataset.

Am I doing something wrong? The data set provided in the example works fine though. Why?


回答1:


I just did some manual tests. Don't exactly know why, but for this binary classifier, when I increase the amount of data to make sure at least 16 image per label are used for training, it starts working.

For your case, because you split the train/test by a factor of 0.5, you need 32 images per label. Could you try if that solve your issue?



来源:https://stackoverflow.com/questions/63231811/valueerror-expect-x-to-be-a-non-empty-array-or-dataset-tensor-flow-lite-model

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!