Compare commits

...

3 Commits

Author SHA1 Message Date
b67bda8042 fix: 修复 Python TensorRT 资源释放
- 移除不存在的 .destroy() 方法调用
- Python TensorRT 由 GC 管理,= None 即释放
2026-01-30 10:39:02 +08:00
bcabe65984 chore: 忽略说明文档
- 忽略 *.md、CHANGELOG.md、README.md
- 保留 requirements.txt
2026-01-30 10:14:16 +08:00
02c30d7461 chore: 更新 .gitignore 规则
- 忽略 __pycache__/、*.pyc 等 Python 缓存
- 忽略 .trae/ AI 临时文件
- 忽略 logs/ 日志目录
- 忽略 models/*.onnx 中间产物
- 保留 CHANGELOG.md、build_engine.py 等核心文件
2026-01-30 10:12:09 +08:00
2 changed files with 47 additions and 6 deletions

48
.gitignore vendored
View File

@@ -1,4 +1,46 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
*.egg-info/
dist/
build/
# traefile AI
.trae/
# 日志文件
logs/
*.log
# 模型文件(忽略中间产物)
models/*.onnx
# 环境配置
.env
.env.local
# IDE
.idea/
.vscode/
*.swp
*.swo
*~
# OS
.DS_Store
Thumbs.db
# 测试覆盖率
htmlcov/
.coverage
.coverage.*
*.coverag
# 说明文档(不随代码仓库分发)
CHANGELOG.md
.trae/documents/plan_20260129_104739.md
.trae/rules/commit_rules.md
.trae/documents/将 yolov8 替换为 yolo11n.md
README.md
*.md
!requirements.txt

View File

@@ -331,19 +331,18 @@ class TensorRTEngine:
return {"total_mb": 0, "used_mb": 0, "free_mb": 0}
def _release_resources(self):
"""释放资源"""
"""释放资源Python TensorRT 由 GC 管理,无需 destroy"""
if self._stream:
try:
self._stream.synchronize()
except Exception:
pass
self._stream = None
if self._context:
self._context.destroy()
self._context = None
if self._engine:
self._engine.destroy()
self._engine = None
self._memory_pool.clear()