ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
reusex::vision::libtorch::LibTorchYolo Class Reference

YOLO instance segmentation model using LibTorch (TorchScript). More...

#include <Yolo.hpp>

Inheritance diagram for reusex::vision::libtorch::LibTorchYolo:
Collaboration diagram for reusex::vision::libtorch::LibTorchYolo:

Public Member Functions

 LibTorchYolo (const std::filesystem::path &model_path, bool use_cuda=false)
 Construct and load a YOLO model from a TorchScript file.
std::vector< IDataset::Pairforward (const std::span< IDataset::Pair > &input) override
 Run YOLO inference on a batch of images.
Public Member Functions inherited from reusex::vision::IModel
virtual ~IModel ()=default

Static Public Member Functions

static std::unique_ptr< LibTorchYolocreate (const std::filesystem::path &model_path, bool use_cuda=false)
 Factory method for creating a LibTorchYolo instance.
Static Public Member Functions inherited from reusex::vision::IModel
static std::unique_ptr< IModelcreate (const std::filesystem::path &model_path, bool use_gpu=false)

Detailed Description

YOLO instance segmentation model using LibTorch (TorchScript).

Loads a TorchScript YOLO segmentation model and implements the IModel interface for use with the backend-agnostic annotation pipeline.

Definition at line 24 of file Yolo.hpp.

Constructor & Destructor Documentation

◆ LibTorchYolo()

reusex::vision::libtorch::LibTorchYolo::LibTorchYolo ( const std::filesystem::path & model_path,
bool use_cuda = false )
explicit

Construct and load a YOLO model from a TorchScript file.

Parameters
model_pathPath to the .pt TorchScript model file.
use_cudaWhether to use CUDA for inference (falls back to CPU).

Member Function Documentation

◆ create()

std::unique_ptr< LibTorchYolo > reusex::vision::libtorch::LibTorchYolo::create ( const std::filesystem::path & model_path,
bool use_cuda = false )
static

Factory method for creating a LibTorchYolo instance.

Parameters
model_pathPath to the .pt TorchScript model file.
use_cudaWhether to use CUDA for inference (defaults to false).
Returns
Unique pointer to the created model.

◆ forward()

std::vector< IDataset::Pair > reusex::vision::libtorch::LibTorchYolo::forward ( const std::span< IDataset::Pair > & input)
overridevirtual

Run YOLO inference on a batch of images.

Each input Pair must contain a LibTorchData with a letterboxed image. Output Pairs contain the same LibTorchData with label_image populated.

Parameters
inputSpan of (data, index) pairs from the dataset.
Returns
Vector of (data, index) pairs with label_image set.

Implements reusex::vision::IModel.


The documentation for this class was generated from the following file:
  • libs/reusex/include/vision/libtorch/Yolo.hpp