in src/datasets.py [0:0]
def __init__(self, config, train_config):
self.config = config
self.train_config = train_config
self.dataset_path = config.data
self.view = View()
self.scale = config.scale
from features import SpherePosDir
self.use_warped_depth_range = isinstance(train_config.f_in[0], SpherePosDir)
# read in dataset specific .json
with open(os.path.join(self.dataset_path, "dataset_info.json"), "r") as f:
dataset_info = json.load(f)
self.view.view_cell_center = dataset_info["view_cell_center"]
self.view.view_cell_size = dataset_info["view_cell_size"]
self.view.camera_scale = 1.
if "camera_scale" in dataset_info:
self.view.camera_scale = float(dataset_info["camera_scale"])
self.w, self.h = dataset_info["resolution"][0], dataset_info["resolution"][1]
if self.scale > 1:
self.w = self.w // self.scale
self.h = self.h // self.scale
self.train_config.h = self.h
self.train_config.w = self.w
self.view.fov = float(dataset_info["camera_angle_x"])
self.view.focal = float(.5 * self.w / np.tan(.5 * self.view.fov))
# vertically flip loaded depth files
self.flip_depth = dataset_info["flip_depth"]
# adjustments if depth is based on distance to camera plane, and not distance to camera origin
self.depth_distance_adjustment = dataset_info["depth_distance_adjustment"]
if "depth_ignore" not in dataset_info or "depth_range" not in dataset_info or \
"depth_range_warped_log" not in dataset_info or \
"depth_range_warped_lin" not in dataset_info:
print("error: necessary depth range information not found in 'dataset_info.json'")
sys.exit(-1)
self.depth_ignore = float(dataset_info["depth_ignore"])
self.depth_range = [float(dataset_info["depth_range"][0]), float(dataset_info["depth_range"][1])]
self.depth_max = self.depth_range[1]
if config.depthTransform == "linear":
self.depth_transform = depth_transforms.LinearTransform
self.depth_range_warped = [float(dataset_info["depth_range_warped_lin"][0]),
float(dataset_info["depth_range_warped_lin"][1])]
elif config.depthTransform == "log":
self.depth_transform = depth_transforms.LogTransform
self.depth_range_warped = [float(dataset_info["depth_range_warped_log"][0]),
float(dataset_info["depth_range_warped_log"][1])]