日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

MindSpore数据集mindspore::dataset

發(fā)布時(shí)間:2023/11/28 生活经验 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 MindSpore数据集mindspore::dataset 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

MindSpore數(shù)據(jù)集mindspore::dataset
ResizeBilinear
#include <image_process.h>
bool ResizeBilinear(LiteMat &src, LiteMat &dst, int dst_w, int dst_h)
通過雙線性算法調(diào)整圖像大小,當(dāng)前僅支持的數(shù)據(jù)類型為uint8,當(dāng)前支持的通道為3和1。
? 參數(shù)
o src: 輸入的圖片數(shù)據(jù)。
o dst: 輸出的圖片數(shù)據(jù)。
o dst_w: 輸出圖片數(shù)據(jù)的寬度。
o dst_h: 輸出圖片數(shù)據(jù)的高度。
? 返回值
執(zhí)行成功返回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,提供數(shù)據(jù)為RGB或者BGR格式,不用進(jìn)行格式轉(zhuǎn)換,當(dāng)前支持的轉(zhuǎn)換是RGB_TO_BGR、RGBA_To_RGB、RGBA_To_BGR、NV21_To_BGR和NV12_To_BGR。
? 參數(shù)
o data: 輸入的數(shù)據(jù)。
o pixel_type: 像素點(diǎn)的類型。
o data_type: 數(shù)據(jù)的類型。
o w: 輸出數(shù)據(jù)的寬度。
o h: 輸出數(shù)據(jù)的高度。
o mat: 用于存儲圖像數(shù)據(jù)。
? 返回值
初始化成功返回true,否則返回false。
ConvertTo
#include <image_process.h>
bool ConvertTo(LiteMat &src, LiteMat &dst, double scale = 1.0)
轉(zhuǎn)換數(shù)據(jù)類型,當(dāng)前支持的轉(zhuǎn)換是將uint8轉(zhuǎn)換為float。
? 參數(shù)
o src: 輸入的圖片數(shù)據(jù)。
o dst: 輸出圖像數(shù)據(jù)。
o scale: 對像素做尺度(默認(rèn)值為1.0)。
? 返回值
轉(zhuǎn)換數(shù)據(jù)類型成功返回true,否則返回false。
Crop
#include <image_process.h>
bool Crop(LiteMat &src, LiteMat &dst, int x, int y, int w, int h)
裁剪圖像,通道支持為3和1。
? 參數(shù)
o src: 輸入的圖片數(shù)據(jù)。
o dst: 輸出圖像數(shù)據(jù)。
o x: 屏幕截圖起點(diǎn)的x坐標(biāo)值。
o y: 屏幕截圖起點(diǎn)的y坐標(biāo)值。
o w: 截圖的寬度。
o h: 截圖的高度。
? 返回值
裁剪圖像成功返回true,否則返回false。
SubStractMeanNormalize
#include <image_process.h>
bool SubStractMeanNormalize(const LiteMat &src, LiteMat &dst, const std::vector &mean, const std::vector &std)
歸一化圖像,當(dāng)前支持的數(shù)據(jù)類型為float。
? 參數(shù)
o src: 輸入的圖片數(shù)據(jù)。
o dst: 輸出圖像數(shù)據(jù)。
o mean: 數(shù)據(jù)集的均值。
o std: 數(shù)據(jù)集的方差。
? 返回值
歸一化成功返回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。
? 參數(shù)
o src: 輸入的圖片數(shù)據(jù)。
o dst: 輸出圖像數(shù)據(jù)。
o top: 圖片頂部長度。
o bottom: 圖片底部長度。
o left: 圖片左邊長度。
o right: 圖片右邊長度。
o pad_type: padding的類型。
o fill_b_or_gray: R或者GRAY。
o fill_g: G。
o fill_r: R。
? 返回值
填充圖像成功返回true,否則返回false。
ExtractChannel
#include <image_process.h>
bool ExtractChannel(const LiteMat &src, LiteMat &dst, int col)
按索引提取圖像通道。
? 參數(shù)
o src: 輸入的圖片數(shù)據(jù)。
o col: 通道的序號。
? 返回值
提取圖像通道成功返回true,否則返回false。
Split
#include <image_process.h>
bool Split(const LiteMat &src, std::vector &mv)
將圖像通道拆分為單通道。
? 參數(shù)
o src: 輸入的圖片數(shù)據(jù)。
o mv: 單個通道數(shù)據(jù)。
? 返回值
圖像通道拆分成功返回true,否則返回false。
Merge
#include <image_process.h>
bool Merge(const std::vector &mv, LiteMat &dst)
用幾個單通道陣列創(chuàng)建一個多通道圖像。
? 參數(shù)
o mv: 單個通道數(shù)據(jù)。
o dst: 輸出圖像數(shù)據(jù)。
? 返回值
創(chuàng)建多通道圖像成功返回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通道圖像應(yīng)用仿射變換。
? 參數(shù)
o src: 輸入圖片數(shù)據(jù)。
o out_img: 輸出圖片數(shù)據(jù)。
o M[6]: 仿射變換矩陣。
o dsize: 輸出圖像的大小。
o borderValue: 采圖之后用于填充的像素值。
void Affine(LiteMat &src, LiteMat &out_img, double M[6], std::vector<size_t> dsize, UINT8_C3 borderValue)
#include <image_process.h>
對3通道圖像應(yīng)用仿射變換。
? 參數(shù)
o src: 輸入圖片數(shù)據(jù)。
o out_img: 輸出圖片數(shù)據(jù)。
o M[6]: 仿射變換矩陣。
o dsize: 輸出圖像的大小。
o borderValue: 采圖之后用于填充的像素值。
GetDefaultBoxes
#include <image_process.h>
std::vector<std::vector> GetDefaultBoxes(BoxesConfig config)
獲取Faster R-CNN,SSD,YOLO等的默認(rèn)框。
? 參數(shù)
o config: BoxesConfig結(jié)構(gòu)體對象。
? 返回值
返回默認(rèn)框。
ConvertBoxes
#include <image_process.h>
void ConvertBoxes(std::vector<std::vector> &boxes, std::vector<std::vector> &default_boxes, BoxesConfig config)
將預(yù)測框轉(zhuǎn)換為(y,x,h,w)的實(shí)際框。
? 參數(shù)
o boxes: 實(shí)際框的大小。
o default_boxes: 默認(rèn)框。
o config: BoxesConfig結(jié)構(gòu)體對象。
ApplyNms
#include <image_process.h>
std::vector ApplyNms(std::vector<std::vector> &all_boxes, std::vector &all_scores, float thres, int max_boxes)
對實(shí)際框的非極大值抑制。
? 參數(shù)
o all_boxes: 所有輸入的框。
o all_scores: 通過網(wǎng)絡(luò)執(zhí)行后所有框的得分。
o thres: IOU的預(yù)值。
o max_boxes: 輸出框的最大值。
? 返回值
返回框的id。
LiteMat
#include <lite_mat.h>
LiteMat是一個處理圖像的類。
構(gòu)造函數(shù)和析構(gòu)函數(shù)
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的構(gòu)造方法,使用參數(shù)的默認(rèn)值。
~LiteMat
~LiteMat()
MindSpore dataset LiteMat的析構(gòu)函數(shù)。
公有成員函數(shù)
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)
該函數(shù)用于初始化圖像的通道,寬度和高度,參數(shù)不同。
IsEmpty
bool IsEmpty() const
確定對象是否為空的函數(shù)。
? 返回值
返回true或者false。
Release
void Release()
釋放內(nèi)存的函數(shù)。
公有屬性
data_ptr_
data_ptr_
pointer類型,表示存放圖像數(shù)據(jù)的地址。
elem_size_
elem_size_
int類型,表示元素的字節(jié)數(shù)。
width_
width_
int類型,表示圖像的寬度。
height_
height_
int類型,表示圖像的高度。
channel_
channel_
int類型,表示圖像的通道數(shù)。
c_step_
c_step_
int類型,表示經(jīng)過對齊后的圖像寬高之積。
dims_
dims_
int類型,表示圖像的維數(shù)。
size_
size_
size_t類型,表示圖像占用內(nèi)存的大小。
data_type_
data_type_
LDataType類型,表示圖像的數(shù)據(jù)類型。
ref_count_
ref_count_
pointer類型,表示引用計(jì)數(shù)器的地址。
Subtract
#include <lite_mat.h>
bool Subtract(const LiteMat &src_a, const LiteMat &src_b, LiteMat *dst)
計(jì)算每個元素的兩個圖像之間的差異。
? 參數(shù)
o src_a: 輸入的圖像a的數(shù)據(jù)。
o src_b: 輸入的圖像b的數(shù)據(jù)。
o dst: 輸出圖像的數(shù)據(jù)。
? 返回值
滿足條件的計(jì)算返回true,否則返回false。
Divide
#include <lite_mat.h>
bool Divide(const LiteMat &src_a, const LiteMat &src_b, LiteMat *dst)
計(jì)算每個元素在兩個圖像之間的劃分。
? 參數(shù)
o src_a: 輸入的圖像a的數(shù)據(jù)。
o src_b: 輸入的圖像b的數(shù)據(jù)。
o dst: 輸出圖像的數(shù)據(jù)。
? 返回值
滿足條件的計(jì)算返回true,否則返回false。
Multiply
#include <lite_mat.h>
bool Multiply(const LiteMat &src_a, const LiteMat &src_b, LiteMat *dst)
計(jì)算每個元素在兩個圖像之間的相乘值。
? 參數(shù)
o src_a: 輸入的圖像a的數(shù)據(jù)。
o src_b: 輸入的圖像b的數(shù)據(jù)。
o dst: 輸出圖像的數(shù)據(jù)。
? 返回值
滿足條件的計(jì)算返回true,否則返回false。

總結(jié)

以上是生活随笔為你收集整理的MindSpore数据集mindspore::dataset的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。