[英]Using mnist dataset on tflite model maker
I would like to try tflite model maker which provides pretrained machine learning models for softwares.我想尝试为软件提供预训练机器学习模型的 tflite model 制造商。 I'm new at it and i'd like to set a tflite model with "mnist" dataset for image classification api.
我是新手,我想为图像分类 api 设置一个带有“mnist”数据集的 tflite model。 I took my data from keras.datasets but i can't import it with "DataLoader" which is in tflite.
我从 keras.datasets 中获取了我的数据,但我无法使用 tflite 中的“DataLoader”导入它。
My question: Is there any way to use array data on image_classifier?我的问题:有没有办法在 image_classifier 上使用数组数据?
my codes:我的代码:
from tflite_model_maker import image_classifier
from tflite_model_maker.image_classifier import DataLoader
from sklearn.datasets import load_digits
data = load_digits()
# Load input data specific to an on-device ML app.
train_data, test_data = data.split(0.9)
# Customize the TensorFlow model.
model = image_classifier.create(train_data)
# Evaluate the model.
loss, accuracy = model.evaluate(test_data)
Error i encountered:我遇到的错误:
KeyError: 'split'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
1 frames
/usr/local/lib/python3.7/dist-packages/sklearn/utils/__init__.py in __getattr__(self, key)
117 return self[key]
118 except KeyError:
--> 119 raise AttributeError(key)
120
121 def __setstate__(self, state):
AttributeError: split
load_digits() object has no attribute split, use train_test_split from sklearn. load_digits() object 没有属性拆分,使用sklearn中的 train_test_split。 For example:
例如:
train_data, test_data = train_test_split(data, target, test_size=0.01)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.