JeVois  1.22
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Loading...
Searching...
No Matches
common.h
Go to the documentation of this file.
1/**
2 * Copyright 2020 (C) Hailo Technologies Ltd.
3 * All rights reserved.
4 *
5 * Hailo Technologies Ltd. ("Hailo") disclaims any warranties, including, but not limited to,
6 * the implied warranties of merchantability and fitness for a particular purpose.
7 * This software is provided on an "AS IS" basis, and Hailo has no obligation to provide maintenance,
8 * support, updates, enhancements, or modifications.
9 *
10 * You may use this software in the development of any project.
11 * You shall not reproduce, modify or distribute this software without prior written permission.
12 **/
13/**
14 * @ file example_common.h
15 * Common macros and defines used by Hailort Examples
16 **/
17
18#pragma once
19
20// #ifndef _EXAMPLE_COMMON_H_
21// #define _EXAMPLE_COMMON_H_
22
23#include <stdio.h>
24#include <stdlib.h>
25#include "hailo/hailort.h"
26#include "double_buffer.hpp"
27
28
29#define RESET "\033[0m"
30#define BLACK "\033[30m" /* Black */
31#define RED "\033[31m" /* Red */
32#define GREEN "\033[32m" /* Green */
33#define YELLOW "\033[33m" /* Yellow */
34#define BLUE "\033[34m" /* Blue */
35#define MAGENTA "\033[35m" /* Magenta */
36#define CYAN "\033[36m" /* Cyan */
37#define WHITE "\033[37m" /* White */
38#define BOLDBLACK "\033[1m\033[30m" /* Bold Black */
39#define BOLDRED "\033[1m\033[31m" /* Bold Red */
40#define BOLDGREEN "\033[1m\033[32m" /* Bold Green */
41#define BOLDYELLOW "\033[1m\033[33m" /* Bold Yellow */
42#define BOLDBLUE "\033[1m\033[34m" /* Bold Blue */
43#define BOLDMAGENTA "\033[1m\033[35m" /* Bold Magenta */
44#define BOLDCYAN "\033[1m\033[36m" /* Bold Cyan */
45#define BOLDWHITE "\033[1m\033[37m" /* Bold White */
46
47template <typename T>
49public:
50 FeatureData(uint32_t buffers_size, float32_t qp_zp, float32_t qp_scale, uint32_t width, hailo_vstream_info_t vstream_info) :
51 m_buffers(buffers_size), m_qp_zp(qp_zp), m_qp_scale(qp_scale), m_width(width), m_vstream_info(vstream_info)
52 {}
53 static bool sort_tensors_by_size (std::shared_ptr<FeatureData> i, std::shared_ptr<FeatureData> j) { return i->m_width < j->m_width; };
54
55 DoubleBuffer<T> m_buffers;
56 float32_t m_qp_zp;
57 float32_t m_qp_scale;
58 uint32_t m_width;
59 hailo_vstream_info_t m_vstream_info;
60};
61
62std::string get_coco_name_from_int(int cls)
63{
64 std::string result = "N/A";
65 switch(cls) {
66 case 0: result = "__background__";break;
67 case 1: result = "person";break;
68 case 2: result = "bicycle";break;
69 case 3: result = "car";break;
70 case 4: result = "motorcycle";break;
71 case 5: result = "airplane";break;
72 case 6: result = "bus";break;
73 case 7: result = "train";break;
74 case 8: result = "truck";break;
75 case 9: result = "boat";break;
76 case 10: result = "traffic light";break;
77 case 11: result = "fire hydrant";break;
78 case 12: result = "stop sign";break;
79 case 13: result = "parking meter";break;
80 case 14: result = "bench";break;
81 case 15: result = "bird";break;
82 case 16: result = "cat";break;
83 case 17: result = "dog";break;
84 case 18: result = "horse";break;
85 case 19: result = "sheep";break;
86 case 20: result = "cow";break;
87 case 21: result = "elephant";break;
88 case 22: result = "bear";break;
89 case 23: result = "zebra";break;
90 case 24: result = "giraffe";break;
91 case 25: result = "backpack";break;
92 case 26: result = "umbrella";break;
93 case 27: result = "handbag";break;
94 case 28: result = "tie";break;
95 case 29: result = "suitcase";break;
96 case 30: result = "frisbee";break;
97 case 31: result = "skis";break;
98 case 32: result = "snowboard";break;
99 case 33: result = "sports ball";break;
100 case 34: result = "kite";break;
101 case 35: result = "baseball bat";break;
102 case 36: result = "baseball glove";break;;
103 case 37: result = "skateboard";break;
104 case 38: result = "surfboard";break;
105 case 39: result = "tennis racket";break;
106 case 40: result = "bottle";break;
107 case 41: result = "wine glass";break;
108 case 42: result = "cup";break;
109 case 43: result = "fork";break;
110 case 44: result = "knife";break;
111 case 45: result = "spoon";break;
112 case 46: result = "bowl";break;
113 case 47: result = "banana";break;
114 case 48: result = "apple";break;
115 case 49: result = "sandwich";break;
116 case 50: result = "orange";break;
117 case 51: result = "broccoli";break;
118 case 52: result = "carrot";break;
119 case 53: result = "hot dog";break;
120 case 54: result = "pizza";break;
121 case 55: result = "donut";break;
122 case 56: result = "cake";break;
123 case 57: result = "chair";break;
124 case 58: result = "couch";break;
125 case 59: result = "potted plant";break;
126 case 60: result = "bed";break;
127 case 61: result = "dining table";break;
128 case 62: result = "toilet";break;
129 case 63: result = "tv";break;
130 case 64: result = "laptop";break;
131 case 65: result = "mouse";break;
132 case 66: result = "remote";break;
133 case 67: result = "keyboard";break;
134 case 68: result = "cell phone";break;
135 case 69: result = "microwave";break;
136 case 70: result = "oven";break;
137 case 71: result = "toaster";break;
138 case 72: result = "sink";break;
139 case 73: result = "refrigerator";break;
140 case 74: result = "book";break;
141 case 75: result = "clock";break;
142 case 76: result = "vase";break;
143 case 77: result = "scissors";break;
144 case 78: result = "teddy bear";break;
145 case 79: result = "hair drier";break;
146 case 80: result = "toothbrush";break;
147 }
148 return result;
149}
150
151// #endif /* _EXAMPLE_COMMON_H_ */
FeatureData(uint32_t buffers_size, float32_t qp_zp, float32_t qp_scale, uint32_t width, hailo_vstream_info_t vstream_info)
Definition common.h:50
float32_t m_qp_zp
Definition common.h:56
static bool sort_tensors_by_size(std::shared_ptr< FeatureData > i, std::shared_ptr< FeatureData > j)
Definition common.h:53
DoubleBuffer< T > m_buffers
Definition common.h:55
uint32_t m_width
Definition common.h:58
hailo_vstream_info_t m_vstream_info
Definition common.h:59
float32_t m_qp_scale
Definition common.h:57
std::string get_coco_name_from_int(int cls)
Definition common.h:62