Skip to content

F64081169/Nvprof_Jetson_Nano_Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nvprof_Jetson_Nano_Example

使用TRTEXEC產生PROFILING結果

https://github.com/F64081169/Nvprof_Jetson_Nano_Example/tree/main/yolov4-tiny-profilingResult

  • 產生資訊放於yolov4-tiny-profilingResult

新增cu_prof_start() and cu_prof_stop() in nvprof.py.

def loop_and_detect(cam, trt_yolo, conf_th, vis):
    """Continuously capture images from camera and do object detection.
    # Arguments
      cam: the camera instance (video source).
      trt_yolo: the TRT YOLO object detector instance.
      conf_th: confidence/score threshold for object detection.
      vis: for visualization.
    """
    full_scrn = False
    fps = 0.0
    tic = time.time()
    cu_prof_start() #for nvprof start profiling
    while True:
        if cv2.getWindowProperty(WINDOW_NAME, 0) < 0:
            break
        img = cam.read()
        if img is None:
            break
        boxes, confs, clss = trt_yolo.detect(img, conf_th)
        img = vis.draw_bboxes(img, boxes, confs, clss)
        img = show_fps(img, fps)
        cv2.imshow(WINDOW_NAME, img)
        toc = time.time()
        curr_fps = 1.0 / (toc - tic)
        # calculate an exponentially decaying average of fps number
        fps = curr_fps if fps == 0.0 else (fps*0.95 + curr_fps*0.05)
        tic = toc        
        key = cv2.waitKey(1)
        if key == 27:  # ESC key: quit program
            break
        elif key == ord('F') or key == ord('f'):  # Toggle fullscreen
            full_scrn = not full_scrn
            set_display(WINDOW_NAME, full_scrn)
        cu_prof_stop() #for nvprof stop profiling

start profiling function 加於while loop前

stop profiling function 加於while loop最後

  • 即可觀察每次inference的執行資訊

results

image image image

reference

  1. [腾讯机智] tensorflow profiling工具简介——nvprof和nvvp
  2. Jetson上的零拷贝
  3. NVVP Tutorial Gist
  4. Cuda Toolkit Documentation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages