问题
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