This project builds a shared library (libAickTensorrt.so) and a test
runner (pipeline_test) for a 10X image pipeline:
- YOLO detection (1600x1600 input)
- Impurities classification (2-class)
- Regression scoring (length / dispersion / num)
本项目生成动态库 libAickTensorrt.so 和测试程序 pipeline_test,用于 10X大图流水线:
1)YOLO 检测(输入 1600x1600)
2)杂质二分类
3)回归打分(长度/分散度/数量)
The pipeline is driven by 10Xconfig.txt and logs to ./Log/10X/.
流水线由 10Xconfig.txt 驱动,日志输出到 ./Log/10X/。
src//include/: core implementation (TensorRT + OpenCV) /核心实现(TensorRT + OpenCV)engine/: TensorRT engine files (*.engine) /TensorRT 引擎文件10Xconfig.txt: runtime configuration /运行配置main.cpp: example runner used for quick tests /测试入口make.sh: one-shot build + run script /一键编译运行脚本output/: default image output directory (if enabled) /结果图默认输出目录
Tested
- Jetson Orin Nano Super(8GB)
- JetPack 6.2.1 (L4T 36.x)
- TensorRT 10.3.0
- OpenCV 4.14.0 (with CUDA)
已验证
- Jetson Orin Nano Super(8GB)
- JetPack 6.2.1 (L4T 36.x)
- TensorRT 10.3.0
- OpenCV 4.14.0(CUDA 版)
Requirements: GCC/G++, CMake, OpenCV (pkg-config opencv4), CUDA +
TensorRT runtime.
依赖:GCC/G++、CMake、OpenCV(pkg-config opencv4)、CUDA +
TensorRT 运行时。
Recommended build + run / 推荐编译运行:
./make.shmake.sh will / make.sh 会执行:
- Re-generate build directory (CMake) / 重新生成构建目录
- Build
libAickTensorrt.so/ 编译动态库 - Compile
main.cppintopipeline_test/ 编译测试程序 - Run
./pipeline_test ./test.jpgiftest.jpgexists / 若存在test.jpg则直接运行
g++ main.cpp -o pipeline_test \
-I./include \
-L./build/lib -lAickTensorrt \
`pkg-config --cflags --libs opencv4` \
-Wl,-rpath,./build/lib
./pipeline_test ./test.jpg [get_num]10Xconfig.txtmust be in the current working directory.
10Xconfig.txt必须在 当前工作目录。- Input is resized to 1600x1600 in
main.cppbefore inference.
main.cpp中会把输入 resize 到 1600x1600。 get_numis optional; default is 10.
get_num可选,默认 10。
- Paths / 路径:
10X_detection: YOLO engine (1600x1600, multi-output)
10X_detection:YOLO 引擎(1600x1600,多输出头)Impurity_score: 2-class impurities engine
Impurity_score:杂质二分类引擎Chromosome_score: regression engine (len/disp/num)
Chromosome_score:回归打分引擎Foreground_seg: segmentation engine (skipped whenoperationModel=1)
Foreground_seg:分割引擎(operationModel=1时跳过)
conf_thres,iou_thres: YOLO thresholdsimpurityThreshold: impurities class thresholdlenBottom,dispBottom,numBottom: regression thresholdsmeanScore_th: minimum base score to allow bonusscoreFilter: final score filterisSaveImg,saveImgPath: whether to write cropped ROIs
conf_thres,iou_thres:YOLO 阈值impurityThreshold:杂质分类阈值lenBottom,dispBottom,numBottom:回归阈值meanScore_th:允许加分的基础分阈值scoreFilter:最终筛选阈值isSaveImg,saveImgPath:是否保存 ROI 图像
- Logs / 日志:
./Log/10X/10X_YYYYMMDD.txt - ROI images / 结果图:
saveImgPathin10Xconfig.txt - Detected points / 点结果: printed by
pipeline_testafterGetShootingPoint(...)
-
YOLO (10X_detection): input
1600x1600x3, multi-output heads.
Output[1] is the main head (Size ~ 945000). Output[2..4] are auxiliary heads. -
Impurities (Impurity_score): input
224x224x3, output2(2-class). -
Regression (Chromosome_score): input
224x224x3, output3(len/disp/num). -
Foreground segmentation (Foreground_seg): input
960x960x3, output mask (disabled whenoperationModel=1). -
YOLO(10X_detection):输入
1600x1600x3,多输出头。
Output[1] 为主输出头(Size ~ 945000),Output[2..4] 为辅助输出头。 -
杂质分类(Impurity_score):输入
224x224x3,输出2(二分类)。 -
回归打分(Chromosome_score):输入
224x224x3,输出3(长度/分散度/数量)。 -
前景分割(Foreground_seg):输入
960x960x3,输出 mask (当operationModel=1时跳过)。
From include/AickTensorrt.h / include/AickTensorrt.h 中的主要接口:
DeepLearningFuncs::AickTensorrtStarter* api = AickTensorrtStarter::get_instance();
api->InitParam(params);
api->InintModel(); // loads YOLO + impurities + regression (per config)
api->AickTensorrt(image, w, h, stageInfo);
api->GetShootingPoint(points, names, get_num);Only the 10X pipeline (YOLO → classification → regression scoring) has
been tested so far.
目前仅验证 10X 流水线(YOLO → 分类 → 回归打分)。
Measured average latency is ~200 ms per image on Jetson Orin Nano Super for the full 10X pipeline (YOLO + impurities + regression).
在 Jetson Orin Nano Super 上实测 10X 全流程(YOLO + 杂质分类 + 回归打分) 单张平均推理约 200 ms。
- Pipeline failed: check
10Xconfig.txtpaths and engine files.
流水线失败:检查10Xconfig.txt与引擎路径。 - No output images: set
isSaveImg=1and ensuresaveImgPathis writable.
不出图:确保isSaveImg=1且saveImgPath可写。 - Scores are zero: verify regression outputs and thresholds.
得分为 0:检查回归输出和阈值配置。
-
Use JetPack 6.2.1 + TensorRT 10.3.0 (tested).
-
Engines should be built on the same device model to avoid TRT warnings or performance issues.
-
If CUDA OOM or
createInferRuntimefails, reduce concurrency, keep batch B=1, or unload unused models. -
Ensure
./output/exists and is writable whenisSaveImg=1. -
Run from project root so
10Xconfig.txtandLog/resolve correctly. -
Existing engines from TensorRT 8.x will NOT work. You must re-export or re-build
.enginefiles usingtrtexecor the built-in initializer on the Orin Nano device. -
建议使用 JetPack 6.2.1 + TensorRT 10.3.0(已验证)。
-
Engine 最好在同型号设备上生成,避免 TRT 警告或性能异常。
-
如遇 CUDA OOM 或
createInferRuntime失败,降低并发、固定 B=1, 或只加载必要模型。 -
isSaveImg=1时请确保./output/可写。 -
建议在项目根目录运行,保证
10Xconfig.txt与Log/路径正确。 -
TRT 8.x 的引擎文件在 10.x 下不可用,必须在本地重新生成