Open liulai opened 4 years ago
设备: cpu:Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz 2.71GHz GPU:inter(R) HD graphics 620 参考mobilenetssd.cpp代码 结构如下: static int detect_net(ncnn::Net& mobilenet, const cv::Mat& bgr, std::vector& objects) { //略 ncnn::Extractor ex = mobilenet.create_extractor(); ex.input("data", in); ncnn::Mat out; ex.extract("detection_out", out); //略}
int main() { //略
ncnn::create_gpu_instance();
ncnn::Net mobilenet = mobilenet_load(); ncnn::Extractor ex = mobilenet.create_extractor(); while (1) { lasttime = clock(); cap.read(frame); if (frame.empty()) { cout << "the source is over." << endl; break; } cv::resize(frame, dst, cv::Size(frame.cols / 2, frame.rows / 2)); std::vector<Object> objects; //detect_mobilenet(dst, objects); detect_net(mobilenet, dst, objects); draw_objects(dst, objects); if (cv::waitKey(1) >= 0) { break; } currtime = clock(); int fps = static_cast<int>(1.f / (currtime - lasttime) * 1000); cout << "fps " << fps << endl; }
ncnn::destroy_gpu_instance();
//略 }
实际结果fps:大概为4-6
https://github.com/dog-qiuqiu/MobileNetv2-YOLOV3 华为MATE30 可以跑33ms每帧
设备: cpu:Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz 2.71GHz GPU:inter(R) HD graphics 620 参考mobilenetssd.cpp代码 结构如下: static int detect_net(ncnn::Net& mobilenet, const cv::Mat& bgr, std::vector
int main() { //略
if NCNN_VULKAN
endif // NCNN_VULKAN
if NCNN_VULKAN
endif // NCNN_VULKAN
//略 }
实际结果fps:大概为4-6