简体   繁体   English

如何使用 OptionsDataset 构建卷积神经网络

[英]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.

相关问题 如何正确屏蔽卷积神经网络中的值 - How do I properly mask values in my Convolutional Neural Network 如何使用 _OptionsDataset 进行数据扩充? - How can I do data augmentation with _OptionsDataset? 如何使用Keras构建多类卷积神经网络 - How to build a multi-class convolutional neural network with Keras 如何在 keras python 中构建一维卷积神经网络? - How to build 1D Convolutional Neural Network in keras python? 如何确定由 Keras 上的卷积神经网络预测的二元类? - How do I determine the binary class predicted by a convolutional neural network on Keras? 如何修改此PyTorch卷积神经网络以接受64 x 64图像并正确输出预测? - How do I modify this PyTorch convolutional neural network to accept a 64 x 64 image and properly output predictions? 如何训练带有负和正元素作为第一层输入的卷积神经网络? - How do I train the Convolutional Neural Network with negative and positive elements as the input of the first layer? 在卷积神经网络中,如何使用 Maxout 而不是 ReLU 作为激活函数? - In a convolutional neural network, how do I use Maxout instead of ReLU as an activation function? Python / Tensorflow - 我已经训练了卷积神经网络,如何测试它? - Python/Tensorflow - I have trained the convolutional neural network, how to test it? 对于使用数据增强进行图像分类的卷积神经网络,如何在 keras 中获得可重现的结果? - How can I get reproducible results in keras for a convolutional neural network using data augmentation for image classification?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM