-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasic_structures.html
167 lines (167 loc) · 11.4 KB
/
basic_structures.html
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<!-- HTML header for doxygen 1.8.6-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="shortcut icon" type="image/x-icon" href="odlogo_small.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<meta name="keywords" content="object detection, object recognition, detection, recognition, vision, computer vision, image processing, point cloud, opens ource"/>
<meta name="description" content="Open Detection, OD, is a standalone open source project for object detection and recognition in images and 3D point clouds."/>
<meta name="author" content="Kripasindhu Sarkar"/>
<title>Open Detection: Basic Structures</title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<style>
.carousel-inner > .item > img,
.carousel-inner > .item > a > img {
width: 70%;
margin: auto;
}
</style>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() {
if ($('.searchresults').length > 0) { searchBox.DOMSearchField().focus(); }
});
</script>
<link rel="search" href="search-opensearch.php?v=opensearch.xml" type="application/opensearchdescription+xml" title="Open Detection"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">Open Detection
 <span id="projectnumber">1.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>OD</span></a></li>
<li><a href="tutorial_root.html"><span>User Guide</span></a></li>
<li><a href="usergroup0.html"><span>API Documentation</span></a></li>
<li><a href="idea_list_gsoc2017.html"><span>GSoC 2017 Ideas</span></a></li>
<li><a href="usergroup1.html"><span>GSoC16</span></a></li>
<li><a href="installation_instruction.html"><span>Downloads</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<div class="left">
<form id="FSearchBox" action="search.php" method="get">
<img id="MSearchSelect" src="search/mag.png" alt=""/>
<input type="text" id="MSearchField" name="query" value="Search" size="20" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"/>
</form>
</div><div class="right"></div>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('basic_structures.html','');});
</script>
<div id="doc-content">
<div class="header">
<div class="headertitle">
<div class="title">Basic Structures </div> </div>
</div><!--header-->
<div class="contents">
<div class="toc"><h3>Table of Contents</h3>
<ul><li class="level1"><a href="#basic_structures1">Basic Structure </a><ul><li class="level2"><a href="#basic_structures2">Trainer</a></li>
<li class="level2"><a href="#basic_structures3">Detector</a></li>
<li class="level2"><a href="#basic_structures4">Detection</a></li>
<li class="level2"><a href="#basic_structures5">Typical code structure</a></li>
</ul>
</li>
</ul>
</div>
<div class="textblock"><h1><a class="anchor" id="basic_structures1"></a>
Basic Structure </h1>
<p>This article covers the basic structures and pipelines of OD.</p>
<p>The basic classes in OD are Trainers and Detectors. A Trainer (the offline stage) of a detection method acts on <code>training input data</code> to produce intermediate data called <code>trained data</code>. A corresponding Detector (the online stage) of the same method uses the <code>trained data</code> produced by Trainer to detect or recognize object in a given <code>Scene</code> (query image/point cloud). <code>Trained data</code> is usually stored in a preconfigured directory structure depending on the method starting from the base directory set for OpenDetection - <code>trained data location</code>.</p>
<p>The data by Trainer can be used by any of the Detectors. The Decector can use data of different types of Trainers (or no trainers at all). Therefore there is many-to-many mapping between Trainers and Detector which is currently resolved by Documentation (i.e. one needs to see the documentation to find out what Trainer to use for a given Detector). In future we plan to associate this mapping by grouping compatible Trainer/Detector under <code>ObjectDetector</code>s.</p>
<h2><a class="anchor" id="basic_structures2"></a>
Trainer</h2>
<p>Each <code>Trainer</code> (<a class="el" href="classod_1_1_o_d_trainer.html" title="The base class for all trainers. ">od::ODTrainer</a>) implements a virtual function <code>train</code> with the following signature: </p>
<pre class="fragment">virtual int train() = 0;
</pre><h2><a class="anchor" id="basic_structures3"></a>
Detector</h2>
<p>Each Detector (<a class="el" href="classod_1_1_o_d_detector.html" title="The main detector class; all special Detectors derives from this. ">od::ODDetector</a>) implements two functions - <code>detect()</code> and <code>detectOmni()</code> of the following signature. <code>detectOmni()</code> performs a detection/recognition on the entire scene (unsegmented and unprocessed) and provides information about the detection as well as its exact location. detect() takes an 'object candidate' or a segmented/processed scene as an input and identifies if the entire scene is a detection. </p>
<pre class="fragment">virtual ODDetections* detect(ODScene *scene);
virtual ODDetections* detectOmni(ODScene *scene);
</pre><p>Depending on the type of scene, Detectors are categorised in od::Detector2D and od::Detector3D.</p>
<h2><a class="anchor" id="basic_structures4"></a>
Detection</h2>
<p>A result of a Detector is Detections - a collection of Detection (<a class="el" href="classod_1_1_o_d_detection.html" title="The base class of all the detection. ">od::ODDetection</a>). Detection contains detection/recognition details as well as its exact location in the scene(for example bounding box for <a class="el" href="classod_1_1_o_d_detection2_d.html" title="Detection for 2D with 2D location information. ">od::ODDetection2D</a> and location/orientation for od::Detection3D) .</p>
<h2><a class="anchor" id="basic_structures5"></a>
Typical code structure</h2>
<p>A very typical code looks covering most of the pipeline looks like:</p>
<div class="fragment"><div class="line"><span class="comment">//train:</span></div>
<div class="line"><a class="code" href="classod_1_1g2d_1_1_o_d_h_o_g_trainer.html">od::g2d::ODHOGTrainer</a> *trainer = <span class="keyword">new</span> <a class="code" href="classod_1_1g2d_1_1_o_d_h_o_g_trainer.html">od::g2d::ODHOGTrainer</a>(<span class="stringliteral">""</span>, trained_data_dir); <span class="comment">//chose a trainer type</span></div>
<div class="line">trainer-><a class="code" href="classod_1_1g2d_1_1_o_d_h_o_g_trainer.html#a853f5cbb76d2f2fa7745cc2733cd3dd9">setPosSamplesDir</a>(pos_samples); <span class="comment">//set all the configurations as required by the trainer, the default values are provided as well</span></div>
<div class="line">trainer-><a class="code" href="classod_1_1g2d_1_1_o_d_h_o_g_trainer.html#a4b6f1041d1c18c1debc380f6010e31d5">setNegSamplesDir</a>(neg_samples);</div>
<div class="line">trainer-><a class="code" href="classod_1_1g2d_1_1_o_d_h_o_g_trainer.html#adeba443d711d535713519dd36722fe7e">setNOFeaturesNeg</a>(10);</div>
<div class="line">trainer-><a class="code" href="classod_1_1g2d_1_1_o_d_h_o_g_trainer.html#a201f76b48514907b9382b761eaef88de">setTrainHardNegetive</a>(<span class="keyword">true</span>);</div>
<div class="line">trainer-><a class="code" href="classod_1_1g2d_1_1_o_d_h_o_g_trainer.html#a8c29fe3df89c6d83836614d98e5a97a1">train</a>(); <span class="comment">//train!</span></div>
<div class="line"></div>
<div class="line"><span class="comment">//detect:</span></div>
<div class="line">ODDetector *detector = <span class="keyword">new</span> <a class="code" href="classod_1_1g2d_1_1_o_d_h_o_g_detector.html">od::g2d::ODHOGDetector</a>; <span class="comment">//chose a detector type</span></div>
<div class="line">detector->setTrainingDataLocation(trained_data_dir);</div>
<div class="line">detector-><a class="code" href="classod_1_1g2d_1_1_o_d_h_o_g_detector.html#a03940e18d6357d4c01d3159417f4355c">init</a>(); <span class="comment">//init with the required options</span></div>
<div class="line"></div>
<div class="line"><span class="comment">//do as may detections as needed in a loop using the initialized settings:</span></div>
<div class="line">ODDetections2D *detections = detector->detectOmni(scene); <span class="comment">//Use the detect* methods for detection. sene is a scene object from frameGenerator</span></div>
<div class="line"></div>
<div class="line"><span class="comment">//infer</span></div>
<div class="line">showimage(detections->renderMetainfo(*scene).getCVImage()) <span class="comment">//do something with the detections, </span></div>
</div><!-- fragment --><p>For more details please take a look into the examples provided with the <code>examples</code> folder in the repository and the rest of the user guide. </p>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.6-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="tutorial_root.html">User Guide</a></li>
<li class="footer">Send your queries <a href="mailto:[email protected]?Subject=OpenDetection" target="_top">here</a>.</li>
</ul>
</div>
</body>
</html>