Skip to content

Commit

Permalink
Merge pull request #15 from GOOD-I-DEER/feat/face-detection-node
Browse files Browse the repository at this point in the history
Feat/face detection node
  • Loading branch information
chickennight authored Sep 21, 2023
2 parents c03e4e7 + c33c111 commit 45b9df8
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
22 changes: 13 additions & 9 deletions GOOD-I-DEER/nodes/object-detection-node/face-detection.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script type="text/javascript">
RED.nodes.registerType("face-detection", {
RED.nodes.registerType("good-face-detection", {
category: "GOOD I DEER",
color: "#1AE5BE",
defaults: {
name: { value: "" },
returnType: { value: "information", validate: function(v) {
returnType: { value: 0, validate: function(v) {
const returnType = Number(v);

if(returnType <= 1) {
Expand All @@ -15,10 +15,18 @@
} else if(returnType == 1) {
this._def.outputLabels = ["Image Buffer"];
}
this._def.defaults.absolutePathDir.validate = function(v) {
return true;
};
} else if (returnType == 2){
$("#absolutePathDir-form").css('display', 'block');
this.outputs = 0;
this._def.outputLabels = undefined;
this._def.defaults.absolutePathDir.validate = function(v) {
if(v)
return true;
return false;
}
}
return true;
} },
Expand All @@ -32,11 +40,7 @@
}
return threshold >= 0 && threshold < 1;
}},
absolutePathDir: { value: "", validate: function(v) {
if(v)
return true;
return false;
} }
absolutePathDir: { value: "" }
},
inputs: 1,
outputs: 1,
Expand All @@ -50,7 +54,7 @@
});
</script>

<script type="text/html" data-template-name="face-detection">
<script type="text/html" data-template-name="good-face-detection">
<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" />
Expand All @@ -74,6 +78,6 @@
</div>
</script>

<script type="text/html" data-help-name="face-detection">
<script type="text/html" data-help-name="good-face-detection">
<p>face-detection node using yolov8</p>
</script>
3 changes: 2 additions & 1 deletion GOOD-I-DEER/nodes/object-detection-node/face-detection.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = function (RED) {

const node = this;
const returnType = Number(config.returnType);
console.log(config.returnType);
const saveDir = config.absolutePathDir;
let bufferFromImage;

Expand Down Expand Up @@ -207,5 +208,5 @@ module.exports = function (RED) {
}
}

RED.nodes.registerType("face-detection", yolov8NodeFace);
RED.nodes.registerType("good-face-detection", yolov8NodeFace);
};
6 changes: 3 additions & 3 deletions GOOD-I-DEER/nodes/object-detection-node/object-detection.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script type="text/javascript">
RED.nodes.registerType("object-detection", {
RED.nodes.registerType("good-object-detection", {
category: "GOOD I DEER",
color: "#1AE5BE",
defaults: {
Expand Down Expand Up @@ -28,7 +28,7 @@
});
</script>

<script type="text/html" data-template-name="object-detection">
<script type="text/html" data-template-name="good-object-detection">
<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" />
Expand All @@ -48,6 +48,6 @@
</div>
</script>

<script type="text/html" data-help-name="object-detection">
<script type="text/html" data-help-name="good-object-detection">
<p>object-detection node using yolov8</p>
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -257,5 +257,5 @@ module.exports = function (RED) {
];
}

RED.nodes.registerType("object-detection", yolov8Node);
RED.nodes.registerType("good-object-detection", yolov8Node);
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
"AWS": "301-AWS.js",
"DB": "302-DB.js",
"SlackNotification": "303-SlackNotification.js",
"ObjectDetection": "GOOD-I-DEER/nodes/object-detection-node/object-detection.js",
"GoodObjectDetection": "GOOD-I-DEER/nodes/object-detection-node/object-detection.js",
"GoodFaceDetection": "GOOD-I-DEER/nodes/object-detection-node/face-detection.js",
"ChromaDB": "GOOD-I-DEER/nodes/chroma-db-node/chroma-db.js",
"FaceDetection": "GOOD-I-DEER/nodes/object-detection-node/face-detection.js",
"FaceVectorization": "GOOD-I-DEER/nodes/face-vectorization-node/face-vectorization.js",
"CalculateCosine": "GOOD-I-DEER/nodes/cosine-similarity-node/calculate-cosine.js"
}
Expand Down

0 comments on commit 45b9df8

Please sign in to comment.