RK3588 NPU 研究(二)

  1. RK提供了两个模型,mobilenet和YOLO5。
    • mobilenet模型相对小,使用起来不是很明显
    • yolo5模型大一些,可以对88种目标进行检测,提供检测的结果包括类别、包围框坐标、可信度等信息。基于rknn_yolov5_demo进行分析。
  2. rknn_yolov5_demo基本信息
    • 代码位置:hardware/rockchip/rknpu2/examples/rknn_yolov5_demo
    • 编译脚本
      • build-android_RK3588.sh
        • 使用cmake编译
      • CMakeLists.txt
        • 编译源文件
           92 # rknn_yolov5_demo
           93 include_directories( ${CMAKE_SOURCE_DIR}/include)
           94 
           95 add_executable(rknn_yolov5_demo
           96         src/main.cc
           97         src/postprocess.cc
           98 )
           99 
          100 target_link_libraries(rknn_yolov5_demo
          101   ${RKNN_RT_LIB}
          102   ${RGA_LIB}
          103   ${OpenCV_LIBS}
          104 )
          
          头文件在include目录,源代码有两.cc文件
        • 依赖库有rknn_rt、rga、opencv
           26 # rknn api
           27 if(TARGET_SOC STREQUAL "rk356x")
           28   set(RKNN_API_PATH ${CMAKE_SOURCE_DIR}/../../runtime/RK356X/${CMAKE_SYSTEM_NAME}/librknn_api)
           29 elseif(TARGET_SOC STREQUAL "rk3588")
           30   set(RKNN_API_PATH ${CMAKE_SOURCE_DIR}/../../runtime/RK3588/${CMAKE_SYSTEM_NAME}/librknn_api)
           31 else()
           32   message(FATAL_ERROR "TARGET_SOC is not set, ref value: rk356x or rk3588 or rv110x")
           33 endif()
           34 
           35 if (CMAKE_SYSTEM_NAME STREQUAL "Android")
           36   set(RKNN_RT_LIB ${RKNN_API_PATH}/${CMAKE_ANDROID_ARCH_ABI}/librknnrt.so)
           37 else()
           38   set(RKNN_RT_LIB ${RKNN_API_PATH}/${LIB_ARCH}/librknnrt.so)
           39 endif()
           40 include_directories(${RKNN_API_PATH}/include)
           41 include_directories(${CMAKE_SOURCE_DIR}/../3rdparty)
           42 
           43 # opencv
           44 if (CMAKE_SYSTEM_NAME STREQUAL "Android")
           45     set(OpenCV_DIR ${CMAKE_SOURCE_DIR}/../3rdparty/opencv/OpenCV-android-sdk/sdk/native/jni/abi-${CMAKE_ANDROID_ARCH_ABI})
           46 else()
           47   if(LIB_ARCH STREQUAL "armhf")
           48     set(OpenCV_DIR ${CMAKE_SOURCE_DIR}/../3rdparty/opencv/opencv-linux-armhf/share/OpenCV)
           49   else()
           50     set(OpenCV_DIR ${CMAKE_SOURCE_DIR}/../3rdparty/opencv/opencv-linux-aarch64/share/OpenCV)
           51   endif()
           52 endif()
           53 find_package(OpenCV REQUIRED)
           54 
           55 #rga
           56 if(TARGET_SOC STREQUAL "rk356x")
           57   set(RGA_PATH ${CMAKE_SOURCE_DIR}/../3rdparty/rga/RK356X)
           58 elseif(TARGET_SOC STREQUAL "rk3588")
           59   set(RGA_PATH ${CMAKE_SOURCE_DIR}/../3rdparty/rga/RK3588)
           60 else()
           61   message(FATAL_ERROR "TARGET_SOC is not set, ref value: rk356x or rk3588")
           62 endif()
           63 if (CMAKE_SYSTEM_NAME STREQUAL "Android")
           64   set(RGA_LIB ${RGA_PATH}/lib/Android/${CMAKE_ANDROID_ARCH_ABI}/librga.so)
           65 else()
           66   set(RGA_LIB ${RGA_PATH}/lib/Linux//${LIB_ARCH}/librga.so)
           67 endif()
           68 include_directories( ${RGA_PATH}/include)
          
          • rknn_rt:rknn的runtime环境,有这个库yolo5就能运行起来
          • rga:图像缩放和颜色空间转换,例如YUV到RGB
          • opencv:支持图像压缩算法,比如jpg、png等等,支持图像文件载入比如bmp等等
          • rga和opencv提供的是对yolo5输入和输出图像的支持,并非必须
  3. yolo5应用移植
    • 目标
      移植yolo5应用,从camera采集图像,用yolo5对图像进行检测,得到图像中"人"类别的信息

    • 移植分析
      前面分析过,只有两个.cc文件,头文件在include中寻找,根据需要添加

      • main.cc
        需要规整为一个C++的类
      • postprocess.cc
        作为方法实现文件
    • 移植代码
      在这里插入图片描述

      确定使用到的就是箭头指向的文件

      • 创建class AiAlgoYolo5

        class AiAlgoYolo5 : public webrtc::test::VideoFrameSubscriber
        {
        public:
        	AiAlgoYolo5(int source_id);
        	virtual ~AiAlgoYolo5();
        	int start(int source_id);
        	void stop();
        	void dump_tensor_attr(rknn_tensor_attr *attr);
        	uint8_t *load_data(FILE *fp, size_t ofst, size_t sz);
        	uint8_t *load_model(const char *filename, int *model_size);
        	int saveFloat(const char *file_name, float *output, int element_size);
        	virtual void OnFrame(const webrtc::VideoFrame &) override;
        	virtual void OnFrame(BOOAT::SharedBufferPtr &videoFrame) override;
        	virtual void CleanFrame() override;
        	int DealOneFrame();
        
        private:
        	std::shared_ptr<std::thread> _th{nullptr};
        	ThreadQueue<webrtc::VideoFrame> _qu;
        	ThreadQueue<BOOAT::SharedBufferPtr> _bufferQ;
        	bool _is_stop{ true };
        	int _source_id;
        	int _width;
        	int _height;
        	unsigned char *model_data;
        	rknn_context ctx;
        	rknn_input_output_num io_num;
        	int yolo_input_channel;
        	int yolo_input_width;
        	int yolo_input_height;
        	rknn_input inputs[YOLO5_INPUT_NUMBER];
        	rknn_output outputs[YOLO5_OUTPUT_NUMBER];
        	rknn_tensor_attr input_attrs[YOLO5_INPUT_NUMBER];
        	rknn_tensor_attr output_attrs[YOLO5_OUTPUT_NUMBER];
        	void *resize_buf;
        
        private:
        	uint64_t _frame_num;
        
        };
        
          - start()准备运行环境
          - DealOneFrame()采集一张camera图像,完成一帧检测工作,可以多次检测
          - stop()退出运行环境
        
        • start()实现
        	int AiAlgoYolo5::start(int source_id)
        	{
        		int ret = 0;
        
        		LOGD("===>>>IN \t[%s] \r\n", __FUNCTION__);
        
        		LOGD("AiAlgoYolo5::start():  _source_id = [ %d ].\r\n", _source_id);
        
        		/* Create the neural network */
        		LOGD("Loading mode...\n");
        		char model_name[80] = "/vendor/bin/yolo5/yolov5s-640-640.rknn";
        		int model_data_size = 0;
        		model_data = load_model(model_name, &model_data_size);
        		ret = rknn_init(&ctx, model_data, model_data_size, 0, NULL);
        		if (ret < 0) {
        			LOGE("AiAlgoYolo5 start rknn_init error ret=%d\n", ret);
        			return -1;
        		}
        
        		rknn_sdk_version version;
        		ret = rknn_query(ctx, RKNN_QUERY_SDK_VERSION, &version, sizeof(rknn_sdk_version));
        		if (ret < 0) {
        			LOGE("AiAlgoYolo5 start rknn_init error ret=%d\n", ret);
        			return -1;
        		}
        		LOGD("AiAlgoYolo5 start sdk version: %s driver version: %s\n", version.api_version, version.drv_version);
        
        		ret = rknn_query(ctx, RKNN_QUERY_IN_OUT_NUM, &io_num, sizeof(io_num));
        		if (ret < 0) {
        			LOGE("AiAlgoYolo5 start rknn_init error ret=%d\n", ret);
        			return -1;
        		}
        		if ((io_num.n_input != YOLO5_INPUT_NUMBER) || (io_num.n_output != YOLO5_OUTPUT_NUMBER)) {
        			LOGE("AiAlgoYolo5 start model error input num: %d, output num: %d\n", io_num.n_input, io_num.n_output);
        		} else {
        			LOGD("AiAlgoYolo5 start model input num: %d, output num: %d\n", io_num.n_input, io_num.n_output);
        		}
        
        		memset(input_attrs, 0, sizeof(input_attrs));
        		for (int i = 0; i < io_num.n_input; i++) {
        			input_attrs[i].index = i;
        			ret = rknn_query(ctx, RKNN_QUERY_INPUT_ATTR, &(input_attrs[i]), sizeof(rknn_tensor_attr));
        			if (ret < 0) {
        				LOGE("AiAlgoYolo5 start rknn_init error ret=%d\n", ret);
        				return -1;
        			}
        			dump_tensor_attr(&(input_attrs[i]));
        		}
        
        		memset(output_attrs, 0, sizeof(output_attrs));
        		for (int i = 0; i < io_num.n_output; i++) {
        			output_attrs[i].index = i;
        			ret = rknn_query(ctx, RKNN_QUERY_OUTPUT_ATTR, &(output_attrs[i]), sizeof(rknn_tensor_attr));
        			dump_tensor_attr(&(output_attrs[i]));
        		}
        
        		if (input_attrs[0].fmt == RKNN_TENSOR_NCHW) {
        			LOGD("AiAlgoYolo5 start model is NCHW input fmt\n");
        			yolo_input_channel = input_attrs[0].dims[1];
        			yolo_input_height = input_attrs[0].dims[2];
        			yolo_input_width = input_attrs[0].dims[3];
        		} else {
        			LOGD("AiAlgoYolo5 start model is NHWC input fmt\n");
        			yolo_input_height = input_attrs[0].dims[1];
        			yolo_input_width = input_attrs[0].dims[2];
        			yolo_input_channel = input_attrs[0].dims[3];
        		}
        
        		LOGD("AiAlgoYolo5 start model input height=%d, width=%d, channel=%d\n", yolo_input_height, yolo_input_width, yolo_input_channel);
        
        		memset(inputs, 0, sizeof(inputs));
        		inputs[0].index = 0;
        		inputs[0].type = RKNN_TENSOR_UINT8;
        		inputs[0].size = yolo_input_width * yolo_input_height * yolo_input_channel;
        		inputs[0].fmt = RKNN_TENSOR_NHWC;
        		inputs[0].pass_through = 0;
        
        		resize_buf = malloc(640 * 640 * 3);
        
        		LOGD("===<<<OUT \t[%s] \r\n", __FUNCTION__);
        
        		return ret;
        	}
        	```
        	rknn_init,加载模型yolov5s-640-640.rknn
        	rknn_query,获取模型中参数信息,进行相应的准备工作,比如input,output。
        - stop()实现
        	```
        	void AiAlgoYolo5::stop()
        	{
        		LOGD("===>>>IN \t[%s] \r\n", __FUNCTION__);
        
        		deinitPostProcess();
        
        		// release
        		rknn_destroy(ctx);
        
        		if (model_data) {
        			free(model_data);
        			model_data = nullptr;
        		}
        
        		if (resize_buf) {
        			free(resize_buf);
        			resize_buf = nullptr;
        		}
        
        		LOGD("===<<<OUT \t[%s] \r\n", __FUNCTION__);
        	}
        	```
        	rknn_destroy,环境退出,资源释放
        - DealOneFrame()实现
        

        int AiAlgoYolo5::DealOneFrame()
        {
        uint64_t start_time, stop_time, scal_start_time, scal_stop_time;
        char text[256];
        bool flag = false;
        int ret = 0;

          const float nms_threshold = NMS_THRESH;
          const float box_conf_threshold = BOX_THRESH;
        
          rga_buffer_t src;
          rga_buffer_t dst;
          im_rect src_rect;
          im_rect dst_rect;
        
          memset(&src_rect, 0, sizeof(src_rect));
          memset(&dst_rect, 0, sizeof(dst_rect));
          memset(&src, 0, sizeof(src));
          memset(&dst, 0, sizeof(dst));
        
          // 这一段是从camera获取nv12实时图像的代码,依赖图像获取class,开始
          _bufferQ.clear();
          BOOAT::SharedBufferPtr frame = _bufferQ.pop(flag, std::chrono::milliseconds(1000));//ms
          //LOGD("AiAlgoYolo5::DealOneFrame _source_id %d flag %d", _source_id, flag);
          if (flag) {
          	MP::VideoBufferParam *pBufInfo = static_cast<MP::VideoBufferParam *>(frame->getParam());
          	uint8_t *nv12Data = pBufInfo->yuvPtr;
          	//LOGD("AiAlgoYolo5::DealOneFrame _source_id %d [%d %d] data %p", _source_id, pBufInfo->width, pBufInfo->height, nv12Data);
        
          	_width = pBufInfo->width;
          	_height = pBufInfo->height;
          	// 这一段是从camera获取nv12实时图像的代码,依赖图像获取class,结束
          	// 这一段是从camera获取到的nv12图像缩放到640x640的RGB图像,用到了rga,结束
          	scal_start_time = AiGetTimeMs();
          	//LOGD("AiAlgoYolo5::DealOneFrame scal_start_time %ld", scal_start_time);
          	if (_width != yolo_input_width || _height != yolo_input_height) {
          		//LOGD("AiAlgoYolo5::DealOneFrame resize with RGA!\n");
          		if (resize_buf) {
          			memset(resize_buf, 0x00, yolo_input_height * yolo_input_width * yolo_input_channel);
          		} else {
          			LOGE("AiAlgoYolo5::DealOneFrame %d, resize_buf check error!", __LINE__);
          			return -1;
          		}
          		src = wrapbuffer_virtualaddr((void *)nv12Data, _width, _height, RK_FORMAT_YCbCr_420_SP);
          		dst = wrapbuffer_virtualaddr((void *)resize_buf, yolo_input_width, yolo_input_height, RK_FORMAT_RGB_888);
          		ret = imcheck(src, dst, src_rect, dst_rect);
          		if (IM_STATUS_NOERROR != ret) {
          			LOGE("AiAlgoYolo5::DealOneFrame %d, check error! %s", __LINE__, imStrError((IM_STATUS)ret));
          			return -1;
          		}
          		IM_STATUS STATUS = imresize(src, dst);
          		inputs[0].buf = resize_buf;
          	} else {
          		inputs[0].buf = (void *)nv12Data;
          	}
          	scal_stop_time = AiGetTimeMs();
          	//LOGD("AiAlgoYolo5::DealOneFrame scal_stop_time %ld", scal_stop_time);
          	LOGD("AiAlgoYolo5::DealOneFrame scal once run use %ld ms", (scal_stop_time - scal_start_time));
          	// 这一段是从camera获取到的nv12图像缩放到640x640的RGB图像,用到了rga库,结束
          	// 这一段是yolo运行检测,开始
          	start_time = AiGetTimeMs();
          	//LOGD("AiAlgoYolo5::DealOneFrame start_time %ld", start_time);
          	rknn_inputs_set(ctx, io_num.n_input, inputs);
          	memset(outputs, 0, sizeof(outputs));
          	for (int i = 0; i < io_num.n_output; i++) {
          		outputs[i].want_float = 0;
          	}
        
          	ret = rknn_run(ctx, NULL);
          	ret = rknn_outputs_get(ctx, io_num.n_output, outputs, NULL);
        
          	stop_time = AiGetTimeMs();
          	//LOGD("AiAlgoYolo5::DealOneFrame stop_time %ld", stop_time);
          	LOGD("AiAlgoYolo5::DealOneFrame once run use %ld ms", (stop_time - start_time));
          	// 这一段是yolo运行检测,结束
          	// 这一段对yolo检测结果分析,目前只关心person类别,开始
          	// post process
          	float scale_w = (float)yolo_input_width / _width;
          	float scale_h = (float)yolo_input_height / _height;
        
          	detect_result_group_t detect_result_group;
          	std::vector<float> out_scales;
          	std::vector<int32_t> out_zps;
          	for (int i = 0; i < io_num.n_output; ++i) {
          		out_scales.push_back(output_attrs[i].scale);
          		out_zps.push_back(output_attrs[i].zp);
          	}
          	post_process((int8_t *)outputs[0].buf, (int8_t *)outputs[1].buf, (int8_t *)outputs[2].buf, yolo_input_height, yolo_input_width,
          				 box_conf_threshold, nms_threshold, scale_w, scale_h, out_zps, out_scales, &detect_result_group);
          	for (int i = 0; i < detect_result_group.count; i++) {
          		detect_result_t *det_result = &(detect_result_group.results[i]);
          		if (strcmp(det_result->name, "person") == 0) {
          			sprintf(text, "%.1f%%", det_result->prop * 100);
          			LOGD("AiAlgoYolo5::DealOneFrame %s @ (%d %d %d %d) %f\n", det_result->name, det_result->box.left, det_result->box.top,
          				 det_result->box.right, det_result->box.bottom, det_result->prop);
          		}
          	}
          }
          // 这一段对yolo检测结果分析,目前只关心person类别,结束
          return 0;
        

        }

      • Android.bp实现

        cc_library_static {
        	name: "libAiAlgo",
        	local_include_dirs: [
        		"api/",
        		"base/",
        		"base/media_base/",
        		"base/log/include/",
        		"modules/ai_algo/include/",
        	],
        
        	include_dirs: [
        		"hardware/rockchip/librga/include/",
        		"hardware/rockchip/librga/im2d_api/",
        	],
        
        	srcs: [
        		"modules/ai_algo/src/ai_algo_yolo5.cpp",
        		"modules/ai_algo/src/postprocess.cpp",
        	],
        
        	shared_libs: [
        		"librga",
        		"libyuv",
        		"librknnrt",
        	],
        
        	cflags: [
        		"-g",
        		"-fexceptions",
        		"-Wno-unused-variable",
        		"-Wno-unused-function",
        		"-Wno-unused-parameter",
        		"-Wno-format",
        	],
        }
        

      由于camera采集到的就是nv12图像,不需要图像的压缩算法,没有用到opencv库。图像的缩放,用了rga库,也可以用yuv库实现。

    • 运行日志

    04-03 15:45:50.027 13755 13760 D RKCodecEngine: AiAlgoYolo5::OnFrame bufsid 1 sid 1, [3840 2160]
    04-03 15:45:50.027 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame _source_id 1 [3840 2160] data 0x7367a42000
    04-03 15:45:50.027 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal_start_time 1712130350027
    04-03 15:45:50.035 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal_stop_time 1712130350035
    04-03 15:45:50.035 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 8 ms
    04-03 15:45:50.035 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame start_time 1712130350035
    04-03 15:45:50.044 13755 13760 D RKCodecEngine: AiAlgoYolo5::OnFrame bufsid 1 sid 1, [3840 2160]
    04-03 15:45:50.061 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame stop_time 1712130350061
    04-03 15:45:50.061 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 26 ms
    04-03 15:45:50.061 13755 13760 D RKCodecEngine: AiAlgoYolo5::OnFrame bufsid 1 sid 1, [3840 2160]
    04-03 15:45:50.061 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame person @ (750 0 1650 1370) 0.356758
    04-03 15:45:51.211 13755 13760 D RKCodecEngine: AiAlgoYolo5::OnFrame bufsid 1 sid 1, [3840 2160]
    04-03 15:45:51.211 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame _source_id 1 [3840 2160] data 0x73708a4000
    04-03 15:45:51.211 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal_start_time 1712130351211
    04-03 15:45:51.219 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal_stop_time 1712130351219
    04-03 15:45:51.219 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 8 ms
    04-03 15:45:51.219 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame start_time 1712130351219
    04-03 15:45:51.228 13755 13760 D RKCodecEngine: AiAlgoYolo5::OnFrame bufsid 1 sid 1, [3840 2160]
    04-03 15:45:51.242 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame stop_time 1712130351242
    04-03 15:45:51.242 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 23 ms
    04-03 15:45:51.242 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame person @ (996 3 2136 1329) 0.711339
    04-03 15:45:51.244 13755 13760 D RKCodecEngine: AiAlgoYolo5::OnFrame bufsid 1 sid 1, [3840 2160]
    04-03 15:45:52.244 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame _source_id 1 [3840 2160] data 0x7372848000
    04-03 15:45:52.244 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal_start_time 1712130352244
    04-03 15:45:52.253 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal_stop_time 1712130352253
    04-03 15:45:52.253 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 9 ms
    04-03 15:45:52.253 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame start_time 1712130352253
    04-03 15:45:52.261 13755 13760 D RKCodecEngine: AiAlgoYolo5::OnFrame bufsid 1 sid 1, [3840 2160]
    04-03 15:45:52.277 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame stop_time 1712130352277
    04-03 15:45:52.277 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 24 ms
    04-03 15:45:52.277 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame person @ (2040 0 3012 1356) 0.641171
    04-03 15:45:53.296 13755 13760 D RKCodecEngine: AiAlgoYolo5::OnFrame bufsid 1 sid 1, [3840 2160]
    04-03 15:45:53.296 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame _source_id 1 [3840 2160] data 0x7363afa000
    04-03 15:45:53.296 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal_start_time 1712130353296
    04-03 15:45:53.306 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal_stop_time 1712130353306
    04-03 15:45:53.306 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 10 ms
    04-03 15:45:53.306 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame start_time 1712130353306
    04-03 15:45:53.314 13755 13760 D RKCodecEngine: AiAlgoYolo5::OnFrame bufsid 1 sid 1, [3840 2160]
    04-03 15:45:53.330 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame stop_time 1712130353330
    04-03 15:45:53.330 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 24 ms
    04-03 15:45:53.330 13755 13755 D RKCodecEngine: AiAlgoYolo5::DealOneFrame person @ (1524 13 2610 1373) 0.404886
    
    同事配合,每次都能检测到他,只漏出身体一小部分也能行,效只漏出身体一小部分也能行,可以的:DealOneFrame person @ (996 3 2136 1329) 0.711339
    • 性能
    04-02 19:14:24.590 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 10 ms
    04-02 19:14:24.613 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 23 ms
    04-02 19:14:25.640 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 11 ms
    04-02 19:14:25.661 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 21 ms
    04-02 19:14:26.673 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 11 ms
    04-02 19:14:26.697 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 24 ms
    04-02 19:14:27.855 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 10 ms
    04-02 19:14:27.876 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 21 ms
    04-02 19:14:28.888 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 10 ms
    04-02 19:14:28.909 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 21 ms
    04-02 19:14:29.923 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 11 ms
    04-02 19:14:29.944 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 21 ms
    04-02 19:14:30.955 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 10 ms
    04-02 19:14:30.985 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 30 ms
    04-02 19:14:32.005 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 10 ms
    04-02 19:14:32.028 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 23 ms
    04-02 19:14:33.054 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 9 ms
    04-02 19:14:33.076 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 22 ms
    04-02 19:14:34.089 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 11 ms
    04-02 19:14:34.111 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 22 ms
    04-02 19:14:35.139 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 11 ms
    04-02 19:14:35.163 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 24 ms
    04-02 19:14:36.187 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 9 ms
    04-02 19:14:36.210 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 22 ms
    04-02 19:14:37.238 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 10 ms
    04-02 19:14:37.262 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 23 ms
    04-02 19:14:38.421 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 10 ms
    04-02 19:14:38.443 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 22 ms
    04-02 19:14:39.454 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 10 ms
    04-02 19:14:39.476 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 22 ms
    04-02 19:14:40.487 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 10 ms
    04-02 19:14:40.511 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 24 ms
    04-02 19:14:41.538 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 12 ms
    04-02 19:14:41.562 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 24 ms
    04-02 19:14:42.588 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 11 ms
    04-02 19:14:42.610 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 22 ms
    04-02 19:14:43.621 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 11 ms
    04-02 19:14:43.643 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 22 ms
    04-02 19:14:44.654 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame scal once run use 11 ms
    04-02 19:14:44.676 24382 24382 D RKCodecEngine: AiAlgoYolo5::DealOneFrame once run use 22 ms
    
    采集图像的缩放,从4k到640x640用rga实现,耗时11ms
    yolo5检测,22ms
    能够做到30fps
  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值