FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
onnx_runtime_cpp/examples/MaskRCNN.cpp at develop · cardboardcode/onnx_runtime_cpp · GitHub
cardboardcode
/
onnx_runtime_cpp
Public
forked from
xmba15/onnx_runtime_cpp
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
0
Pull requests
0
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
onnx_runtime_cpp
/
examples
/
MaskRCNN.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
57 lines (50 loc) · 1.72 KB
Breadcrumbs
onnx_runtime_cpp
/
examples
/
MaskRCNN.cpp
Copy path
File metadata and controls
57 lines (50 loc) · 1.72 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
*
* @file MaskRCNN.cpp
*
* @author btran
*
*/
#
include
<
cstring
>
#
include
"
MaskRCNN.hpp
"
namespace
Ort
{
MaskRCNN::MaskRCNN
(
const
uint16_t
numClasses,
//
const
std::string& modelPath,
//
const
std::optional<
size_t
>& gpuIdx,
const
std::optional<std::vector<std::vector<
int64_t
>>>& inputShapes)
: ImageRecognitionOrtSessionHandlerBase(numClasses, modelPath, gpuIdx, inputShapes)
{
}
MaskRCNN::~MaskRCNN
()
{
}
void
MaskRCNN::preprocess
(
float
* dst,
//
const
float
* src,
//
const
int64_t
targetImgWidth,
//
const
int64_t
targetImgHeight,
//
const
int
numChannels)
const
{
for
(
int
c =
0
; c < numChannels; ++c) {
for
(
int
i =
0
; i < targetImgHeight; ++i) {
for
(
int
j =
0
; j < targetImgWidth; ++j) {
dst[c * targetImgHeight * targetImgWidth + i * targetImgWidth + j] =
src[i * targetImgWidth * numChannels + j * numChannels + c];
}
}
}
}
void
MaskRCNN::preprocess
(
float
* dst,
//
const
cv::Mat& imgSrc,
//
const
int64_t
targetImgWidth,
//
const
int64_t
targetImgHeight,
//
const
int
numChannels)
const
{
for
(
int
i =
0
; i < targetImgHeight; ++i) {
for
(
int
j =
0
; j < targetImgWidth; ++j) {
for
(
int
c =
0
; c < numChannels; ++c) {
dst[c * targetImgHeight * targetImgWidth + i * targetImgWidth + j] = imgSrc.
ptr
<
float
>(i, j)[c];
}
}
}
}
}
//
namespace Ort
Back
|
FazBrowse Home
|
New Git URL