• matlab 构建数据集实用 api


    我们当前有如下目录结构的图像数据集(用于图像分类):


    这里写图片描述

    1. imageDatastore

    • imageDatastore:imds = imageDatastore('./images', 'IncludeSubfolders', true, 'labelsource', 'foldernames')
      • 第一个参数./images表示文件所在的路径;
      • 后续参数都是键值对(key-value)的形式
        • includesubfolders:是否继续读取子文件夹中的图像数据;
        • labelsource:图像 label 的来源是什么;
      • 此时的imds已包含了原始数据集丰富的信息;
        • tbl = countEachLabel(imds) ⇒ 见名知意,创建一个表格,某一label图像,及其对应的图像个数;
        • categories = tbl.Label;( tbl 是一个 table,tbl.Label 索引的是表中的列)
      • imds.Files:全部文件名构成的 cell 集合;

    2. splitEachLabel:拆分数据集

    • [imds1,imds2] = splitEachLabel(imds, p);
      • p 可以是一个小数,表示百分比,根据百分比划分;
      • 也可以是一个整数,根据这一整数进行划分;
  • 相关阅读:
    [BZOJ3043]IncDec Sequence
    【NOIP2015】字串
    [NOIP]2016天天爱跑步
    【NOIP2015】运输计划
    [poj3565]Ants
    【ZOJ2760】How Many Shortest Path
    [POJ3281] Dining
    P1077摆花
    校内测之zay与银临 (day2)
    P1880石子合并
  • 原文地址:https://www.cnblogs.com/mtcnn/p/9421479.html
Copyright © 2020-2023  润新知