@viun/node-red-contrib-overview
Version:
Collection of nodes to control the Overview's smart AI cameras
72 lines (70 loc) • 2.57 kB
HTML
<script type="text/x-red" data-help-name="check confidence classification">
<p>Checks confidence thresholds for pass/fail classifications.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload.classification.predictions
<span class="property-type">array</span>
</dt>
<dd>Array of predictions containing confidence and predicted_class</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload
<span class="property-type">boolean</span>
</dt>
<dd>True if all "pass" classes meet threshold and no "fail" classes exceed threshold</dd>
</dl>
</script>
<script type="text/javascript">
RED.nodes.registerType('check confidence classification', {
category: 'analysis',
color: '#D8BFD8',
defaults: {
name: { value: "" },
passThreshold: {
value: 0.9,
required: true,
validate: function(v) {
return !isNaN(v) && v >= 0 && v <= 1;
}
},
failThreshold: {
value: 0.8,
required: true,
validate: function(v) {
return !isNaN(v) && v >= 0 && v <= 1;
}
}
},
inputs: 1,
outputs: 1,
icon: "font-awesome/fa-check-circle",
label: function() {
return this.name || "Check Confidence Classification";
},
oneditprepare: function() {
$("#node-input-passThreshold").typedInput({
type: "num",
types: ["num"]
});
$("#node-input-failThreshold").typedInput({
type: "num",
types: ["num"]
});
}
});
</script>
<script type="text/html" data-template-name="check confidence classification">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-passThreshold"><i class="fa fa-check"></i> Pass Threshold</label>
<input type="number" id="node-input-passThreshold" min="0" max="1" step="0.01">
</div>
<div class="form-row">
<label for="node-input-failThreshold"><i class="fa fa-times"></i> Fail Threshold</label>
<input type="number" id="node-input-failThreshold" min="0" max="1" step="0.01">
</div>
</script>