Is the Nx Cloud up? Visit our Status Page for the current health and performance of the Nx Cloud.

Status Page

Example of Facial Recognition

Answered

Comments

2 comments

  • Andrey Terentyev
    • Network Optix team

    Hello,

    You could have a look at the examples  from step1 to step4 in the cpp folder of this repo.

    https://github.com/networkoptix/nx_open_integrations

    Examples are built on OpenCV library.

    step3 has object detection.

    step4 has object tracking.

    Configuring objects to be detected

    In the ObjectDetector class we use the standard way of running the neural network inference and decoding the results. There are few things to pinpoint though. 

    MobileNet SSD Cafe  is capable to detect object of certain types identified by a string values. They are built into the model. We enumerate all these values in  kClasses. At the moment we want only three of them to be detected, so we create kClassesToDetect. See the detection.cpp:

     

    static std::string kClasses[] = {
        "background", "aeroplane", "bicycle", "bird", "boat", "bottle", "bus", "car", "cat",
        "chair", "cow", "dining table", "dog", "horse", "motorbike", "person", "potted plant",
        "sheep", "sofa", "train", "tv monitor"
    };

    const std::vector<std::string> kClassesToDetect{"cat", "dog", "person"};

    During processing the detection we will filter only object that have interesting class in kClassesToDetect. Here is a code example: 

    const std::string classLabel = kClasses[(size_t) classIndex];
    bool oneOfRequiredClasses = std::find(
            kClassesToDetect.begin(), kClassesToDetect.end(), classLabel) != kClassesToDetect.end();

    if (confidentDetection && oneOfRequiredClasses)
    { ...

    Finally, we get different level of confidence in each object for every object, if the confidence is low - this might be a false positive results (false positive is...), so we need to weed it out. 

     

    We use hard-coded value of the confidence threshold in convertRawDetectionToDetection of  object_detection.cpp, because the plugin has no settings yet (we will introduce them in the following steps).

    const bool confidentDetection = confidence >= confidenceThreshold;


    Now It’s very easy to detect other classes of objects that are included in kClasses: we need just add them to kClassesToDetect

    1
  • Permanently deleted user

    Hi Andrey,

    Thanks a lot for it. It really helps!

     

     

    0

Please sign in to leave a comment.