roflcoopter / viseron

Self-hosted, local only NVR and AI Computer Vision software. With features such as object detection, motion detection, face recognition and more, it gives you the power to keep an eye on your home, office or any other place you want to monitor.
MIT License
1.62k stars 167 forks source link

Creating custom component #798

Open ZeyadAyman1 opened 1 month ago

ZeyadAyman1 commented 1 month ago

Hello, Firstly i wanted to thank you for putting so much effort in making such a project and making it open source. I have a question regarding the components, in case i have my own object detection model like a custom trained yolov5 model or something, how can i use it and is there a way to make custom components for customized object detection, face recognition or any task ?

roflcoopter commented 1 month ago

Depends on what format your YOLOv5 model is in. If you can convert it to Darknet weights then it can be used. Otherwise a new component for Ultralytics has to be created (and i currently dont have enough time to do that sadly)

It should be fairly easy to create a custom component. When starting the docker container all you have to do is mount your custom component to the folder /src/viseron/components/your_component_name

If you want a simple example of how a component works you can check the source for the compreface component here: https://github.com/roflcoopter/viseron/blob/dev/viseron/components/compreface/__init__.py There is sadly no good documentation on this yet.

The key take away is that if a CONFIG_SCHEMA variable is available Viseron will automatically check it for you. If the config check passes it calls the setup method for the component where you are free to do whatever you like.