DCGAN on CelebA Dataset using Libtorch (PyTorch C++ Frontend API)
Functions
dataset.cpp File Reference
#include "dataset.hpp"

Functions

torch::Tensor read_data (std::string location, int resize=224)
 Function to return image read at location given as type torch::Tensor. Resizes image to (224, 224, 3) More...
 
torch::Tensor read_label (int label)
 Function to return label from int (0, 1 for binary and 0, 1, ..., n-1 for n-class classification) as type torch::Tensor. More...
 
std::vector< torch::Tensor > process_images (std::vector< std::string > list_images, int resize=224)
 Function returns vector of tensors (images) read from the list of images in a folder. More...
 
std::vector< torch::Tensor > process_labels (std::vector< int > list_labels)
 Function returns vector of tensors (labels) read from the list of labels. More...
 
std::pair< std::vector< std::string >, std::vector< int > > load_data_from_folder (std::vector< std::string > folders_name)
 Function to load data from given folder(s) name(s) (folders_name). Returns pair of vectors of string (image locations) and int (respective labels) More...
 

Function Documentation

◆ load_data_from_folder()

std::pair<std::vector<std::string>,std::vector<int> > load_data_from_folder ( std::vector< std::string >  folders_name)

Function to load data from given folder(s) name(s) (folders_name) Returns pair of vectors of string (image locations) and int (respective labels)

Arguments:

  1. folders_name (std::vector<std::string> type) - name of folders as a vector to load data from

◆ process_images()

std::vector<torch::Tensor> process_images ( std::vector< std::string >  list_images,
int  resize = 224 
)

Arguments:

  1. list_images (std::vector<std::string> type) - list of image paths in a folder to be read
  2. resize (int type) - argument for resizing each image

◆ process_labels()

std::vector<torch::Tensor> process_labels ( std::vector< int >  list_labels)

Arguments:

  1. list_labels (std::vector<int> list_labels) -

◆ read_data()

torch::Tensor read_data ( std::string  location,
int  resize = 224 
)

Function to return image read at location given as type torch::Tensor.

Arguments:

  1. location (std::string type) - required to load image from the location
  2. resize (int type) - required to resize an image

◆ read_label()

torch::Tensor read_label ( int  label)

Arguments:

  1. label (int type) - required to convert int to tensor