【问题标题】:It appears imageLabeler cannot handle a transformed datastore?看起来 imageLabeler 无法处理转换后的数据存储?
【发布时间】:2021-10-03 10:09:05
【问题描述】:

Matlab 应用程序imageLabeler 应该支持以下格式:

imageLabeler(imgStore)

我有一个imgStore,定义如下:

imds = imageDatastore(cellArrayOfImageFilenames);
imgStore = transform(imds, @(x)demosaic(x,'rggb'));

我必须这样做,因为我的图像存储为拜耳编码图像,这是我想出的让 imgStore 将这些图像作为 3 通道 RGB 图像返回的唯一方法。但是,当我尝试初始化 imageLabeler 时,我收到此错误:

>> imageLabeler(imgStore)
Error using imageLabelerInternal
Expected input name to be one of these types:

char

Instead its type was matlab.io.datastore.TransformedDatastore.

Error in vision.internal.imageLabeler.imageLabelerInternal

Error in imageLabeler (line 58)
vision.internal.imageLabeler.imageLabelerInternal(varargin{:});

TLDR: 如何让 imageLabeler 处理我的拜耳编码图像?

【问题讨论】:

    标签: matlab image-processing


    【解决方案1】:

    解决此问题的方法是使用 imageDatastore 'ReadFcn' 参数。 imageDatastore explicity 的文档告诉你不要这样做,因为它会减慢神经网络的速度。这是 Matlab 文档文本:

    使用 ReadFcn 转换或预处理 2-D 图像不是 推荐的。对于 imformats 识别的文件格式,指定 ReadFcn 会降低 imageDatastore 的性能。更多 转换和预处理图像的有效方法,请参阅预处理 深度学习图像(深度学习工具箱)。

    综上所述,解决方法如下:

    imgStore = imageDatastore(cellArrayOfImageFilenames ...
                , 'ReadFcn', @(x)demosaic(imread(x),'rggb')));
    

    【讨论】:

    • 最好使用指向“显式”文档的链接和文本来支持您的答案
    猜你喜欢
    • 1970-01-01
    • 2014-02-26
    • 1970-01-01
    • 1970-01-01
    • 2019-08-15
    • 1970-01-01
    • 1970-01-01
    • 2015-01-21
    • 1970-01-01
    相关资源
    最近更新 更多