Contents¶
Safety Gear Demo UDF Overview¶
Safety Gear Demo is a user defined function (udf) that accepts the frames, detects safety gears such as safety helmet, safety jackets in the frame and any violations occurring.
Note
: This will work only in the
safe gear video file([WORK_DIR]/IEdgeInsights/CustomUdfs/NativeSafetyGearIngestion/Safety_Full_Hat_and_Vest.avi
).
For camera use case, proper tuning needs to be done to have the proper model
built and used for inference.
UDF config
:
{
"name": "safety_gear_demo",
"type": "native",
"device": "CPU",
"model_xml": "./safety_gear_demo/ref/frozen_inference_graph.xml",
"model_bin": "./safety_gear_demo/ref/frozen_inference_graph.bin"
}
NOTE:
The above config works for both “CPU” and “GPU” devices after setting appropriate
device
value.The UDFs are placed under CustomUDFs(
[WORK_DIR]/IEdgeInsights/CustomUdfs
) for maintaining modularity of code structure, so that all sample UDFs can be clubbed at one place. You can move these directories in the host system and compile the code. For example, following steps can make this UDF to run from home directory.The docker-compose.yml(
[WORK_DIR]/IEdgeInsights/CustomUdfs/NativeSafetyGearAnalytics/docker-compose.yml
) file of the UDF can be altered to update the path for build-context and Dockerfile as shown below.From:
---snip--- build: context: $PWD/../CustomUdfs/NativeSafetyGearAnalytics dockerfile: $PWD/../CustomUdfs/NativeSafetyGearAnalytics/Dockerfile ---snip--- To
-----snip----- build: context: $HOME/NativeSafetyGearAnalytics dockerfile: $HOME/NativeSafetyGearAnalytics/Dockerfile
Change the video-streaming-all-udfs.yml(
[WORK_DIR]/IEdgeInsights/build/usecases/video-streaming-all-udfs.yml
) file to define the service with full path instead of relative path from IEdgeInsights as follows:From:
CustomUdfs/NativeSafetyGearAnalytics
To
/home/<user_name>/NativeSafetyGearAnalytics <<< Make sure the full path should start with "/">>>