Skip to content

Higher level API for DL networks. #14580

@dkurt

Description

@dkurt

Basically, this is a GSoC project which has not been applied this year:

We want to see some kind of higher level API which can manage DL networks. There are several criterias for now:

  • Hide asynchronous inference management internally. User just choose the number of requests (what about heterogenous scenario? In example, use both GPU and VPU with specific number of requestst for each other).
  • Models from https://github.com/opencv/opencv/blob/master/samples/dnn/models.yml should be downloaded automatically in samples. Can we also introduce some kind of new automatically generated classes definitions for them? I.e.:
CV_EXPORTS_W YOLOv3 : public Model {
  YOLOv3(const std::string& model = "yolov3.weights", const std::string& config= "yolov3.cfg", int weight = 416, int height = 416, Scalar mean = Scalar(), float scale = 0.00392);
};

User do not need to care about input's preprocessing. We can do it automatically. The base class can find the files (already implemented) or download if there are no (need to do).

class Model : public Net {
  Model(const std::string& model, const std::string& config = "", int weight = -1, int height = -1, Scalar mean = Scalar(), float scale = 1.0);

  // Overridden version which accepts frame and can make blob.
  void setInput();
};
  • We can add some methods to simplify postprocessing (i.e. detect type of output layer for detection network as we do in object detection samples):
void detect(std::vector<float>& confidences, std::vector<Rect>& boxes, float confThreshold, float nmsThreshold);

So instead doing forward with postprocessing and can just call detect and then manage the predictions (i.e. draw it on the frame).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions