如何用YOLO的动态库DLL
先编译Yolo为(C++)DLL库(yolo_cpp_dll.dll)。
使用MSVS2015,打开build\darknet\yolo_cpp_dll.sln。
设置x64-Release,然后build yolo_cpp_dll。
前提是已经安装CUDA 9.1。为了使用cuDNN,需要在 properties -> C/C++ -> Preprocessor -> Preprocessor Definitions中设置CUDNN;
然后,其API的使用方式:
class Detector {
public:
Detector(std::string cfg_filename, std::string weight_filename, int gpu_id = 0);
~Detector();
std::vector<bbox_t> detect(std::string image_filename, float thresh = 0.2, bool use_mean = false);
std::vector<bbox_t> detect(image_t img, float thresh = 0.2, bool use_mean = false);
static image_t load_image(std::string image_filename);
static void free_image(image_t m);
#ifdef OPENCV
std::vector<bbox_t> detect(cv::Mat mat, float thresh = 0.2, bool use_mean = false);
#endif
};
本文暂时没有评论,来添加一个吧(●'◡'●)