fix: 优化边缘端稳定性和日志管理
1. database.py: 优化数据库连接和错误处理 2. postprocessor.py: 改进后处理逻辑 3. result_reporter.py: 完善告警上报字段 4. video_stream.py: 增强视频流稳定性 5. main.py: 优化启动流程和异常处理 6. logger.py: 改进日志格式和轮转配置 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -728,9 +728,18 @@ class PostProcessor:
|
||||
|
||||
if len(batch_outputs) == 1:
|
||||
first_output = batch_outputs[0]
|
||||
if isinstance(first_output, np.ndarray) and first_output.ndim == 3:
|
||||
if first_output.shape[0] == batch_size:
|
||||
if isinstance(first_output, np.ndarray):
|
||||
if first_output.ndim == 3 and first_output.shape[0] == batch_size:
|
||||
# 已经是 (batch, 84, anchors) 格式
|
||||
outputs_array = first_output
|
||||
elif first_output.ndim == 1:
|
||||
# TensorRT 返回扁平 1D 数组,需要 reshape 为 (batch, 84, anchors)
|
||||
per_image = first_output.shape[0] // batch_size
|
||||
num_anchors = per_image // 84
|
||||
outputs_array = first_output.reshape(batch_size, 84, num_anchors)
|
||||
elif first_output.ndim == 2:
|
||||
# (84, anchors) 单张图的输出
|
||||
outputs_array = first_output.reshape(1, first_output.shape[0], first_output.shape[1])
|
||||
else:
|
||||
outputs_array = first_output
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user