This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Processing of current captured frame and a part of previous frame simultaneously in VSDK.

Hi All,

I am working on TDA2x. I have 2 algorithms namely, Face detection and Eye Detection.

The current pipeline is first the face detection algorithm works, and its output is given to eye detection algorithm. So in current situation both the algorithm works serially as my eye detection is dependent on face detection's output.

I want to change the flow of the framework. I want my flow in such a way that face detection will happen on current captured frame and at the same time eye detection has the previous frame from face detection plugin.

So my face detection would be working on nth frame and eye detection would be processing (n-1)th frame from face detection plugin.

I want to know is this implementation possible in Vision SDK? And if Yes, then how to I pass previous frame output from face detection plugin to eye detection plugin?

Any help will be appreciated.

Thanks,

Mrunali

  • Hi Mrunali,

    I have pinged Vision SDK team to comment here.

    Thanks,
    Alex
  • Hi Mrunali,


     Is the intention to run face detection and eye detection algorithms in parallel threads?

    Thanks and Rgds

    Suriya Narayanan L

  • Hi Mrunali,

    This is possible, i presume that you have two algorithm plugin's (one for face detection & other for the eye detection) and the output of these algorithms do not modify input frames (i.e. it operates in ALGORITHM_LINK_QUEUEMODE_NOTINPLACE mode) 

    You could use a dupLink to replicate the incoming frames and pass frame simultaneously to your alog's. The face detection works on all the frames but eye detection delays it by one frame.

    i.e. eye detect, on first call to process API, will save (remember the pointer to frame) frame (A) and output no eye-detected. On subsequent process API call, eye-detect algo would work on the saved frame (A) and now store the second frame (B), this is repeated for all the frames.

    Please note that you will have to increase the number of buffers allocated by Link/Plugin preceeding your plugins.

    Regards,

    Sujith

  • Hi Sujith,

    In Mrunali's usecase the output of face detection algorithm is fed into eye detection algorithm.

    In that case, I was thinking of maintaining a shared Queue that the face detection algorithm will populate.

    The eye detection algorithm can then pop out the top most element from the Queue and process it.

    Thanks and Regards
    Suriya Narayanan L
  • Hi Suriya,

    In case these algo's are not required to run simultaneously. We would not require a shared queue.
    We could update eye-detect algo to deffer processing of frame by one "process frame" call to achieve the required delay.

    Lets wait on inputs from Mrunali.

    Regards,
    Sujith
  • Hi Supriya,

    Yes my intension is to run face detection and eye detection in parallel.

    Thanks
    Mrunali
  • Hi Sujith,

    Thank you for your input.
    In my case, I want to delay eye detection by one frame because my eye detection takes output from face detection algorithm as its input.
    The scenario is that i want to run both the algorithms in parallel. As my 2nd algorithm is dependent on the 1st, I thought of processing previous frame for eye detection.

    My current framework is:

    Capture -> Face_Detection_Algplugin -> Eye_Detection_Algplugin -> Display

    In this case as both the algorithm works serially my FPS is very less. So as an optimization technique i thought of processing both algorithms in parallel.

    Thanks,
    Mrunali
  • Hi Mrunali,

    As we discussed earlier, please use dup and delay processing of frame in Eye detection.
    Data flow could be something like
    Capture -> Dup +-> Face_Detection_Algplugin
    | |
    | V
    | Q1
    +-> Q0 Eye_Detection_Algplugin -> Display

    Regards,
    Sujith