Turning off TensorRT verbose when loading a model


When loading or running a tensorRT model on an nvidia jetson using ultralytics YOLOv8, it will (regardless of turning setting Verbose=False) always print out the following information to the console:

Loading modelZoo/fish_s.engine for TensorRT inference...
[03/02/2024-14:55:44] [TRT] [I] Loaded engine size: 22 MiB
[03/02/2024-14:55:44] [TRT] [I] [MemUsageChange] TensorRT-managed allocation in engine deserialization: CPU +0, GPU +21, now: CPU 0, GPU 21 (MiB)
[03/02/2024-14:55:44] [TRT] [I] [MemUsageChange] TensorRT-managed allocation in IExecutionContext creation: CPU +0, GPU +14, now: CPU 0, GPU 35 (MiB)

And here is the code:

import cv2
from ultralytics import YOLO

imageFile = 'test.jpg'
modelFile = 'modelZoo/test_s.engine'
image = cv2.imread(imageFile)
color = (255, 255, 255)

model = YOLO(modelFile, task='detect')
classList = ['test']

# This is where the output is being thrown
result = model.predict(imageFile, conf = 0.2, iou=0.3, device = 0, 
                       half=True, imgsz=416, verbose = False)

for detection in result:
    data = detection.boxes.data 
    list = data.tolist()
    for object in list:
        bbox = [int(i) for i in object[0:4]]
        conf = object[4]
        classes = classList[int(object[5])]
        output = [bbox, conf, classes]
        label = "ID: " + str(output[2]) + "; conf: " + str(round(output[1], 2))

        cv2.rectangle(image, output[0][0:2], output[0][2:4], color, 2)
        cv2.putText(image, label, (output[0][0], output[0][3] + 30), 
                    cv2.FONT_HERSHEY_SIMPLEX, 1, color, 2)

cv2.imshow("Detections", image)

Is there any possible way to get this to shut off? On the jetson’s the source code for TRT is abstracted so I can’t change it that way and I’ve tried to force shutoff console output through python sys packages and TRT manages to override this. Any information on this topic would be extremely helpful as I use console outputs for error logging in my AI deployments. Before its suggested to me, yes, I have read the Developer Guide and it doesn’t have any suggestions that fix this issue. Thank you for in advance for any help!


TensorRT Version:
GPU Type: Nvidia Jetson Xavier NX dev kit
Nvidia Driver Version: Jetpack 5.1.3 (driver not applicable)
CUDA Version: 11.4
CUDNN Version: 8.6.0
Operating System + Version: Ubuntu 20.04
Python Version (if applicable): 3.8.10
TensorFlow Version (if applicable): N/A
PyTorch Version (if applicable): torch version 2.1.0
Baremetal or Container (if container which image + tag): N/A