带有多标签图像的

带有多标签图像的

本文介绍了带有多标签图像的 caffe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含多个标签的图像数据集;数据集中有 100 个类,每个图像有 1 到 5 个标签与之关联.

我正在按照以下 URL 中的说明进行操作:

https://github.com/BVLC/caffe/issues/550

它说我需要生成一个文本文件,列出图像及其标签,如

/home/my_test_dir/picture-foo.jpg 0/home/my_test_dir/picture-foo1.jpg 1

就我而言,由于我有多标签图像,是否可以简单地添加如下标签?

/home/my_test_dir/picture-foo.jpg 0 2 5/home/my_test_dir/picture-foo1.jpg 1 4

我有一种感觉,它可能不会那么简单,如果我是对的,在设置 Caffe 的过程中,我应该在哪一步以及如何整合数据集的多标签性?

解决方案

我相信 Shai 的回答不再是最新的.Caffe 支持 HDF5 和 LMDB 格式的多标签/矩阵地面实况.this github评论中的python代码片段演示了如何构建多标签LMDB 基本事实(有关 HDF5 格式,请参阅 Shai 的回答).与构建单标签图像数据集不同,为图像构建了一个 lmdb,而为多标签地面实况数据构建了第二个单独的 lmdb.该片段处理空间多标签真实情况,可用于图像的像素标记.

将数据写入 lmdb 的顺序至关重要.基本事实的顺序必须与图像的顺序相匹配.

SOFTMAX_LOSS、EUCLIDEAN_LOSS、SIGMOID_CROSS_ENTROPY_LOSS等损失层也支持多标签数据.但是,Accuracy 层仍然仅限于单标签数据.您可能希望关注 this github issue 以跟踪何时将此功能添加到咖啡.

I have a dataset of images that have multiple labels; There are 100 classes in the dataset, and each image has 1 to 5 labels associated with them.

I'm following the instruction in the following URL:

https://github.com/BVLC/caffe/issues/550

It says that I need to generate a text file listing the images and its labels as in

In my case, since I have multi-label images, does it work to simply add labels as in following?

I have a feeling that it's probably not going to be that simple, and if I'm right, in what step and how should I integrate the multi-label-ness of the dataset in the process of setting up Caffe?

解决方案

I believe Shai's answer is no longer up-to-date.Caffe supports multi-label/matrix ground truth for HDF5 and LMDB formats.The python snippet in this github comment demonstrates how to construct multi-label LMDB ground truth (see Shai's answer for HDF5 format).Different from the construction of single-label image datasets, an lmdb is constructed for the images while a second separate lmdb is constructed for the multi-label ground truth data. The snippet deals with spatial multi-label ground truth useful for pixel-wise labeling of images.

The order in which data is written to the lmdb is crucial. The order of the ground truth must match the order of the images.

Loss layers such as SOFTMAX_LOSS, EUCLIDEAN_LOSS, SIGMOID_CROSS_ENTROPY_LOSS also support multi-label data.However, the Accuracy layer is still limited to single-label data. You might want to follow this github issue to keep track of when this feature is added to Caffe.

这篇关于带有多标签图像的 caffe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 11:58