Contents ======== * `Contents <#contents>`__ * `Safety Gear Demo UDF Overview <#safety-gear-demo-udf-overview>`__ ## Safety Gear Demo UDF Overview Safety Gear Demo UDF accepts the frame, and detects safety gears such as safety helmets, and safety jackets in the frame and any violations occurring. .. **NOTE**\ : This works only with the safe gear video file(\ ``[WORK_DIR]/IEdgeInsights/CustomUdfs/PySafetyGearIngestion/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``\ : .. code-block:: json { "name": "safety_gear.safety_classifier", "type": "python", "device": "CPU", "model_xml": "./safety_gear/ref/frozen_inference_graph.xml", "model_bin": "./safety_gear/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/PySafetyGearAnalytics/docker-compose.yml``\ ) file of the UDF can be altered to update the path for **build-context** and **Dockerfile** as shown below. From: .. code-block:: yml ---snip--- build: context: $PWD/../CustomUdfs/PySafetyGearAnalytics dockerfile: $PWD/../CustomUdfs/PySafetyGearAnalytics/Dockerfile ---snip--- To .. code-block:: yml -----snip----- build: context: $HOME/PySafetyGearAnalytics dockerfile: $HOME/PySafetyGearAnalytics/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: .. code-block:: yml CustomUdfs/PySafetyGearAnalytics To .. code-block:: yml /home//PySafetyGearAnalytics <<< Make sure the full path should start with "/">>>