/
deepstack-custom-model.html
108 lines (98 loc) · 4.56 KB
/
deepstack-custom-model.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
<script type="text/javascript">
RED.nodes.registerType('deepstack-custom-model',{
category: 'function',
color: '#4682b4',
defaults: {
name: {value:""},
server: {value:"", type:"deepstack-server"},
confidence: {value: 80,required:true,validate:RED.validators.number()},
customModel: {value:"",required:true,validate:RED.validators.regex(/.+/)},
drawPredictions: {value: false},
outlineColor: {value: 'pink'},
custom: {value: ""},
outputs: {value:1}
},
inputs:1,
outputs:1,
icon: "font-awesome/fa-flask",
label: function() {
return this.name||"Custom Model";
},
oneditprepare: function() {
var node = this;
if (! $("#node-input-drawPredictions").is(":checked")) {
$("#row-outlineColor").hide();
$("#row-printLabel").hide();
}
$("#node-input-drawPredictions").click(function() {
$("#row-outlineColor").toggle(this.checked);
$("#row-printLabel").toggle(this.checked);
});
}
});
</script>
<script type="text/x-red" data-template-name="deepstack-custom-model">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
</div>
<div class="form-row">
<label for="node-input-server"><i class="icon-tag"></i> Deepstack server</label>
<input type="text" id="node-input-server">
</div>
<div class="form-row">
<label for="node-input-customModel"><i class="icon-tag"></i> Custom Model</label>
<input type="text" id="node-input-customModel">
</div>
<hr />
<div class="form-row">
<label for="node-input-confidence"><i class="icon-tag"></i> Minimum Confidence (%)</label>
<input type="text" id="node-input-confidence" size="5">
</div>
<div class="form-row">
<input type="checkbox" id="node-input-drawPredictions" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-drawPredictions" style="width: 90%;">Draw prediction outlines</label>
</div>
<div class="form-row" id="row-outlineColor" style="padding-left:10%;">
<label for="node-input-outlineColor"><i class="icon-tag"></i> Outline color</label>
<input type="text" id="node-input-outlineColor">
</div>
<div class="form-row" id="row-printLabel" style="padding-left:10%;">
<input type="checkbox" id="node-input-printLabel" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-printLabel" style="width: 90%;">Print prediction label</label>
</div>
</script>
<script type="text/x-red" data-help-name="deepstack-custom-model">
<p>A node to query the Deepstack Custom Model API.</p>
<p>Before usage of this node, make sure the model is installed on your Deepstack server. See Deepstack <a href="https://docs.deepstack.cc/custom-models/index.html">docs on custom models</a> for deteails.</p>
<h3>Inputs</h3>
<p>The node takes one single input, the image to be processed.</p>
<dl class="message-properties">
<dt>payload
<span class="property-type">buffer</span>
</dt>
<dd> the image buffer to process. </dd>
</dl>
<h3>Outputs</h3>
<p>The output contains all predictions made by the Custom Model API.</p>
<ol class="node-ports">
<li>Standard output
<dl class="message-properties">
<dt>payload <span class="property-type">object</span></dt>
<dd>Deepstack Detection predictions.</dd>
<dt>success <span class="property-type">boolean</span></dt>
<dd>Deepstack Detection status.</dd>
<dt>originalImage <span class="property-type">buffer</span></dt>
<dd>the image buffer processed.</dd>
<dt>outlinedImage <span class="property-type">buffer</span></dt>
<dd>the image buffer with rectangular outline around detected objects. Only if config option *drawPredictions* is true.</dd>
</dl>
</li>
</ol>
<h3>Details</h3>
<p>Sends an image to the Deepstack Custom Model API and outputs the predictions.</p>
<h3>References</h3>
<ul>
<li><a href="https://deepstack.cc/">Deepstack</a> - the service performing the actual magic.</li>
</ul>
</script>