diff --git a/Orient_Anything/render/__init__.py b/Orient_Anything/render/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..2d73bcc46bae29f8b35fe23ced170a778634bbbe --- /dev/null +++ b/Orient_Anything/render/__init__.py @@ -0,0 +1,3 @@ +# flake8: noqa +from .core import render +from .model import Model diff --git a/Orient_Anything/render/core.py b/Orient_Anything/render/core.py new file mode 100644 index 0000000000000000000000000000000000000000..8d82b7bb412fc64b6a51333e8b7ee115a678212a --- /dev/null +++ b/Orient_Anything/render/core.py @@ -0,0 +1,370 @@ +import typing as t +from functools import partial + +import numpy as np +from copy import deepcopy +from .canvas import Canvas + +from . import speedup + + +# 2D part + + +class Vec2d: + __slots__ = "x", "y", "arr" + + def __init__(self, *args): + if len(args) == 1 and isinstance(args[0], Vec3d): + self.arr = Vec3d.narr + else: + assert len(args) == 2 + self.arr = list(args) + + self.x, self.y = [d if isinstance(d, int) else int(d + 0.5) for d in self.arr] + + def __repr__(self): + return f"Vec2d({self.x}, {self.y})" + + def __truediv__(self, other): + return (self.y - other.y) / (self.x - other.x) + + def __eq__(self, other): + return self.x == other.x and self.y == other.y + + +def draw_line( + v1: Vec2d, v2: Vec2d, canvas: Canvas, color: t.Union[tuple, str] = "white" +): + """ + Draw a line with a specified color + + https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm + """ + v1, v2 = deepcopy(v1), deepcopy(v2) + if v1 == v2: + canvas.draw((v1.x, v1.y), color=color) + return + + steep = abs(v1.y - v2.y) > abs(v1.x - v2.x) + if steep: + v1.x, v1.y = v1.y, v1.x + v2.x, v2.y = v2.y, v2.x + v1, v2 = (v1, v2) if v1.x < v2.x else (v2, v1) + slope = abs((v1.y - v2.y) / (v1.x - v2.x)) + y = v1.y + error: float = 0 + incr = 1 if v1.y < v2.y else -1 + dots = [] + for x in range(int(v1.x), int(v2.x + 0.5)): + dots.append((int(y), x) if steep else (x, int(y))) + error += slope + if abs(error) >= 0.5: + y += incr + error -= 1 + + canvas.draw(dots, color=color) + + +def draw_triangle(v1, v2, v3, canvas, color, wireframe=False): + """ + Draw a triangle with 3 ordered vertices + + http://www.sunshine2k.de/coding/java/TriangleRasterization/TriangleRasterization.html + """ + _draw_line = partial(draw_line, canvas=canvas, color=color) + + if wireframe: + _draw_line(v1, v2) + _draw_line(v2, v3) + _draw_line(v1, v3) + return + + def sort_vertices_asc_by_y(vertices): + return sorted(vertices, key=lambda v: v.y) + + def fill_bottom_flat_triangle(v1, v2, v3): + invslope1 = (v2.x - v1.x) / (v2.y - v1.y) + invslope2 = (v3.x - v1.x) / (v3.y - v1.y) + + x1 = x2 = v1.x + y = v1.y + + while y <= v2.y: + _draw_line(Vec2d(x1, y), Vec2d(x2, y)) + x1 += invslope1 + x2 += invslope2 + y += 1 + + def fill_top_flat_triangle(v1, v2, v3): + invslope1 = (v3.x - v1.x) / (v3.y - v1.y) + invslope2 = (v3.x - v2.x) / (v3.y - v2.y) + + x1 = x2 = v3.x + y = v3.y + + while y > v2.y: + _draw_line(Vec2d(x1, y), Vec2d(x2, y)) + x1 -= invslope1 + x2 -= invslope2 + y -= 1 + + v1, v2, v3 = sort_vertices_asc_by_y((v1, v2, v3)) + + # 填充 + if v1.y == v2.y == v3.y: + pass + elif v2.y == v3.y: + fill_bottom_flat_triangle(v1, v2, v3) + elif v1.y == v2.y: + fill_top_flat_triangle(v1, v2, v3) + else: + v4 = Vec2d(int(v1.x + (v2.y - v1.y) / (v3.y - v1.y) * (v3.x - v1.x)), v2.y) + fill_bottom_flat_triangle(v1, v2, v4) + fill_top_flat_triangle(v2, v4, v3) + + +# 3D part + + +class Vec3d: + __slots__ = "x", "y", "z", "arr" + + def __init__(self, *args): + # for Vec4d cast + if len(args) == 1 and isinstance(args[0], Vec4d): + vec4 = args[0] + arr_value = (vec4.x, vec4.y, vec4.z) + else: + assert len(args) == 3 + arr_value = args + self.arr = np.array(arr_value, dtype=np.float64) + self.x, self.y, self.z = self.arr + + def __repr__(self): + return repr(f"Vec3d({','.join([repr(d) for d in self.arr])})") + + def __sub__(self, other): + return self.__class__(*[ds - do for ds, do in zip(self.arr, other.arr)]) + + def __bool__(self): + """ False for zero vector (0, 0, 0) + """ + return any(self.arr) + + +class Mat4d: + def __init__(self, narr=None, value=None): + self.value = np.matrix(narr) if value is None else value + + def __repr__(self): + return repr(self.value) + + def __mul__(self, other): + return self.__class__(value=self.value * other.value) + + +class Vec4d(Mat4d): + def __init__(self, *narr, value=None): + if value is not None: + self.value = value + elif len(narr) == 1 and isinstance(narr[0], Mat4d): + self.value = narr[0].value + else: + assert len(narr) == 4 + self.value = np.matrix([[d] for d in narr]) + + self.x, self.y, self.z, self.w = ( + self.value[0, 0], + self.value[1, 0], + self.value[2, 0], + self.value[3, 0], + ) + self.arr = self.value.reshape((1, 4)) + + +# Math util +def normalize(v: Vec3d): + return Vec3d(*speedup.normalize(*v.arr)) + + +def dot_product(a: Vec3d, b: Vec3d): + return speedup.dot_product(*a.arr, *b.arr) + + +def cross_product(a: Vec3d, b: Vec3d): + return Vec3d(*speedup.cross_product(*a.arr, *b.arr)) + +BASE_LIGHT = 0.9 +def get_light_intensity(face) -> float: + # lights = [Vec3d(-2, 4, -10), Vec3d(10, 4, -2), Vec3d(8, 8, -8), Vec3d(0, 0, -8)] + lights = [Vec3d(-2, 4, -10)] + # lights = [] + + v1, v2, v3 = face + up = normalize(cross_product(v2 - v1, v3 - v1)) + intensity = BASE_LIGHT + for light in lights: + intensity += dot_product(up, normalize(light))*0.2 + return intensity + + +def look_at(eye: Vec3d, target: Vec3d, up: Vec3d = Vec3d(0, -1, 0)) -> Mat4d: + """ + http://www.songho.ca/opengl/gl_camera.html#lookat + + Args: + eye: 摄像机的世界坐标位置 + target: 观察点的位置 + up: 就是你想让摄像机立在哪个方向 + https://stackoverflow.com/questions/10635947/what-exactly-is-the-up-vector-in-opengls-lookat-function + 这里默认使用了 0, -1, 0, 因为 blender 导出来的模型数据似乎有问题,导致y轴总是反的,于是把摄像机的up也翻一下得了。 + """ + f = normalize(eye - target) + l = normalize(cross_product(up, f)) # noqa: E741 + u = cross_product(f, l) + + rotate_matrix = Mat4d( + [[l.x, l.y, l.z, 0], [u.x, u.y, u.z, 0], [f.x, f.y, f.z, 0], [0, 0, 0, 1.0]] + ) + translate_matrix = Mat4d( + [[1, 0, 0, -eye.x], [0, 1, 0, -eye.y], [0, 0, 1, -eye.z], [0, 0, 0, 1.0]] + ) + + return Mat4d(value=(rotate_matrix * translate_matrix).value) + + +def perspective_project(r, t, n, f, b=None, l=None): # noqa: E741 + """ + 目的: + 把相机坐标转换成投影在视网膜的范围在(-1, 1)的笛卡尔坐标 + + 原理: + 对于x,y坐标,相似三角形可以算出投影点的x,y + 对于z坐标,是假设了near是-1,far是1,然后带进去算的 + http://www.songho.ca/opengl/gl_projectionmatrix.html + https://www.scratchapixel.com/lessons/3d-basic-rendering/perspective-and-orthographic-projection-matrix/opengl-perspective-projection-matrix + + 推导出来的矩阵: + [ + 2n/(r-l) 0 (r+l/r-l) 0 + 0 2n/(t-b) (t+b)/(t-b) 0 + 0 0 -(f+n)/f-n (-2*f*n)/(f-n) + 0 0 -1 0 + ] + + 实际上由于我们用的视网膜(near pane)是个关于远点对称的矩形,所以矩阵简化为: + [ + n/r 0 0 0 + 0 n/t 0 0 + 0 0 -(f+n)/f-n (-2*f*n)/(f-n) + 0 0 -1 0 + ] + + Args: + r: right, t: top, n: near, f: far, b: bottom, l: left + """ + return Mat4d( + [ + [n / r, 0, 0, 0], + [0, n / t, 0, 0], + [0, 0, -(f + n) / (f - n), (-2 * f * n) / (f - n)], + [0, 0, -1, 0], + ] + ) + + +def draw(screen_vertices, world_vertices, model, canvas, wireframe=True): + """standard algorithm + """ + for triangle_indices in model.indices: + vertex_group = [screen_vertices[idx - 1] for idx in triangle_indices] + face = [Vec3d(world_vertices[idx - 1]) for idx in triangle_indices] + if wireframe: + draw_triangle(*vertex_group, canvas=canvas, color="black", wireframe=True) + else: + intensity = get_light_intensity(face) + if intensity > 0: + draw_triangle( + *vertex_group, canvas=canvas, color=(int(intensity * 255),) * 3 + ) + + +def draw_with_z_buffer(screen_vertices, world_vertices, model, canvas): + """ z-buffer algorithm + """ + intensities = [] + triangles = [] + for i, triangle_indices in enumerate(model.indices): + screen_triangle = [screen_vertices[idx - 1] for idx in triangle_indices] + uv_triangle = [model.uv_vertices[idx - 1] for idx in model.uv_indices[i]] + world_triangle = [Vec3d(world_vertices[idx - 1]) for idx in triangle_indices] + intensities.append(abs(get_light_intensity(world_triangle))) + # take off the class to let Cython work + triangles.append( + [np.append(screen_triangle[i].arr, uv_triangle[i]) for i in range(3)] + ) + + faces = speedup.generate_faces( + np.array(triangles, dtype=np.float64), model.texture_width, model.texture_height + ) + for face_dots in faces: + for dot in face_dots: + intensity = intensities[dot[0]] + u, v = dot[3], dot[4] + color = model.texture_array[u, v] + canvas.draw((dot[1], dot[2]), tuple(int(c * intensity) for c in color[:3])) + # TODO: add object rendering mode (no texture) + # canvas.draw((dot[1], dot[2]), (int(255 * intensity),) * 3) + + +def render(model, height, width, filename, cam_loc, wireframe=False): + """ + Args: + model: the Model object + height: cavas height + width: cavas width + picname: picture file name + """ + model_matrix = Mat4d([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) + # TODO: camera configration + view_matrix = look_at(Vec3d(cam_loc[0], cam_loc[1], cam_loc[2]), Vec3d(0, 0, 0)) + projection_matrix = perspective_project(0.5, 0.5, 3, 1000) + + world_vertices = [] + + def mvp(v): + world_vertex = model_matrix * v + world_vertices.append(Vec4d(world_vertex)) + return projection_matrix * view_matrix * world_vertex + + def ndc(v): + """ + 各个坐标同时除以 w,得到 NDC 坐标 + """ + v = v.value + w = v[3, 0] + x, y, z = v[0, 0] / w, v[1, 0] / w, v[2, 0] / w + return Mat4d([[x], [y], [z], [1 / w]]) + + def viewport(v): + x = y = 0 + w, h = width, height + n, f = 0.3, 1000 + return Vec3d( + w * 0.5 * v.value[0, 0] + x + w * 0.5, + h * 0.5 * v.value[1, 0] + y + h * 0.5, + 0.5 * (f - n) * v.value[2, 0] + 0.5 * (f + n), + ) + + # the render pipeline + screen_vertices = [viewport(ndc(mvp(v))) for v in model.vertices] + + with Canvas(filename, height, width) as canvas: + if wireframe: + draw(screen_vertices, world_vertices, model, canvas) + else: + draw_with_z_buffer(screen_vertices, world_vertices, model, canvas) + + render_img = canvas.add_white_border().copy() + return render_img \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/RAFTDecoder/vit.raft5.giant2.kitti.py b/external/Metric3D/training/mono/configs/RAFTDecoder/vit.raft5.giant2.kitti.py new file mode 100644 index 0000000000000000000000000000000000000000..5b6a7202ddeb34e49ca742282bab357bba5dc26d --- /dev/null +++ b/external/Metric3D/training/mono/configs/RAFTDecoder/vit.raft5.giant2.kitti.py @@ -0,0 +1,132 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_giant2_reg.dpt_raft.py', + + '../_base_/datasets/nyu.py', + '../_base_/datasets/kitti.py' + ] + +import numpy as np +model=dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=8, + n_downsample=2, + detach=False, + ), +) + +# loss method +losses=dict( + decoder_losses=[ + dict(type='VNLoss', sample_ratio=0.2, loss_weight=0.1), + dict(type='GRUSequenceLoss', loss_weight=1.0, loss_gamma=0.9, stereo_sup=0), + dict(type='DeNoConsistencyLoss', loss_weight=0.001, loss_fn='CEL', scale=2) + ], +) + +data_array = [ + + [ + dict(KITTI='KITTI_dataset'), + ], +] + + + +# configs of the canonical space +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0, 1), + depth_normalize=(0.1, 200), +# crop_size=(544, 1216), +# crop_size = (544, 992), + crop_size = (616, 1064), # %28 = 0 +) + +# online evaluation +# evaluation = dict(online_eval=True, interval=1000, metrics=['abs_rel', 'delta1', 'rmse'], multi_dataset_eval=True) +#log_interval = 100 + +interval = 4000 +log_interval = 100 +evaluation = dict( + online_eval=False, + interval=interval, + metrics=['abs_rel', 'delta1', 'rmse', 'normal_mean', 'normal_rmse', 'normal_a1'], + multi_dataset_eval=True, + exclude=['DIML_indoor', 'GL3D', 'Tourism', 'MegaDepth'], +) + +# save checkpoint during training, with '*_AMP' is employing the automatic mix precision training +checkpoint_config = dict(by_epoch=False, interval=interval) +runner = dict(type='IterBasedRunner_AMP', max_iters=20010) + +# optimizer +optimizer = dict( + type='AdamW', + encoder=dict(lr=5e-7, betas=(0.9, 0.999), weight_decay=0, eps=1e-10), + decoder=dict(lr=1e-5, betas=(0.9, 0.999), weight_decay=0, eps=1e-10), + strict_match = True +) +# schedule +lr_config = dict(policy='poly', + warmup='linear', + warmup_iters=20, + warmup_ratio=1e-6, + power=0.9, min_lr=1e-8, by_epoch=False) + +acc_batch = 1 +batchsize_per_gpu = 2 +thread_per_gpu = 2 + +KITTI_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) diff --git a/external/Metric3D/training/mono/configs/RAFTDecoder/vit.raft5.giant2.nyu.py b/external/Metric3D/training/mono/configs/RAFTDecoder/vit.raft5.giant2.nyu.py new file mode 100644 index 0000000000000000000000000000000000000000..c59676811aec1a05917adeca2c1f43a46e9bec88 --- /dev/null +++ b/external/Metric3D/training/mono/configs/RAFTDecoder/vit.raft5.giant2.nyu.py @@ -0,0 +1,136 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_giant2_reg.dpt_raft.py', + + '../_base_/datasets/nyu.py', + '../_base_/datasets/kitti.py' + ] + +import numpy as np +model=dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=8, + n_downsample=2, + detach=False, + ), +) + +# loss method +losses=dict( + decoder_losses=[ + dict(type='VNLoss', sample_ratio=0.2, loss_weight=1.0), + dict(type='GRUSequenceLoss', loss_weight=1.0, loss_gamma=0.9, stereo_sup=0), + dict(type='NormalBranchLoss', loss_weight=1.5, loss_fn='NLL_ours_GRU'), + dict(type='DeNoConsistencyLoss', loss_weight=0.001, loss_fn='CEL', scale=2), + dict(type='HDNRandomLoss', loss_weight=0.5, random_num=10), + dict(type='HDSNRandomLoss', loss_weight=0.5, random_num=20, batch_limit=4), + dict(type='PWNPlanesLoss', loss_weight=1), + ], +) + +data_array = [ + + [ + dict(NYU='NYU_dataset'), + ], +] + + + +# configs of the canonical space +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0, 1), + depth_normalize=(0.1, 200), +# crop_size=(544, 1216), +# crop_size = (544, 992), + crop_size = (616, 1064), # %28 = 0 +) + +# online evaluation +# evaluation = dict(online_eval=True, interval=1000, metrics=['abs_rel', 'delta1', 'rmse'], multi_dataset_eval=True) +#log_interval = 100 + +interval = 4000 +log_interval = 200 +evaluation = dict( + online_eval=False, + interval=interval, + metrics=['abs_rel', 'delta1', 'rmse', 'normal_mean', 'normal_rmse', 'normal_a1'], + multi_dataset_eval=True, + exclude=['DIML_indoor', 'GL3D', 'Tourism', 'MegaDepth'], +) + +# save checkpoint during training, with '*_AMP' is employing the automatic mix precision training +checkpoint_config = dict(by_epoch=False, interval=interval) +runner = dict(type='IterBasedRunner_AMP', max_iters=20010) + +# optimizer +optimizer = dict( + type='AdamW', + encoder=dict(lr=5e-7, betas=(0.9, 0.999), weight_decay=0, eps=1e-10), + decoder=dict(lr=1e-5, betas=(0.9, 0.999), weight_decay=0, eps=1e-10), + strict_match = True +) +# schedule +lr_config = dict(policy='poly', + warmup='linear', + warmup_iters=20, + warmup_ratio=1e-6, + power=0.9, min_lr=1e-8, by_epoch=False) + +acc_batch = 1 +batchsize_per_gpu = 2 +thread_per_gpu = 2 + +NYU_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) diff --git a/external/Metric3D/training/mono/configs/RAFTDecoder/vit.raft5.giant2.py b/external/Metric3D/training/mono/configs/RAFTDecoder/vit.raft5.giant2.py new file mode 100644 index 0000000000000000000000000000000000000000..fef5d6177d199f8f2c5b03b254b74d47d6c34bc2 --- /dev/null +++ b/external/Metric3D/training/mono/configs/RAFTDecoder/vit.raft5.giant2.py @@ -0,0 +1,1048 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_giant2_reg.dpt_raft.py', + + '../_base_/datasets/ddad.py', + '../_base_/datasets/_data_base_.py', + '../_base_/datasets/argovers2.py', + '../_base_/datasets/cityscapes.py', + '../_base_/datasets/drivingstereo.py', + '../_base_/datasets/dsec.py', + '../_base_/datasets/lyft.py', + '../_base_/datasets/mapillary_psd.py', + '../_base_/datasets/diml.py', + '../_base_/datasets/taskonomy.py', + '../_base_/datasets/uasol.py', + '../_base_/datasets/pandaset.py', + '../_base_/datasets/waymo.py', + + '../_base_/default_runtime.py', + '../_base_/schedules/schedule_1m.py', + + '../_base_/datasets/hm3d.py', + '../_base_/datasets/matterport3d.py', + '../_base_/datasets/replica.py', + '../_base_/datasets/vkitti.py', + ] + +import numpy as np +model=dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=8, + n_downsample=2, + detach=False, + ), +) + +# loss method +losses=dict( + decoder_losses=[ + dict(type='VNLoss', sample_ratio=0.2, loss_weight=1.0), + dict(type='GRUSequenceLoss', loss_weight=0.5, loss_gamma=0.9, stereo_sup=0.0), + dict(type='SkyRegularizationLoss', loss_weight=0.001, sample_ratio=0.4, regress_value=200, normal_regress=[0, 0, -1]), + dict(type='HDNRandomLoss', loss_weight=0.5, random_num=10), + dict(type='HDSNRandomLoss', loss_weight=0.5, random_num=20, batch_limit=4), + dict(type='PWNPlanesLoss', loss_weight=1), + dict(type='NormalBranchLoss', loss_weight=1.5, loss_fn='NLL_ours_GRU'), + dict(type='DeNoConsistencyLoss', loss_weight=0.01, loss_fn='CEL', scale=2, depth_detach=True) + ], + gru_losses=[ + dict(type='SkyRegularizationLoss', loss_weight=0.001, sample_ratio=0.4, regress_value=200, normal_regress=[0, 0, -1]), + ], +) + +data_array = [ + # Outdoor 1 + [ + dict(UASOL='UASOL_dataset'), #13.6w + dict(Cityscapes_trainextra='Cityscapes_dataset'), #1.8w + dict(Cityscapes_sequence='Cityscapes_dataset'), #13.5w + dict(DIML='DIML_dataset'), # 12.2w + dict(Waymo='Waymo_dataset'), # 99w + ], + # Outdoor 2 + [ + dict(DSEC='DSEC_dataset'), + dict(Mapillary_PSD='MapillaryPSD_dataset'), # 74.2w + dict(DrivingStereo='DrivingStereo_dataset'), # 17.6w + dict(Argovers2='Argovers2_dataset'), # 285.6w + ], + # Outdoor 3 + [ + dict(Lyft='Lyft_dataset'), #15.8w + dict(DDAD='DDAD_dataset'), #7.4w + dict(Pandaset='Pandaset_dataset'), #3.8w + dict(Virtual_KITTI='VKITTI_dataset'), # 3.7w # syn + ], + #Indoor 1 + [ + dict(Replica='Replica_dataset'), # 5.6w # syn + dict(Replica_gso='Replica_dataset'), # 10.7w # syn + dict(Hypersim='Hypersim_dataset'), # 2.4w + dict(ScanNetAll='ScanNetAll_dataset'), + ], + # Indoor 2 + [ + dict(Taskonomy='Taskonomy_dataset'), #447.2w + dict(Matterport3D='Matterport3D_dataset'), #14.4w + dict(HM3D='HM3D_dataset'), # 200w, very noisy, sampled some data + ], +] + + + +# configs of the canonical space +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0, 1), + depth_normalize=(0.1, 200), +# crop_size=(544, 1216), +# crop_size = (544, 992), + crop_size = (616, 1064), # %28 = 0 +) + +log_interval = 100 +acc_batch = 1 +# online evaluation +# evaluation = dict(online_eval=True, interval=1000, metrics=['abs_rel', 'delta1', 'rmse'], multi_dataset_eval=True) +interval = 40000 +evaluation = dict( + online_eval=False, + interval=interval, + metrics=['abs_rel', 'delta1', 'rmse', 'normal_mean', 'normal_rmse', 'normal_a1'], + multi_dataset_eval=True, + exclude=['DIML_indoor', 'GL3D', 'Tourism', 'MegaDepth'], +) + +# save checkpoint during training, with '*_AMP' is employing the automatic mix precision training +checkpoint_config = dict(by_epoch=False, interval=interval) +runner = dict(type='IterBasedRunner_AMP', max_iters=800010) + +# optimizer +optimizer = dict( + type='AdamW', +# encoder=dict(lr=1e-4, betas=(0.9, 0.999), weight_decay=0.01, eps=1e-6), + encoder=dict(lr=8e-6, betas=(0.9, 0.999), weight_decay=1e-3, eps=1e-6), + decoder=dict(lr=1e-4, betas=(0.9, 0.999), weight_decay=0.01, eps=1e-6), + #strict_match=True +) +# schedule +lr_config = dict(policy='poly', + warmup='linear', + warmup_iters=1000, + warmup_ratio=1e-6, + power=0.9, min_lr=1e-6, by_epoch=False) + +batchsize_per_gpu = 3 +thread_per_gpu = 1 + +Argovers2_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Cityscapes_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +DIML_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Lyft_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +DDAD_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + # sample_size = 1200, + ), + )) +DSEC_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +DrivingStereo_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +MapillaryPSD_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Pandaset_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Taskonomy_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +UASOL_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Waymo_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Matterport3D_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Replica_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +VKITTI_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +HM3D_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.75, 1.3), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +BlendedMVG_omni_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.75, 1.3), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + ), + )) +ScanNetAll_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Hypersim_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/RAFTDecoder/vit.raft5.large.kitti.py b/external/Metric3D/training/mono/configs/RAFTDecoder/vit.raft5.large.kitti.py new file mode 100644 index 0000000000000000000000000000000000000000..7870c9760a79a2634542a188cccfe7fc0571bab1 --- /dev/null +++ b/external/Metric3D/training/mono/configs/RAFTDecoder/vit.raft5.large.kitti.py @@ -0,0 +1,132 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_large_reg.dpt_raft.py', + + '../_base_/datasets/nyu.py', + '../_base_/datasets/kitti.py' + ] + +import numpy as np +model=dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=8, + n_downsample=2, + detach=False, + ), +) + +# loss method +losses=dict( + decoder_losses=[ + dict(type='VNLoss', sample_ratio=0.2, loss_weight=0.1), + dict(type='GRUSequenceLoss', loss_weight=1.0, loss_gamma=0.9, stereo_sup=0), + dict(type='DeNoConsistencyLoss', loss_weight=0.001, loss_fn='CEL', scale=2) + ], +) + +data_array = [ + + [ + dict(KITTI='KITTI_dataset'), + ], +] + + + +# configs of the canonical space +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0, 1), + depth_normalize=(0.1, 200), +# crop_size=(544, 1216), +# crop_size = (544, 992), + crop_size = (616, 1064), # %28 = 0 +) + +# online evaluation +# evaluation = dict(online_eval=True, interval=1000, metrics=['abs_rel', 'delta1', 'rmse'], multi_dataset_eval=True) +#log_interval = 100 + +interval = 4000 +log_interval = 100 +evaluation = dict( + online_eval=False, + interval=interval, + metrics=['abs_rel', 'delta1', 'rmse', 'normal_mean', 'normal_rmse', 'normal_a1'], + multi_dataset_eval=True, + exclude=['DIML_indoor', 'GL3D', 'Tourism', 'MegaDepth'], +) + +# save checkpoint during training, with '*_AMP' is employing the automatic mix precision training +checkpoint_config = dict(by_epoch=False, interval=interval) +runner = dict(type='IterBasedRunner_AMP', max_iters=20010) + +# optimizer +optimizer = dict( + type='AdamW', + encoder=dict(lr=5e-7, betas=(0.9, 0.999), weight_decay=0, eps=1e-10), + decoder=dict(lr=1e-5, betas=(0.9, 0.999), weight_decay=0, eps=1e-10), + strict_match = True +) +# schedule +lr_config = dict(policy='poly', + warmup='linear', + warmup_iters=20, + warmup_ratio=1e-6, + power=0.9, min_lr=1e-8, by_epoch=False) + +acc_batch = 1 +batchsize_per_gpu = 2 +thread_per_gpu = 2 + +KITTI_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) diff --git a/external/Metric3D/training/mono/configs/RAFTDecoder/vit.raft5.large.py b/external/Metric3D/training/mono/configs/RAFTDecoder/vit.raft5.large.py new file mode 100644 index 0000000000000000000000000000000000000000..645d24d76e2078bb3806b0bc9d68c0b4add814aa --- /dev/null +++ b/external/Metric3D/training/mono/configs/RAFTDecoder/vit.raft5.large.py @@ -0,0 +1,1047 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_large_reg.dpt_raft.py', + + '../_base_/datasets/ddad.py', + '../_base_/datasets/_data_base_.py', + '../_base_/datasets/argovers2.py', + '../_base_/datasets/cityscapes.py', + '../_base_/datasets/drivingstereo.py', + '../_base_/datasets/dsec.py', + '../_base_/datasets/lyft.py', + '../_base_/datasets/mapillary_psd.py', + '../_base_/datasets/diml.py', + '../_base_/datasets/taskonomy.py', + '../_base_/datasets/uasol.py', + '../_base_/datasets/pandaset.py', + '../_base_/datasets/waymo.py', + + '../_base_/default_runtime.py', + '../_base_/schedules/schedule_1m.py', + + '../_base_/datasets/hm3d.py', + '../_base_/datasets/matterport3d.py', + '../_base_/datasets/replica.py', + '../_base_/datasets/vkitti.py', + ] + +import numpy as np +model=dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=8, + n_downsample=2, + detach=False, + ), +) + +# loss method +losses=dict( + decoder_losses=[ + dict(type='VNLoss', sample_ratio=0.2, loss_weight=1.0), + dict(type='GRUSequenceLoss', loss_weight=0.5, loss_gamma=0.9, stereo_sup=0.0), + dict(type='SkyRegularizationLoss', loss_weight=0.001, sample_ratio=0.4, regress_value=200, normal_regress=[0, 0, -1]), + dict(type='HDNRandomLoss', loss_weight=0.5, random_num=10), + dict(type='HDSNRandomLoss', loss_weight=0.5, random_num=20, batch_limit=4), + dict(type='PWNPlanesLoss', loss_weight=1), + dict(type='NormalBranchLoss', loss_weight=1.0, loss_fn='NLL_ours_GRU'), + dict(type='DeNoConsistencyLoss', loss_weight=0.01, loss_fn='CEL', scale=2, depth_detach=True) + ], + gru_losses=[ + dict(type='SkyRegularizationLoss', loss_weight=0.001, sample_ratio=0.4, regress_value=200, normal_regress=[0, 0, -1]), + ], +) + +data_array = [ + # Outdoor 1 + [ + dict(UASOL='UASOL_dataset'), #13.6w + dict(Cityscapes_trainextra='Cityscapes_dataset'), #1.8w + dict(Cityscapes_sequence='Cityscapes_dataset'), #13.5w + dict(DIML='DIML_dataset'), # 12.2w + dict(Waymo='Waymo_dataset'), # 99w + ], + # Outdoor 2 + [ + dict(DSEC='DSEC_dataset'), + dict(Mapillary_PSD='MapillaryPSD_dataset'), # 74.2w + dict(DrivingStereo='DrivingStereo_dataset'), # 17.6w + dict(Argovers2='Argovers2_dataset'), # 285.6w + ], + # Outdoor 3 + [ + dict(Lyft='Lyft_dataset'), #15.8w + dict(DDAD='DDAD_dataset'), #7.4w + dict(Pandaset='Pandaset_dataset'), #3.8w + dict(Virtual_KITTI='VKITTI_dataset'), # 3.7w # syn + ], + #Indoor 1 + [ + dict(Replica='Replica_dataset'), # 5.6w # syn + dict(Replica_gso='Replica_dataset'), # 10.7w # syn + dict(Hypersim='Hypersim_dataset'), # 2.4w + dict(ScanNetAll='ScanNetAll_dataset'), + ], + # Indoor 2 + [ + dict(Taskonomy='Taskonomy_dataset'), #447.2w + dict(Matterport3D='Matterport3D_dataset'), #14.4w + dict(HM3D='HM3D_dataset'), # 200w, very noisy, sampled some data + ], +] + + + +# configs of the canonical space +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0, 1), + depth_normalize=(0.1, 200), +# crop_size=(544, 1216), +# crop_size = (544, 992), + crop_size = (616, 1064), # %28 = 0 +) + +log_interval = 100 +# online evaluation +# evaluation = dict(online_eval=True, interval=1000, metrics=['abs_rel', 'delta1', 'rmse'], multi_dataset_eval=True) +interval = 20000 +evaluation = dict( + #online_eval=True, + online_eval=False, + interval=interval, + metrics=['abs_rel', 'delta1', 'rmse', 'normal_mean', 'normal_rmse', 'normal_a1'], + multi_dataset_eval=True, + exclude=['DIML_indoor', 'GL3D', 'Tourism', 'MegaDepth'], +) + +# save checkpoint during training, with '*_AMP' is employing the automatic mix precision training +checkpoint_config = dict(by_epoch=False, interval=interval) +runner = dict(type='IterBasedRunner_AMP', max_iters=800010) + +# optimizer +optimizer = dict( + type='AdamW', +# encoder=dict(lr=1e-4, betas=(0.9, 0.999), weight_decay=0.01, eps=1e-6), + encoder=dict(lr=1e-5, betas=(0.9, 0.999), weight_decay=1e-3, eps=1e-6), + decoder=dict(lr=1e-4, betas=(0.9, 0.999), weight_decay=0.01, eps=1e-6), +) +# schedule +lr_config = dict(policy='poly', + warmup='linear', + warmup_iters=500, + warmup_ratio=1e-6, + power=0.9, min_lr=1e-6, by_epoch=False) + +batchsize_per_gpu = 4 +thread_per_gpu = 4 + +Argovers2_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Cityscapes_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +DIML_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Lyft_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +DDAD_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + # sample_size = 1200, + ), + )) +DSEC_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +DrivingStereo_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +MapillaryPSD_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Pandaset_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Taskonomy_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +UASOL_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Waymo_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Matterport3D_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Replica_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +VKITTI_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +HM3D_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.75, 1.3), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +BlendedMVG_omni_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.75, 1.3), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + ), + )) +ScanNetAll_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Hypersim_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/RAFTDecoder/vit.raft5.small.py b/external/Metric3D/training/mono/configs/RAFTDecoder/vit.raft5.small.py new file mode 100644 index 0000000000000000000000000000000000000000..484e1df74f598faf4bd08c9698ab512f92ebb3f5 --- /dev/null +++ b/external/Metric3D/training/mono/configs/RAFTDecoder/vit.raft5.small.py @@ -0,0 +1,1047 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_small_reg.dpt_raft.py', + + '../_base_/datasets/ddad.py', + '../_base_/datasets/_data_base_.py', + '../_base_/datasets/argovers2.py', + '../_base_/datasets/cityscapes.py', + '../_base_/datasets/drivingstereo.py', + '../_base_/datasets/dsec.py', + '../_base_/datasets/lyft.py', + '../_base_/datasets/mapillary_psd.py', + '../_base_/datasets/diml.py', + '../_base_/datasets/taskonomy.py', + '../_base_/datasets/uasol.py', + '../_base_/datasets/pandaset.py', + '../_base_/datasets/waymo.py', + + '../_base_/default_runtime.py', + '../_base_/schedules/schedule_1m.py', + + '../_base_/datasets/hm3d.py', + '../_base_/datasets/matterport3d.py', + '../_base_/datasets/replica.py', + '../_base_/datasets/vkitti.py', + ] + +import numpy as np +model=dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=4, + n_downsample=2, + detach=False, + ), +) + +# loss method +losses=dict( + decoder_losses=[ + dict(type='VNLoss', sample_ratio=0.2, loss_weight=1.0), + dict(type='GRUSequenceLoss', loss_weight=0.5, loss_gamma=0.9, stereo_sup=0.0), + dict(type='SkyRegularizationLoss', loss_weight=0.001, sample_ratio=0.4, regress_value=200, normal_regress=[0, 0, -1]), + dict(type='HDNRandomLoss', loss_weight=0.5, random_num=10), + dict(type='HDSNRandomLoss', loss_weight=0.5, random_num=20, batch_limit=4), + dict(type='PWNPlanesLoss', loss_weight=1), + dict(type='NormalBranchLoss', loss_weight=1.0, loss_fn='NLL_ours_GRU'), + dict(type='DeNoConsistencyLoss', loss_weight=0.01, loss_fn='CEL', scale=2, depth_detach=True) + ], + gru_losses=[ + dict(type='SkyRegularizationLoss', loss_weight=0.001, sample_ratio=0.4, regress_value=200, normal_regress=[0, 0, -1]), + ], +) + +data_array = [ + # Outdoor 1 + [ + dict(UASOL='UASOL_dataset'), #13.6w + dict(Cityscapes_trainextra='Cityscapes_dataset'), #1.8w + dict(Cityscapes_sequence='Cityscapes_dataset'), #13.5w + dict(DIML='DIML_dataset'), # 12.2w + dict(Waymo='Waymo_dataset'), # 99w + ], + # Outdoor 2 + [ + dict(DSEC='DSEC_dataset'), + dict(Mapillary_PSD='MapillaryPSD_dataset'), # 74.2w + dict(DrivingStereo='DrivingStereo_dataset'), # 17.6w + dict(Argovers2='Argovers2_dataset'), # 285.6w + ], + # Outdoor 3 + [ + dict(Lyft='Lyft_dataset'), #15.8w + dict(DDAD='DDAD_dataset'), #7.4w + dict(Pandaset='Pandaset_dataset'), #3.8w + dict(Virtual_KITTI='VKITTI_dataset'), # 3.7w # syn + ], + #Indoor 1 + [ + dict(Replica='Replica_dataset'), # 5.6w # syn + dict(Replica_gso='Replica_dataset'), # 10.7w # syn + dict(Hypersim='Hypersim_dataset'), # 2.4w + dict(ScanNetAll='ScanNetAll_dataset'), + ], + # Indoor 2 + [ + dict(Taskonomy='Taskonomy_dataset'), #447.2w + dict(Matterport3D='Matterport3D_dataset'), #14.4w + dict(HM3D='HM3D_dataset'), # 200w, very noisy, sampled some data + ], +] + + + +# configs of the canonical space +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0, 1), + depth_normalize=(0.1, 200), +# crop_size=(544, 1216), +# crop_size = (544, 992), + crop_size = (616, 1064), # %28 = 0 +) + +log_interval = 100 +# online evaluation +# evaluation = dict(online_eval=True, interval=1000, metrics=['abs_rel', 'delta1', 'rmse'], multi_dataset_eval=True) +interval = 20000 +evaluation = dict( + #online_eval=True, + online_eval=False, + interval=interval, + metrics=['abs_rel', 'delta1', 'rmse', 'normal_mean', 'normal_rmse', 'normal_a1'], + multi_dataset_eval=True, + exclude=['DIML_indoor', 'GL3D', 'Tourism', 'MegaDepth'], +) + +# save checkpoint during training, with '*_AMP' is employing the automatic mix precision training +checkpoint_config = dict(by_epoch=False, interval=interval) +runner = dict(type='IterBasedRunner_AMP', max_iters=800010) + +# optimizer +optimizer = dict( + type='AdamW', +# encoder=dict(lr=1e-4, betas=(0.9, 0.999), weight_decay=0.01, eps=1e-6), + encoder=dict(lr=1e-5, betas=(0.9, 0.999), weight_decay=1e-3, eps=1e-6), + decoder=dict(lr=1e-4, betas=(0.9, 0.999), weight_decay=0.01, eps=1e-6), +) +# schedule +lr_config = dict(policy='poly', + warmup='linear', + warmup_iters=500, + warmup_ratio=1e-6, + power=0.9, min_lr=1e-6, by_epoch=False) + +batchsize_per_gpu = 6 +thread_per_gpu = 4 + +Argovers2_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Cityscapes_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +DIML_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Lyft_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +DDAD_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + # sample_size = 1200, + ), + )) +DSEC_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +DrivingStereo_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +MapillaryPSD_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Pandaset_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Taskonomy_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +UASOL_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Waymo_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Matterport3D_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Replica_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +VKITTI_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +HM3D_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.75, 1.3), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +BlendedMVG_omni_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.75, 1.3), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + ), + )) +ScanNetAll_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Hypersim_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/RAFTDecoder/vit.raft5.small.sanity_check.py b/external/Metric3D/training/mono/configs/RAFTDecoder/vit.raft5.small.sanity_check.py new file mode 100644 index 0000000000000000000000000000000000000000..a882418caeeb35a0778c526ed81a771306a775db --- /dev/null +++ b/external/Metric3D/training/mono/configs/RAFTDecoder/vit.raft5.small.sanity_check.py @@ -0,0 +1,1014 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_small_reg.dpt_raft.py', + + '../_base_/datasets/ddad.py', + '../_base_/datasets/_data_base_.py', + '../_base_/datasets/argovers2.py', + '../_base_/datasets/cityscapes.py', + '../_base_/datasets/drivingstereo.py', + '../_base_/datasets/dsec.py', + '../_base_/datasets/lyft.py', + '../_base_/datasets/mapillary_psd.py', + '../_base_/datasets/diml.py', + '../_base_/datasets/taskonomy.py', + '../_base_/datasets/uasol.py', + '../_base_/datasets/pandaset.py', + '../_base_/datasets/waymo.py', + + '../_base_/default_runtime.py', + '../_base_/schedules/schedule_1m.py', + + '../_base_/datasets/hm3d.py', + '../_base_/datasets/matterport3d.py', + '../_base_/datasets/replica.py', + '../_base_/datasets/vkitti.py', + ] + +import numpy as np +model=dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=4, + n_downsample=2, + detach=False, + ), +) + +# loss method +losses=dict( + decoder_losses=[ + dict(type='VNLoss', sample_ratio=0.2, loss_weight=1.0), + dict(type='GRUSequenceLoss', loss_weight=0.5, loss_gamma=0.9, stereo_sup=0.0), + dict(type='SkyRegularizationLoss', loss_weight=0.001, sample_ratio=0.4, regress_value=200, normal_regress=[0, 0, -1]), + dict(type='HDNRandomLoss', loss_weight=0.5, random_num=10), + dict(type='HDSNRandomLoss', loss_weight=0.5, random_num=20, batch_limit=4), + dict(type='PWNPlanesLoss', loss_weight=1), + dict(type='NormalBranchLoss', loss_weight=1.0, loss_fn='NLL_ours_GRU'), + dict(type='DeNoConsistencyLoss', loss_weight=0.01, loss_fn='CEL', scale=2, depth_detach=True) + ], + gru_losses=[ + dict(type='SkyRegularizationLoss', loss_weight=0.001, sample_ratio=0.4, regress_value=200, normal_regress=[0, 0, -1]), + ], +) + +data_array = [ + [ + dict(Matterport3D='Matterport3D_dataset'), #14.4w + ], +] + + + +# configs of the canonical space +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0, 1), + depth_normalize=(0.1, 200), +# crop_size=(544, 1216), +# crop_size = (544, 992), + crop_size = (616, 1064), # %28 = 0 +) + +log_interval = 100 +# online evaluation +# evaluation = dict(online_eval=True, interval=1000, metrics=['abs_rel', 'delta1', 'rmse'], multi_dataset_eval=True) +interval = 20000 +evaluation = dict( + #online_eval=True, + online_eval=False, + interval=interval, + metrics=['abs_rel', 'delta1', 'rmse', 'normal_mean', 'normal_rmse', 'normal_a1'], + multi_dataset_eval=True, +) + +# save checkpoint during training, with '*_AMP' is employing the automatic mix precision training +checkpoint_config = dict(by_epoch=False, interval=interval) +runner = dict(type='IterBasedRunner_AMP', max_iters=800010) + +# optimizer +optimizer = dict( + type='AdamW', +# encoder=dict(lr=1e-4, betas=(0.9, 0.999), weight_decay=0.01, eps=1e-6), + encoder=dict(lr=1e-5, betas=(0.9, 0.999), weight_decay=1e-3, eps=1e-6), + decoder=dict(lr=1e-4, betas=(0.9, 0.999), weight_decay=0.01, eps=1e-6), +) +# schedule +lr_config = dict(policy='poly', + warmup='linear', + warmup_iters=500, + warmup_ratio=1e-6, + power=0.9, min_lr=1e-6, by_epoch=False) + +batchsize_per_gpu = 3 +thread_per_gpu = 4 + +Argovers2_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Cityscapes_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +DIML_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Lyft_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +DDAD_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + # sample_size = 1200, + ), + )) +DSEC_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +DrivingStereo_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +MapillaryPSD_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Pandaset_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Taskonomy_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +UASOL_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Waymo_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=True), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Matterport3D_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Replica_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +VKITTI_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +HM3D_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.75, 1.3), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +BlendedMVG_omni_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.75, 1.3), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + ), + )) +ScanNetAll_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) +Hypersim_dataset=dict( + data = dict( + train=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomResize', + prob=0.5, + ratio_range=(0.85, 1.15), + is_lidar=False), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.05), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + #sample_size = 10000, + ), + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_size = 1200, + ), + )) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/7scenes.py b/external/Metric3D/training/mono/configs/_base_/datasets/7scenes.py new file mode 100644 index 0000000000000000000000000000000000000000..2d2e42a9bdd2c9e8c2ffb8a6f637c617e978b875 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/7scenes.py @@ -0,0 +1,83 @@ +# dataset settings +# data will resized/cropped to the canonical size, refer to ._data_base_.py + +SevenScenes_dataset=dict( + lib = 'SevenScenesDataset', + data_root = 'data/public_datasets', + data_name = '7Scenes', + transfer_to_canonical = True, + metric_scale = 1000.0, + original_focal_length = 500, + original_size = (480, 640), + data_type='denselidar', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='ETH3D/annotations/test_annotations_new.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='ETH3D/annotations/test_annotations_new.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='AdjustSize', + # ignore_label=-1, + # padding=[123.675, 116.28, 103.53]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 20,), + # configs for the training pipeline + test=dict( + anno_path='ETH3D/annotations/test_annotations_new.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[123.675, 116.28, 103.53]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + ), +) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/_data_base_.py b/external/Metric3D/training/mono/configs/_base_/datasets/_data_base_.py new file mode 100644 index 0000000000000000000000000000000000000000..7f1d339ad89ad1c9a0fec6c5bee928a2462b2eb1 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/_data_base_.py @@ -0,0 +1,12 @@ +# canonical camera setting and basic data setting + +data_basic=dict( + canonical_space = dict( + img_size=(540, 960), + focal_length=1196.0, + ), + depth_range=(0.9, 150), + depth_normalize=(0.006, 1.001), + crop_size = (512, 960), + clip_depth_range=(0.1, 200), +) diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/argovers2.py b/external/Metric3D/training/mono/configs/_base_/datasets/argovers2.py new file mode 100644 index 0000000000000000000000000000000000000000..158841701fa3cf2ddbb8092f9d6992dc760d4735 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/argovers2.py @@ -0,0 +1,74 @@ +# dataset settings + +Argovers2_dataset=dict( + lib = 'Argovers2Dataset', + data_root = 'data/public_datasets', + data_name = 'Argovers2', + transfer_to_canonical = True, + metric_scale = 200.0, + original_focal_length = (1688.844624443858, 1776.8498213965734), + original_size = (1550, 2048), + data_type='lidar', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='Argovers2/annotations/train_annotations_wneigh.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='LiDarResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='Argovers2/annotations/val_annotations_wneigh.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 20,), + # configs for the training pipeline + test=dict( + anno_path='Argovers2/annotations/test_annotations_wneigh.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 6000,), + ), +) diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/blended_mvg.py b/external/Metric3D/training/mono/configs/_base_/datasets/blended_mvg.py new file mode 100644 index 0000000000000000000000000000000000000000..4ee6b8dce6c132dc9293dc7319517e56fe315f43 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/blended_mvg.py @@ -0,0 +1,78 @@ +# dataset settings +# data will resized/cropped to the canonical size, refer to ._data_base_.py + +BlendedMVG_omni_dataset=dict( + lib = 'BlendedMVGOmniDataset', + data_root = 'data/public_datasets', + data_name = 'BlendedMVG_omni', + transfer_to_canonical = True, + metric_scale = 512.0, + original_focal_length = 575.6656, + original_size = (576, 768), + data_type='denselidar_nometric', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='BlendedMVG/annotations/train.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.05,), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 50)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='BlendedMVG/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[123.675, 116.28, 103.53]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 5,), + # configs for the training pipeline + test=dict( + anno_path='BlendedMVG/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[123.675, 116.28, 103.53]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[123.675, 116.28, 103.53]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + ), +) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/cityscapes.py b/external/Metric3D/training/mono/configs/_base_/datasets/cityscapes.py new file mode 100644 index 0000000000000000000000000000000000000000..ff3721ce6751bf159cc929351902730adccedec0 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/cityscapes.py @@ -0,0 +1,79 @@ +# dataset settings + +Cityscapes_dataset=dict( + lib = 'CityscapesDataset', + data_root = 'data/public_datasets', + data_name = 'Cityscapes', + transfer_to_canonical = True, + metric_scale = 200.0, + original_focal_length = (2263.9108952994275, 2263.9108952994275), + original_size = (1024, 2048), + data_type='stereo', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='Cityscapes_sequence/annotations/train.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='Cityscapes_sequence/annotations/val.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 20,), + # configs for the training pipeline + test=dict( + anno_path='Cityscapes_sequence/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[123.675, 116.28, 103.53]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + ), +) diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/ddad.py b/external/Metric3D/training/mono/configs/_base_/datasets/ddad.py new file mode 100644 index 0000000000000000000000000000000000000000..522dc563fb639d3254eb116f247aecdce0e79c7d --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/ddad.py @@ -0,0 +1,80 @@ +# dataset settings + +DDAD_dataset=dict( + lib = 'DDADDataset', + data_root = 'data/public_datasets', + data_name = 'DDAD', + transfer_to_canonical = True, + metric_scale = 200.0, + original_focal_length = (2181, 1060), + original_size = (1216, 1936), + data_type='lidar', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='DDAD/annotations/train_annotations.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='LiDarResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='DDAD/annotations/val_annotations.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 20,), + # configs for the training pipeline + test=dict( + anno_path='DDAD/annotations/test_annotations.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + # dict(type='LabelScaleCononical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), #(1216, 1952), # + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[123.675, 116.28, 103.53]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 800,), + ), +) diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/ddad_any.py b/external/Metric3D/training/mono/configs/_base_/datasets/ddad_any.py new file mode 100644 index 0000000000000000000000000000000000000000..3dc24d84df26cd4b778f21ab65775abd453853d1 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/ddad_any.py @@ -0,0 +1,79 @@ +# dataset settings + +DDADAny_dataset=dict( + lib = 'AnyDataset', + data_root = 'data/public_datasets', + data_name = 'DDAD', + transfer_to_canonical = True, + metric_scale = 200.0, + original_focal_length = (2181, 1060), + original_size = (1216, 1936), + data_type='lidar', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='DDAD/annotations/train_annotations.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='LiDarResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='DDAD/annotations/val_annotations.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 20,), + # configs for the training pipeline + test=dict( + anno_path='DDAD/annotations/test_annotations.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 6000,), + ), +) diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/diml.py b/external/Metric3D/training/mono/configs/_base_/datasets/diml.py new file mode 100644 index 0000000000000000000000000000000000000000..71fe2a7741f9a0871b184eb722f3906bd7860202 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/diml.py @@ -0,0 +1,79 @@ +# dataset settings + +DIML_dataset=dict( + lib = 'DIMLDataset', + data_root = 'data/public_datasets', + data_name = 'DIML', + transfer_to_canonical = True, + metric_scale = 200.0, + original_focal_length = (1398.402, ), + original_size = (1080, 1920), + data_type='stereo', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='DIML/annotations/train.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='DIML/annotations/val.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 20,), + # configs for the training pipeline + test=dict( + anno_path='DIML/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[123.675, 116.28, 103.53]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + ), +) diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/diml_indoor.py b/external/Metric3D/training/mono/configs/_base_/datasets/diml_indoor.py new file mode 100644 index 0000000000000000000000000000000000000000..6c2721effc6317c402c289a803dfa591b440970e --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/diml_indoor.py @@ -0,0 +1,76 @@ +# dataset settings + +DIML_indoor_dataset=dict( + lib = 'DIMLDataset', + data_root = 'data/public_datasets', + data_name = 'DIML_indoor', + metric_scale = 1000.0, + data_type='stereo_nocamera', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='DIML/annotations/train.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='DIML/annotations/val.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 20,), + # configs for the training pipeline + test=dict( + anno_path='DIML/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[123.675, 116.28, 103.53]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + ), +) diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/diode.py b/external/Metric3D/training/mono/configs/_base_/datasets/diode.py new file mode 100644 index 0000000000000000000000000000000000000000..c6a8de74e6f3101e7d9a39721dbe6eb132c68eed --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/diode.py @@ -0,0 +1,80 @@ +# dataset settings +# data will resized/cropped to the canonical size, refer to ._data_base_.py + +DIODE_dataset=dict( + lib = 'DIODEDataset', + data_root = 'data/public_datasets', + data_name = 'DIODE', + transfer_to_canonical = True, + metric_scale = 1.0, + original_focal_length = 886.81, + original_size = (764, 1024), + data_type='denselidar', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='DIODE/annotations/train.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='DIODE/annotations/val.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 50,), + # configs for the training pipeline + test=dict( + anno_path='DIODE/annotations/test_annotations_new.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[123.675, 116.28, 103.53]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + ), +) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/drivingstereo.py b/external/Metric3D/training/mono/configs/_base_/datasets/drivingstereo.py new file mode 100644 index 0000000000000000000000000000000000000000..2f770a7adb692a28dd621eb174361cd46e13d20a --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/drivingstereo.py @@ -0,0 +1,79 @@ +# dataset settings + +DrivingStereo_dataset=dict( + lib = 'DrivingStereoDataset', + data_root = 'data/public_datasets', + data_name = 'DrivingStereo', + transfer_to_canonical = True, + metric_scale = 256.0, + original_focal_length = (1006.938, 1003.556), + original_size = (400, 881), + data_type='lidar', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='DrivingStereo/annotations/train_annotations.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='LiDarResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='DrivingStereo/annotations/val_annotations.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 20,), + # configs for the training pipeline + test=dict( + anno_path='DrivingStereo/annotations/test_annotations.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[123.675, 116.28, 103.53]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + ), +) diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/dsec.py b/external/Metric3D/training/mono/configs/_base_/datasets/dsec.py new file mode 100644 index 0000000000000000000000000000000000000000..5d1bbcd05f6194f583d39d7b26193860f966faf8 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/dsec.py @@ -0,0 +1,79 @@ +# dataset settings + +DSEC_dataset=dict( + lib = 'DSECDataset', + data_root = 'data/public_datasets', + data_name = 'DSEC', + transfer_to_canonical = True, + metric_scale = 200.0, + original_focal_length = (1150.8943600390282, ), + original_size = (1080, 1440), + data_type='lidar', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='DSEC/annotations/train_annotations_wtmpl.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='LiDarResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='DSEC/annotations/val_annotations_wtmpl.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 20,), + # configs for the training pipeline + test=dict( + anno_path='DSEC/annotations/test_annotations_wtmpl.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[123.675, 116.28, 103.53]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + ), +) diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/eth3d.py b/external/Metric3D/training/mono/configs/_base_/datasets/eth3d.py new file mode 100644 index 0000000000000000000000000000000000000000..660db92b301cf48f800b1551ed268b7169dec64a --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/eth3d.py @@ -0,0 +1,80 @@ +# dataset settings +# data will resized/cropped to the canonical size, refer to ._data_base_.py + +ETH3D_dataset=dict( + lib = 'ETH3DDataset', + data_root = 'data/public_datasets', + data_name = 'ETH3D', + transfer_to_canonical = True, + metric_scale = 1.0, + original_focal_length = 886.81, + original_size = (764, 1024), + data_type='lidar', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='ETH3D/annotations/test_annotations_new.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='ETH3D/annotations/test_annotations_new.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 20,), + # configs for the training pipeline + test=dict( + anno_path='ETH3D/annotations/test_annotations_new.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[123.675, 116.28, 103.53]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + ), +) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/hm3d.py b/external/Metric3D/training/mono/configs/_base_/datasets/hm3d.py new file mode 100644 index 0000000000000000000000000000000000000000..c800a616668066b1a8feeaeffdadd6a0e4cd2298 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/hm3d.py @@ -0,0 +1,78 @@ +# dataset settings +# data will resized/cropped to the canonical size, refer to ._data_base_.py + +HM3D_dataset=dict( + lib = 'HM3DDataset', + data_root = 'data/public_datasets', + data_name = 'HM3D', + transfer_to_canonical = True, + metric_scale = 512.0, + original_focal_length = 575.6656, + original_size = (512, 512), + data_type='denselidar', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='HM3D/annotations/train.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(0.9, 1.2)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.0, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.05,), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 50)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='HM3D/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 20,), + # configs for the training pipeline + test=dict( + anno_path='HM3D/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[123.675, 116.28, 103.53]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + ), +) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/hypersim.py b/external/Metric3D/training/mono/configs/_base_/datasets/hypersim.py new file mode 100644 index 0000000000000000000000000000000000000000..b6cf4e2ad272d110f2b4b275a31b0683cefc715e --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/hypersim.py @@ -0,0 +1,71 @@ +# dataset settings +# data will resized/cropped to the canonical size, refer to ._data_base_.py + +Hypersim_dataset=dict( + lib = 'HypersimDataset', + data_name = 'Hypersim', + metric_scale = 1.0, + data_type='denselidar_syn', + data = dict( + # configs for the training pipeline + train=dict( + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(0.9, 1.3)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.0, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.05,), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 50)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 200,), + # configs for the training pipeline + test=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 2000,), + ), +) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/ibims.py b/external/Metric3D/training/mono/configs/_base_/datasets/ibims.py new file mode 100644 index 0000000000000000000000000000000000000000..0851029095748b90bf9d1b6c4b7cd03b17f2f345 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/ibims.py @@ -0,0 +1,80 @@ +# dataset settings +# data will resized/cropped to the canonical size, refer to ._data_base_.py + +IBIMS_dataset=dict( + lib = 'IBIMSDataset', + data_root = 'data/public_datasets', + data_name = 'IBIMS', + transfer_to_canonical = True, + metric_scale = 1000.0, + original_focal_length = 518.857, + original_size = (480, 640), + data_type='lidar', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='IBIMS/annotations/train.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='IBIMS/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 20,), + # configs for the training pipeline + test=dict( + anno_path='IBIMS/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[123.675, 116.28, 103.53]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + ), +) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/kitti.py b/external/Metric3D/training/mono/configs/_base_/datasets/kitti.py new file mode 100644 index 0000000000000000000000000000000000000000..8d68f806bea0333c6b6eecfb99c9384adfef2023 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/kitti.py @@ -0,0 +1,80 @@ +# dataset settings +# data will resized/cropped to the canonical size, refer to ._data_base_.py + +KITTI_dataset=dict( + lib = 'KITTIDataset', + data_root = 'data/public_datasets', + data_name = 'KITTI', + transfer_to_canonical = True, + metric_scale = 256.0, + original_focal_length = 518.857, + original_size = (480, 640), + data_type='lidar', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='KITTI/annotations/train.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='KITTI/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 20,), + # configs for the training pipeline + test=dict( + anno_path='KITTI/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[123.675, 116.28, 103.53]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + ), +) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/leddarpixset.py b/external/Metric3D/training/mono/configs/_base_/datasets/leddarpixset.py new file mode 100644 index 0000000000000000000000000000000000000000..27eb3e6d04397792c9a5ed3e3afc9b6c5b827b00 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/leddarpixset.py @@ -0,0 +1,80 @@ +# dataset settings + +LeddarPixSet_dataset=dict( + lib = 'LeddarPixSetDataset', + data_root = 'data/public_datasets', + data_name = 'LeddarPixSet', + transfer_to_canonical = True, + metric_scale = 200.0, + original_focal_length = (2181, 1060), + original_size = (1080, 1440), + data_type='lidar', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='LeddarPixSet/annotations/train_annotations.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='LiDarResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='LeddarPixSet/annotations/val_annotations.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 50,), + # configs for the training pipeline + test=dict( + anno_path='LeddarPixSet/annotations/test_annotations.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + # dict(type='LabelScaleCononical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), #(1216, 1952), # + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[123.675, 116.28, 103.53]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + ), +) diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/lyft.py b/external/Metric3D/training/mono/configs/_base_/datasets/lyft.py new file mode 100644 index 0000000000000000000000000000000000000000..5917ec9fb5e820834257615267360337c7530b4b --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/lyft.py @@ -0,0 +1,79 @@ +# dataset settings + +Lyft_dataset=dict( + lib = 'LyftDataset', + data_root = 'data/public_datasets', + data_name = 'Lyft', + transfer_to_canonical = True, + metric_scale = 200.0, + original_focal_length = (877.406430795, 3416.79, 1108.782, 3986.358, 3427.04, ), + original_size = (1024, 1224), + data_type='lidar', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='Lyft/annotations/train_annotations_wtmpl.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='LiDarResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='Lyft/annotations/val_annotations_wtmpl.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 20,), + # configs for the training pipeline + test=dict( + anno_path='Lyft/annotations/test_annotations_wtmpl.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 6000,), + ), +) diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/lyft_any.py b/external/Metric3D/training/mono/configs/_base_/datasets/lyft_any.py new file mode 100644 index 0000000000000000000000000000000000000000..5775563e8462922168257b240b0d2c2ce9d22214 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/lyft_any.py @@ -0,0 +1,79 @@ +# dataset settings + +LyftAny_dataset=dict( + lib = 'AnyDataset', + data_root = 'data/public_datasets', + data_name = 'Lyft', + transfer_to_canonical = True, + metric_scale = 200.0, + original_focal_length = (877.406430795, 880.82631362), + original_size = (1024, 1224), + data_type='lidar', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='Lyft/annotations/train_annotations_wtmpl.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='LiDarResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='Lyft/annotations/val_annotations_wtmpl.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 20,), + # configs for the training pipeline + test=dict( + anno_path='Lyft/annotations/test_annotations_wtmpl.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[123.675, 116.28, 103.53]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 6000,), + ), +) diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/mapillary_psd.py b/external/Metric3D/training/mono/configs/_base_/datasets/mapillary_psd.py new file mode 100644 index 0000000000000000000000000000000000000000..744e246d4e7832fd60eb9695d33dd873205cae5d --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/mapillary_psd.py @@ -0,0 +1,79 @@ +# dataset settings + +MapillaryPSD_dataset=dict( + lib = 'MapillaryPSDDataset', + data_root = 'data/public_datasets', + data_name = 'MapillaryPSD', + transfer_to_canonical = True, + metric_scale = 256.0, + original_focal_length = (1664.38, 1725.494, 1231.4812, 2576.447), + original_size = (1536, 2048), + data_type='sfm', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='Mapillary_PSD/annotations/train_annotations.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriten by data_basic configs + crop_type='rand', # center, rand, rand_in_field + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='Mapillary_PSD/annotations/val_annotations.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 20,), + # configs for the training pipeline + test=dict( + anno_path='Mapillary_PSD/annotations/test_annotations.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + ), +) diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/matterport3d.py b/external/Metric3D/training/mono/configs/_base_/datasets/matterport3d.py new file mode 100644 index 0000000000000000000000000000000000000000..c1d3b5a8da21720850b77705c9488a5adef5d741 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/matterport3d.py @@ -0,0 +1,78 @@ +# dataset settings +# data will resized/cropped to the canonical size, refer to ._data_base_.py + +Matterport3D_dataset=dict( + lib = 'Matterport3DDataset', + data_root = 'data/public_datasets', + data_name = 'Matterport3D', + transfer_to_canonical = True, + metric_scale = 4000.0, + original_focal_length = 575.6656, + original_size = (1024, 1280), + data_type='denselidar', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='Matterport3D/annotations/test.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.05,), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 50)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='Matterport3D/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 20,), + # configs for the training pipeline + test=dict( + anno_path='Matterport3D/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + ), +) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/nuscenes.py b/external/Metric3D/training/mono/configs/_base_/datasets/nuscenes.py new file mode 100644 index 0000000000000000000000000000000000000000..5d47b3937d501929c1efdba25030ef4e6744feb4 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/nuscenes.py @@ -0,0 +1,79 @@ +# dataset settings + +NuScenes_dataset=dict( + lib = 'NuScenesDataset', + data_root = 'data/public_datasets', + data_name = 'NuScenes', + transfer_to_canonical = True, + metric_scale = 200.0, + original_focal_length = (877.406430795, 1200.82631362), + original_size = (1024, 1224), + data_type='lidar', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='NuScenes/annotations/train_annotations_wtmpl.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='LiDarResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='NuScenes/annotations/val_annotations_wtmpl.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 20,), + # configs for the training pipeline + test=dict( + anno_path='NuScenes/annotations/test_annotations_wtmpl.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + ), +) diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/nuscenes_any.py b/external/Metric3D/training/mono/configs/_base_/datasets/nuscenes_any.py new file mode 100644 index 0000000000000000000000000000000000000000..8b1af09a1eecd9a3db11bc9596a439cecc4e58fb --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/nuscenes_any.py @@ -0,0 +1,79 @@ +# dataset settings + +NuScenesAny_dataset=dict( + lib = 'AnyDataset', + data_root = 'data/public_datasets', + data_name = 'NuScenes', + transfer_to_canonical = True, + metric_scale = 200.0, + original_focal_length = (877.406430795, 1200.82631362), + original_size = (1024, 1224), + data_type='lidar', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='NuScenes/annotations/train_annotations_wtmpl.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='LiDarResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='NuScenes/annotations/val_annotations_wtmpl.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + # configs for the training pipeline + test=dict( + anno_path='NuScenes/annotations/test_annotations_wtmpl.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + ), +) diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/nyu.py b/external/Metric3D/training/mono/configs/_base_/datasets/nyu.py new file mode 100644 index 0000000000000000000000000000000000000000..f5e81e07893e30daf05ba5ce644e3c9ab6000330 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/nyu.py @@ -0,0 +1,80 @@ +# dataset settings +# data will resized/cropped to the canonical size, refer to ._data_base_.py + +NYU_dataset=dict( + lib = 'NYUDataset', + data_root = 'data/public_datasets', + data_name = 'NYU', + transfer_to_canonical = True, + metric_scale = 6000.0, + original_focal_length = 518.857, + original_size = (480, 640), + data_type='lidar', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='NYU/annotations/train.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='NYU/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 20,), + # configs for the training pipeline + test=dict( + anno_path='NYU/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + ), +) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/pandaset.py b/external/Metric3D/training/mono/configs/_base_/datasets/pandaset.py new file mode 100644 index 0000000000000000000000000000000000000000..0e59ed9fc9a9676f42abe2e6665ce6a801e4f9d0 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/pandaset.py @@ -0,0 +1,79 @@ +# dataset settings + +Pandaset_dataset=dict( + lib = 'PandasetDataset', + data_root = 'data/public_datasets', + data_name = 'Pandaset', + transfer_to_canonical = True, + metric_scale = 200.0, + original_focal_length = (1970.01, 930.45, 929.84), + original_size = (1080, 1920), + data_type='lidar', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='Pandaset/annotations/annotations_train.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='LiDarResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='Pandaset/annotations/annotations_val.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 20,), + # configs for the training pipeline + test=dict( + anno_path='Pandaset/annotations/annotations_test.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 800,), + ), +) diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/replica.py b/external/Metric3D/training/mono/configs/_base_/datasets/replica.py new file mode 100644 index 0000000000000000000000000000000000000000..2bd849813ea0894875aee1c51d36a9bd269ab3d6 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/replica.py @@ -0,0 +1,78 @@ +# dataset settings +# data will resized/cropped to the canonical size, refer to ._data_base_.py + +Replica_dataset=dict( + lib = 'ReplicaDataset', + data_root = 'data/public_datasets', + data_name = 'Replica', + transfer_to_canonical = True, + metric_scale = 512.0, + original_focal_length = 575.6656, + original_size = (512, 512), + data_type='denselidar_syn', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='Replica/annotations/test.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.05,), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 50)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='Replica/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 50,), + # configs for the training pipeline + test=dict( + anno_path='Replica/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 2000,), + ), +) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/scannet.py b/external/Metric3D/training/mono/configs/_base_/datasets/scannet.py new file mode 100644 index 0000000000000000000000000000000000000000..7ce2390bb1e4444cf6c24d75f4a04ef1407fd1b1 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/scannet.py @@ -0,0 +1,80 @@ +# dataset settings +# data will resized/cropped to the canonical size, refer to ._data_base_.py + +ScanNet_dataset=dict( + lib = 'ScanNetDataset', + data_root = 'data/public_datasets', + data_name = 'ScanNet', + transfer_to_canonical = True, + metric_scale = 1000.0, + original_focal_length = 1165.371094, + original_size = (968, 1296), + data_type='lidar', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='ScanNet/annotations/test.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='ScanNet/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 20,), + # configs for the training pipeline + test=dict( + anno_path='ScanNet/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + ), +) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/scannet_all.py b/external/Metric3D/training/mono/configs/_base_/datasets/scannet_all.py new file mode 100644 index 0000000000000000000000000000000000000000..fa1e025af160f18b617a1a6c8c02fd1c5f773655 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/scannet_all.py @@ -0,0 +1,80 @@ +# dataset settings +# data will resized/cropped to the canonical size, refer to ._data_base_.py + +ScanNetAll_dataset=dict( + lib = 'ScanNetDataset', + data_root = 'data/public_datasets', + data_name = 'ScanNetAll', + transfer_to_canonical = True, + metric_scale = 1000.0, + original_focal_length = 1165.371094, + original_size = (968, 1296), + data_type='denselidar', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='ScanNet/annotations/test.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='ScanNet/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 20,), + # configs for the training pipeline + test=dict( + anno_path='ScanNet/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + ), +) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/taskonomy.py b/external/Metric3D/training/mono/configs/_base_/datasets/taskonomy.py new file mode 100644 index 0000000000000000000000000000000000000000..b7ad3f1053ae4556905403b76a8d810c4d787afc --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/taskonomy.py @@ -0,0 +1,78 @@ +# dataset settings +# data will resized/cropped to the canonical size, refer to ._data_base_.py + +Taskonomy_dataset=dict( + lib = 'TaskonomyDataset', + data_root = 'data/public_datasets', + data_name = 'Taskonomy', + transfer_to_canonical = True, + metric_scale = 512.0, + original_focal_length = 575.6656, + original_size = (512, 512), + data_type='denselidar', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='Taskonomy/annotations/test.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(0.9, 1.3)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.0, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.1, + distortion_prob=0.05,), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 50)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='Taskonomy/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 20,), + # configs for the training pipeline + test=dict( + anno_path='Taskonomy/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 2000,), + ), +) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/uasol.py b/external/Metric3D/training/mono/configs/_base_/datasets/uasol.py new file mode 100644 index 0000000000000000000000000000000000000000..b80efd1c60ccf252d92ce946728ba8c5fc0a83a9 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/uasol.py @@ -0,0 +1,74 @@ +# dataset settings + +UASOL_dataset=dict( + lib = 'UASOLDataset', + data_root = 'data/public_datasets', + data_name = 'UASOL', + transfer_to_canonical = True, + metric_scale = 200.0, + original_focal_length = (2263.9108952994275, 2263.9108952994275), + original_size = (1024, 2048), + data_type='stereo', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='UASOL/annotations/train.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='UASOL/annotations/test_all.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 100,), + # configs for the training pipeline + test=dict( + anno_path='UASOL/annotations/test_all.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + ), +) diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/vkitti.py b/external/Metric3D/training/mono/configs/_base_/datasets/vkitti.py new file mode 100644 index 0000000000000000000000000000000000000000..c2f7b5b39d0ab7237f0b64fecc4190fa8ac497d5 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/vkitti.py @@ -0,0 +1,80 @@ +# dataset settings +# data will resized/cropped to the canonical size, refer to ._data_base_.py + +VKITTI_dataset=dict( + lib = 'VKITTIDataset', + data_root = 'data/public_datasets', + data_name = 'VKITTI', + transfer_to_canonical = True, + metric_scale = 100.0, + original_focal_length = 725.0087, + original_size = (375, 1242), + data_type='denselidar_syn', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='VKITTI/annotations/train.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='VKITTI/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 50,), + # configs for the training pipeline + test=dict( + anno_path='VKITTI/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + ), +) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/_base_/datasets/waymo.py b/external/Metric3D/training/mono/configs/_base_/datasets/waymo.py new file mode 100644 index 0000000000000000000000000000000000000000..1ac9d95fc15a9be431a044d0fad7d391b6d6ab10 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/datasets/waymo.py @@ -0,0 +1,80 @@ +# dataset settings +# data will resized/cropped to the canonical size, refer to ._data_base_.py + +Waymo_dataset=dict( + lib = 'WaymoDataset', + data_root = 'data/public_datasets', + data_name = 'Waymo', + transfer_to_canonical = True, + metric_scale = 200.0, + original_focal_length = 2000.8, + original_size = (2000, 2000), + data_type='lidar', + data = dict( + # configs for the training pipeline + train=dict( + anno_path='Waymo/annotations/train.json', + sample_ratio = 1.0, + sample_size = -1, + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(0.9, 1.4)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='rand', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='RandomEdgeMask', + mask_maxsize=50, + prob=0.2, + rgb_invalid=[0,0,0], + label_invalid=-1,), + dict(type='RandomHorizontalFlip', + prob=0.4), + dict(type='PhotoMetricDistortion', + to_gray_prob=0.2, + distortion_prob=0.1,), + dict(type='Weather', + prob=0.1), + dict(type='RandomBlur', + prob=0.05), + dict(type='RGBCompresion', prob=0.1, compression=(0, 40)), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ],), + + # configs for the training pipeline + val=dict( + anno_path='Waymo/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='ResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='RandomCrop', + crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + crop_type='center', + ignore_label=-1, + padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 50,), + # configs for the training pipeline + test=dict( + anno_path='Waymo/annotations/test.json', + pipeline=[dict(type='BGR2RGB'), + # dict(type='LiDarResizeCanonical', ratio_range=(1.0, 1.0)), + dict(type='ResizeKeepRatio', + resize_size=(512, 960), + ignore_label=-1, + padding=[0, 0, 0]), + # dict(type='RandomCrop', + # crop_size=(0,0), # crop_size will be overwriteen by data_basic configs + # crop_type='center', + # ignore_label=-1, + # padding=[0, 0, 0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1,), + ), +) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/_base_/default_runtime.py b/external/Metric3D/training/mono/configs/_base_/default_runtime.py new file mode 100644 index 0000000000000000000000000000000000000000..4815a5c0c6bce22f2b8a499f033de971f146aeda --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/default_runtime.py @@ -0,0 +1,23 @@ +# distributed training configs, if dist_url == 'env://'('tcp://127.0.0.1:6795'), nodes related configs should be set in the shell +dist_params = dict(port=None, backend='nccl', dist_url='env://') + +log_name = 'tbd' +log_file = 'out.log' + +load_from = None +resume_from = None + +#workflow = [('train', 1)] +cudnn_benchmark = True +log_interval = 20 + +use_tensorboard = True + +evaluation = dict(online_eval=True, interval=1000, metrics=['abs_rel', 'delta1']) +checkpoint_config = dict(by_epoch=False, interval=16000) + + +# runtime settings, IterBasedRunner or EpochBasedRunner, e.g. runner = dict(type='EpochBasedRunner', max_epoches=100) +runner = dict(type='IterBasedRunner', max_iters=160000) + +test_metrics = ['abs_rel', 'rmse', 'silog', 'delta1', 'delta2', 'delta3', 'rmse_log', 'log10', 'sq_rel'] \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/_base_/losses/all_losses.py b/external/Metric3D/training/mono/configs/_base_/losses/all_losses.py new file mode 100644 index 0000000000000000000000000000000000000000..c0ad857e7b2f859e72f9bf4556a97e3d6bed6326 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/losses/all_losses.py @@ -0,0 +1,26 @@ +""" +There are multiple losses can be applied. + +dict(type='GradientLoss_Li', scale_num=4, loss_weight=1.0), +dict(type='VNLoss', sample_ratio=0.2, loss_weight=1.0), +dict(type='SilogLoss', variance_focus=0.5, loss_weight=1.0), +dict(type='WCELoss', loss_weight=1.0, depth_normalize=(0.1, 1), bins_num=200) +dict(type='RegularizationLoss', loss_weight=0.1) +dict(type='EdgeguidedRankingLoss', loss_weight=1.0) +Note that out_channel and depth_normalize will be overwriten by configs in data_basic. +""" + +# loss_decode=[dict(type='VNLoss', sample_ratio=0.2, loss_weight=1.0), +# #dict(type='SilogLoss', variance_focus=0.5, loss_weight=1.0), +# dict(type='WCELoss', loss_weight=1.0, depth_normalize=(0, 0), out_channel=0)] + +# loss_auxi = [#dict(type='WCELoss', loss_weight=1.0, depth_normalize=(0.1, 1), out_channel=200), +# ] +losses=dict( + decoder_losses=[ + dict(type='VNLoss', sample_ratio=0.2, loss_weight=1.0), + dict(type='WCELoss', loss_weight=1.0, depth_normalize=(0, 0), out_channel=0), + ], + auxi_losses=[], + pose_losses=[], +) diff --git a/external/Metric3D/training/mono/configs/_base_/models/backbones/dino_vit_giant2_reg.py b/external/Metric3D/training/mono/configs/_base_/models/backbones/dino_vit_giant2_reg.py new file mode 100644 index 0000000000000000000000000000000000000000..3c1ebc96ceaa32ad9310d3b84d55d252be843c46 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/models/backbones/dino_vit_giant2_reg.py @@ -0,0 +1,7 @@ +model = dict( + backbone=dict( + type='vit_giant2_reg', + prefix='backbones.', + out_channels=[1536, 1536, 1536, 1536], + drop_path_rate = 0.0), + ) diff --git a/external/Metric3D/training/mono/configs/_base_/models/backbones/dino_vit_large_reg.py b/external/Metric3D/training/mono/configs/_base_/models/backbones/dino_vit_large_reg.py new file mode 100644 index 0000000000000000000000000000000000000000..25e96747d459d42df299f8a6a1e14044a0e56164 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/models/backbones/dino_vit_large_reg.py @@ -0,0 +1,7 @@ +model = dict( + backbone=dict( + type='vit_large_reg', + prefix='backbones.', + out_channels=[1024, 1024, 1024, 1024], + drop_path_rate = 0.0), + ) diff --git a/external/Metric3D/training/mono/configs/_base_/models/backbones/dino_vit_small_reg.py b/external/Metric3D/training/mono/configs/_base_/models/backbones/dino_vit_small_reg.py new file mode 100644 index 0000000000000000000000000000000000000000..0c8bd97dccb9cdee7517250f40e01bb3124144e6 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/models/backbones/dino_vit_small_reg.py @@ -0,0 +1,7 @@ +model = dict( + backbone=dict( + type='vit_small_reg', + prefix='backbones.', + out_channels=[384, 384, 384, 384], + drop_path_rate = 0.0), + ) diff --git a/external/Metric3D/training/mono/configs/_base_/models/encoder_decoder/dino_vit_giant2_reg.dpt_raft.py b/external/Metric3D/training/mono/configs/_base_/models/encoder_decoder/dino_vit_giant2_reg.dpt_raft.py new file mode 100644 index 0000000000000000000000000000000000000000..73702d298c05979bcdf013e9c30ec56f4e36665b --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/models/encoder_decoder/dino_vit_giant2_reg.dpt_raft.py @@ -0,0 +1,19 @@ +# model settings +_base_ = ['../backbones/dino_vit_giant2_reg.py'] +model = dict( + type='DensePredModel', + decode_head=dict( + type='RAFTDepthDPT', + in_channels=[1536, 1536, 1536, 1536], + use_cls_token=True, + feature_channels = [384, 768, 1536, 1536], # [2/7, 1/7, 1/14, 1/14] + decoder_channels = [192, 384, 768, 1536, 1536], # [4/7, 2/7, 1/7, 1/14, 1/14] + up_scale = 7, + hidden_channels=[192, 192, 192, 192], # [x_4, x_8, x_16, x_32] [192, 384, 768, 1536] + n_gru_layers=3, + n_downsample=2, + iters=3, + slow_fast_gru=True, + num_register_tokens=4, + prefix='decode_heads.'), +) diff --git a/external/Metric3D/training/mono/configs/_base_/models/encoder_decoder/dino_vit_large_reg.dpt_raft.py b/external/Metric3D/training/mono/configs/_base_/models/encoder_decoder/dino_vit_large_reg.dpt_raft.py new file mode 100644 index 0000000000000000000000000000000000000000..26ab6dc090e9cdb840d84fab10587becb536dbb8 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/models/encoder_decoder/dino_vit_large_reg.dpt_raft.py @@ -0,0 +1,19 @@ +# model settings +_base_ = ['../backbones/dino_vit_large_reg.py'] +model = dict( + type='DensePredModel', + decode_head=dict( + type='RAFTDepthDPT', + in_channels=[1024, 1024, 1024, 1024], + use_cls_token=True, + feature_channels = [256, 512, 1024, 1024], # [2/7, 1/7, 1/14, 1/14] + decoder_channels = [128, 256, 512, 1024, 1024], # [4/7, 2/7, 1/7, 1/14, 1/14] + up_scale = 7, + hidden_channels=[128, 128, 128, 128], # [x_4, x_8, x_16, x_32] [192, 384, 768, 1536] + n_gru_layers=3, + n_downsample=2, + iters=3, + slow_fast_gru=True, + num_register_tokens=4, + prefix='decode_heads.'), +) diff --git a/external/Metric3D/training/mono/configs/_base_/models/encoder_decoder/dino_vit_small_reg.dpt_raft.py b/external/Metric3D/training/mono/configs/_base_/models/encoder_decoder/dino_vit_small_reg.dpt_raft.py new file mode 100644 index 0000000000000000000000000000000000000000..19466c191e9f2a83903e55ca4fc0827d9a11bcb9 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/models/encoder_decoder/dino_vit_small_reg.dpt_raft.py @@ -0,0 +1,19 @@ +# model settings +_base_ = ['../backbones/dino_vit_small_reg.py'] +model = dict( + type='DensePredModel', + decode_head=dict( + type='RAFTDepthDPT', + in_channels=[384, 384, 384, 384], + use_cls_token=True, + feature_channels = [96, 192, 384, 768], # [2/7, 1/7, 1/14, 1/14] + decoder_channels = [48, 96, 192, 384, 384], # [-, 1/4, 1/7, 1/14, 1/14] + up_scale = 7, + hidden_channels=[48, 48, 48, 48], # [x_4, x_8, x_16, x_32] [1/4, 1/7, 1/14, -] + n_gru_layers=3, + n_downsample=2, + iters=3, + slow_fast_gru=True, + num_register_tokens=4, + prefix='decode_heads.'), +) diff --git a/external/Metric3D/training/mono/configs/_base_/schedules/schedule_1m.py b/external/Metric3D/training/mono/configs/_base_/schedules/schedule_1m.py new file mode 100644 index 0000000000000000000000000000000000000000..7b347f377bbe5751d8b24919d0e3eeb98b7d3900 --- /dev/null +++ b/external/Metric3D/training/mono/configs/_base_/schedules/schedule_1m.py @@ -0,0 +1,9 @@ +optimizer = dict( + type='SGD', + encoder=dict(lr=0.01, ), + decoder=dict(lr=0.01, ), +) +# learning policy +lr_config = dict(policy='poly',) #dict(policy='poly', power=0.9, min_lr=1e-4, by_epoch=False) + + diff --git a/external/Metric3D/training/mono/configs/test_configs_vit_giant2/ddad.vit.dpt.raft.py b/external/Metric3D/training/mono/configs/test_configs_vit_giant2/ddad.vit.dpt.raft.py new file mode 100644 index 0000000000000000000000000000000000000000..e10f34d62e9c26180cac7ecdc681f8f961a3a162 --- /dev/null +++ b/external/Metric3D/training/mono/configs/test_configs_vit_giant2/ddad.vit.dpt.raft.py @@ -0,0 +1,94 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_giant2_reg.dpt_raft.py', + + '../_base_/datasets/ddad.py', + '../_base_/datasets/_data_base_.py', + + '../_base_/default_runtime.py', + '../_base_/schedules/schedule_1m.py' + ] + +import numpy as np + +model = dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=8, + n_downsample=2, + detach=False, + ) +) + +# model settings +find_unused_parameters = True + + + +# data configs, some similar data are merged together +data_array = [ + # group 1 + [ + dict(DDAD='DDAD_dataset'), + ], +] +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0,1), + depth_normalize=(0.1, 200), + crop_size = (1120, 2016), + clip_depth_range=(0.1, 200), + vit_size=(616,1064), +) + + +test_metrics = ['abs_rel', 'rmse', 'silog', 'delta1', 'delta2', 'delta3'] +DDAD_dataset=dict( + data = dict( + test=dict( + anno_path='DDAD/annotations/test_annotations.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='ResizeKeepRatio', + # resize_size=(1216, 1952), #(544, 992), # + # resize_size=(560, 1008), + # resize_size=(840, 1512), + resize_size=(616,1064), + ignore_label=-1, + padding=[0,0,0]), + # dict(type='ResizeKeepRatio', + # resize_size=(1120, 2016), + # ignore_label=-1, + # padding=[0,0,0], + # keep_gt=True), + # dict(type='RandomCrop', + # crop_size=(0,0), + # crop_type='center', + # ignore_label=-1, + # padding=[0,0,0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 500, + ), + )) + +# DDAD_dataset=dict( +# data = dict( +# test=dict( +# anno_path='DDAD/annotations/test_annotations.json', +# pipeline=[dict(type='BGR2RGB'), +# dict(type='KeepResizeCanoSize', +# resize_size=(640, 1088), #(1216, 1952), #(512, 960), # +# ignore_label=-1, +# padding=[0, 0, 0]), +# dict(type='ToTensor'), +# dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), +# ], +# sample_ratio = 1.0, +# sample_size = 80, +# ), +# )) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/test_configs_vit_giant2/diode.vit.dpt.raft.py b/external/Metric3D/training/mono/configs/test_configs_vit_giant2/diode.vit.dpt.raft.py new file mode 100644 index 0000000000000000000000000000000000000000..cf203976e9ac02fa32bd501e61908c876ec74b7c --- /dev/null +++ b/external/Metric3D/training/mono/configs/test_configs_vit_giant2/diode.vit.dpt.raft.py @@ -0,0 +1,66 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_giant2_reg.dpt_raft.py', + + '../_base_/datasets/diode.py', + '../_base_/datasets/_data_base_.py', + + '../_base_/default_runtime.py', + '../_base_/schedules/schedule_1m.py' + ] + +import numpy as np + +model=dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=8, + n_downsample=2, + detach=False, + ) +) + +# model settings +find_unused_parameters = True + + + +# data configs, some similar data are merged together +data_array = [ + # group 1 + [ + #dict(DIODE='DIODE_dataset'), + #dict(DIODE_indoor='DIODE_dataset') + dict(DIODE_outdoor='DIODE_dataset') + ], +] +data_basic=dict( + canonical_space = dict( + img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0, 1), + depth_normalize=(0.1, 200),# (0.3, 160), + # crop_size = (512, 960), + clip_depth_range=(0.1, 150), +) + + + +# indoor (544, 928), outdoor: (768, 1088) +test_metrics = ['abs_rel', 'rmse', 'silog', 'delta1', 'delta2', 'delta3', 'normal_mean', 'normal_rmse', 'normal_a1'] +DIODE_dataset=dict( + data = dict( + test=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='ResizeKeepRatio', + resize_size=(616, 1064), #(544, 992), #(768, 1088), #(768, 1120), # (768, 1216), #(768, 1024), # (768, 1216), #(768, 1312), # + ignore_label=-1, + padding=[0,0,0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1, + ), + )) diff --git a/external/Metric3D/training/mono/configs/test_configs_vit_giant2/dsec.vit.dpt.raft.py b/external/Metric3D/training/mono/configs/test_configs_vit_giant2/dsec.vit.dpt.raft.py new file mode 100644 index 0000000000000000000000000000000000000000..a12a59c3aea652bd85ae036c1991355c92bff757 --- /dev/null +++ b/external/Metric3D/training/mono/configs/test_configs_vit_giant2/dsec.vit.dpt.raft.py @@ -0,0 +1,95 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_giant2_reg.dpt_raft.py', + + '../_base_/datasets/dsec.py', + '../_base_/datasets/_data_base_.py', + + '../_base_/default_runtime.py', + '../_base_/schedules/schedule_1m.py' + ] + +import numpy as np + +model = dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=8, + n_downsample=2, + detach=False, + ) +) + +# model settings +find_unused_parameters = True + + + +# data configs, some similar data are merged together +data_array = [ + # group 1 + [ + dict(DSEC='DSEC_dataset'), + ], +] + +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0,1), + depth_normalize=(0.1, 200), + crop_size = (1120, 2016), + clip_depth_range=(0.1, 200), + vit_size=(616,1064), +) + + +test_metrics = ['abs_rel', 'rmse', 'silog', 'delta1', 'delta2', 'delta3'] +DSEC_dataset=dict( + data = dict( + test=dict( + anno_path='DSEC/annotations/test_annotations.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='ResizeKeepRatio', + # resize_size=(1216, 1952), #(544, 992), # + # resize_size=(560, 1008), + # resize_size=(840, 1512), + resize_size=(616,1064), + ignore_label=-1, + padding=[0,0,0]), + # dict(type='ResizeKeepRatio', + # resize_size=(1120, 2016), + # ignore_label=-1, + # padding=[0,0,0], + # keep_gt=True), + # dict(type='RandomCrop', + # crop_size=(0,0), + # crop_type='center', + # ignore_label=-1, + # padding=[0,0,0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 500, + ), + )) + +# DDAD_dataset=dict( +# data = dict( +# test=dict( +# anno_path='DDAD/annotations/test_annotations.json', +# pipeline=[dict(type='BGR2RGB'), +# dict(type='KeepResizeCanoSize', +# resize_size=(640, 1088), #(1216, 1952), #(512, 960), # +# ignore_label=-1, +# padding=[0, 0, 0]), +# dict(type='ToTensor'), +# dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), +# ], +# sample_ratio = 1.0, +# sample_size = 80, +# ), +# )) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/test_configs_vit_giant2/eth3d.vit.dpt.raft.py b/external/Metric3D/training/mono/configs/test_configs_vit_giant2/eth3d.vit.dpt.raft.py new file mode 100644 index 0000000000000000000000000000000000000000..4fb27193e8e6a608a7a187866455150824b4fbf8 --- /dev/null +++ b/external/Metric3D/training/mono/configs/test_configs_vit_giant2/eth3d.vit.dpt.raft.py @@ -0,0 +1,70 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_giant2_reg.dpt_raft.py', + + '../_base_/datasets/eth3d.py', + '../_base_/datasets/_data_base_.py', + + '../_base_/default_runtime.py', + '../_base_/schedules/schedule_1m.py' + ] + +import numpy as np + +model = dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=8, + n_downsample=2, + detach=False, + ) +) + +# model settings +find_unused_parameters = True + + + +# data configs, some similar data are merged together +data_array = [ + # group 1 + [ + dict(ETH3D='ETH3D_dataset'), #447.2w + ], +] +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0, 1), + depth_normalize=(0.1, 200),# (0.3, 160), + crop_size = (1120, 2016), + clip_depth_range=(0.1, 200), + vit_size=(616,1064), +) + +# indoor (544, 928), outdoor: (768, 1088) +test_metrics = ['abs_rel', 'rmse', 'silog', 'delta1', 'delta2', 'delta3', 'normal_mean', 'normal_rmse', 'normal_a1'] +ETH3D_dataset=dict( + data = dict( + test=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='ResizeKeepRatio', + # resize_size=(512, 512), #(768, 1088), #(768, 1120), # (768, 1216), #(768, 1024), # (768, 1216), #(768, 1312), # (512, 512) + resize_size=(616,1064), + # resize_size=(1120, 2016), + ignore_label=-1, + padding=[0,0,0]), + # dict(type='RandomCrop', + # crop_size=(0,0), + # crop_type='center', + # ignore_label=-1, + # padding=[0,0,0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1, + ), + )) diff --git a/external/Metric3D/training/mono/configs/test_configs_vit_giant2/ibims.vit.dpt.raft.py b/external/Metric3D/training/mono/configs/test_configs_vit_giant2/ibims.vit.dpt.raft.py new file mode 100644 index 0000000000000000000000000000000000000000..4523fb35a715bfb7f4c63ca93e3ea4e934eb604c --- /dev/null +++ b/external/Metric3D/training/mono/configs/test_configs_vit_giant2/ibims.vit.dpt.raft.py @@ -0,0 +1,71 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_giant2_reg.dpt_raft.py', + + '../_base_/datasets/ibims.py', + '../_base_/datasets/_data_base_.py', + + '../_base_/default_runtime.py', + '../_base_/schedules/schedule_1m.py' + ] + +import numpy as np + +model = dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=8, + n_downsample=2, + detach=False, + ) +) + +# model settings +find_unused_parameters = True + + + +# data configs, some similar data are merged together +data_array = [ + # group 1 + [ + dict(IBIMS='IBIMS_dataset'), #447.2w + ], +] +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0, 1), + depth_normalize=(0.1, 200),# (0.3, 160), + crop_size = (1120, 2016), + clip_depth_range=(0.1, 10), + vit_size=(616,1064), +) +clip_depth = True + +# indoor (544, 928), outdoor: (768, 1088) +test_metrics = ['abs_rel', 'rmse', 'silog', 'delta1', 'delta2', 'delta3', 'normal_mean', 'normal_rmse', 'normal_a3', 'normal_a4', 'normal_a5', 'normal_median'] +IBIMS_dataset=dict( + data = dict( + test=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='ResizeKeepRatio', + # resize_size=(512, 512), #(768, 1088), #(768, 1120), # (768, 1216), #(768, 1024), # (768, 1216), #(768, 1312), # (512, 512) + resize_size=(616,1064), + # resize_size=(1120, 2016), + ignore_label=-1, + padding=[0,0,0]), + # dict(type='RandomCrop', + # crop_size=(0,0), + # crop_type='center', + # ignore_label=-1, + # padding=[0,0,0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1, + ), + )) diff --git a/external/Metric3D/training/mono/configs/test_configs_vit_giant2/kitti.vit.dpt.raft.py b/external/Metric3D/training/mono/configs/test_configs_vit_giant2/kitti.vit.dpt.raft.py new file mode 100644 index 0000000000000000000000000000000000000000..4807c46ff1478c956991222a7389742b50f0560f --- /dev/null +++ b/external/Metric3D/training/mono/configs/test_configs_vit_giant2/kitti.vit.dpt.raft.py @@ -0,0 +1,82 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_giant2_reg.dpt_raft.py', + + '../_base_/datasets/kitti.py', + '../_base_/datasets/_data_base_.py', + + '../_base_/default_runtime.py', + '../_base_/schedules/schedule_1m.py' + ] + +import numpy as np + +model = dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=8, + n_downsample=2, + detach=False, + ) +) + +# model settings +find_unused_parameters = True + + + +# data configs, some similar data are merged together +data_array = [ + # group 1 + [ + dict(KITTI='KITTI_dataset'), + ], +] +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0,1), + depth_normalize=(0.1, 200), + crop_size = (1120, 2016), + clip_depth_range=(0.1, 80), + vit_size=(616,1064), +) + +clip_depth = False + +test_metrics = ['abs_rel', 'rmse', 'silog', 'delta1', 'delta2', 'delta3', 'rmse_log', + 'log10'] +KITTI_dataset=dict( + data = dict( + test=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='ResizeKeepRatio', + resize_size=(616, 1064), #(416, 1248), #(480, 1216), #(512, 1088), #(512, 1312), #(480, 1248), # # + ignore_label=-1, + padding=[0,0,0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1, + ), + )) + +# DDAD_dataset=dict( +# data = dict( +# test=dict( +# anno_path='DDAD/annotations/test_annotations.json', +# pipeline=[dict(type='BGR2RGB'), +# dict(type='KeepResizeCanoSize', +# resize_size=(640, 1088), #(1216, 1952), #(512, 960), # +# ignore_label=-1, +# padding=[0, 0, 0]), +# dict(type='ToTensor'), +# dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), +# ], +# sample_ratio = 1.0, +# sample_size = 80, +# ), +# )) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/test_configs_vit_giant2/nuscenes.vit.dpt.raft.py b/external/Metric3D/training/mono/configs/test_configs_vit_giant2/nuscenes.vit.dpt.raft.py new file mode 100644 index 0000000000000000000000000000000000000000..d783a19447b03af1a62c92b0898d182c25fb641e --- /dev/null +++ b/external/Metric3D/training/mono/configs/test_configs_vit_giant2/nuscenes.vit.dpt.raft.py @@ -0,0 +1,93 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_giant2_reg.dpt_raft.py', + + '../_base_/datasets/nuscenes.py', + '../_base_/datasets/_data_base_.py', + + '../_base_/default_runtime.py', + '../_base_/schedules/schedule_1m.py' + ] + +import numpy as np + +model = dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=8, + n_downsample=2, + detach=False, + ) +) + +# model settings +find_unused_parameters = True + + + +# data configs, some similar data are merged together +data_array = [ + # group 1 + [ + dict(NuScenes='NuScenes_dataset'), + ], +] +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0,1), + depth_normalize=(0.1, 200), + crop_size = (1120, 2016), + clip_depth_range=(0.1, 200), + vit_size=(616,1064), +) + + +test_metrics = ['abs_rel', 'rmse', 'silog', 'delta1', 'delta2', 'delta3'] +NuScenes_dataset=dict( + data = dict( + test=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='ResizeKeepRatio', + # resize_size=(1216, 1952), #(544, 992), # + # resize_size=(560, 1008), + # resize_size=(840, 1512), + resize_size=(616,1064), + ignore_label=-1, + padding=[0,0,0]), + # dict(type='ResizeKeepRatio', + # resize_size=(1120, 2016), + # ignore_label=-1, + # padding=[0,0,0], + # keep_gt=True), + # dict(type='RandomCrop', + # crop_size=(0,0), + # crop_type='center', + # ignore_label=-1, + # padding=[0,0,0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 500, + ), + )) + +# DDAD_dataset=dict( +# data = dict( +# test=dict( +# anno_path='DDAD/annotations/test_annotations.json', +# pipeline=[dict(type='BGR2RGB'), +# dict(type='KeepResizeCanoSize', +# resize_size=(640, 1088), #(1216, 1952), #(512, 960), # +# ignore_label=-1, +# padding=[0, 0, 0]), +# dict(type='ToTensor'), +# dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), +# ], +# sample_ratio = 1.0, +# sample_size = 80, +# ), +# )) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/test_configs_vit_giant2/nyu.vit.dpt.raft.py b/external/Metric3D/training/mono/configs/test_configs_vit_giant2/nyu.vit.dpt.raft.py new file mode 100644 index 0000000000000000000000000000000000000000..80f75f8a6c6a009294e8818f9d8d780e54f1f277 --- /dev/null +++ b/external/Metric3D/training/mono/configs/test_configs_vit_giant2/nyu.vit.dpt.raft.py @@ -0,0 +1,64 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_giant2_reg.dpt_raft.py', + + '../_base_/datasets/nyu.py', + '../_base_/datasets/_data_base_.py', + + '../_base_/default_runtime.py', + '../_base_/schedules/schedule_1m.py' + ] + +import numpy as np + +model = dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=8, + n_downsample=2, + detach=False, + ) +) + +# model settings +find_unused_parameters = True + + + +# data configs, some similar data are merged together +data_array = [ + # group 1 + [ + dict(NYU='NYU_dataset'), + ], +] +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0,1), + depth_normalize=(0.1, 200), + crop_size = (1120, 2016), + clip_depth_range=(0.1, 10), + vit_size=(616,1064), +) +clip_depth = True + + +test_metrics = ['abs_rel', 'rmse', 'silog', 'delta1', 'delta2', 'delta3', 'rmse_log', 'log10', 'normal_mean', 'normal_rmse', 'normal_median', 'normal_a3', 'normal_a4', 'normal_a5'] +NYU_dataset=dict( + data = dict( + test=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='ResizeKeepRatio', + resize_size=(616, 1064), #(544, 992), #(480, 1216), #(480, 640), # + ignore_label=-1, + padding=[0,0,0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1, + ), + )) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/test_configs_vit_giant2/scannet.vit.dpt.raft.py b/external/Metric3D/training/mono/configs/test_configs_vit_giant2/scannet.vit.dpt.raft.py new file mode 100644 index 0000000000000000000000000000000000000000..7c556d92cc21cb877251d378e66f1cc0475f0430 --- /dev/null +++ b/external/Metric3D/training/mono/configs/test_configs_vit_giant2/scannet.vit.dpt.raft.py @@ -0,0 +1,66 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_giant2_reg.dpt_raft.py', + + '../_base_/datasets/scannet.py', + '../_base_/datasets/scannet_all.py', + #'../_base_/datasets/_data_base_.py', + + '../_base_/default_runtime.py', + '../_base_/schedules/schedule_1m.py' + ] + +import numpy as np + +model = dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=8, + n_downsample=2, + detach=False, + ) +) + +# model settings +find_unused_parameters = True + + + +# data configs, some similar data are merged together +data_array = [ + # group 1 + [ + #dict(ScanNet='ScanNet_dataset'), + dict(ScanNetAll='ScanNetAll_dataset') + ], +] +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0,1), + depth_normalize=(0.1, 200), + crop_size = (1120, 2016), + clip_depth_range=(0.1, 200), + vit_size=(616,1064), +) + + +test_metrics = ['abs_rel', 'rmse', 'silog', 'delta1', 'delta2', 'delta3', 'rmse_log', 'log10', 'normal_mean', 'normal_rmse', 'normal_median', 'normal_a3', 'normal_a4', 'normal_a5'] +ScanNetAll_dataset=dict( +#ScanNet_dataset=dict( + data = dict( + test=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='ResizeKeepRatio', + resize_size=(616, 1064), #(544, 992), #(480, 1216), #(480, 640), # + ignore_label=-1, + padding=[0,0,0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 500, + ), + )) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/test_configs_vit_giant2/waymo.vit.dpt.raft.py b/external/Metric3D/training/mono/configs/test_configs_vit_giant2/waymo.vit.dpt.raft.py new file mode 100644 index 0000000000000000000000000000000000000000..a0a425d3f89f6215d51528a783e6a2b47f22480c --- /dev/null +++ b/external/Metric3D/training/mono/configs/test_configs_vit_giant2/waymo.vit.dpt.raft.py @@ -0,0 +1,95 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_giant2_reg.dpt_raft.py', + + '../_base_/datasets/waymo.py', + '../_base_/datasets/_data_base_.py', + + '../_base_/default_runtime.py', + '../_base_/schedules/schedule_1m.py' + ] + +import numpy as np + +model = dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=8, + n_downsample=2, + detach=False, + ) +) + +# model settings +find_unused_parameters = True + + + +# data configs, some similar data are merged together +data_array = [ + # group 1 + [ + dict(Waymo='Waymo_dataset'), + ], +] + +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0,1), + depth_normalize=(0.1, 200), + crop_size = (1120, 2016), + clip_depth_range=(0.1, 200), + vit_size=(616,1064), +) + + +test_metrics = ['abs_rel', 'rmse', 'silog', 'delta1', 'delta2', 'delta3'] +Waymo_dataset=dict( + data = dict( + test=dict( + anno_path='Waymo/annotations/test_annotations.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='ResizeKeepRatio', + # resize_size=(1216, 1952), #(544, 992), # + # resize_size=(560, 1008), + # resize_size=(840, 1512), + resize_size=(616,1064), + ignore_label=-1, + padding=[0,0,0]), + # dict(type='ResizeKeepRatio', + # resize_size=(1120, 2016), + # ignore_label=-1, + # padding=[0,0,0], + # keep_gt=True), + # dict(type='RandomCrop', + # crop_size=(0,0), + # crop_type='center', + # ignore_label=-1, + # padding=[0,0,0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 500, + ), + )) + +# DDAD_dataset=dict( +# data = dict( +# test=dict( +# anno_path='DDAD/annotations/test_annotations.json', +# pipeline=[dict(type='BGR2RGB'), +# dict(type='KeepResizeCanoSize', +# resize_size=(640, 1088), #(1216, 1952), #(512, 960), # +# ignore_label=-1, +# padding=[0, 0, 0]), +# dict(type='ToTensor'), +# dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), +# ], +# sample_ratio = 1.0, +# sample_size = 80, +# ), +# )) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/test_configs_vit_small/ddad.vit.dpt.raft.py b/external/Metric3D/training/mono/configs/test_configs_vit_small/ddad.vit.dpt.raft.py new file mode 100644 index 0000000000000000000000000000000000000000..ebf6bb7cc90136cfe0485d8c6171816f12d98e40 --- /dev/null +++ b/external/Metric3D/training/mono/configs/test_configs_vit_small/ddad.vit.dpt.raft.py @@ -0,0 +1,94 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_small_reg.dpt_raft.py', + + '../_base_/datasets/ddad.py', + '../_base_/datasets/_data_base_.py', + + '../_base_/default_runtime.py', + '../_base_/schedules/schedule_1m.py' + ] + +import numpy as np + +model = dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=4, + n_downsample=2, + detach=False, + ) +) + +# model settings +find_unused_parameters = True + + + +# data configs, some similar data are merged together +data_array = [ + # group 1 + [ + dict(DDAD='DDAD_dataset'), + ], +] +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0,1), + depth_normalize=(0.1, 200), + crop_size = (1120, 2016), + clip_depth_range=(0.1, 200), + vit_size=(616,1064), +) + + +test_metrics = ['abs_rel', 'rmse', 'silog', 'delta1', 'delta2', 'delta3'] +DDAD_dataset=dict( + data = dict( + test=dict( + anno_path='DDAD/annotations/test_annotations.json', + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='ResizeKeepRatio', + # resize_size=(1216, 1952), #(544, 992), # + # resize_size=(560, 1008), + # resize_size=(840, 1512), + resize_size=(616,1064), + ignore_label=-1, + padding=[0,0,0]), + # dict(type='ResizeKeepRatio', + # resize_size=(1120, 2016), + # ignore_label=-1, + # padding=[0,0,0], + # keep_gt=True), + # dict(type='RandomCrop', + # crop_size=(0,0), + # crop_type='center', + # ignore_label=-1, + # padding=[0,0,0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 500, + ), + )) + +# DDAD_dataset=dict( +# data = dict( +# test=dict( +# anno_path='DDAD/annotations/test_annotations.json', +# pipeline=[dict(type='BGR2RGB'), +# dict(type='KeepResizeCanoSize', +# resize_size=(640, 1088), #(1216, 1952), #(512, 960), # +# ignore_label=-1, +# padding=[0, 0, 0]), +# dict(type='ToTensor'), +# dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), +# ], +# sample_ratio = 1.0, +# sample_size = 80, +# ), +# )) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/test_configs_vit_small/diode.vit.dpt.raft.py b/external/Metric3D/training/mono/configs/test_configs_vit_small/diode.vit.dpt.raft.py new file mode 100644 index 0000000000000000000000000000000000000000..545911616d74712e121196d1893c383a3ec233da --- /dev/null +++ b/external/Metric3D/training/mono/configs/test_configs_vit_small/diode.vit.dpt.raft.py @@ -0,0 +1,66 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_small_reg.dpt_raft.py', + + '../_base_/datasets/diode.py', + '../_base_/datasets/_data_base_.py', + + '../_base_/default_runtime.py', + '../_base_/schedules/schedule_1m.py' + ] + +import numpy as np + +model=dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=4, + n_downsample=2, + detach=False, + ) +) + +# model settings +find_unused_parameters = True + + + +# data configs, some similar data are merged together +data_array = [ + # group 1 + [ + #dict(DIODE='DIODE_dataset'), + #dict(DIODE_indoor='DIODE_dataset') + dict(DIODE_outdoor='DIODE_dataset') + ], +] +data_basic=dict( + canonical_space = dict( + img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0, 1), + depth_normalize=(0.1, 200),# (0.3, 160), + # crop_size = (512, 960), + clip_depth_range=(0.1, 150), +) + + + +# indoor (544, 928), outdoor: (768, 1088) +test_metrics = test_metrics = ['abs_rel', 'rmse', 'silog', 'delta1', 'delta2', 'delta3', 'normal_median' , 'normal_mean', 'normal_rmse', 'normal_a1', 'normal_a2', 'normal_a3', 'normal_a4', 'normal_a5'] +DIODE_dataset=dict( + data = dict( + test=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='ResizeKeepRatio', + resize_size=(616, 1064), #(544, 992), #(768, 1088), #(768, 1120), # (768, 1216), #(768, 1024), # (768, 1216), #(768, 1312), # + ignore_label=-1, + padding=[0,0,0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1, + ), + )) diff --git a/external/Metric3D/training/mono/configs/test_configs_vit_small/eth3d.vit.dpt.raft.py b/external/Metric3D/training/mono/configs/test_configs_vit_small/eth3d.vit.dpt.raft.py new file mode 100644 index 0000000000000000000000000000000000000000..1a9c035bc3fcdfb64657a2ef459d193f2c8c530c --- /dev/null +++ b/external/Metric3D/training/mono/configs/test_configs_vit_small/eth3d.vit.dpt.raft.py @@ -0,0 +1,70 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_small_reg.dpt_raft.py', + + '../_base_/datasets/eth3d.py', + '../_base_/datasets/_data_base_.py', + + '../_base_/default_runtime.py', + '../_base_/schedules/schedule_1m.py' + ] + +import numpy as np + +model = dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=4, + n_downsample=2, + detach=False, + ) +) + +# model settings +find_unused_parameters = True + + + +# data configs, some similar data are merged together +data_array = [ + # group 1 + [ + dict(ETH3D='ETH3D_dataset'), #447.2w + ], +] +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0, 1), + depth_normalize=(0.1, 200),# (0.3, 160), + crop_size = (1120, 2016), + clip_depth_range=(0.1, 200), + vit_size=(616,1064), +) + +# indoor (544, 928), outdoor: (768, 1088) +test_metrics = ['abs_rel', 'rmse', 'silog', 'delta1', 'delta2', 'delta3', 'normal_mean', 'normal_rmse', 'normal_a1'] +ETH3D_dataset=dict( + data = dict( + test=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='ResizeKeepRatio', + # resize_size=(512, 512), #(768, 1088), #(768, 1120), # (768, 1216), #(768, 1024), # (768, 1216), #(768, 1312), # (512, 512) + resize_size=(616,1064), + # resize_size=(1120, 2016), + ignore_label=-1, + padding=[0,0,0]), + # dict(type='RandomCrop', + # crop_size=(0,0), + # crop_type='center', + # ignore_label=-1, + # padding=[0,0,0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1, + ), + )) diff --git a/external/Metric3D/training/mono/configs/test_configs_vit_small/ibims.vit.dpt.raft.py b/external/Metric3D/training/mono/configs/test_configs_vit_small/ibims.vit.dpt.raft.py new file mode 100644 index 0000000000000000000000000000000000000000..e4732570df5f65bfed63f0459a50719d44efff77 --- /dev/null +++ b/external/Metric3D/training/mono/configs/test_configs_vit_small/ibims.vit.dpt.raft.py @@ -0,0 +1,70 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_large_reg.dpt_raft.py', + + '../_base_/datasets/ibims.py', + '../_base_/datasets/_data_base_.py', + + '../_base_/default_runtime.py', + '../_base_/schedules/schedule_1m.py' + ] + +import numpy as np + +model = dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=4, + n_downsample=2, + detach=False, + ) +) + +# model settings +find_unused_parameters = True + + + +# data configs, some similar data are merged together +data_array = [ + # group 1 + [ + dict(IBIMS='IBIMS_dataset'), #447.2w + ], +] +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0, 1), + depth_normalize=(0.1, 200),# (0.3, 160), + crop_size = (1120, 2016), + clip_depth_range=(0.1, 200), + vit_size=(616,1064), +) + +# indoor (544, 928), outdoor: (768, 1088) +test_metrics = ['abs_rel', 'rmse', 'silog', 'delta1', 'delta2', 'delta3', 'normal_mean', 'normal_rmse', 'normal_a3', 'normal_a4', 'normal_a5', 'normal_median'] +IBIMS_dataset=dict( + data = dict( + test=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='ResizeKeepRatio', + # resize_size=(512, 512), #(768, 1088), #(768, 1120), # (768, 1216), #(768, 1024), # (768, 1216), #(768, 1312), # (512, 512) + resize_size=(616,1064), + # resize_size=(1120, 2016), + ignore_label=-1, + padding=[0,0,0]), + # dict(type='RandomCrop', + # crop_size=(0,0), + # crop_type='center', + # ignore_label=-1, + # padding=[0,0,0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1, + ), + )) diff --git a/external/Metric3D/training/mono/configs/test_configs_vit_small/kitti.vit.dpt.raft.py b/external/Metric3D/training/mono/configs/test_configs_vit_small/kitti.vit.dpt.raft.py new file mode 100644 index 0000000000000000000000000000000000000000..8966f5c7dcfcc791bbc192231337b8e36f509eb2 --- /dev/null +++ b/external/Metric3D/training/mono/configs/test_configs_vit_small/kitti.vit.dpt.raft.py @@ -0,0 +1,81 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_small_reg.dpt_raft.py', + + '../_base_/datasets/kitti.py', + '../_base_/datasets/_data_base_.py', + + '../_base_/default_runtime.py', + '../_base_/schedules/schedule_1m.py' + ] + +import numpy as np + +model = dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=4, + n_downsample=2, + detach=False, + ) +) + +# model settings +find_unused_parameters = True + + + +# data configs, some similar data are merged together +data_array = [ + # group 1 + [ + dict(KITTI='KITTI_dataset'), + ], +] +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0,1), + depth_normalize=(0.1, 200), + crop_size = (1120, 2016), + clip_depth_range=(0.1, 200), + vit_size=(616,1064), +) + + +test_metrics = ['abs_rel', 'rmse', 'silog', 'delta1', 'delta2', 'delta3', 'rmse_log', + 'log10'] +KITTI_dataset=dict( + data = dict( + test=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='ResizeKeepRatio', + resize_size=(616, 1064), #(416, 1248), #(480, 1216), #(512, 1088), #(512, 1312), #(480, 1248), # # + ignore_label=-1, + padding=[0,0,0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1, + ), + )) + +# DDAD_dataset=dict( +# data = dict( +# test=dict( +# anno_path='DDAD/annotations/test_annotations.json', +# pipeline=[dict(type='BGR2RGB'), +# dict(type='KeepResizeCanoSize', +# resize_size=(640, 1088), #(1216, 1952), #(512, 960), # +# ignore_label=-1, +# padding=[0, 0, 0]), +# dict(type='ToTensor'), +# dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), +# ], +# sample_ratio = 1.0, +# sample_size = 80, +# ), +# )) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/test_configs_vit_small/nuscenes.vit.dpt.raft.py b/external/Metric3D/training/mono/configs/test_configs_vit_small/nuscenes.vit.dpt.raft.py new file mode 100644 index 0000000000000000000000000000000000000000..25f9e065b05930e6512e373b7068e1bbf9ae9d8a --- /dev/null +++ b/external/Metric3D/training/mono/configs/test_configs_vit_small/nuscenes.vit.dpt.raft.py @@ -0,0 +1,93 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_small_reg.dpt_raft.py', + + '../_base_/datasets/nuscenes.py', + '../_base_/datasets/_data_base_.py', + + '../_base_/default_runtime.py', + '../_base_/schedules/schedule_1m.py' + ] + +import numpy as np + +model = dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=4, + n_downsample=2, + detach=False, + ) +) + +# model settings +find_unused_parameters = True + + + +# data configs, some similar data are merged together +data_array = [ + # group 1 + [ + dict(NuScenes='NuScenes_dataset'), + ], +] +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0,1), + depth_normalize=(0.1, 200), + crop_size = (1120, 2016), + clip_depth_range=(0.1, 200), + vit_size=(616,1064), +) + + +test_metrics = ['abs_rel', 'rmse', 'silog', 'delta1', 'delta2', 'delta3'] +NuScenes_dataset=dict( + data = dict( + test=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='ResizeKeepRatio', + # resize_size=(1216, 1952), #(544, 992), # + # resize_size=(560, 1008), + # resize_size=(840, 1512), + resize_size=(616,1064), + ignore_label=-1, + padding=[0,0,0]), + # dict(type='ResizeKeepRatio', + # resize_size=(1120, 2016), + # ignore_label=-1, + # padding=[0,0,0], + # keep_gt=True), + # dict(type='RandomCrop', + # crop_size=(0,0), + # crop_type='center', + # ignore_label=-1, + # padding=[0,0,0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1, + ), + )) + +# DDAD_dataset=dict( +# data = dict( +# test=dict( +# anno_path='DDAD/annotations/test_annotations.json', +# pipeline=[dict(type='BGR2RGB'), +# dict(type='KeepResizeCanoSize', +# resize_size=(640, 1088), #(1216, 1952), #(512, 960), # +# ignore_label=-1, +# padding=[0, 0, 0]), +# dict(type='ToTensor'), +# dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), +# ], +# sample_ratio = 1.0, +# sample_size = 80, +# ), +# )) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/test_configs_vit_small/nyu.vit.dpt.raft.py b/external/Metric3D/training/mono/configs/test_configs_vit_small/nyu.vit.dpt.raft.py new file mode 100644 index 0000000000000000000000000000000000000000..c3f23c53a158d103bb479967c7981e81f8c9fd49 --- /dev/null +++ b/external/Metric3D/training/mono/configs/test_configs_vit_small/nyu.vit.dpt.raft.py @@ -0,0 +1,63 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_small_reg.dpt_raft.py', + + '../_base_/datasets/nyu.py', + '../_base_/datasets/_data_base_.py', + + '../_base_/default_runtime.py', + '../_base_/schedules/schedule_1m.py' + ] + +import numpy as np + +model = dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=4, + n_downsample=2, + detach=False, + ) +) + +# model settings +find_unused_parameters = True + + + +# data configs, some similar data are merged together +data_array = [ + # group 1 + [ + dict(NYU='NYU_dataset'), + ], +] +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0,1), + depth_normalize=(0.1, 200), + crop_size = (1120, 2016), + clip_depth_range=(0.1, 200), + vit_size=(616,1064), +) + + +test_metrics = ['abs_rel', 'rmse', 'silog', 'delta1', 'delta2', 'delta3', 'rmse_log', 'log10', 'normal_mean', 'normal_rmse', 'normal_median', 'normal_a3', 'normal_a4', 'normal_a5'] +NYU_dataset=dict( + data = dict( + test=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='ResizeKeepRatio', + resize_size=(616, 1064), #(544, 992), #(480, 1216), #(480, 640), # + ignore_label=-1, + padding=[0,0,0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = -1, + ), + )) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/test_configs_vit_small/scannet.vit.dpt.raft.py b/external/Metric3D/training/mono/configs/test_configs_vit_small/scannet.vit.dpt.raft.py new file mode 100644 index 0000000000000000000000000000000000000000..dc5308680a13074702799c67a06160f1c007dca4 --- /dev/null +++ b/external/Metric3D/training/mono/configs/test_configs_vit_small/scannet.vit.dpt.raft.py @@ -0,0 +1,66 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_small_reg.dpt_raft.py', + + '../_base_/datasets/scannet.py', + '../_base_/datasets/scannet_all.py', + #'../_base_/datasets/_data_base_.py', + + '../_base_/default_runtime.py', + '../_base_/schedules/schedule_1m.py' + ] + +import numpy as np + +model = dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=4, + n_downsample=2, + detach=False, + ) +) + +# model settings +find_unused_parameters = True + + + +# data configs, some similar data are merged together +data_array = [ + # group 1 + [ + #dict(ScanNet='ScanNet_dataset'), + dict(ScanNetAll='ScanNetAll_dataset') + ], +] +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0,1), + depth_normalize=(0.1, 200), + crop_size = (1120, 2016), + clip_depth_range=(0.1, 200), + vit_size=(616,1064), +) + + +test_metrics = ['abs_rel', 'rmse', 'silog', 'delta1', 'delta2', 'delta3', 'rmse_log', 'log10', 'normal_mean', 'normal_rmse', 'normal_median', 'normal_a3', 'normal_a4', 'normal_a5'] +ScanNetAll_dataset=dict( +#ScanNet_dataset=dict( + data = dict( + test=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='ResizeKeepRatio', + resize_size=(616, 1064), #(544, 992), #(480, 1216), #(480, 640), # + ignore_label=-1, + padding=[0,0,0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 500, + ), + )) \ No newline at end of file diff --git a/external/Metric3D/training/mono/configs/test_configs_vit_small/taskonomy.vit.dpt.raft.py b/external/Metric3D/training/mono/configs/test_configs_vit_small/taskonomy.vit.dpt.raft.py new file mode 100644 index 0000000000000000000000000000000000000000..638c945b32bc013f7d13cdf636587fe2643ece39 --- /dev/null +++ b/external/Metric3D/training/mono/configs/test_configs_vit_small/taskonomy.vit.dpt.raft.py @@ -0,0 +1,70 @@ +_base_=['../_base_/losses/all_losses.py', + '../_base_/models/encoder_decoder/dino_vit_small_reg.dpt_raft.py', + + '../_base_/datasets/taskonomy.py', + '../_base_/datasets/_data_base_.py', + + '../_base_/default_runtime.py', + '../_base_/schedules/schedule_1m.py' + ] + +import numpy as np + +model = dict( + decode_head=dict( + type='RAFTDepthNormalDPT5', + iters=4, + n_downsample=2, + detach=False, + ) +) + +# model settings +find_unused_parameters = True + + + +# data configs, some similar data are merged together +data_array = [ + # group 1 + [ + dict(Taskonomy='Taskonomy_dataset'), #447.2w + ], +] +data_basic=dict( + canonical_space = dict( + # img_size=(540, 960), + focal_length=1000.0, + ), + depth_range=(0, 1), + depth_normalize=(0.1, 200),# (0.3, 160), + crop_size = (1120, 2016), + clip_depth_range=(0.1, 200), + vit_size=(616,1064), +) + +# indoor (544, 928), outdoor: (768, 1088) +test_metrics = ['abs_rel', 'rmse', 'silog', 'delta1', 'delta2', 'delta3', 'normal_mean', 'normal_rmse', 'normal_median', 'normal_a3', 'normal_a4', 'normal_a5'] +Taskonomy_dataset=dict( + data = dict( + test=dict( + pipeline=[dict(type='BGR2RGB'), + dict(type='LabelScaleCononical'), + dict(type='ResizeKeepRatio', + # resize_size=(512, 512), #(768, 1088), #(768, 1120), # (768, 1216), #(768, 1024), # (768, 1216), #(768, 1312), # (512, 512) + resize_size=(616,1064), + # resize_size=(1120, 2016), + ignore_label=-1, + padding=[0,0,0]), + # dict(type='RandomCrop', + # crop_size=(0,0), + # crop_type='center', + # ignore_label=-1, + # padding=[0,0,0]), + dict(type='ToTensor'), + dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), + ], + sample_ratio = 1.0, + sample_size = 500, + ), + )) diff --git a/external/Metric3D/training/mono/utils/raindropper/__init__.py b/external/Metric3D/training/mono/utils/raindropper/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/external/Metric3D/training/mono/utils/raindropper/config.py b/external/Metric3D/training/mono/utils/raindropper/config.py new file mode 100644 index 0000000000000000000000000000000000000000..06b1f211dbcbe37699b96ac2e2bbf60e79c24dda --- /dev/null +++ b/external/Metric3D/training/mono/utils/raindropper/config.py @@ -0,0 +1,24 @@ +""" +Arguments: +maxR -- maximum drop radius +minR -- minimum drop radius +maxDrops -- maximum number of drops in the image +minDrops -- minimum number of drops in the image +edge_darkratio -- brightness reduction factor for drops edges +return_label -- flag defining whether a label will be returned or just an image with generated raindrops +A, B, C, D -- in this code are useless, old version is used for control bezeir +""" + +cfg = { + 'maxR': 35, # max not more then 150 + 'minR': 10, + 'maxDrops': 50, + 'minDrops': 15, + 'edge_darkratio': 1.0, + 'return_label': True, + 'label_thres': 128, + 'A': (1, 4.5), + 'B': (3, 1), + 'C': (1, 3), + 'D': (3, 3) +} diff --git a/external/Metric3D/training/mono/utils/raindropper/dropgenerator.py b/external/Metric3D/training/mono/utils/raindropper/dropgenerator.py new file mode 100644 index 0000000000000000000000000000000000000000..39b72c787316520af784655a61962b08b039c6c1 --- /dev/null +++ b/external/Metric3D/training/mono/utils/raindropper/dropgenerator.py @@ -0,0 +1,425 @@ +# change rainy drop func from +# https://github.com/EvoCargo/RaindropsOnWindshield/blob/main/raindrops_generator/raindrop/dropgenerator.py + +import math +import random +from random import randint + +import cv2 +import numpy as np +from PIL import Image, ImageDraw, ImageEnhance +from skimage.measure import label as skimage_label + +from .raindrop import Raindrop, make_bezier + + +def CheckCollision(DropList): + """This function handle the collision of the drops. + + :param DropList: list of raindrop class objects + """ + listFinalDrops = [] + Checked_list = [] + list_len = len(DropList) + # because latter raindrops in raindrop list should has more colision information + # so reverse list + DropList.reverse() + drop_key = 1 + for drop in DropList: + # if the drop has not been handle + if drop.getKey() not in Checked_list: + # if drop has collision with other drops + if drop.getIfColli(): + # get collision list + collision_list = drop.getCollisionList() + # first get radius and center to decide how will the collision do + final_x = drop.getCenters()[0] * drop.getRadius() + final_y = drop.getCenters()[1] * drop.getRadius() + tmp_devide = drop.getRadius() + final_R = drop.getRadius() * drop.getRadius() + for col_id in collision_list: + col_id = int(col_id) + Checked_list.append(col_id) + # list start from 0 + final_x += DropList[list_len - col_id].getRadius() * DropList[list_len - col_id].getCenters()[0] + final_y += DropList[list_len - col_id].getRadius() * DropList[list_len - col_id].getCenters()[1] + tmp_devide += DropList[list_len - col_id].getRadius() + final_R += DropList[list_len - col_id].getRadius() * DropList[list_len - col_id].getRadius() + final_x = int(round(final_x / tmp_devide)) + final_y = int(round(final_y / tmp_devide)) + final_R = int(round(math.sqrt(final_R))) + # rebuild drop after handled the collisions + newDrop = Raindrop(drop_key, (final_x, final_y), final_R) + drop_key = drop_key + 1 + listFinalDrops.append(newDrop) + # no collision + else: + drop.setKey(drop_key) + drop_key = drop_key + 1 + listFinalDrops.append(drop) + + return listFinalDrops + + +def generate_label(h, w, cfg): + """This function generate list of raindrop class objects and label map of + this drops in the image. + + :param h: image height + :param w: image width + :param cfg: config with global constants + :param shape: int from 0 to 2 defining raindrop shape type + """ + maxDrop = cfg['maxDrops'] + minDrop = cfg['minDrops'] + maxR = cfg['maxR'] + minR = cfg['minR'] + drop_num = randint(minDrop, maxDrop) + imgh = h + imgw = w + # random drops position + ran_pos = [(int(random.random() * imgw), int(random.random() * imgh)) for _ in range(drop_num)] + listRainDrops = [] + listFinalDrops = [] + for key, pos in enumerate(ran_pos): + key = key + 1 + radius = random.randint(minR, maxR) + shape = random.randint(1, 1) + drop = Raindrop(key, pos, radius, shape) + listRainDrops.append(drop) +# to check if collision or not + label_map = np.zeros([h, w]) + collisionNum = len(listRainDrops) + listFinalDrops = list(listRainDrops) + loop = 0 + while collisionNum > 0: + loop = loop + 1 + listFinalDrops = list(listFinalDrops) + collisionNum = len(listFinalDrops) + label_map = np.zeros_like(label_map) + # Check Collision + for drop in listFinalDrops: + # check the bounding + (ix, iy) = drop.getCenters() + radius = drop.getRadius() + ROI_WL = 2 * radius + ROI_WR = 2 * radius + ROI_HU = 3 * radius + ROI_HD = 2 * radius + if (iy - 3 * radius) < 0: + ROI_HU = iy + if (iy + 2 * radius) > imgh: + ROI_HD = imgh - iy + if (ix - 2 * radius) < 0: + ROI_WL = ix + if (ix + 2 * radius) > imgw: + ROI_WR = imgw - ix + + +# apply raindrop label map to Image's label map + drop_label = drop.getLabelMap() + # check if center has already has drops + if (label_map[iy, ix] > 0): + col_ids = np.unique(label_map[iy - ROI_HU:iy + ROI_HD, ix - ROI_WL:ix + ROI_WR]) + col_ids = col_ids[col_ids != 0] + drop.setCollision(True, col_ids) + label_map[iy - ROI_HU:iy + ROI_HD, + ix - ROI_WL:ix + ROI_WR] = drop_label[3 * radius - ROI_HU:3 * radius + ROI_HD, 2 * radius - + ROI_WL:2 * radius + ROI_WR] * drop.getKey() + else: + label_map[iy - ROI_HU:iy + ROI_HD, + ix - ROI_WL:ix + ROI_WR] = drop_label[3 * radius - ROI_HU:3 * radius + ROI_HD, 2 * radius - + ROI_WL:2 * radius + ROI_WR] * drop.getKey() + # no collision + collisionNum = collisionNum - 1 + + if collisionNum > 0: + listFinalDrops = CheckCollision(listFinalDrops) + return listFinalDrops, label_map + + +def generateDrops(imagePath, cfg, listFinalDrops): + """Generate raindrops on the image. + + :param imagePath: path to the image on which you want to generate drops + :param cfg: config with global constants + :param listFinalDrops: final list of raindrop class objects after handling collisions + :param label_map: general label map of all drops in the image + """ + ifReturnLabel = cfg['return_label'] + edge_ratio = cfg['edge_darkratio'] + + PIL_bg_img = Image.open(imagePath).convert('RGB') + bg_img = np.asarray(PIL_bg_img) + label_map = np.zeros_like(bg_img)[:, :, 0] + imgh, imgw, _ = bg_img.shape + + A = cfg['A'] + B = cfg['B'] + C = cfg['C'] + D = cfg['D'] + + alpha_map = np.zeros_like(label_map).astype(np.float64) + + for drop in listFinalDrops: + (ix, iy) = drop.getCenters() + radius = drop.getRadius() + ROI_WL = 2 * radius + ROI_WR = 2 * radius + ROI_HU = 3 * radius + ROI_HD = 2 * radius + if (iy - 3 * radius) < 0: + ROI_HU = iy + if (iy + 2 * radius) > imgh: + ROI_HD = imgh - iy + if (ix - 2 * radius) < 0: + ROI_WL = ix + if (ix + 2 * radius) > imgw: + ROI_WR = imgw - ix + + drop_alpha = drop.getAlphaMap() + alpha_map[iy - ROI_HU:iy + ROI_HD, + ix - ROI_WL:ix + ROI_WR] += drop_alpha[3 * radius - ROI_HU:3 * radius + ROI_HD, + 2 * radius - ROI_WL:2 * radius + ROI_WR] + + alpha_map = alpha_map / np.max(alpha_map) * 255.0 + + PIL_bg_img = Image.open(imagePath) + for idx, drop in enumerate(listFinalDrops): + (ix, iy) = drop.getCenters() + radius = drop.getRadius() + ROIU = iy - 3 * radius + ROID = iy + 2 * radius + ROIL = ix - 2 * radius + ROIR = ix + 2 * radius + if (iy - 3 * radius) < 0: + ROIU = 0 + ROID = 5 * radius + if (iy + 2 * radius) > imgh: + ROIU = imgh - 5 * radius + ROID = imgh + if (ix - 2 * radius) < 0: + ROIL = 0 + ROIR = 4 * radius + if (ix + 2 * radius) > imgw: + ROIL = imgw - 4 * radius + ROIR = imgw + + tmp_bg = bg_img[ROIU:ROID, ROIL:ROIR, :] + try: + drop.updateTexture(tmp_bg) + except Exception: + del listFinalDrops[idx] + continue + tmp_alpha_map = alpha_map[ROIU:ROID, ROIL:ROIR] + + output = drop.getTexture() + tmp_output = np.asarray(output).astype(np.float)[:, :, -1] + tmp_alpha_map = tmp_alpha_map * (tmp_output / 255) + tmp_alpha_map = Image.fromarray(tmp_alpha_map.astype('uint8')) + + edge = ImageEnhance.Brightness(output) + edge = edge.enhance(edge_ratio) + + PIL_bg_img.paste(edge, (ix - 2 * radius, iy - 3 * radius), output) + PIL_bg_img.paste(output, (ix - 2 * radius, iy - 3 * radius), output) + + mask = np.zeros_like(bg_img) + + if len(listFinalDrops) > 0: + # make circles and elipses + for drop in listFinalDrops: + if (drop.shape == 0): + cv2.circle(mask, drop.center, drop.radius, (255, 255, 255), -1) + if (drop.shape == 1): + cv2.circle(mask, drop.center, drop.radius, (255, 255, 255), -1) + cv2.ellipse(mask, drop.center, (drop.radius, int(1.3 * math.sqrt(3) * drop.radius)), 0, 180, 360, + (255, 255, 255), -1) + + img = Image.fromarray(np.uint8(mask[:, :, 0]), 'L') + # make beziers + for drop in listFinalDrops: + if (drop.shape == 2): + img = Image.fromarray(np.uint8(img), 'L') + draw = ImageDraw.Draw(img) + ts = [t / 100.0 for t in range(101)] + xys = [(drop.radius * C[0] - 2 * drop.radius + drop.center[0], + drop.radius * C[1] - 3 * drop.radius + drop.center[1]), + (drop.radius * B[0] - 2 * drop.radius + drop.center[0], + drop.radius * B[1] - 3 * drop.radius + drop.center[1]), + (drop.radius * D[0] - 2 * drop.radius + drop.center[0], + drop.radius * D[1] - 3 * drop.radius + drop.center[1])] + bezier = make_bezier(xys) + points = bezier(ts) + + xys = [(drop.radius * C[0] - 2 * drop.radius + drop.center[0], + drop.radius * C[1] - 3 * drop.radius + drop.center[1]), + (drop.radius * A[0] - 2 * drop.radius + drop.center[0], + drop.radius * A[1] - 3 * drop.radius + drop.center[1]), + (drop.radius * D[0] - 2 * drop.radius + drop.center[0], + drop.radius * D[1] - 3 * drop.radius + drop.center[1])] + bezier = make_bezier(xys) + points.extend(bezier(ts)) + draw.polygon(points, fill='white') + mask = np.array(img) + + im_mask = Image.fromarray(mask.astype('uint8')) + + if ifReturnLabel: + output_label = np.array(alpha_map) + output_label.flags.writeable = True + output_label[output_label > 0] = 1 + output_label = Image.fromarray(output_label.astype('uint8')) + return PIL_bg_img, output_label, im_mask + + return PIL_bg_img + + +def generateDrops_np(img_np, cfg, listFinalDrops): + """Generate raindrops on the image. + + :param imgs: numpy imgs shape -> [B, H, W, C], type -> np.uint8 + :param cfg: config with global constants + :param listFinalDrops: final list of raindrop class objects after handling collisions + :param label_map: general label map of all drops in the image + """ + ifReturnLabel = cfg['return_label'] + edge_ratio = cfg['edge_darkratio'] + + # PIL_bg_img = Image.open(imagePath) + # label_map = np.zeros_like(bg_img)[:,:,0] + # imgh, imgw, _ = bg_img.shape + bg_img = img_np + label_map = np.zeros_like(bg_img)[:, :, 0] # [H, W] + imgh, imgw, _ = bg_img.shape + + A = cfg['A'] + B = cfg['B'] + C = cfg['C'] + D = cfg['D'] + + # 0. generate alpha change map by generated list raindrops + alpha_map = np.zeros_like(label_map).astype(np.float64) # [H, W] + + for drop in listFinalDrops: + (ix, iy) = drop.getCenters() + radius = drop.getRadius() + ROI_WL = 2 * radius + ROI_WR = 2 * radius + ROI_HU = 3 * radius + ROI_HD = 2 * radius + if (iy - 3 * radius) < 0: + ROI_HU = iy + if (iy + 2 * radius) > imgh: + ROI_HD = imgh - iy + if (ix - 2 * radius) < 0: + ROI_WL = ix + if (ix + 2 * radius) > imgw: + ROI_WR = imgw - ix + + drop_alpha = drop.getAlphaMap() + + alpha_map[iy - ROI_HU:iy + ROI_HD, + ix - ROI_WL:ix + ROI_WR] += drop_alpha[3 * radius - ROI_HU:3 * radius + ROI_HD, + 2 * radius - ROI_WL:2 * radius + ROI_WR] + + alpha_map = alpha_map / np.max(alpha_map) * 255.0 + + PIL_bg_img = Image.fromarray(np.uint8(bg_img)).convert('RGB') + # convert + for idx, drop in enumerate(listFinalDrops): + (ix, iy) = drop.getCenters() + radius = drop.getRadius() + ROIU = iy - 3 * radius + ROID = iy + 2 * radius + ROIL = ix - 2 * radius + ROIR = ix + 2 * radius + if (iy - 3 * radius) < 0: + ROIU = 0 + ROID = 5 * radius + if (iy + 2 * radius) > imgh: + ROIU = imgh - 5 * radius + ROID = imgh + if (ix - 2 * radius) < 0: + ROIL = 0 + ROIR = 4 * radius + if (ix + 2 * radius) > imgw: + ROIL = imgw - 4 * radius + ROIR = imgw + + tmp_bg = bg_img[ROIU:ROID, ROIL:ROIR] + try: + drop.updateTexture(tmp_bg) + except Exception: + del listFinalDrops[idx] + continue + tmp_alpha_map = alpha_map[ROIU:ROID, ROIL:ROIR] + + output = drop.getTexture() + tmp_output = np.asarray(output).astype(np.float)[:, :, -1] + tmp_alpha_map = tmp_alpha_map * (tmp_output / 255) + tmp_alpha_map = Image.fromarray(tmp_alpha_map.astype('uint8')) + + edge = ImageEnhance.Brightness(output) + edge = edge.enhance(edge_ratio) + + # PIL_bg_img.paste(edge, (ix-2*radius, iy-3*radius), output) + # PIL_bg_img.paste(output, (ix-2*radius, iy-3*radius), output) + PIL_bg_img.paste(edge, (ROIL, ROIU), output) + PIL_bg_img.paste(output, (ROIL, ROIU), output) + + +# mask process part + mask = np.zeros_like(bg_img) + + if len(listFinalDrops) > 0: + # make circles and elipses + for drop in listFinalDrops: + if (drop.shape == 0): + cv2.circle(mask, drop.center, drop.radius, (255, 255, 255), -1) + if (drop.shape == 1): + cv2.circle(mask, drop.center, drop.radius, (255, 255, 255), -1) + cv2.ellipse(mask, drop.center, (drop.radius, int(1.3 * math.sqrt(3) * drop.radius)), 0, 180, 360, + (255, 255, 255), -1) + + img = Image.fromarray(np.uint8(mask[:, :, 0]), 'L') + # make beziers + for drop in listFinalDrops: + if (drop.shape == 2): + img = Image.fromarray(np.uint8(img), 'L') + draw = ImageDraw.Draw(img) + ts = [t / 100.0 for t in range(101)] + A0, A1 = drop.control_point['A'][0], drop.control_point['A'][1] + B0, B1 = drop.control_point['B'][0], drop.control_point['B'][1] + C0, C1 = drop.control_point['C'][0], drop.control_point['C'][1] + D0, D1 = drop.control_point['D'][0], drop.control_point['D'][1] + xys = [(drop.radius * C0 - 2 * drop.radius + drop.center[0], + drop.radius * C1 - 3 * drop.radius + drop.center[1]), + (drop.radius * B0 - 2 * drop.radius + drop.center[0], + drop.radius * B1 - 3 * drop.radius + drop.center[1]), + (drop.radius * D0 - 2 * drop.radius + drop.center[0], + drop.radius * D1 - 3 * drop.radius + drop.center[1])] + bezier = make_bezier(xys) + points = bezier(ts) + + xys = [(drop.radius * C0 - 2 * drop.radius + drop.center[0], + drop.radius * C1 - 3 * drop.radius + drop.center[1]), + (drop.radius * A0 - 2 * drop.radius + drop.center[0], + drop.radius * A1 - 3 * drop.radius + drop.center[1]), + (drop.radius * D0 - 2 * drop.radius + drop.center[0], + drop.radius * D1 - 3 * drop.radius + drop.center[1])] + bezier = make_bezier(xys) + points.extend(bezier(ts)) + draw.polygon(points, fill='white') + mask = np.array(img) + + im_mask = Image.fromarray(mask.astype('uint8')) + + if ifReturnLabel: + output_label = np.array(alpha_map) + output_label.flags.writeable = True + output_label[output_label > 0] = 1 + output_label = Image.fromarray(output_label.astype('uint8')) + return PIL_bg_img, output_label, im_mask + + return PIL_bg_img diff --git a/external/Metric3D/training/mono/utils/raindropper/raindrop.py b/external/Metric3D/training/mono/utils/raindropper/raindrop.py new file mode 100644 index 0000000000000000000000000000000000000000..ae7b66c1f5f1a6280b8898b06206131c8a6e289f --- /dev/null +++ b/external/Metric3D/training/mono/utils/raindropper/raindrop.py @@ -0,0 +1,194 @@ +# change rainy drop func from +# https://github.com/EvoCargo/RaindropsOnWindshield/blob/main/raindrops_generator/raindrop/raindrop.py + +import math +import random +from random import randint + +import cv2 +import numpy as np +from PIL import Image, ImageDraw, ImageFilter +from raindropper.config import cfg + + +def make_bezier(xys): + # xys should be a sequence of 2-tuples (Bezier control points) + n = len(xys) + combinations = pascal_row(n - 1) + + def bezier(ts): + # This uses the generalized formula for bezier curves + # http://en.wikipedia.org/wiki/B%C3%A9zier_curve#Generalization + result = [] + for t in ts: + tpowers = (t**i for i in range(n)) + upowers = reversed([(1 - t)**i for i in range(n)]) + coefs = [c * a * b for c, a, b in zip(combinations, tpowers, upowers)] + result.append(tuple(sum([coef * p for coef, p in zip(coefs, ps)]) for ps in zip(*xys))) + return result + + return bezier + + +def pascal_row(n, memo={}): + # This returns the nth row of Pascal Triangle + if n in memo: + return memo[n] + result = [1] + x, numerator = 1, n + for denominator in range(1, n // 2 + 1): + x *= numerator + x /= denominator + result.append(x) + numerator -= 1 + if n & 1 == 0: + result.extend(reversed(result[:-1])) + else: + result.extend(reversed(result)) + memo[n] = result + return result + + +class Raindrop(): + + def __init__(self, key, centerxy=None, radius=None, shape=None): + # param key: a unique key identifying a drop + # param centerxy: tuple defining coordinates of raindrop center in the image + # param radius: radius of a drop + # param shape: int from 0 to 2 defining raindrop shape type + self.key = key + self.ifcol = False + self.col_with = [] + self.center = centerxy + self.radius = radius + # self.blur_coeff = max(int(self.radius/3), 1) + # self.blur_coeff = max(int(cfg["maxR"] / self.radius), 1) + self.blur_coeff = 3 + self.shape = shape + self.type = 'default' + # label map's WxH = 4*R , 5*R + self.labelmap = np.zeros((self.radius * 5, self.radius * 4)) + self.alphamap = np.zeros((self.radius * 5, self.radius * 4)) + self.background = None + self.texture = None + self.control_point = {} + self._create_label() + self.use_label = False + + def setCollision(self, col, col_with): + self.ifcol = col + self.col_with = col_with + + def updateTexture(self, bg): + # gaussian blur radius may be 1, 3, 5 + radius_array = [1, 3] + blur_radius_idx = randint(0, 1) + blur_radius = radius_array[blur_radius_idx] + fg = (Image.fromarray(np.uint8(bg))).filter(ImageFilter.GaussianBlur(radius=blur_radius)) + fg = np.asarray(fg) + + # add fish eye effect to simulate the background + K = np.array([[30 * self.radius, 0, 2 * self.radius], [0., 20 * self.radius, 3 * self.radius], [0., 0., 1]]) + D = np.array([0.0, 0.0, 0.0, 0.0]) + Knew = K.copy() + + Knew[(0, 1), (0, 1)] = math.pow(self.radius, 1 / 500) * 2 * Knew[(0, 1), (0, 1)] + fisheye = cv2.fisheye.undistortImage(fg, K, D=D, Knew=Knew) + + tmp = np.expand_dims(self.alphamap, axis=-1) + tmp = np.concatenate((fisheye, tmp), axis=2) + + self.texture = Image.fromarray(tmp.astype('uint8'), 'RGBA') + + def _create_label(self): + self._createDefaultDrop() + + def _createDefaultDrop(self): + """create the raindrop Alpha Map according to its shape type update + raindrop label.""" + if (self.shape == 0): + cv2.circle(self.labelmap, (self.radius * 2, self.radius * 3), int(self.radius), 128, -1) + self.alphamap = (Image.fromarray(np.uint8(self.labelmap))).filter( + ImageFilter.GaussianBlur(radius=self.blur_coeff)) + self.alphamap = np.asarray(self.alphamap).astype(np.float) + self.alphamap = self.alphamap / np.max(self.alphamap) * 255.0 + # set label map + self.labelmap[self.labelmap > 0] = 1 + + if (self.shape == 1): + cv2.circle(self.labelmap, (self.radius * 2, self.radius * 3), int(self.radius), 128, -1) + cv2.ellipse(self.labelmap, (self.radius * 2, self.radius * 3), + (self.radius, int(1.3 * math.sqrt(3) * self.radius)), 0, 180, 360, 128, -1) + + self.alphamap = (Image.fromarray(np.uint8(self.labelmap))).filter( + ImageFilter.GaussianBlur(radius=self.blur_coeff)) + self.alphamap = np.asarray(self.alphamap).astype(np.float) + self.alphamap = self.alphamap / np.max(self.alphamap) * 255.0 + # set label map + self.labelmap[self.labelmap > 0] = 1 + + if (self.shape == 2): + C0 = random.uniform(0, 1) + C1 = random.uniform(0, 1) + A0 = random.uniform(0, 1) + A1 = random.uniform(2, 3) + D0 = random.uniform(2, 3) + D1 = random.uniform(2, 3) + B0 = random.uniform(2, 3) + B1 = random.uniform(0, 1) + + self.control_point['A'] = (A0, A1) + self.control_point['B'] = (B0, B1) + self.control_point['C'] = (C0, C1) + self.control_point['D'] = (D0, D1) + + img = Image.fromarray(np.uint8(self.labelmap), 'L') + draw = ImageDraw.Draw(img) + ts = [t / 100.0 for t in range(101)] + xys = [(self.radius * C0, self.radius * C1), (self.radius * B0, self.radius * B1), + (self.radius * D0, self.radius * D1)] + bezier = make_bezier(xys) + points = bezier(ts) + + xys = [(self.radius * C0, self.radius * C1), (self.radius * A0, self.radius * A1), + (self.radius * D0, self.radius * D1)] + bezier = make_bezier(xys) + points.extend(bezier(ts)) + draw.polygon(points, fill='gray') + + self.alphamap = img.filter(ImageFilter.GaussianBlur(radius=self.blur_coeff)) + self.alphamap = np.asarray(self.alphamap).astype(np.float) + self.alphamap = self.alphamap / np.max(self.alphamap) * 255.0 + + # set label map + self.labelmap[self.labelmap > 0] = 1 + + def setKey(self, key): + self.key = key + + def getLabelMap(self): + return self.labelmap + + def getAlphaMap(self): + return self.alphamap + + def getTexture(self): + return self.texture + + def getCenters(self): + return self.center + + def getRadius(self): + return self.radius + + def getKey(self): + return self.key + + def getIfColli(self): + return self.ifcol + + def getCollisionList(self): + return self.col_with + + def getUseLabel(self): + return self.use_label diff --git a/external/Metric3D/training/mono/utils/raindropper/raindrop_augmentor.py b/external/Metric3D/training/mono/utils/raindropper/raindrop_augmentor.py new file mode 100644 index 0000000000000000000000000000000000000000..c160359cee94128cb644ee886231d3d45367fdb0 --- /dev/null +++ b/external/Metric3D/training/mono/utils/raindropper/raindrop_augmentor.py @@ -0,0 +1,30 @@ +import numpy as np + +from .config import cfg +from .dropgenerator import generate_label, generateDrops_np + + +class RainDrop_Augmentor(): + + def __init__(self, height, width): + drops_list, label_map = generate_label(height, width, cfg) + self.drops_list = drops_list + self.label_map = label_map + + def generate_one(self, img_np, mode='rgb'): + + assert mode in ['gray', 'rgb'] + + # requirement input [H, W, 3] + if (mode == 'gray'): + img_np = np.squeeze(img_np) + img_np = np.expand_dims(img_np, axis=-1) + img_np = np.repeat(img_np, 3, axis=-1) + + output_img, output_label, mask = generateDrops_np(img_np, cfg, self.drops_list) + output_img = np.asarray(output_img) + + if (mode == 'gray'): + output_img = output_img[:, :, 0] + + return output_img