PCIe 비동기 추론 실행
| 필드 | 값 |
|---|---|
| 범주 | PCIe 코프로세싱 |
| 난이도 | 초급 |
| 예상 소요 시간 | 15 minutes |
| 레이블 | PCIe, asynchronous, throughput, detection |
이 튜토리얼에서는 튜토리얼 024에서 사용한 YOLOv8s 이미지와 박스 디코딩 구성, 640x480 해상도의 거리 장면 이미지를 재사용합니다. 저장 및 이미지 디코딩이 PCIe 측정에 영향을 미치지 않도록 동일한 이미지를 반복적으로 제출합니다.
둘러보기
하나의 감지 모델 구성
이미지를 한 번 로드하고, 카드 측 COCO 전처리 및 YOLOv8 박스 디코딩을 구성한 다음, 큐 0에 하나의 Model을 빌드합니다. 누락된 파일이나 카드 시작 오류가 발생하면 측정 시작 전에 프로그램이 중지됩니다.
pcie_host/tutorials/025_run_pcie_inference_async/run_pcie_inference_async.cpp
const Args args = parse_args(argc, argv);
if (!std::filesystem::is_regular_file(kModelPath)) {
throw std::runtime_error(std::string("model does not exist: ") + kModelPath);
}
const cv::Mat image = cv::imread(kImagePath, cv::IMREAD_COLOR);
if (image.empty()) {
throw std::runtime_error(std::string("OpenCV could not decode: ") + kImagePath);
}
pcie::ConnectionOptions connection;
connection.card_id = args.card_id;
pcie::Model model(kModelPath, detection_options(), connection);
model.build(kBuildTimeoutMs);
파이프라인 워밍업
시간을 측정하지 않고 몇 개의 전체 감지를 실행합니다. 워밍업은 모델 시작 및 첫 번째 버퍼 효과를 보고된 워크로드에서 제거합니다.
pcie_host/tutorials/025_run_pcie_inference_async/run_pcie_inference_async.cpp
for (int index = 0; index < kWarmupFrames; ++index) {
(void)detection_count(model.run(image, kPullTimeoutMs));
}