SPCSim.data_loaders package
Submodules
SPCSim.data_loaders.perpixel_loaders module
- class SPCSim.data_loaders.perpixel_loaders.PerPixelLoader(num_dists=1, min_dist=0, max_dist=1, sig_bkg_list=[[1, 1]], tmax=100, num_runs=1, device='cpu')[source]
Bases:
object
This class loads a custom RGB-D image with each row consisting of different distance values and avg signal-background photons and R columns where R is the number of runs to be captured for each pixel with a specific SBR and distance combination.
Note
If A is the output transient matrix then A[i,j] gives readings for
dist_idx = i % len(SBR_list)
,SBR_Pair_idx = (i/num_dists)
, andRun_idx = j
.
SPCSim.data_loaders.rgbd_loaders module
- class SPCSim.data_loaders.rgbd_loaders.NYULoader1(Nr, Nc, crop_r1=44, crop_r2=470, crop_c1=40, crop_c2=600, device='cpu', n_tbins=1000, tmax=100, folder='train')[source]
Bases:
RGBDLoader
- class SPCSim.data_loaders.rgbd_loaders.RGBDLoader(Nr, Nc, crop_r1=0, crop_r2=-1, crop_c1=0, crop_c2=-1, device='cpu', n_tbins=1000, tmax=100, folder='train')[source]
Bases:
object
General class to load RGB-D datasets
- get_data(rgb_pth, dist_pth, albedo_pth='', intensity_pth='')[source]
Method to get the RGB-D data
- Parameters:
rgb_pth (str) – File path to rgb image
dist_pth (str) – File path to distance image
albedo_pth (str, optional) – _description_. Defaults to “”.
intensity_pth (str, optional) – _description_. Defaults to “”.
- Returns:
Dictionary containing the rgb, intensity, albedo and distance image
- Return type:
data (dictionary)
SPCSim.data_loaders.transient_loaders module
- class SPCSim.data_loaders.transient_loaders.TransientGenerator(Nr=1, Nc=1, N_tbins=1000, tmax=100, FWHM=1, device='cpu')[source]
Bases:
object
- get_shifted_laser_pulse_mesh(gt_dist)[source]
Method to compute the time shifted gaussian pulse based on the true distance
- Parameters:
gt_dist (torch.tensor) – Scene ground truth distance image of dimension (Nr, Nc)
- Returns:
Tensor of time shifted laser pulse for each pixel based on the true distance
- Return type:
tr (torch.tensor)
- get_signal_attenuation(albedo, dist)[source]
Method to calculate attenuation factor from albedo information and dist information.
- Parameters:
albedo (torch.tensor) – Scene albedo image of dimension (Nr, Nc)
dist (torch.tensor) – Scene ground truth distance image of dimension (Nr, Nc)
- Returns:
Attenuated signal
- Return type:
signal_attn (torch.tensor)
- get_transient(gt_dist, albedo, intensity, alpha_sig, alpha_bkg)[source]
Method to add noise and attenuation to ideal transient
- Parameters:
gt_dist (torch.tensor) – Scene ground truth distance image of dimension (Nr, Nc)
albedo (torch.tensor) – Scene albedo image of dimension (Nr, Nc)
intensity (torch.tensor) – Scene intensity image of dimension (Nr, Nc)
alpha_sig (float) – Average signal photons per laser cycle
alpha_bkg (float) – Average background photons per laser cycle (not per bin)
Note
Signal attenuation only depends on scene albedo and background flux depends on the total scene intensity.
- Returns:
Time shifted attenuated laser pulse representing the photon density incident on the SPAD camera.
- Return type:
r_t1 (torch.tensor)
- gt_shift_idx(gt_dist)[source]
Method to compute the peak location in bins unit for given scene distance
- Parameters:
gt_dist (torch.tensor) – Scene ground truth distance image of dimension (Nr, Nc)
- Returns:
Tensor consisting of integer values corresponding to the peak location.
- Return type:
shift_idx (torch.tensor)