[英]How do I build convolutional neural network using OptionsDataset
This summer I started learning about neural networks and I am currently planning to implement a convolutional neural network for object detection using voc dataset from tensorflow_datasets.今年夏天我开始学习神经网络,我目前正计划使用来自 tensorflow_datasets 的 voc 数据集实现一个卷积神经网络,用于 object 检测。 I have loaded the dataset using the following code snippet:
我已经使用以下代码片段加载了数据集:
ds, info = tfds.load('voc', split=['train','test'], with_info=True, shuffle_files=True)
Then I split the dataset into train and test, accordingly:然后我将数据集拆分为训练和测试,相应地:
train, test = ds[0], ds[1]
I have also built my model using keras layers API.我还使用 keras 层 API 构建了我的 model。 The problem is that, I do not actually know how to train this dataset using my model.
问题是,我实际上不知道如何使用我的 model 训练这个数据集。 How do I input this dataset to my model?
如何将此数据集输入到我的 model? What is the most efficient and logical way?
什么是最有效和合乎逻辑的方式?
The types of the train, test split is as follows:火车的类型,测试拆分如下:
print(type(train))
print(type(test))
Output: Output:
<class 'tensorflow.python.data.ops.dataset_ops._OptionsDataset'>
<class 'tensorflow.python.data.ops.dataset_ops._OptionsDataset'>
Train dataset contains the data you use to train your model.训练数据集包含用于训练 model 的数据。 Test usually contains the data you use to evaluate your model.
测试通常包含您用来评估 model 的数据。 Please note that the actual voc dataset has also a validation split:
请注意,实际的 voc 数据集也有一个验证拆分:
So the usual logic is to use train dataset to train and validation dataset to validate against while training.所以通常的逻辑是使用训练数据集来训练和验证数据集在训练时进行验证。 And later on you evaluate the performance of your model using the test dataset.
稍后您使用测试数据集评估 model 的性能。 So the structure would like this:
所以结构应该是这样的:
model.fit(train_dataset, epochs=x, validation_data=validation_dataset)
model.evaluate(test_dataset)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.