node-red-contrib-oscar-fishdetector-async
Version:
Fish Detector Async node.
647 lines (646 loc) • 12.3 kB
JSON
{
"id": "9d16b4cc0e3f6956",
"type": "subflow",
"name": "OSCAR Fish Detector Async ",
"info": "## OBSEA Fish DETECTOR\nThe OBSEA is an underwater observatory that has been acquiring multiparametric\n data since 2009. Over the years, various cameras have been deployed,\n resulting in a vast archive of pictures dating back to 2011. Historically, \n this data has been manually analyzed to extract ecological information \n about the fish community in the area, a process that is both time-consuming \n and repetitive.\n\nIn this application, we employed an AI-based fish detection and classification\n algorithm, leveraging YOLOv8, to automate this process. The model has been\n finetuned to detect and classify fish at the OBSEA underwater observatory. ",
"category": "OSCAR",
"in": [
{
"x": 40,
"y": 20,
"wires": [
{
"id": "6b56587f2f1b8c54"
}
]
}
],
"out": [
{
"x": 1310,
"y": 380,
"wires": [
{
"id": "805d8f40b817d228",
"port": 0
}
]
},
{
"x": 1190,
"y": 320,
"wires": [
{
"id": "05b92692ec91f758",
"port": 0
}
]
}
],
"env": [
{
"name": "MinIOConfig",
"type": "minio-config",
"value": "",
"ui": {
"type": "conf-types"
}
},
{
"name": "InputBucket",
"type": "str",
"value": "",
"ui": {
"type": "input",
"opts": {
"types": [
"str"
]
}
}
},
{
"name": "ObjectName",
"type": "str",
"value": "",
"ui": {
"type": "input",
"opts": {
"types": [
"str"
]
}
}
},
{
"name": "OutputBucket",
"type": "str",
"value": "",
"ui": {
"type": "input",
"opts": {
"types": [
"str"
]
}
}
},
{
"name": "Prefix",
"type": "str",
"value": "",
"ui": {
"type": "input",
"opts": {
"types": [
"str"
]
}
}
}
],
"meta": {
"module": "node-red-contrib-oscar-fishdetector-async",
"type": "",
"version": "0.3.1",
"author": "vicente.rdguezb@gmail.com",
"desc": "Fish Detector Async node.",
"keywords": "Node-RED, hello world",
"license": "Apache-2.0"
},
"color": "#3FADB5",
"inputLabels": [
"Image(base64)"
],
"outputLabels": [
"Image",
"Json"
],
"icon": "font-awesome/fa-file-image-o",
"status": {
"x": 1360,
"y": 60,
"wires": [
{
"id": "b9720b262b6d555e",
"port": 0
},
{
"id": "7c03cd7ca4c3cfda",
"port": 0
},
{
"id": "d9899850a601604a",
"port": 0
}
]
},
"flow": [
{
"id": "29e2ff08b065b91e",
"type": "objects",
"z": "9d16b4cc0e3f6956",
"objects_name": "",
"host": "${MinIOConfig}",
"objects_operation": "putObject",
"objects_bucket": "",
"objects_object": "",
"objects_offset": "",
"objects_length": "",
"objects_stream": "",
"objects_size": "",
"objects_metadata": "",
"objects_sourceobject": "",
"objects_conditions": "",
"objects_objectslist": [],
"objects_prefix": "",
"objects_etag": "",
"objects_datetime": "",
"x": 530,
"y": 80,
"wires": [
[
"f17c7d9ed29e8a45"
],
[
"04c4b9e8a15ec862"
]
]
},
{
"id": "89b5865e7fa6779f",
"type": "objects",
"z": "9d16b4cc0e3f6956",
"objects_name": "",
"host": "${MinIOConfig}",
"objects_operation": "getObject",
"objects_bucket": "",
"objects_object": "",
"objects_offset": "",
"objects_length": "",
"objects_stream": "",
"objects_size": "",
"objects_metadata": "",
"objects_sourceobject": "",
"objects_conditions": "",
"objects_objectslist": [],
"objects_prefix": "",
"objects_etag": "",
"objects_datetime": "",
"x": 710,
"y": 380,
"wires": [
[
"b7b1bbe2e651a608"
],
[
"04c4b9e8a15ec862"
]
]
},
{
"id": "b7b1bbe2e651a608",
"type": "function",
"z": "9d16b4cc0e3f6956",
"name": "function 21",
"func": "msg.payload = msg.payload.objectData\nflow.set(\"outBucket_FD\", \"\");\nflow.set(\"prefix_FD\", \"\"); \nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 970,
"y": 380,
"wires": [
[
"805d8f40b817d228"
]
]
},
{
"id": "805d8f40b817d228",
"type": "base64",
"z": "9d16b4cc0e3f6956",
"name": "",
"action": "str",
"property": "payload",
"x": 1140,
"y": 380,
"wires": [
[
"7c03cd7ca4c3cfda"
]
]
},
{
"id": "8be7177867c9645b",
"type": "notifications",
"z": "9d16b4cc0e3f6956",
"notifications_name": "",
"host": "${MinIOConfig}",
"notifications_operation": "listenBucketNotification",
"notifications_bucket": "",
"notifications_notificationconfig": "",
"notifications_prefix": "",
"notifications_suffix": "",
"notifications_events": "",
"notifications_events_object_created_put": true,
"notifications_events_object_created_post": false,
"notifications_events_object_created_copy": false,
"notifications_events_object_created_complete_multipart_upload": false,
"notifications_events_object_removed_delete": false,
"notifications_events_object_accessed_get": false,
"notifications_events_object_accessed_head": false,
"x": 190,
"y": 240,
"wires": [
[
"904f2a198b805b87"
],
[
"04c4b9e8a15ec862"
]
]
},
{
"id": "904f2a198b805b87",
"type": "function",
"z": "9d16b4cc0e3f6956",
"name": "function 22",
"func": "msg.objectName = msg.payload.listenBucketNotification.s3.object.key;\nvar out = flow.get(\"outBucket_FD\")\n\nif (msg.objectName.endsWith('.json')) {\n // Acción para archivos .json\n\n msg.bucketName =out\n return [msg, null]; // Devuelve a la primera salida\n}\n// Comprobar si el archivo termina en .jpg\nelse {\n msg.bucketName = out\n return [null, msg]; // Ninguna salida se activa\n}",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 430,
"y": 320,
"wires": [
[
"b22b6bd4d9107661"
],
[
"89b5865e7fa6779f"
]
]
},
{
"id": "82ce5593c049c37e",
"type": "comment",
"z": "9d16b4cc0e3f6956",
"name": "Async Fish-Detector",
"info": "Async Fish-Detector",
"x": 150,
"y": 340,
"wires": []
},
{
"id": "b22b6bd4d9107661",
"type": "objects",
"z": "9d16b4cc0e3f6956",
"objects_name": "",
"host": "${MinIOConfig}",
"objects_operation": "getObject",
"objects_bucket": "",
"objects_object": "",
"objects_offset": "",
"objects_length": "",
"objects_stream": "",
"objects_size": "",
"objects_metadata": "",
"objects_sourceobject": "",
"objects_conditions": "",
"objects_objectslist": [],
"objects_prefix": "",
"objects_etag": "",
"objects_datetime": "",
"x": 670,
"y": 320,
"wires": [
[
"3675f43b8fc60ec3"
],
[
"04c4b9e8a15ec862"
]
]
},
{
"id": "3675f43b8fc60ec3",
"type": "function",
"z": "9d16b4cc0e3f6956",
"name": "function 23",
"func": "msg.payload = msg.payload.objectData\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 870,
"y": 320,
"wires": [
[
"05b92692ec91f758"
]
]
},
{
"id": "05b92692ec91f758",
"type": "json",
"z": "9d16b4cc0e3f6956",
"name": "",
"property": "payload",
"action": "",
"pretty": true,
"x": 1010,
"y": 320,
"wires": [
[
"7c03cd7ca4c3cfda"
]
]
},
{
"id": "d4ba7ef249b28989",
"type": "function",
"z": "9d16b4cc0e3f6956",
"name": "function 24",
"func": "msg.stream = msg.image\nmsg.objectName =msg.object_name\nmsg.bucketName=msg.in_bucket\nflow.set(\"outBucket_FD\", msg.out_bucket); \nflow.set(\"prefix_FD\", msg.prefix); \nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 330,
"y": 80,
"wires": [
[
"29e2ff08b065b91e"
]
]
},
{
"id": "6b56587f2f1b8c54",
"type": "change",
"z": "9d16b4cc0e3f6956",
"name": "",
"rules": [
{
"t": "set",
"p": "prefix",
"pt": "msg",
"to": "Prefix",
"tot": "env"
},
{
"t": "set",
"p": "out_bucket",
"pt": "msg",
"to": "OutputBucket",
"tot": "env"
},
{
"t": "set",
"p": "image",
"pt": "msg",
"to": "payload",
"tot": "msg"
},
{
"t": "set",
"p": "in_bucket",
"pt": "msg",
"to": "InputBucket",
"tot": "env"
},
{
"t": "set",
"p": "object_name",
"pt": "msg",
"to": "ObjectName",
"tot": "env"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 140,
"y": 80,
"wires": [
[
"d4ba7ef249b28989",
"b9720b262b6d555e"
]
]
},
{
"id": "f17c7d9ed29e8a45",
"type": "function",
"z": "9d16b4cc0e3f6956",
"name": "function 25",
"func": "var out=flow.get(\"outBucket_FD\")\nvar prefix = flow.get(\"prefix_FD\")\nmsg.prefix =prefix\nmsg.bucketName=out\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 550,
"y": 140,
"wires": [
[
"8be7177867c9645b"
]
]
},
{
"id": "04c4b9e8a15ec862",
"type": "function",
"z": "9d16b4cc0e3f6956",
"name": "Error ",
"func": "var error = msg.payload\nif (error != null){\n msg.payload=error;\n return msg;\n}\nelse {\n return null;\n}\n \n;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 950,
"y": 140,
"wires": [
[]
]
},
{
"id": "7c03cd7ca4c3cfda",
"type": "change",
"z": "9d16b4cc0e3f6956",
"name": "End Service",
"rules": [
{
"t": "delete",
"p": "payload",
"pt": "msg"
},
{
"t": "set",
"p": "payload.text",
"pt": "msg",
"to": "Finished!",
"tot": "str"
},
{
"t": "set",
"p": "payload.shape",
"pt": "msg",
"to": "dot",
"tot": "str"
},
{
"t": "set",
"p": "payload.fill",
"pt": "msg",
"to": "blue",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1230,
"y": 200,
"wires": [
[]
]
},
{
"id": "b9720b262b6d555e",
"type": "change",
"z": "9d16b4cc0e3f6956",
"name": "Start Service",
"rules": [
{
"t": "delete",
"p": "payload",
"pt": "msg"
},
{
"t": "set",
"p": "payload.text",
"pt": "msg",
"to": "Processing....",
"tot": "str"
},
{
"t": "set",
"p": "payload.shape",
"pt": "msg",
"to": "dot",
"tot": "str"
},
{
"t": "set",
"p": "payload.fill",
"pt": "msg",
"to": "green",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 350,
"y": 40,
"wires": [
[]
]
},
{
"id": "722925bdc130a708",
"type": "catch",
"z": "9d16b4cc0e3f6956",
"name": "",
"scope": null,
"uncaught": false,
"x": 790,
"y": 80,
"wires": [
[
"d9899850a601604a"
]
]
},
{
"id": "d9899850a601604a",
"type": "change",
"z": "9d16b4cc0e3f6956",
"name": "Error Service",
"rules": [
{
"t": "delete",
"p": "payload",
"pt": "msg"
},
{
"t": "set",
"p": "payload.text",
"pt": "msg",
"to": "error.message",
"tot": "msg"
},
{
"t": "set",
"p": "payload.shape",
"pt": "msg",
"to": "dot",
"tot": "str"
},
{
"t": "set",
"p": "payload.fill",
"pt": "msg",
"to": "red",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 990,
"y": 80,
"wires": [
[]
]
},
{
"id": "3540f0eb036c8c0b",
"type": "subflow:9d16b4cc0e3f6956",
"z": "8c95e5dd22c4eae1",
"name": "",
"env": [
{
"name": "MinIOConfig",
"value": "",
"type": "conf-type"
}
],
"x": 830,
"y": 500,
"wires": [
[
"29407c56b836b25b"
],
[
"2c46c47572e5bf71"
]
]
}
]
}