1 Star 0 Fork 0

Microdream36/yolov5-seg-opencv-onnxruntime-cpp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
yolov5_utils.h 1.36 KB
一键复制 编辑 原始数据 按行查看 历史
UNeedCryDear 提交于 2023-11-09 14:06 . update
#pragma once
#include<iostream>
#include <numeric>
#include<opencv2/opencv.hpp>
#include<io.h>
#define ORT_OLD_VISON 13 //ort1.12.0 之前的版本为旧版本API
struct OutputSeg {
int id; //结果类别id
float confidence; //结果置信度
cv::Rect box; //矩形框
cv::Mat boxMask; //矩形框内mask,节省内存空间和加快速度
};
struct MaskParams {
//int segChannels = 32;
//int segWidth = 160;
//int segHeight = 160;
int netWidth = 640;
int netHeight = 640;
float maskThreshold = 0.5;
cv::Size srcImgShape;
cv::Vec4d params;
};
bool CheckModelPath(std::string modelPath);
bool CheckParams(int netHeight, int netWidth, const int* netStride, int strideSize);
void DrawPred(cv::Mat& img,
std::vector<OutputSeg> result,
std::vector<std::string> classNames,
std::vector<cv::Scalar> color,
bool isVideo = false
);
void LetterBox(const cv::Mat& image, cv::Mat& outImage,
cv::Vec4d& params, //[ratio_x,ratio_y,dw,dh]
const cv::Size& newShape = cv::Size(640, 640),
bool autoShape = false,
bool scaleFill = false,
bool scaleUp = true,
int stride = 32,
const cv::Scalar& color = cv::Scalar(114, 114, 114));
void GetMask(const cv::Mat& maskProposals, const cv::Mat& maskProtos, std::vector<OutputSeg>& OutputSeg, const MaskParams& maskParams);
void GetMask2(const cv::Mat& maskProposals, const cv::Mat& maskProtos, OutputSeg& output, const MaskParams& maskParams);
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/microdream36/yolov5-seg-opencv-onnxruntime-cpp.git
git@gitee.com:microdream36/yolov5-seg-opencv-onnxruntime-cpp.git
microdream36
yolov5-seg-opencv-onnxruntime-cpp
yolov5-seg-opencv-onnxruntime-cpp
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385