feat: TensorRT 固定 batch=4 重构

- tensorrt_engine.py 工业级 Buffer Pool
- preprocessor.py 添加 pad_to_batch4()
- postprocessor.py 支持批量输出
- settings.py 固定 batch_size=4
This commit is contained in:
2026-02-02 14:49:47 +08:00
parent 956bcbbc3e
commit 745cadc8e7
18 changed files with 68258 additions and 130 deletions

View File

@@ -75,8 +75,7 @@ class InferenceConfig:
model_path: str = "./models/yolo11n.engine"
input_width: int = 480
input_height: int = 480
batch_size: int = 1
max_batch_size: int = 8
batch_size: int = 4
conf_threshold: float = 0.5
nms_threshold: float = 0.45
device_id: int = 0
@@ -160,8 +159,7 @@ class Settings:
model_path=os.getenv("MODEL_PATH", "./models/yolo11n.engine"),
input_width=int(os.getenv("INPUT_WIDTH", "480")),
input_height=int(os.getenv("INPUT_HEIGHT", "480")),
batch_size=int(os.getenv("BATCH_SIZE", "1")),
max_batch_size=int(os.getenv("MAX_BATCH_SIZE", "8")),
batch_size=int(os.getenv("BATCH_SIZE", "4")),
conf_threshold=float(os.getenv("CONF_THRESHOLD", "0.5")),
nms_threshold=float(os.getenv("NMS_THRESHOLD", "0.45")),
)