zoukankan      html  css  js  c++  java
  • 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 可以是一个小数,表示百分比,根据百分比划分;
      • 也可以是一个整数,根据这一整数进行划分;
  • 相关阅读:
    Linux系统之-TCP-IP链路层
    TCP-IP协议简介
    一些概念
    Bolzano-Weierstrass 定理
    Newton 插值法
    用 Ipe 画图
    Codeforces #677D Vanya and Treasure
    Codeforces #990E Post Lamp
    hihoCoder #1763 道路摧毁
    hihoCoder #1758 加减
  • 原文地址:https://www.cnblogs.com/mtcnn/p/9421480.html
Copyright © 2011-2022 走看看