Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 图像分类&x2B;本地化_Python_Tensorflow_Keras_Image Classification - Fatal编程技术网

Python 图像分类&x2B;本地化

Python 图像分类&x2B;本地化,python,tensorflow,keras,image-classification,Python,Tensorflow,Keras,Image Classification,我正在研究一个图像分类问题,我的目标是创建一个模型,在这个模型中,我可以输入图像、其类和边界框的值(x_min、y_min、x_max、y_max)。到目前为止,我只使用图像检测,我使用ImageDataGenerator加载我的图像,所以这对我来说是新事物 在Aurélien Géron的《Scikit Learn,Keras&TensorFlow与机器学习实践》一书中,他简要提到了图像分类和定位,并提供了一个示例模型 base_model =keras.applications.xcept

我正在研究一个图像分类问题,我的目标是创建一个模型,在这个模型中,我可以输入图像、其类和边界框的值(x_min、y_min、x_max、y_max)。到目前为止,我只使用图像检测,我使用ImageDataGenerator加载我的图像,所以这对我来说是新事物

在Aurélien Géron的《Scikit Learn,Keras&TensorFlow与机器学习实践》一书中,他简要提到了图像分类和定位,并提供了一个示例模型

 base_model =keras.applications.xception.Xception(weights="imagenet",include_top=False)
 avg = keras.layers.GlobalAveragePooling2D()(base_model.output)
 class_output = keras.layers.Dense(n_classes, activation="softmax")(avg)
 loc_output = keras.layers.Dense(4)(avg)
 model = keras.Model(inputs=base_model.input, outputs=[class_output, loc_output])
 model.compile(loss=["sparse_categorical_crossentropy", "mse"], loss_weights=[0.8, 0.2],  optimizer='adam', metrics=["accuracy"])
他还提到数据应该是元组的形式

(images, (class_labels, bounding_boxes))

但据我所知,keras只接受数组形式的数据。因此,如果有人能帮助我理解模型应该如何设计,以及应该如何向模型提供输入以获得图像的类别和边界框的值作为输出。

让输入数据为图像,目标值为4个坐标,即边界框的坐标

让输入数据为图像目标值为4个坐标,即边界框的坐标

我建议使用tfrecord。下面是一个带教程链接的问答:我建议使用tfrecord。以下是一个SO问答,带有教程链接: