Skip to content
Snippets Groups Projects
Commit 0510eaf2 authored by Philip ABBET's avatar Philip ABBET
Browse files

Merge branch 'docfixes' into 'docker'

[doc] clariefied session's Algorythms-Unsynchronized Operation documentation

See merge request !216
parents 0c38d3f8 ac4d8278
No related branches found
No related tags found
1 merge request!216[doc] clariefied session's Algorythms-Unsynchronized Operation documentation
Pipeline #
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
============ ============
Graphically represented, :ref:`toolchains` look like a set of interconnected Graphically represented, :ref:`toolchains` look like a set of interconnected
blocks. As illustrated in the figure below, each block can accomodate one blocks. As illustrated in the figure below, each block can accommodate one
*Algorithm*, along with the necessary input and output interfaces. We also *Algorithm*, along with the necessary input and output interfaces. We also
refer to the inputs and outputs collectively as *endpoints*. refer to the inputs and outputs collectively as *endpoints*.
...@@ -212,7 +212,7 @@ The example below illustrates how such an algorithm could be implemented: ...@@ -212,7 +212,7 @@ The example below illustrates how such an algorithm could be implemented:
if inputs['in2'].isDataUnitDone(): if inputs['in2'].isDataUnitDone():
out = magical_processing(self.objs) out = magical_processing(self.objs)
outputs['out'].write({'value': out}) outputs['out'].write({'value': out})
self.images = [] #reset accumulator for next label self.objs = [] #reset accumulator for next label
return True return True
...@@ -229,19 +229,20 @@ Unsynchronized Operation ...@@ -229,19 +229,20 @@ Unsynchronized Operation
------------------------ ------------------------
Not all inputs for a block need to be synchronized together. In the diagram Not all inputs for a block need to be synchronized together. In the diagram
shown below, the block is synchronized with the input ``in`` (as indicated by shown below, the block is synchronized with the inputs ``in`` and ``in2`` (as indicated by
the green circle which matches the color of the input line connecting ``in``). the green circle which matches the colour of the input lines connecting ``in`` and ``in2``).
The output ``out`` is synchronized with the block. The input ``in2`` is not The output ``out`` is synchronized with the block (and as one can notice locking at the code
synchronized with the endpoint ``in`` and with the block. A processing block below, outputs signal after every ``in`` input). The input ``in3`` is not
synchronized with the endpoints ``in``, ``in2`` and with the block. A processing block
which receives a previously calculated model and must score test samples is a which receives a previously calculated model and must score test samples is a
good example for this condition. In this case, the user is responsible for good example for this condition. In this case, the user is responsible for
reading out the contents of ``in2`` explicitly. reading out the contents of ``in3`` explicitly.
.. image:: img/case-study-4.* .. image:: img/case-study-4.*
In this case the algorithm will include an explicit loop to read the In this case the algorithm will include an explicit loop to read the
unsynchronized input (``in2``). unsynchronized input (``in3``).
.. code-block:: python .. code-block:: python
:linenos: :linenos:
...@@ -260,12 +261,15 @@ unsynchronized input (``in2``). ...@@ -260,12 +261,15 @@ unsynchronized input (``in2``).
# Loads the "model" data at the beginning, once # Loads the "model" data at the beginning, once
if self.models is None: if self.models is None:
self.models = [] self.models = []
while inputs['in2'].hasMoreData(): while inputs['in3'].hasMoreData():
inputs['in2'].next() inputs['in3'].next()
self.models.append(inputs['in2'].data.value) self.models.append(inputs['in3'].data.value)
# Processes the current input in `in', apply the model/models # Processes the current input in `in' and `in2', apply the
out = magical_processing(inputs['in'].data.value, self.models) # model/models
out = magical_processing(inputs['in'].data.value,
inputs['in2'].data.value,
self.models)
# Writes the output # Writes the output
outputs.write({'value': out}) outputs.write({'value': out})
...@@ -289,18 +293,20 @@ it is safer to treat inputs using their *group*. For example: ...@@ -289,18 +293,20 @@ it is safer to treat inputs using their *group*. For example:
def process(self, inputs, outputs): def process(self, inputs, outputs):
# N.B.: this will be called for every unit in `in' # N.B.: this will be called for every unit in `in':
# Loads the "model" data at the beginning, once # Loads the "model" data at the beginning, once
if self.models is None: if self.models is None:
self.models = [] self.models = []
group = inputs.groupOf('in2') group = inputs.groupOf('in3')
while group.hasMoreData(): while group.hasMoreData():
group.next() #synchronously advances the data group.next() #synchronously advances the data
self.models.append(group['in2'].data.value) self.models.append(group['in3'].data.value)
# Processes the current input in `in', apply the model/models # Processes the current input in `in' and `in2', apply the model/models
out = magical_processing(inputs['in'].data.value, self.models) out = magical_processing(inputs['in'].data.value,
inputs['in2'].data.value,
self.models)
# Writes the output # Writes the output
outputs.write({'value': out}) outputs.write({'value': out})
......
No preview for this file type
doc/user/algorithms/img/case-study-4.png

10.2 KiB | W: | H:

doc/user/algorithms/img/case-study-4.png

25.8 KiB | W: | H:

doc/user/algorithms/img/case-study-4.png
doc/user/algorithms/img/case-study-4.png
doc/user/algorithms/img/case-study-4.png
doc/user/algorithms/img/case-study-4.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
viewBox="0 0 916.23114 352.40994" viewBox="0 0 916.23114 352.40994"
id="svg2" id="svg2"
version="1.1" version="1.1"
inkscape:version="0.91 r13725" inkscape:version="0.48.5 r10040"
sodipodi:docname="case-study-4.svg" sodipodi:docname="case-study-4.png"
inkscape:export-filename="/remote/idiap.svm/user.active/aanjos/work/beat/beat.web/doc/user/algorithms/img/case-study-2.png" inkscape:export-filename="/remote/idiap.svm/user.active/aanjos/work/beat/beat.web/doc/user/algorithms/img/case-study-2.png"
inkscape:export-xdpi="39.93" inkscape:export-xdpi="39.93"
inkscape:export-ydpi="39.93"> inkscape:export-ydpi="39.93">
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
borderopacity="1.0" borderopacity="1.0"
inkscape:pageopacity="0.0" inkscape:pageopacity="0.0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:zoom="1.1507426" inkscape:zoom="1.6273958"
inkscape:cx="426.85751" inkscape:cx="443.09969"
inkscape:cy="143.10754" inkscape:cy="190.44509"
inkscape:document-units="px" inkscape:document-units="px"
inkscape:current-layer="layer1" inkscape:current-layer="layer1"
showgrid="false" showgrid="false"
...@@ -36,11 +36,11 @@ ...@@ -36,11 +36,11 @@
fit-margin-left="0" fit-margin-left="0"
fit-margin-right="0" fit-margin-right="0"
fit-margin-bottom="0" fit-margin-bottom="0"
inkscape:window-width="1737" inkscape:window-width="1920"
inkscape:window-height="678" inkscape:window-height="1023"
inkscape:window-x="141" inkscape:window-x="0"
inkscape:window-y="299" inkscape:window-y="35"
inkscape:window-maximized="0" inkscape:window-maximized="1"
showguides="false" /> showguides="false" />
<defs <defs
id="defs4"> id="defs4">
...@@ -529,17 +529,6 @@ ...@@ -529,17 +529,6 @@
x="759.71167" x="759.71167"
y="130.29988" y="130.29988"
ry="0" /> ry="0" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:12.5px;line-height:125%;font-family:'Bitstream Vera Sans';-inkscape-font-specification:'Bitstream Vera Sans Bold';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none"
x="807.63184"
y="225.98012"
id="text5121-1"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan5123-5"
x="807.63184"
y="225.98012">0</tspan></text>
<rect <rect
style="fill:#0000ff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" style="fill:#0000ff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect5021-6-1" id="rect5021-6-1"
...@@ -548,17 +537,6 @@ ...@@ -548,17 +537,6 @@
x="694.76788" x="694.76788"
y="130.29988" y="130.29988"
ry="0" /> ry="0" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:12.5px;line-height:125%;font-family:'Bitstream Vera Sans';-inkscape-font-specification:'Bitstream Vera Sans Bold';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none"
x="694.56702"
y="226.10121"
id="text5133-6"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan5135-6"
x="694.56702"
y="226.10121">2</tspan></text>
<rect <rect
style="fill:#0000ff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" style="fill:#0000ff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect5021-61" id="rect5021-61"
...@@ -567,17 +545,6 @@ ...@@ -567,17 +545,6 @@
x="628.89764" x="628.89764"
y="130.29988" y="130.29988"
ry="0" /> ry="0" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:12.5px;line-height:125%;font-family:'Bitstream Vera Sans';-inkscape-font-specification:'Bitstream Vera Sans Bold';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none"
x="675.45081"
y="226.10121"
id="text5137-9"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan5139-8"
x="675.45081"
y="226.10121">2</tspan></text>
<rect <rect
style="fill:#0000ff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" style="fill:#0000ff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect5021-61-8" id="rect5021-61-8"
...@@ -586,30 +553,14 @@ ...@@ -586,30 +553,14 @@
x="562.78333" x="562.78333"
y="130.29988" y="130.29988"
ry="0" /> ry="0" />
<path
id="path5084-2-8"
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 562.22585,212.98296 c 0,0 -0.16294,-8.47588 0,-8.47588 m -0.24934,0 113.66455,0 0,8.47588"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:12.5px;line-height:125%;font-family:'Bitstream Vera Sans';-inkscape-font-specification:'Bitstream Vera Sans Bold';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none"
x="561.48877"
y="225.98012"
id="text5141-1-2"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan5143-5-2"
x="561.48877"
y="225.98012">4</tspan></text>
<circle <circle
style="fill:#00a700;fill-opacity:1;fill-rule:nonzero;stroke:#00a700;stroke-opacity:1" style="fill:#00a700;fill-opacity:1;fill-rule:nonzero;stroke:#00a700;stroke-opacity:1"
id="path3084" id="path3084"
transform="matrix(0.88950579,0,0,0.88950579,0.40991991,75.333784)" transform="matrix(0.88950579,0,0,0.88950579,0.40991991,75.333784)"
cx="575.2807" cx="575.2807"
cy="66.578423" cy="66.578423"
r="11.297053" /> r="11.297053"
d="m 586.57775,66.578423 c 0,6.23919 -5.05786,11.297053 -11.29705,11.297053 -6.23919,0 -11.29705,-5.057863 -11.29705,-11.297053 0,-6.239191 5.05786,-11.297054 11.29705,-11.297054 6.23919,0 11.29705,5.057863 11.29705,11.297054 z" />
<path <path
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 98.769463,197.13924 0,7.92225 113.620307,0 0,-7.92225" d="m 98.769463,197.13924 0,7.92225 113.620307,0 0,-7.92225"
...@@ -630,12 +581,6 @@ ...@@ -630,12 +581,6 @@
y="-280.11337" y="-280.11337"
ry="0" ry="0"
transform="scale(1,-1)" /> transform="scale(1,-1)" />
<path
id="path5084-2-8-7"
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 694.25062,212.85716 c 0,0 -0.16294,-8.47588 0,-8.47588 m -0.24934,0 113.66455,0 0,8.47588"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<rect <rect
ry="0" ry="0"
y="256.04727" y="256.04727"
...@@ -741,5 +686,116 @@ ...@@ -741,5 +686,116 @@
id="tspan5068-4-5" id="tspan5068-4-5"
x="88.040718" x="88.040718"
y="418.06717">&lt;user/altdata/1&gt;</tspan></text> y="418.06717">&lt;user/altdata/1&gt;</tspan></text>
<g
id="g3213">
<path
inkscape:connector-curvature="0"
id="path5084-3"
d="m 628.51185,213.60008 0,-8.47588 47.30086,0 0,8.47588"
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
inkscape:connector-curvature="0"
id="path5084-6-6"
d="m 694.27888,213.56318 0,-8.47588 47.30085,0 0,8.47588"
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
inkscape:connector-curvature="0"
id="path5084-6-2-7"
d="m 760.04591,213.56318 0,-8.47588 47.30085,0 0,8.47588"
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<text
sodipodi:linespacing="125%"
id="text5121-5"
y="226.59724"
x="807.68207"
style="font-size:12.5px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold"
xml:space="preserve"><tspan
y="226.59724"
x="807.68207"
id="tspan5123-3"
sodipodi:role="line">0</tspan></text>
<text
sodipodi:linespacing="125%"
id="text5125-5"
y="226.71834"
x="760.38123"
style="font-size:12.5px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold"
xml:space="preserve"><tspan
y="226.71834"
x="760.38123"
id="tspan5127-6"
sodipodi:role="line">1</tspan></text>
<text
sodipodi:linespacing="125%"
id="text5129-2"
y="226.71834"
x="741.24213"
style="font-size:12.5px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold"
xml:space="preserve"><tspan
y="226.71834"
x="741.24213"
id="tspan5131-9"
sodipodi:role="line">1</tspan></text>
<text
sodipodi:linespacing="125%"
id="text5133-1"
y="226.71834"
x="694.21466"
style="font-size:12.5px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold"
xml:space="preserve"><tspan
y="226.71834"
x="694.21466"
id="tspan5135-2"
sodipodi:role="line">2</tspan></text>
<text
sodipodi:linespacing="125%"
id="text5137-7"
y="226.71834"
x="675.62244"
style="font-size:12.5px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold"
xml:space="preserve"><tspan
y="226.71834"
x="675.62244"
id="tspan5139-0"
sodipodi:role="line">2</tspan></text>
<text
sodipodi:linespacing="125%"
id="text5141-9"
y="226.59724"
x="627.77478"
style="font-size:12.5px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold"
xml:space="preserve"><tspan
y="226.59724"
x="627.77478"
id="tspan5143-3"
sodipodi:role="line">3</tspan></text>
<path
inkscape:connector-curvature="0"
id="path5084-1-6"
d="m 562.02627,213.15339 0,-8.47588 47.30085,0 0,8.47588"
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<text
sodipodi:linespacing="125%"
id="text5137-0-0"
y="226.27165"
x="609.13684"
style="font-size:12.5px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold"
xml:space="preserve"><tspan
y="226.27165"
x="609.13684"
id="tspan5139-9-6"
sodipodi:role="line">3</tspan></text>
<text
sodipodi:linespacing="125%"
id="text5141-15-2"
y="226.15056"
x="561.28918"
style="font-size:12.5px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold"
xml:space="preserve"><tspan
y="226.15056"
x="561.28918"
id="tspan5143-6-6"
sodipodi:role="line">4</tspan></text>
</g>
</g> </g>
</svg> </svg>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment