-
Notifications
You must be signed in to change notification settings - Fork 1
/
ini_target.html
659 lines (538 loc) · 32.8 KB
/
ini_target.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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Targets (outputs & losses) — N2D2 documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/language_data.js"></script>
<script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<link rel="author" title="About these documents" href="about.html" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Adversarial module" href="adversarial.html" />
<link rel="prev" title="Network Layers" href="ini_layers.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home" alt="Documentation Home"> N2D2
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">Introduction:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="intro.html">Presentation</a></li>
<li class="toctree-l1"><a class="reference internal" href="about.html">About N2D2-IP</a></li>
<li class="toctree-l1"><a class="reference internal" href="simus.html">Performing simulations</a></li>
<li class="toctree-l1"><a class="reference internal" href="perfs_tools.html">Performance evaluation tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="tuto.html">Tutorials</a></li>
</ul>
<p class="caption"><span class="caption-text">ONNX Import:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="onnx_convert.html">Obtain ONNX models</a></li>
<li class="toctree-l1"><a class="reference internal" href="onnx_import.html">Import ONNX models</a></li>
<li class="toctree-l1"><a class="reference internal" href="onnx_transfer.html">Train from ONNX models</a></li>
</ul>
<p class="caption"><span class="caption-text">Quantization and Export:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="quant_post.html">Post-training quantization</a></li>
<li class="toctree-l1"><a class="reference internal" href="quant_qat.html">[NEW] Quantization-Aware Training</a></li>
<li class="toctree-l1"><a class="reference internal" href="export_CPP.html">Export: C++</a></li>
<li class="toctree-l1"><a class="reference internal" href="export_CPP_STM32.html">Export: C++/STM32</a></li>
<li class="toctree-l1"><a class="reference internal" href="export_TensorRT.html">Export: TensorRT</a></li>
<li class="toctree-l1"><a class="reference internal" href="export_DNeuro.html">Export: DNeuro</a></li>
<li class="toctree-l1"><a class="reference internal" href="export_ONNX.html">Export: ONNX</a></li>
<li class="toctree-l1"><a class="reference internal" href="export_legacy.html">Export: other / legacy</a></li>
</ul>
<p class="caption"><span class="caption-text">INI File Interface:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="ini_intro.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="ini_databases.html">Databases</a></li>
<li class="toctree-l1"><a class="reference internal" href="ini_data_analysis.html">Stimuli data analysis</a></li>
<li class="toctree-l1"><a class="reference internal" href="ini_environment.html">Stimuli provider (Environment)</a></li>
<li class="toctree-l1"><a class="reference internal" href="ini_layers.html">Network Layers</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Targets (outputs & losses)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#from-labels-to-targets">From labels to targets</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#pixel-wise-segmentation">Pixel-wise segmentation</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#loss-functions">Loss functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="#target-types">Target types</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#target">Target</a></li>
<li class="toctree-l3"><a class="reference internal" href="#targetscore">TargetScore</a></li>
<li class="toctree-l3"><a class="reference internal" href="#targetrois">TargetROIs</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="adversarial.html">Adversarial module</a></li>
</ul>
<p class="caption"><span class="caption-text">Python API:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="containers.html">Containers</a></li>
<li class="toctree-l1"><a class="reference internal" href="cells.html">Cells</a></li>
<li class="toctree-l1"><a class="reference internal" href="databases.html">Databases</a></li>
<li class="toctree-l1"><a class="reference internal" href="stimuliprovider.html">StimuliProvider</a></li>
<li class="toctree-l1"><a class="reference internal" href="deepnet.html">DeepNet</a></li>
</ul>
<p class="caption"><span class="caption-text">C++ API / Developer:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="dev_intro.html">Introduction</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">N2D2</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home"></a> »</li>
<li>Targets (outputs & losses)</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/ini_target.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="targets-outputs-losses">
<h1>Targets (outputs & losses)<a class="headerlink" href="#targets-outputs-losses" title="Permalink to this headline">¶</a></h1>
<p>A <code class="docutils literal notranslate"><span class="pre">Target</span></code> is an output point of the neural network. A <code class="docutils literal notranslate"><span class="pre">Target</span></code> specifies
how the error must be computed and back-propagated at the output of a layer,
and computes a classification score. A target also specifies how the database
labels must be mapped to the output neurons.</p>
<p>To specify that the back-propagated error must be computed at the output
of a given layer (generally the last layer, or output layer), one must
add a target section named <em>LayerName</em><code class="docutils literal notranslate"><span class="pre">.Target</span></code>:</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="na">...</span>
<span class="k">[LayerName.Target]</span>
<span class="na">TargetValue</span><span class="o">=</span><span class="s">1.0 ; default: 1.0</span>
<span class="na">DefaultValue</span><span class="o">=</span><span class="s">0.0 ; default: -1.0</span>
</pre></div>
</div>
<div class="section" id="from-labels-to-targets">
<h2>From labels to targets<a class="headerlink" href="#from-labels-to-targets" title="Permalink to this headline">¶</a></h2>
<p>Usually, there are as many output
neurons as labels and each label is mapped to a different neuron. This is the
default behavior in N2D2: each label in the dataset, by order of appearance
when loading the data and label files (files are always loaded in the
alphabetical order), is mapped to the next available output neuron. If there is
more labels than output neurons, an error is thrown at runtime at the first
occurrence of a new label exceeding the output neurons capacity.</p>
<p>This default behavior can be changed using a label-mapping file, where the label
mapping is explicitly specified, which is useful to map several labels to the
same output neuron for example.</p>
<p>To specify a target in the INI file, one must simply add a <em>LayerName</em><code class="docutils literal notranslate"><span class="pre">.Target</span></code> section,
where <em>LayerName</em> is the name of the layer section to which the target must be
associated, as illustrated below:</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="c1">; Output layer</span>
<span class="k">[seg_output]</span>
<span class="na">Input</span><span class="o">=</span><span class="s">...</span>
<span class="na">Type</span><span class="o">=</span><span class="s">Conv</span>
<span class="na">KernelWidth</span><span class="o">=</span><span class="s">1</span>
<span class="na">KernelHeight</span><span class="o">=</span><span class="s">1</span>
<span class="na">NbOutputs</span><span class="o">=</span><span class="s">1</span>
<span class="na">Stride</span><span class="o">=</span><span class="s">1</span>
<span class="na">ActivationFunction</span><span class="o">=</span><span class="s">LogisticWithLoss</span>
<span class="na">WeightsFiller</span><span class="o">=</span><span class="s">XavierFiller</span>
<span class="na">ConfigSection</span><span class="o">=</span><span class="s">common.config</span>
<span class="k">[seg_output.Target]</span>
<span class="na">LabelsMapping</span><span class="o">=</span><span class="s">mapping.dat</span>
</pre></div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">LabelsMapping</span></code> parameter, when present, is the path to the file
containing the mapping of the dataset labels to the outputs of the layer.
In the present case, there is a single output neuron (per output pixel) in the
<em>seg_output</em> layer, which is a special case where two labels can be mapped
since the activation used is a logistic function. One label can be mapped to
the output value 0 and one label can be mapped to the output value 1.
With more than one output neuron (per output pixel) however, it only makes
sense to map a single label per output.</p>
<p>The label mapping file format is a two-columns, space separated, text table,
with the first column corresponding to the name of the label in the dataset
and the second column to the index of the associated output neuron.</p>
<p>Two special label names exist:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">*</span></code> corresponding to annotations without valid label (label ID is -1 in N2D2), sometimes referred to as “ignore label” in N2D2;</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">default</span></code> meaning any valid label name that is not explicitly listed in the label mapping file;</p></li>
</ul>
<p>The <code class="docutils literal notranslate"><span class="pre">background</span></code> name is not a reserved label name, it is simply the name
that is used as <code class="docutils literal notranslate"><span class="pre">DefaultLabel</span></code> in the <code class="docutils literal notranslate"><span class="pre">Database</span></code> driver.</p>
<p>Here is an example of label mapping file for the single output layer <em>seg_output</em>:</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="c1"># background (no defect)</span>
<span class="na">background 0</span>
<span class="c1"># padding</span>
<span class="na">* -1</span>
<span class="c1"># defect</span>
<span class="na">default 1</span>
</pre></div>
</div>
<p>Wildcards can be used as well in the name of the label:</p>
<ul class="simple">
<li><p>* meaning any one or several character(s) starting from this position (non greedy, cannot be used alone as it would refer to the special name for invalid label);</p></li>
<li><p>+ meaning any single character at this position.</p></li>
</ul>
<p>The actual label mapping of every labels present in the dataset for a given
output target is generated automatically when running the simulation. It is
strongly advised to check this generated file to make sure that there is no
error in the <code class="docutils literal notranslate"><span class="pre">LabelsMapping</span></code> file and that the mapping is done as intended.
The file is generated in <em>seg_output.Target/labels_mapping.log.dat</em>.</p>
<div class="section" id="pixel-wise-segmentation">
<h3>Pixel-wise segmentation<a class="headerlink" href="#pixel-wise-segmentation" title="Permalink to this headline">¶</a></h3>
<p>Pixel-wise segmentation consists of directly learning a label for each output
pixel of the network, typically in a fully convolutional network. Without
upscaling, unpooling or deconvolution, the output size is generally smaller than
the input size, by a factor <em>S</em>, corresponding to the product of the strides of
the successive layers.</p>
<p>In practice, because of the scaling factor <em>S</em> of the network, each output pixel
classify an input macro-pixel of size <em>SxS</em>. It is perfectly possible to get rid
of this scaling factor by rescaling the output to the input size before the
<code class="docutils literal notranslate"><span class="pre">Softmax</span></code> layer, using bilinear sampling for example. This can be done during
training, in order to precisely back-propagate the pixel-wise annotations, as
the bilinear sampling algorithm is easily differentiable. However, for
inference, the resampling of the output does not add information to the
segmentation (no new information is created when upscaling an image with
context-agnostic algorithms). This is why the scaling factor <em>S</em> may be kept for
inference, without resampling, in order to reduce the computing and
memory cost of processing the outputs.</p>
<p>Other strategies are possible to back-propagate the pixel-wise annotations,
which need to take into account the scaling factor <em>S</em>:</p>
<ul class="simple">
<li><p>Take the majority annotation within the macro-pixel <em>SxS</em>: the label attributed to the output pixel is the label which occurs the most often in the <em>SxS</em> macro-pixel;</p></li>
<li><p>Take the majority annotation within the macro-pixel <em>SxS</em>, at the exception of a weak annotation. In this case, any label other than the weak label in the macro-pixel takes precedence over the weak one. In N2D2, this is implemented with the <code class="docutils literal notranslate"><span class="pre">WeakTarget</span></code> parameter in <code class="docutils literal notranslate"><span class="pre">[*.target]</span></code> sections:</p></li>
</ul>
<blockquote>
<div><ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">WeakTarget=-1</span></code> means any target other than “ignore” takes precedence. This is useful if the background is ignored. If there is only a few pixels in the macro-pixel that are not background, they take precedence so that the macro-pixel is not considered as background.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">WeakTarget=-2</span></code> means there is no weak label.</p></li>
</ul>
</div></blockquote>
</div>
</div>
<div class="section" id="loss-functions">
<h2>Loss functions<a class="headerlink" href="#loss-functions" title="Permalink to this headline">¶</a></h2>
<p>The loss function in N2D2 is always implicitly defined.
For the <code class="docutils literal notranslate"><span class="pre">Softmax</span></code> layer or the <code class="docutils literal notranslate"><span class="pre">Logistic</span></code> activation, the loss is the <em>cross
entropy loss</em>, when used with the <code class="docutils literal notranslate"><span class="pre">WithLoss=1</span></code> parameter. Otherwise, the
default loss is the <em>MSE (L2) loss</em>.</p>
<p>The reason is that the error is defined at the output of a layer with the
<code class="docutils literal notranslate"><span class="pre">Cell_Frame[_CUDA]::setOutputTarget()</span></code> or <code class="docutils literal notranslate"><span class="pre">Cell_Frame[_CUDA]::setOutputTargets()</span></code>,
which set the value of the input gradient for the cell to <em>(target - output)</em>.
These functions are called in the <code class="docutils literal notranslate"><span class="pre">Target</span></code> class.</p>
<p>So, if a <code class="docutils literal notranslate"><span class="pre">Target</span></code> is attached to any cell, the corresponding loss
function would be the MSE loss, as the simple difference above is the derivative.
For the softmax or the logistic, the special parameter <code class="docutils literal notranslate"><span class="pre">WithLoss</span></code>,
when enabled, will simply by-pass the function derivative and directly set
the output gradient of the function to the difference above. This effectively
results to a cross entropy loss with regards to the input gradient of these
functions, as per the mathematical simplification of the cross entropy loss
derivative multiplied by the functions gradient.</p>
<div class="admonition-demonstration admonition">
<p class="admonition-title">Demonstration</p>
<p>The cross entropy loss for a single image is:</p>
<div class="math notranslate nohighlight">
\[L = -\sum_{j=1}^{M}{y_{j}\log(p_{j})}\]</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<ul class="simple">
<li><p>M - number of classes (dog, cat, fish)</p></li>
<li><p>log - the natural log</p></li>
<li><p>y - binary indicator (0 or 1) if class label <span class="math notranslate nohighlight">\(j\)</span> is the correct classification for this image</p></li>
<li><p>p - predicted probability that the image is of class <span class="math notranslate nohighlight">\(j\)</span></p></li>
</ul>
</div>
<p>The softmax performs the following operation:</p>
<div class="math notranslate nohighlight">
\[p_{i} = \frac{\exp{x_{i}}}{\sum_{k}\exp{x_{k}}}\]</div>
<p>To perform the back-propagation, we need to compute the derivative of the loss
<span class="math notranslate nohighlight">\(L\)</span> with respect to the inputs <span class="math notranslate nohighlight">\(x_{i}\)</span>:</p>
<div class="math notranslate nohighlight">
\[ \begin{align}\begin{aligned}\frac{\partial L}{\partial x_i}=-\sum_ky_k\frac{\partial \log p_k}{\partial x_i}=-\sum_ky_k\frac{1}{p_k}\frac{\partial p_k}{\partial x_i}\\=-y_i(1-p_i)-\sum_{k\neq i}y_k\frac{1}{p_k}({-p_kp_i})\\=-y_i(1-p_i)+\sum_{k\neq i}y_k({p_i})\\=-y_i+y_ip_i+\sum_{k\neq i}y_k({p_i})\\=p_i\left(\sum_k{y_k}\right)-y_i\\=p_i-y_i\end{aligned}\end{align} \]</div>
<p>given that <span class="math notranslate nohighlight">\(\sum_k{y_k}=1\)</span>, as <span class="math notranslate nohighlight">\(y\)</span> is a vector with only one non-zero element, which is 1.</p>
</div>
</div>
<div class="section" id="target-types">
<h2>Target types<a class="headerlink" href="#target-types" title="Permalink to this headline">¶</a></h2>
<div class="section" id="target">
<h3>Target<a class="headerlink" href="#target" title="Permalink to this headline">¶</a></h3>
<p>Base <code class="docutils literal notranslate"><span class="pre">Target</span></code> class.</p>
<p>Base parameters:</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 23%" />
<col style="width: 12%" />
<col style="width: 65%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Parameter</p></th>
<th class="head"><p>Default value</p></th>
<th class="head"><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">Type</span></code></p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">TargetScore</span></code></p></td>
<td><p>Type of <code class="docutils literal notranslate"><span class="pre">Target</span></code></p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">TargetValue</span></code></p></td>
<td><p>1.0</p></td>
<td><p>Target value for the target output neuron(s) (for classification)</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">DefaultValue</span></code></p></td>
<td><p>0.0</p></td>
<td><p>Default value for the non-target output neuron(s) (for classification)</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">TopN</span></code></p></td>
<td><p>1</p></td>
<td><p>The top-N estimated targets per output neuron to save</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">BinaryThreshold</span></code></p></td>
<td><p>0.5</p></td>
<td><p>Threshold for single output (binary classification).</p></td>
</tr>
</tbody>
</table>
<p>Labels to targets parameters:</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 23%" />
<col style="width: 12%" />
<col style="width: 65%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Parameter</p></th>
<th class="head"><p>Default value</p></th>
<th class="head"><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">DataAsTarget</span></code></p></td>
<td><p>0</p></td>
<td><p>If true (1), the data, and not the labels, is the target (for auto-encoders)</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">LabelsMapping</span></code></p></td>
<td></td>
<td><p>Path to the file containing the labels to target mapping</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">CreateMissingLabels</span></code></p></td>
<td><p>0</p></td>
<td><p>If true (1), labels present in the labels mapping file but that are non-existent in the
database are created (with 0 associated stimuli)</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">WeakTarget</span></code></p></td>
<td><p>-2</p></td>
<td><p>When attributing a target to an output macropixel, any target other than
<code class="docutils literal notranslate"><span class="pre">WeakTarget</span></code> in the macropixel takes precedence over <code class="docutils literal notranslate"><span class="pre">WeakTarget</span></code>,
regardless of their respective occurrence.</p>
<blockquote>
<div><ul class="simple">
<li><p>Value can be -1 (meaning any target other than “ignore” takes precedence).</p></li>
<li><p>Default value is -2 (meaning that there is no weak target, as a target is >= -1).</p></li>
</ul>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
<p>Masking parameters:</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 23%" />
<col style="width: 12%" />
<col style="width: 65%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Parameter</p></th>
<th class="head"><p>Default value</p></th>
<th class="head"><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">MaskLabelTarget</span></code></p></td>
<td></td>
<td><p>Name of the <code class="docutils literal notranslate"><span class="pre">Target</span></code> to use for <code class="docutils literal notranslate"><span class="pre">MaskedLabel</span></code></p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">MaskedLabel</span></code></p></td>
<td><p>-1</p></td>
<td><p>If >= 0, only estimated targets with ID <code class="docutils literal notranslate"><span class="pre">MaskedLabel</span></code> in the <code class="docutils literal notranslate"><span class="pre">MaskLabelTarget</span></code> target
are considered in the estimated targets</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">MaskedLabelValue</span></code></p></td>
<td><p>0</p></td>
<td><p>If true (1), the considered estimated targets values are weighted by the estimated
targets values with ID <code class="docutils literal notranslate"><span class="pre">MaskedLabel</span></code> in the <code class="docutils literal notranslate"><span class="pre">MaskLabelTarget</span></code></p></td>
</tr>
</tbody>
</table>
<p>Estimated output images parameters:</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 23%" />
<col style="width: 12%" />
<col style="width: 65%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Parameter</p></th>
<th class="head"><p>Default value</p></th>
<th class="head"><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">NoDisplayLabel</span></code></p></td>
<td><p>-1</p></td>
<td><p>If >= 0, the corresponding label ID is ignored in the estimated output image</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">LabelsHueOffset</span></code></p></td>
<td><p>0</p></td>
<td><p>Hue offset for the first label ID (starting from 0), for the estimated output image</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">EstimatedLabelsValueDisplay</span></code></p></td>
<td><p>1</p></td>
<td><p>If true (1), the value in the HSV colorspace is equal to the estimated
value. Otherwise, displayed value is 255 regardless of the confidence.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">ValueThreshold</span></code></p></td>
<td><p>0.0</p></td>
<td><p>Threshold for estimated value to be considered in the output logs.</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ImageLogFormat</span></code></p></td>
<td><p>jpg</p></td>
<td><p>If left empty, use the database image origin format</p></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="targetscore">
<h3>TargetScore<a class="headerlink" href="#targetscore" title="Permalink to this headline">¶</a></h3>
<p>The default target, which automatically compute the confusion matrix, confusion
metrics and score, for classification or segmentation networks.</p>
<p>Confusion matrix:</p>
<div class="figure align-default" id="id1">
<img alt="Example of confusion matrix generated by a ``TargetScore``." src="_images/confusion_matrix.png" />
<p class="caption"><span class="caption-text">Example of confusion matrix generated by a <code class="docutils literal notranslate"><span class="pre">TargetScore</span></code>.</span><a class="headerlink" href="#id1" title="Permalink to this image">¶</a></p>
</div>
<p>Confusion metrics:</p>
<div class="figure align-default" id="id2">
<img alt="Example of confusion metrics generated by a ``TargetScore``." src="_images/metrics.png" />
<p class="caption"><span class="caption-text">Example of confusion metrics generated by a <code class="docutils literal notranslate"><span class="pre">TargetScore</span></code>.</span><a class="headerlink" href="#id2" title="Permalink to this image">¶</a></p>
</div>
<p>Score:</p>
<div class="figure align-default" id="id3">
<img alt="Example of validation score generated by a ``TargetScore``." src="_images/validation_score.png" />
<p class="caption"><span class="caption-text">Example of validation score generated by a <code class="docutils literal notranslate"><span class="pre">TargetScore</span></code>.</span><a class="headerlink" href="#id3" title="Permalink to this image">¶</a></p>
</div>
</div>
<div class="section" id="targetrois">
<h3>TargetROIs<a class="headerlink" href="#targetrois" title="Permalink to this headline">¶</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">TargetROIs</span></code> allow to perform connected-component labeling (CCL) on
pixel-wise segmentation networks, to retrieve bounding boxes.</p>
<p>This approach is different from classical object detection networks, like SSD or
Yolo, where bounding boxes are directly inferred from anchors.</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 20%" />
<col style="width: 11%" />
<col style="width: 69%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Parameter</p></th>
<th class="head"><p>Default value</p></th>
<th class="head"><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">MinSize</span></code></p></td>
<td><p>0</p></td>
<td><p>Minimum number of macro-pixels above threshold than can constitute a bounding box.
Bounding boxes with fewer than <code class="docutils literal notranslate"><span class="pre">MinSize</span></code> macro-pixels above threshold are discarded</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">MinOverlap</span></code></p></td>
<td><p>0.5</p></td>
<td><p>Minimum overlap (IoU) of a bounding box with an annotation to be considered a match</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">FilterMinHeight</span></code></p></td>
<td><p>0</p></td>
<td><p>Minimum height of the ROI to keep it</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">FilterMinWidth</span></code></p></td>
<td><p>0</p></td>
<td><p>Minimum width of the ROI to keep it</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">FilterMinAspectRatio</span></code></p></td>
<td><p>0.0</p></td>
<td><p>Minimum aspect ratio (width/height) of the ROI to keep it (default is 0.0 = no minimum)</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">FilterMaxAspectRatio</span></code></p></td>
<td><p>0.0</p></td>
<td><p>Maximum aspect ratio (width/height) of the ROI to keep it (default is 0.0 = no minimum)</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">MergeMaxHDist</span></code></p></td>
<td><p>1</p></td>
<td><p>Maximum horizontal distance for merging (in macro-pixels)</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">MergeMaxVDist</span></code></p></td>
<td><p>1</p></td>
<td><p>Maximum vertical distance for merging (in macro-pixels)</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ScoreTopN</span></code></p></td>
<td><p>1</p></td>
<td><p>TopN number of class scores to keep for the ROI</p></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="adversarial.html" class="btn btn-neutral float-right" title="Adversarial module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="ini_layers.html" class="btn btn-neutral float-left" title="Network Layers" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
© Copyright 2019, CEA LIST
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>