17 lines
520 B
Python
17 lines
520 B
Python
|
|
import os
|
|
from ultralytics import YOLO
|
|
|
|
pt_path = '/home/jetson/karung/v4-best.pt'
|
|
print('[INFO] Inspecting new model...')
|
|
model = YOLO(pt_path)
|
|
print('Model Names:', model.names)
|
|
print('Model Task:', model.task)
|
|
|
|
print('[INFO] Exporting v4-best.pt to TensorRT engine (half=True, imgsz=640)...')
|
|
try:
|
|
engine_path = model.export(format='engine', device=0, half=True, imgsz=640)
|
|
print('[SUCCESS] TensorRT Engine exported:', engine_path)
|
|
except Exception as e:
|
|
print('[WARNING] TensorRT export exception:', e)
|