MindSpore数据集mindspore::dataset
MindSpore数据集mindspore::dataset
ResizeBilinear
#include <image_process.h>
bool ResizeBilinear(LiteMat &src, LiteMat &dst, int dst_w, int dst_h)
通过双线性算法调整图像大小,当前仅支持的数据类型为uint8,当前支持的通道为3和1。
- 参数
- src: 输入的图片数据。
- dst: 输出的图片数据。
- dst_w: 输出图片数据的宽度。
- dst_h: 输出图片数据的高度。
- 返回值
执行成功返回true,否则不满足条件返回false。
InitFromPixel
#include <image_process.h>
bool InitFromPixel(const unsigned char *data, LPixelType pixel_type, LDataType data_type, int w, int h, LiteMat &m)
从像素初始化LiteMat,提供数据为RGB或者BGR格式,不用进行格式转换,当前支持的转换是RGB_TO_BGR、RGBA_To_RGB、RGBA_To_BGR、NV21_To_BGR和NV12_To_BGR。
- 参数
- data: 输入的数据。
- pixel_type: 像素点的类型。
- data_type: 数据的类型。
- w: 输出数据的宽度。
- h: 输出数据的高度。
- mat: 用于存储图像数据。
- 返回值
初始化成功返回true,否则返回false。
ConvertTo
#include <image_process.h>
bool ConvertTo(LiteMat &src, LiteMat &dst, double scale = 1.0)
转换数据类型,当前支持的转换是将uint8转换为float。
- 参数
- src: 输入的图片数据。
- dst: 输出图像数据。
- scale: 对像素做尺度(默认值为1.0)。
- 返回值
转换数据类型成功返回true,否则返回false。
Crop
#include <image_process.h>
bool Crop(LiteMat &src, LiteMat &dst, int x, int y, int w, int h)
裁剪图像,通道支持为3和1。
- 参数
- src: 输入的图片数据。
- dst: 输出图像数据。
- x: 屏幕截图起点的x坐标值。
- y: 屏幕截图起点的y坐标值。
- w: 截图的宽度。
- h: 截图的高度。
- 返回值
裁剪图像成功返回true,否则返回false。
SubStractMeanNormalize
#include <image_process.h>
bool SubStractMeanNormalize(const LiteMat &src, LiteMat &dst, const std::vector<float> &mean, const std::vector<float> &std)
归一化图像,当前支持的数据类型为float。
- 参数
- src: 输入的图片数据。
- dst: 输出图像数据。
- mean: 数据集的均值。
- std: 数据集的方差。
- 返回值
归一化成功返回true,否则返回false。
Pad
#include <image_process.h>
bool Pad(const LiteMat &src, LiteMat &dst, int top, int bottom, int left, int right, PaddBorderType pad_type, uint8_t fill_b_or_gray, uint8_t fill_g, uint8_t fill_r)
填充图像,通道支持为3和1。
- 参数
- src: 输入的图片数据。
- dst: 输出图像数据。
- top: 图片顶部长度。
- bottom: 图片底部长度。
- left: 图片左边长度。
- right: 图片右边长度。
- pad_type: padding的类型。
- fill_b_or_gray: R或者GRAY。
- fill_g: G。
- fill_r: R。
- 返回值
填充图像成功返回true,否则返回false。
ExtractChannel
#include <image_process.h>
bool ExtractChannel(const LiteMat &src, LiteMat &dst, int col)
按索引提取图像通道。
- 参数
- src: 输入的图片数据。
- col: 通道的序号。
- 返回值
提取图像通道成功返回true,否则返回false。
Split
#include <image_process.h>
bool Split(const LiteMat &src, std::vector<LiteMat> &mv)
将图像通道拆分为单通道。
- 参数
- src: 输入的图片数据。
- mv: 单个通道数据。
- 返回值
图像通道拆分成功返回true,否则返回false。
Merge
#include <image_process.h>
bool Merge(const std::vector<LiteMat> &mv, LiteMat &dst)
用几个单通道阵列创建一个多通道图像。
- 参数
- mv: 单个通道数据。
- dst: 输出图像数据。
- 返回值
创建多通道图像成功返回true,否则返回false。
Affine
#include <image_process.h>
void Affine(LiteMat &src, LiteMat &out_img, double M[6], std::vector<size_t> dsize, UINT8_C1 borderValue)
对1通道图像应用仿射变换。
- 参数
- src: 输入图片数据。
- out_img: 输出图片数据。
- M[6]: 仿射变换矩阵。
- dsize: 输出图像的大小。
- borderValue: 采图之后用于填充的像素值。
void Affine(LiteMat &src, LiteMat &out_img, double M[6], std::vector<size_t> dsize, UINT8_C3 borderValue)
#include <image_process.h>
对3通道图像应用仿射变换。
- 参数
- src: 输入图片数据。
- out_img: 输出图片数据。
- M[6]: 仿射变换矩阵。
- dsize: 输出图像的大小。
- borderValue: 采图之后用于填充的像素值。
GetDefaultBoxes
#include <image_process.h>
std::vector<std::vector<float>> GetDefaultBoxes(BoxesConfig config)
获取Faster R-CNN,SSD,YOLO等的默认框。
- 参数
- config: BoxesConfig结构体对象。
- 返回值
返回默认框。
ConvertBoxes
#include <image_process.h>
void ConvertBoxes(std::vector<std::vector<float>> &boxes, std::vector<std::vector<float>> &default_boxes, BoxesConfig config)
将预测框转换为(y,x,h,w)的实际框。
- 参数
- boxes: 实际框的大小。
- default_boxes: 默认框。
- config: BoxesConfig结构体对象。
ApplyNms
#include <image_process.h>
std::vector<int> ApplyNms(std::vector<std::vector<float>> &all_boxes, std::vector<float> &all_scores, float thres, int max_boxes)
对实际框的非极大值抑制。
- 参数
- all_boxes: 所有输入的框。
- all_scores: 通过网络执行后所有框的得分。
- thres: IOU的预值。
- max_boxes: 输出框的最大值。
- 返回值
返回框的id。
LiteMat
#include <lite_mat.h>
LiteMat是一个处理图像的类。
构造函数和析构函数
LiteMat
LiteMat()
LiteMat(int width, LDataType data_type = LDataType::UINT8)
LiteMat(int width, int height, LDataType data_type = LDataType::UINT8)
LiteMat(int width, int height, int channel, LDataType data_type = LDataType::UINT8)
MindSpore中dataset模块下LiteMat的构造方法,使用参数的默认值。
~LiteMat
~LiteMat()
MindSpore dataset LiteMat的析构函数。
公有成员函数
Init
void Init(int width, LDataType data_type = LDataType::UINT8)
void Init(int width, int height, LDataType data_type = LDataType::UINT8)
void Init(int width, int height, int channel, LDataType data_type = LDataType::UINT8)
该函数用于初始化图像的通道,宽度和高度,参数不同。
IsEmpty
bool IsEmpty() const
确定对象是否为空的函数。
- 返回值
返回true或者false。
Release
void Release()
释放内存的函数。
公有属性
data_ptr_
data_ptr_
pointer类型,表示存放图像数据的地址。
elem_size_
elem_size_
int类型,表示元素的字节数。
width_
width_
int类型,表示图像的宽度。
height_
height_
int类型,表示图像的高度。
channel_
channel_
int类型,表示图像的通道数。
c_step_
c_step_
int类型,表示经过对齐后的图像宽高之积。
dims_
dims_
int类型,表示图像的维数。
size_
size_
size_t类型,表示图像占用内存的大小。
data_type_
data_type_
LDataType类型,表示图像的数据类型。
ref_count_
ref_count_
pointer类型,表示引用计数器的地址。
Subtract
#include <lite_mat.h>
bool Subtract(const LiteMat &src_a, const LiteMat &src_b, LiteMat *dst)
计算每个元素的两个图像之间的差异。
- 参数
- src_a: 输入的图像a的数据。
- src_b: 输入的图像b的数据。
- dst: 输出图像的数据。
- 返回值
满足条件的计算返回true,否则返回false。
Divide
#include <lite_mat.h>
bool Divide(const LiteMat &src_a, const LiteMat &src_b, LiteMat *dst)
计算每个元素在两个图像之间的划分。
- 参数
- src_a: 输入的图像a的数据。
- src_b: 输入的图像b的数据。
- dst: 输出图像的数据。
- 返回值
满足条件的计算返回true,否则返回false。
Multiply
#include <lite_mat.h>
bool Multiply(const LiteMat &src_a, const LiteMat &src_b, LiteMat *dst)
计算每个元素在两个图像之间的相乘值。
- 参数
- src_a: 输入的图像a的数据。
- src_b: 输入的图像b的数据。
- dst: 输出图像的数据。
- 返回值
满足条件的计算返回true,否则返回false。
MindSpore数据集mindspore::dataset的更多相关文章
- 『计算机视觉』Mask-RCNN_训练网络其一:数据集与Dataset类
Github地址:Mask_RCNN 『计算机视觉』Mask-RCNN_论文学习 『计算机视觉』Mask-RCNN_项目文档翻译 『计算机视觉』Mask-RCNN_推断网络其一:总览 『计算机视觉』M ...
- 镶嵌数据集 Mosaic Dataset 的常见数据组织方式
镶嵌数据集是ESRI公司推出一种用于管理海量影像数据的数据模型,定义在GeoDatabase数据模型中. 它的常见数据组织方式有两种: 1. 源镶嵌数据集 Source Mosaic Dataset ...
- MindSpore张量mindspore::tensor
MindSpore张量mindspore::tensor MSTensor #include <ms_tensor.h> MSTensor定义了MindSpore Lite中的张量. 构造 ...
- MindSpore接口mindspore::api
MindSpore接口mindspore::api Context #include <context.h> Context类用于保存执行中的环境变量. 静态公有成员函数 Instance ...
- HTML5 数据集属性dataset
有时候在HTML元素上绑定一些额外信息,特别是JS选取操作这些元素时特别有帮助.通常我们会使用getAttribute()和setAttribute()来读和写非标题属性的值.但为此付出的代价是文档将 ...
- 数据库学习任务四:数据读取器对象SqlDataReader、数据适配器对象SqlDataAdapter、数据集对象DataSet
数据库应用程序的开发流程一般主要分为以下几个步骤: 创建数据库 使用Connection对象连接数据库 使用Command对象对数据源执行SQL命令并返回数据 使用DataReader和DataSet ...
- pytorch 读数据接口 制作数据集 data.dataset
[吐槽] 啊,代码,你这个大猪蹄子 自己写了cifar10的数据接口,跟官方接口load的数据一样, 沾沾自喜,以为自己会写数据接口了 几天之后,突然想,自己的代码为啥有点慢呢,这数据集不大啊 用了官 ...
- Pytorch数据集读入——Dataset类,实现数据集打乱Shuffle
在进行相关平台的练习过程中,由于要自己导入数据集,而导入方法在市面上五花八门,各种库都可以应用,在这个过程中我准备尝试torchvision的库dataset torchvision.datasets ...
- TensorFlow2.0(10):加载自定义图片数据集到Dataset
.caret, .dropup > .btn > .caret { border-top-color: #000 !important; } .label { border: 1px so ...
随机推荐
- 【日志追踪】(微服务应用和单体应用)-logback中的MDC机制
一.MDC介绍 MDC(Mapped Diagnostic Contexts)映射诊断上下文,该特征是logback提供的一种方便在多线程条件下的记录日志的功能, 某些应用程序采用多线程的方式来处理多 ...
- hdu2604 矩阵快速幂
题意: 给你n个人,排成一个长度是n的队伍,人只有两类f,m,问可以有多少种排法使度列中不出现fff,fmf这样的子串.思路: 一开始暴力,结果超时了,其实这个题目要是能找到类似于 ...
- CString,string,char数组的转换
来源:http://ticktick.blog.51cto.com/823160/317550 //----------------ANSI字符串转换为UNICODE字符串-------------- ...
- Msfvenonm生成一个后门木马
在前一篇文章中我讲了什么是Meterpreter,并且讲解了Meterpreter的用法.传送门-->Metasploit之Meterpreter 今天我要讲的是我们用Msfvenom制作一个木 ...
- Java中的结构语句
目录 循环语句 While循环 do...While循环 for循环 增强型for语句 条件语句 if..else语句 if...else if...else 语句 嵌套的 if-else 语句 sw ...
- SQL注入注释符(#、-- 、/**/)使用条件及其他注释方式的探索
以MySQL为例,首先我们知道mysql注释符有#.-- (后面有空格)./**/三种,在SQL注入中经常用到,但是不一定都适用.笔者在sqlilabs通关过程中就遇到不同场景用的注释符不同,这让我很 ...
- 使用乌龟Git连接github
之前自己是在Gitee+乌龟Git来进行管理项目,因为特殊的需求,需要再Github+乌龟Git来进行管理项目,这盘博客主要讲解的就是这个. 安装环境 Git 安装参考链接:https://www.c ...
- androidstudio2.0引用.so文件
1.将.so文件复制到libs目录下: 2.在build.gradle中添加下面的代码 sourceSets.main.jniLibs.srcDirs = ['libs'] 结果示例: (上面的1.2 ...
- 【目录】Java项目开发中的知识记录
此篇文章为学习Java的目录,<a href="#"></>这种的是还没有写的文章.已经加a标签的是已经写完的.没写的文章急切需要的话可以直接留言,不是特别 ...
- 2019c#将PDF转图片
两种方法: 第一种是用O2S.Components.PDFRender4NET 大家可以去网上查找无水印版本 但是有的时候带颜色的字就变空白了 不知道为什么 第二种是用PdfiumViewer 这种方 ...