pulsatrix
Loading...
Searching...
No Matches
image_folder_dataset.hpp
Go to the documentation of this file.
1
5#pragma once
6
7#include <string>
8#include <vector>
9
10#include "pulsatrix/dataset.hpp"
12
13namespace pulsatrix {
14
22public:
29 ImageFolderDataset(const std::string& root_dir, DeviceBackend* backend);
30
31 [[nodiscard]] int64_t size() const override;
32
38 [[nodiscard]] Sample get(int64_t index) const override;
39
41 [[nodiscard]] const std::vector<std::string>& classes() const { return classes_; }
42
43private:
44 struct Entry {
45 std::string path;
46 int64_t label;
47 };
48
49 std::vector<Entry> entries_;
50 std::vector<std::string> classes_;
51 DeviceBackend* backend_;
52};
53
54} // namespace pulsatrix
Random-access dataset abstraction – pulsatrix's analogue of PyTorch's torch.utils....
Definition dataset.hpp:33
Vendor-agnostic compute/memory backend. CPUBackend, CUDABackend (Phase 1.5), and HIPBackend (Phase 1....
Definition device_backend.hpp:219
Dataset over a directory tree of the form root_dir/<class_name>/<image_file>, mirroring torchvision's...
Definition image_folder_dataset.hpp:21
Sample get(int64_t index) const override
int64_t size() const override
Number of samples in this dataset.
const std::vector< std::string > & classes() const
Sorted class names; classes()[i] is the human-readable name for label i.
Definition image_folder_dataset.hpp:41
ImageFolderDataset(const std::string &root_dir, DeviceBackend *backend)
Random-access dataset abstraction – Sample, Dataset (size()/get()).
Abstract interface isolating vendor-specific memory/compute operations from Tensor/ComputationGraph.
Definition acquisition_functions.hpp:16
One dataset sample: an ordered list of Tensor fields (e.g. {features, label} or {image,...
Definition dataset.hpp:19