ReUseX  0.0.1
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
ReUseX::vision::libtorch::TorchDataset Class Reference

PyTorch Dataset for RTABMap databases. More...

#include <Dataset.hpp>

Inheritance diagram for ReUseX::vision::libtorch::TorchDataset:
Collaboration diagram for ReUseX::vision::libtorch::TorchDataset:

Public Member Functions

 TorchDataset (std::filesystem::path dbPath="")
 Construct TorchDataset from database path.
Example get (size_t index)
 Get a data sample at the given index.
torch::optional< size_t > size () const
 Get the number of samples in the dataset.
void save (std::vector< cv::Mat > imgs, torch::Tensor index)
 Save label images for multiple nodes.

Detailed Description

PyTorch Dataset for RTABMap databases.

This dataset class implements the torch::data::datasets::Dataset interface for use with PyTorch DataLoaders. It uses RTABMapDatabase internally for database access, eliminating code duplication.

Definition at line 26 of file Dataset.hpp.

Constructor & Destructor Documentation

◆ TorchDataset()

ReUseX::vision::libtorch::TorchDataset::TorchDataset ( std::filesystem::path dbPath = "")

Construct TorchDataset from database path.

Parameters
dbPathPath to RTABMap database file

Member Function Documentation

◆ get()

Example ReUseX::vision::libtorch::TorchDataset::get ( size_t index)

Get a data sample at the given index.

Returns a torch::data::Example containing the image tensor and node ID. Images are automatically letterboxed to 640x640 for YOLO-style models.

Parameters
indexIndex in the dataset (0 to size()-1)
Returns
Example with image tensor (CHW format, normalized to [0,1]) and node ID

◆ save()

void ReUseX::vision::libtorch::TorchDataset::save ( std::vector< cv::Mat > imgs,
torch::Tensor index )

Save label images for multiple nodes.

Parameters
imgsVector of label images to save
indexTensor containing node IDs corresponding to each image

◆ size()

torch::optional< size_t > ReUseX::vision::libtorch::TorchDataset::size ( ) const

Get the number of samples in the dataset.

Returns
Optional size (always returns a value)

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