Skip to content

Commit

Permalink
Merge pull request #3 from GOOD-I-DEER/feat/object-detection-node-up-…
Browse files Browse the repository at this point in the history
…down-threshold

feat : object detection node threshold up down function
  • Loading branch information
leecr1215 authored Sep 19, 2023
2 parents 2779223 + 898fffb commit e58a717
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion GOOD-I-DEER/nodes/object-detection-node/object-detection.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
defaults: {
name: { value: "" },
model: { value: "YoloV8n"},
threshold: {value: 0.5, validate: function(v){
let threshold = Number($("#node-input-threshold").val());

if(threshold < 0 || threshold >= 1){
$("#threshold-warning").css('display', 'block');
}else{
$("#threshold-warning").css('display', 'none');
}
return threshold >= 0 && threshold < 1;
}}
},
inputs: 1,
outputs: 1,
Expand Down Expand Up @@ -36,9 +46,14 @@
<input type="text" id="node-input-name" placeholder="Name" />
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-wrench"></i> Model</label>
<label for="node-input-model"><i class="fa fa-wrench"></i> Model</label>
<input type="text" id="node-input-model">
</div>
<div class="form-row">
<label for="node-input-threshold"><i class="fa fa-sort"></i> Threshold</label>
<input type="number" id="node-input-threshold" step="0.1" />
<p id="threshold-warning" style="color: red; display: none; margin-left: 105px;" >0 ≤ threshold < 1</p>
</div>
</script>

<script type="text/html" data-help-name="object-detection">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ module.exports = function (RED) {
const [class_id, prob] = [...Array(80).keys()] // 80개는 라벨링의 갯수 인듯
.map((col) => [col, output[8400 * (col + 4) + index]])
.reduce((accum, item) => (item[1] > accum[1] ? item : accum), [0, 0]);
if (prob < 0.5) {
if (prob < config.threshold) {
// 확률이 0.5이하면 무시
continue;
}
Expand Down

0 comments on commit e58a717

Please sign in to comment.