-
Notifications
You must be signed in to change notification settings - Fork 2
/
yolov9.h
44 lines (29 loc) · 870 Bytes
/
yolov9.h
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
#pragma once
#include <opencv2/core/core.hpp>
#include <net.h>
struct Object
{
cv::Rect_<float> rect;
int label;
float prob;
};
class yolov9
{
public:
yolov9();
//int load(const char* modeltype, int target_size, const float* norm_vals, bool use_gpu = false);
int load(int target_size, const float* norm_vals, bool use_gpu = false);
//int load(AAssetManager* mgr, const char* modeltype, int target_size, const float* norm_vals, bool use_gpu = false);
int detect(const cv::Mat& rgb, std::vector<Object>& objects, float prob_threshold = 0.25f, float nms_threshold = 0.45f);
int draw(cv::Mat& rgb, const std::vector<Object>& objects);
private:
ncnn::Net yolo;
int target_size;
float norm_vals[3];
int image_w;
int image_h;
int in_w;
int in_h;
ncnn::UnlockedPoolAllocator blob_pool_allocator;
ncnn::PoolAllocator workspace_pool_allocator;
};