Configure and Start Video Face Detection

This section will guide you through the fkvideo_detector deployment process. Follow the steps below minding the sequence.

Note

The fkvideo_detector component has to be installed.

In this section:

Specify Video Streams

To specify video streams for face detection, do the following:

  1. Make a copy of the configuration file /etc/fkvideo.ini. Open the new file for editing.

    sudo cp /etc/fkvideo.ini /etc/fk_local_config.ini
    sudo vi /etc/fk_local_config.ini
    
  2. If you have only one camera, you can add it in the new configuration file.

    [General]
    ; Host settings
    api-host=127.0.0.1
    ; Put your token here
    api-token=RczGgVEMizR1njHHQegNH_g9mwGl6-A1
    api-port=8000
    
    ; Camera params
    ; If params doesn't set detector ask cameras list from server by key
    ; Key for receiving cameras list
    ;detector-name=detec1
    ; Camera ID
    camid=local
    ; Stream path
    ; Example: rtsp:// - network stream; /dev/video0 - webcam; file@FPS:PATH - file with configurable FPS
    source=rtsp://admin:qwert1234@192.168.104.199:554/Streaming/Channels/1
    ; Maximum cameras
    detectors-max=20
    
    ; Motion detector scale coefficient for best performance
    scale=0.3
    
    ; In realtime mode detector posts many frames wih increasing quality
    ; Else it sends only best frame
    realtime=1
    
    ; URL that will receive frames
    request-url=/v1/face/
    ; You can add custom head and body params to HTML POST request
    head=
    body=mf_selector=all,meta=User Meta
    ;
    
    ; Address of ntls server
    license-ntls-server=127.0.0.1:3133
    

    Tip

    You can find an example of the configuration file here.

  3. If you have more than one camera, use the Server to store all your cameras. Add your camera to server by POST request v1/camera. For example, add camera to detector=detec1:

    Request

    curl -H 'Authorization: Token 1234567890qwertyuiop' -F "detector=detec1" -F "url=rtsp://user:[email protected]:554/Streaming/Channels/1" -F "meta=test" http://localhost:8000/v1/camera
    

    Response

    {"detector": "detec1", "id": "0e663c00-b945-4676-bb0e-032c1dcf353a", "meta": "test", "url": "rtsp:// user:[email protected]:554/Streaming/Channels/1"}
    

    Now edit your configuration file. For example, detector will connect to server, and get all cameras with detector=detec1

    [General]
    ; Host settings
    api-host=127.0.0.1
    ; Put your token here
    api-token=RczGgVEMizR1njHHQegNH_g9mwGl6-A1
    api-port=8000
    
    ; Camera params
    ; If params doesn't set detector ask cameras list from server by key
    ; Key for receiving cameras list
    detector-name=detec1
    ; Camera ID
    ;camid=
    ; Stream path
    ; Example: rtsp:// - network stream; /dev/video0 - webcam; file@FPS:PATH - file with configurable FPS
    ;source=
    ; Maximum cameras
    detectors-max=20
    
    ; Motion detector scale coefficient for best performance
    scale=0.3
    
    ; In realtime mode detector posts many frames wih increasing quality
    ; Else it sends only best frame
    realtime=1
    
    ; URL that will receive frames
    request-url=/v1/face/
    ; You can add custom head and body params to HTML POST request
    head=
    body=mf_selector=all,,meta=UserMeta
    ;
    
    ; Address of ntls server
    license-ntls-server=127.0.0.1:3133
    

    Tip

    You can find an example of the configuration file here.

Start Component as Application

To start fkvideo_detector as an application, execute:

fkvideo_detector -c /etc/fk_local_config.ini

Use this method for testing purposes.

Start Component as Service

To run the face detection component as a service, do the following:

  1. Execute the following command:

    sudo service fkvideo_detector@fk_local_config start
    
  2. Check service status. The command will return a service description, a status should be active (running).

    sudo service fkvideo_detector@fk_local_config status
    

    Note

    You can get the list of your cameras by the following request:

    curl -H 'Authorization: Token 1234567890qwertyuiop' http://localhost:8000/v1/camera | jq