-
Notifications
You must be signed in to change notification settings - Fork 1
Custom Algorithms
Ekaterina Sevashko edited this page Feb 16, 2024
·
4 revisions
If you want to use 5controlS platform with your Custom Algorithm, you should complete the following steps:
When creating your Custom Algorithm for the Dashboard you have to make sure your Algorithm takes as input data in the following form:
{
"camera_url": "rtsp://admin:just4Taqtile@192.168.1.168/h264_stream",
"algorithm": "name custom algorithm",
"server_url": "http://192.168.1.110",
"extra": [
{
"coords": [
{
"x1": 667.8260869565217,
"x2": 1023.6521739130435,
"y1": 35.91543075453677,
"y2": 716.564905444126,
"zoneId": 72,
"zoneName": "Zone2"
}
]
}
]
}
The output of your Algorithm have to be data in the following form:
{
"algorithm": "name custom algorithm",
"camera": "192.168.1.163",
"start_tracking": "2023-03-23 09:08:45.5",
"stop_tracking": "2023-03-23 09:09:45.5",
"photos": [
{
"image": "images/192.168.1.167/ebb7057f-529e-4f47-a739-a61f0cd058b5.jpeg",
"date": "2023-03-23 09:09:45.5"
},
...
{
"image": "images/192.168.1.167/ebb7057f-529e-4f47-a739-a61f0cd058b5.jpeg",
"date": "2023-03-23 09:09:45.5"
}
],
"violation_found": true,
"extra": {
"zoneId": 54,
"zoneName": "zone1"
}
}
Stop of the Algorithm:
{
"pid": 1
}
When creating your Custom Algorithm for the Inventory you have to make sure your Algorithm takes as input data in the following form:
{
"camera_url": "stream_link",
"algorithm": "name algorithm",
"image_name": "image name docker hub",
"server_url": "http://django-service",
"link_reports": "http://django-service:8000/api/reports/report-with-photos/",
"extra": [
{
"areas": [
{
"itemId": 179,
"itemName": "name item",
"coords": [
{
"x1": 841.967213114754,
"x2": 1142.950819672131,
"y1": 371.9553608617594,
"y2": 514.5478204667863
},
{
"x1": 846.6452459016393,
"x2": 1145.6675409836066,
"y1": 233.92585996409335,
"y2": 362.6272746858168
}
],
"lowStockLevel": 10,
"task": "type items box, red line, bottle"
},
{
"itemId": 180,
"itemName": "name item",
"coords": [
{
"x1": 853.7704918032787,
"x2": 1152.7868852459017,
"y1": 530.1743913824058,
"y2": 694.2533859964094
}
],
"lowStockLevel": 4,
"task": "box"
},
{
"itemId": 45,
"itemName": "name item",
"coords": [
{
"x1": 846.6452459016393,
"x2": 1145.6675409836066,
"y1": 233.92585996409335,
"y2": 362.6272746858168
}
],
"lowStockLevel": 2,
"task": "box"
}
],
"zones": [
{
"zoneId": 160,
"zoneName": "zone name",
"coords": [
{
"x1": 290.66666666666663,
"x2": 642.6666666666666,
"y1": 287.84466019417476,
"y2": 670.7572815533981
}
]
},
{
"zoneId": 149,
"zoneName": "zone name",
"coords": [
{
"x1": 681.4949544072949,
"x2": 865.0243890577509,
"y1": 300.13146714031967,
"y2": 816.1140177619893
}
]
}
]
}
]
}
The output of your Algorithm have to be data in the following form:
{
"camera": "192.168.1.164",
"algorithm": "min_max_control__dashboard",
"start_tracking": "2024-02-16 08:35:10.458742",
"stop_tracking": "2024-02-16 08:35:10.458742",
"photos": [
{
"date": "2024-02-16 08:35:10.458742"
}
],
"violation_found": false,
"extra": [
{
"zoneId": 1,
"zoneName": "main",
"items": [
{
"itemId": 179,
"count": 0,
"image_item": "images/192.168.1.164/f793a832-8b1b-42cd-bb90-fa20e2d3164b.png",
"low_stock_level": false,
"zoneId": 1,
"zoneName": "main"
},
{
"itemId": 180,
"count": 0,
"image_item": "images/192.168.1.164/cde76116-d662-4f4c-8e8b-0159657b3023.png",
"low_stock_level": false,
"zoneId": 1,
"zoneName": "main"
},
{
"itemId": 45,
"count": 0,
"image_item": "images/192.168.1.164/c4adf1b9-b5c6-41fd-9639-92ad5ae26af0.png",
"low_stock_level": false,
"zoneId": 1,
"zoneName": "main"
}
]
}
]
}
Stop of the Algorithm:
{
"pid": 1
}