init commit

This commit is contained in:
Xiaoyang Guo 2019-04-14 17:34:58 +08:00
parent f8358de8f8
commit 6b8f506591
25 changed files with 41706 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
*.pyc
checkpoints
*.ckpt
events.out.*
.idea

7
datasets/__init__.py Normal file
View File

@ -0,0 +1,7 @@
from .kitti_dataset import KITTIDataset
from .sceneflow_dataset import SceneFlowDatset
__datasets__ = {
"sceneflow": SceneFlowDatset,
"kitti": KITTIDataset
}

58
datasets/data_io.py Normal file
View File

@ -0,0 +1,58 @@
import numpy as np
import re
import torchvision.transforms as transforms
def get_transform():
mean = [0.485, 0.456, 0.406]
std = [0.229, 0.224, 0.225]
return transforms.Compose([
transforms.ToTensor(),
transforms.Normalize(mean=mean, std=std),
])
# read all lines in a file
def read_all_lines(filename):
with open(filename) as f:
lines = [line.rstrip() for line in f.readlines()]
return lines
# read an .pfm file into numpy array, used to load SceneFlow disparity files
def pfm_imread(filename):
file = open(filename, 'rb')
color = None
width = None
height = None
scale = None
endian = None
header = file.readline().decode('utf-8').rstrip()
if header == 'PF':
color = True
elif header == 'Pf':
color = False
else:
raise Exception('Not a PFM file.')
dim_match = re.match(r'^(\d+)\s(\d+)\s$', file.readline().decode('utf-8'))
if dim_match:
width, height = map(int, dim_match.groups())
else:
raise Exception('Malformed PFM header.')
scale = float(file.readline().rstrip())
if scale < 0: # little-endian
endian = '<'
scale = -scale
else:
endian = '>' # big-endian
data = np.fromfile(file, endian + 'f')
shape = (height, width, 3) if color else (height, width)
data = np.reshape(data, shape)
data = np.flipud(data)
return data, scale

99
datasets/kitti_dataset.py Normal file
View File

@ -0,0 +1,99 @@
import os
import random
from torch.utils.data import Dataset
from PIL import Image
import numpy as np
from datasets.data_io import get_transform, read_all_lines
class KITTIDataset(Dataset):
def __init__(self, datapath, list_filename, training):
self.datapath = datapath
self.left_filenames, self.right_filenames, self.disp_filenames = self.load_path(list_filename)
self.training = training
if self.training:
assert self.disp_filenames is not None
def load_path(self, list_filename):
lines = read_all_lines(list_filename)
splits = [line.split() for line in lines]
left_images = [x[0] for x in splits]
right_images = [x[1] for x in splits]
if len(splits[0]) == 2: # ground truth not available
return left_images, right_images, None
else:
disp_images = [x[2] for x in splits]
return left_images, right_images, disp_images
def load_image(self, filename):
return Image.open(filename).convert('RGB')
def load_disp(self, filename):
data = Image.open(filename)
data = np.array(data, dtype=np.float32) / 256.
return data
def __len__(self):
return len(self.left_filenames)
def __getitem__(self, index):
left_img = self.load_image(os.path.join(self.datapath, self.left_filenames[index]))
right_img = self.load_image(os.path.join(self.datapath, self.right_filenames[index]))
if self.disp_filenames: # has disparity ground truth
disparity = self.load_disp(os.path.join(self.datapath, self.disp_filenames[index]))
else:
disparity = None
if self.training:
w, h = left_img.size
crop_w, crop_h = 512, 256
x1 = random.randint(0, w - crop_w)
y1 = random.randint(0, h - crop_h)
# random crop
left_img = left_img.crop((x1, y1, x1 + crop_w, y1 + crop_h))
right_img = right_img.crop((x1, y1, x1 + crop_w, y1 + crop_h))
disparity = disparity[y1:y1 + crop_h, x1:x1 + crop_w]
# to tensor, normalize
processed = get_transform()
left_img = processed(left_img)
right_img = processed(right_img)
return {"left": left_img,
"right": right_img,
"disparity": disparity}
else:
w, h = left_img.size
# normalize
processed = get_transform()
left_img = processed(left_img).numpy()
right_img = processed(right_img).numpy()
# pad to size 1248x384
top_pad = 384 - h
right_pad = 1248 - w
assert top_pad > 0 and right_pad > 0
# pad images
left_img = np.lib.pad(left_img, ((0, 0), (top_pad, 0), (0, right_pad)), mode='constant', constant_values=0)
right_img = np.lib.pad(right_img, ((0, 0), (top_pad, 0), (0, right_pad)), mode='constant',
constant_values=0)
# pad disparity gt
if disparity is not None:
assert len(disparity.shape) == 2
disparity = np.lib.pad(disparity, ((top_pad, 0), (0, right_pad)), mode='constant', constant_values=0)
if disparity is not None:
return {"left": left_img,
"right": right_img,
"disparity": disparity,
"top_pad": top_pad,
"right_pad": right_pad}
else:
return {"left": left_img,
"right": right_img,
"top_pad": top_pad,
"right_pad": right_pad}

View File

@ -0,0 +1,75 @@
import os
import random
from torch.utils.data import Dataset
from PIL import Image
import numpy as np
from datasets.data_io import get_transform, read_all_lines, pfm_imread
class SceneFlowDatset(Dataset):
def __init__(self, datapath, list_filename, training):
self.datapath = datapath
self.left_filenames, self.right_filenames, self.disp_filenames = self.load_path(list_filename)
self.training = training
def load_path(self, list_filename):
lines = read_all_lines(list_filename)
splits = [line.split() for line in lines]
left_images = [x[0] for x in splits]
right_images = [x[1] for x in splits]
disp_images = [x[2] for x in splits]
return left_images, right_images, disp_images
def load_image(self, filename):
return Image.open(filename).convert('RGB')
def load_disp(self, filename):
data, scale = pfm_imread(filename)
data = np.ascontiguousarray(data, dtype=np.float32)
return data
def __len__(self):
return len(self.left_filenames)
def __getitem__(self, index):
left_img = self.load_image(os.path.join(self.datapath, self.left_filenames[index]))
right_img = self.load_image(os.path.join(self.datapath, self.right_filenames[index]))
disparity = self.load_disp(os.path.join(self.datapath, self.disp_filenames[index]))
if self.training:
w, h = left_img.size
crop_w, crop_h = 512, 256
x1 = random.randint(0, w - crop_w)
y1 = random.randint(0, h - crop_h)
# random crop
left_img = left_img.crop((x1, y1, x1 + crop_w, y1 + crop_h))
right_img = right_img.crop((x1, y1, x1 + crop_w, y1 + crop_h))
disparity = disparity[y1:y1 + crop_h, x1:x1 + crop_w]
# to tensor, normalize
processed = get_transform()
left_img = processed(left_img)
right_img = processed(right_img)
return {"left": left_img,
"right": right_img,
"disparity": disparity}
else:
w, h = left_img.size
crop_w, crop_h = 960, 512
left_img = left_img.crop((w - crop_w, h - crop_h, w, h))
right_img = right_img.crop((w - crop_w, h - crop_h, w, h))
disparity = disparity[h - crop_h:h, w - crop_w: w]
processed = get_transform()
left_img = processed(left_img)
right_img = processed(right_img)
return {"left": left_img,
"right": right_img,
"disparity": disparity,
"top_pad": 0,
"right_pad": 0}

195
filenames/kitti12_test.txt Normal file
View File

@ -0,0 +1,195 @@
testing/colored_0/000000_10.png testing/colored_1/000000_10.png
testing/colored_0/000001_10.png testing/colored_1/000001_10.png
testing/colored_0/000002_10.png testing/colored_1/000002_10.png
testing/colored_0/000003_10.png testing/colored_1/000003_10.png
testing/colored_0/000004_10.png testing/colored_1/000004_10.png
testing/colored_0/000005_10.png testing/colored_1/000005_10.png
testing/colored_0/000006_10.png testing/colored_1/000006_10.png
testing/colored_0/000007_10.png testing/colored_1/000007_10.png
testing/colored_0/000008_10.png testing/colored_1/000008_10.png
testing/colored_0/000009_10.png testing/colored_1/000009_10.png
testing/colored_0/000010_10.png testing/colored_1/000010_10.png
testing/colored_0/000011_10.png testing/colored_1/000011_10.png
testing/colored_0/000012_10.png testing/colored_1/000012_10.png
testing/colored_0/000013_10.png testing/colored_1/000013_10.png
testing/colored_0/000014_10.png testing/colored_1/000014_10.png
testing/colored_0/000015_10.png testing/colored_1/000015_10.png
testing/colored_0/000016_10.png testing/colored_1/000016_10.png
testing/colored_0/000017_10.png testing/colored_1/000017_10.png
testing/colored_0/000018_10.png testing/colored_1/000018_10.png
testing/colored_0/000019_10.png testing/colored_1/000019_10.png
testing/colored_0/000020_10.png testing/colored_1/000020_10.png
testing/colored_0/000021_10.png testing/colored_1/000021_10.png
testing/colored_0/000022_10.png testing/colored_1/000022_10.png
testing/colored_0/000023_10.png testing/colored_1/000023_10.png
testing/colored_0/000024_10.png testing/colored_1/000024_10.png
testing/colored_0/000025_10.png testing/colored_1/000025_10.png
testing/colored_0/000026_10.png testing/colored_1/000026_10.png
testing/colored_0/000027_10.png testing/colored_1/000027_10.png
testing/colored_0/000028_10.png testing/colored_1/000028_10.png
testing/colored_0/000029_10.png testing/colored_1/000029_10.png
testing/colored_0/000030_10.png testing/colored_1/000030_10.png
testing/colored_0/000031_10.png testing/colored_1/000031_10.png
testing/colored_0/000032_10.png testing/colored_1/000032_10.png
testing/colored_0/000033_10.png testing/colored_1/000033_10.png
testing/colored_0/000034_10.png testing/colored_1/000034_10.png
testing/colored_0/000035_10.png testing/colored_1/000035_10.png
testing/colored_0/000036_10.png testing/colored_1/000036_10.png
testing/colored_0/000037_10.png testing/colored_1/000037_10.png
testing/colored_0/000038_10.png testing/colored_1/000038_10.png
testing/colored_0/000039_10.png testing/colored_1/000039_10.png
testing/colored_0/000040_10.png testing/colored_1/000040_10.png
testing/colored_0/000041_10.png testing/colored_1/000041_10.png
testing/colored_0/000042_10.png testing/colored_1/000042_10.png
testing/colored_0/000043_10.png testing/colored_1/000043_10.png
testing/colored_0/000044_10.png testing/colored_1/000044_10.png
testing/colored_0/000045_10.png testing/colored_1/000045_10.png
testing/colored_0/000046_10.png testing/colored_1/000046_10.png
testing/colored_0/000047_10.png testing/colored_1/000047_10.png
testing/colored_0/000048_10.png testing/colored_1/000048_10.png
testing/colored_0/000049_10.png testing/colored_1/000049_10.png
testing/colored_0/000050_10.png testing/colored_1/000050_10.png
testing/colored_0/000051_10.png testing/colored_1/000051_10.png
testing/colored_0/000052_10.png testing/colored_1/000052_10.png
testing/colored_0/000053_10.png testing/colored_1/000053_10.png
testing/colored_0/000054_10.png testing/colored_1/000054_10.png
testing/colored_0/000055_10.png testing/colored_1/000055_10.png
testing/colored_0/000056_10.png testing/colored_1/000056_10.png
testing/colored_0/000057_10.png testing/colored_1/000057_10.png
testing/colored_0/000058_10.png testing/colored_1/000058_10.png
testing/colored_0/000059_10.png testing/colored_1/000059_10.png
testing/colored_0/000060_10.png testing/colored_1/000060_10.png
testing/colored_0/000061_10.png testing/colored_1/000061_10.png
testing/colored_0/000062_10.png testing/colored_1/000062_10.png
testing/colored_0/000063_10.png testing/colored_1/000063_10.png
testing/colored_0/000064_10.png testing/colored_1/000064_10.png
testing/colored_0/000065_10.png testing/colored_1/000065_10.png
testing/colored_0/000066_10.png testing/colored_1/000066_10.png
testing/colored_0/000067_10.png testing/colored_1/000067_10.png
testing/colored_0/000068_10.png testing/colored_1/000068_10.png
testing/colored_0/000069_10.png testing/colored_1/000069_10.png
testing/colored_0/000070_10.png testing/colored_1/000070_10.png
testing/colored_0/000071_10.png testing/colored_1/000071_10.png
testing/colored_0/000072_10.png testing/colored_1/000072_10.png
testing/colored_0/000073_10.png testing/colored_1/000073_10.png
testing/colored_0/000074_10.png testing/colored_1/000074_10.png
testing/colored_0/000075_10.png testing/colored_1/000075_10.png
testing/colored_0/000076_10.png testing/colored_1/000076_10.png
testing/colored_0/000077_10.png testing/colored_1/000077_10.png
testing/colored_0/000078_10.png testing/colored_1/000078_10.png
testing/colored_0/000079_10.png testing/colored_1/000079_10.png
testing/colored_0/000080_10.png testing/colored_1/000080_10.png
testing/colored_0/000081_10.png testing/colored_1/000081_10.png
testing/colored_0/000082_10.png testing/colored_1/000082_10.png
testing/colored_0/000083_10.png testing/colored_1/000083_10.png
testing/colored_0/000084_10.png testing/colored_1/000084_10.png
testing/colored_0/000085_10.png testing/colored_1/000085_10.png
testing/colored_0/000086_10.png testing/colored_1/000086_10.png
testing/colored_0/000087_10.png testing/colored_1/000087_10.png
testing/colored_0/000088_10.png testing/colored_1/000088_10.png
testing/colored_0/000089_10.png testing/colored_1/000089_10.png
testing/colored_0/000090_10.png testing/colored_1/000090_10.png
testing/colored_0/000091_10.png testing/colored_1/000091_10.png
testing/colored_0/000092_10.png testing/colored_1/000092_10.png
testing/colored_0/000093_10.png testing/colored_1/000093_10.png
testing/colored_0/000094_10.png testing/colored_1/000094_10.png
testing/colored_0/000095_10.png testing/colored_1/000095_10.png
testing/colored_0/000096_10.png testing/colored_1/000096_10.png
testing/colored_0/000097_10.png testing/colored_1/000097_10.png
testing/colored_0/000098_10.png testing/colored_1/000098_10.png
testing/colored_0/000099_10.png testing/colored_1/000099_10.png
testing/colored_0/000100_10.png testing/colored_1/000100_10.png
testing/colored_0/000101_10.png testing/colored_1/000101_10.png
testing/colored_0/000102_10.png testing/colored_1/000102_10.png
testing/colored_0/000103_10.png testing/colored_1/000103_10.png
testing/colored_0/000104_10.png testing/colored_1/000104_10.png
testing/colored_0/000105_10.png testing/colored_1/000105_10.png
testing/colored_0/000106_10.png testing/colored_1/000106_10.png
testing/colored_0/000107_10.png testing/colored_1/000107_10.png
testing/colored_0/000108_10.png testing/colored_1/000108_10.png
testing/colored_0/000109_10.png testing/colored_1/000109_10.png
testing/colored_0/000110_10.png testing/colored_1/000110_10.png
testing/colored_0/000111_10.png testing/colored_1/000111_10.png
testing/colored_0/000112_10.png testing/colored_1/000112_10.png
testing/colored_0/000113_10.png testing/colored_1/000113_10.png
testing/colored_0/000114_10.png testing/colored_1/000114_10.png
testing/colored_0/000115_10.png testing/colored_1/000115_10.png
testing/colored_0/000116_10.png testing/colored_1/000116_10.png
testing/colored_0/000117_10.png testing/colored_1/000117_10.png
testing/colored_0/000118_10.png testing/colored_1/000118_10.png
testing/colored_0/000119_10.png testing/colored_1/000119_10.png
testing/colored_0/000120_10.png testing/colored_1/000120_10.png
testing/colored_0/000121_10.png testing/colored_1/000121_10.png
testing/colored_0/000122_10.png testing/colored_1/000122_10.png
testing/colored_0/000123_10.png testing/colored_1/000123_10.png
testing/colored_0/000124_10.png testing/colored_1/000124_10.png
testing/colored_0/000125_10.png testing/colored_1/000125_10.png
testing/colored_0/000126_10.png testing/colored_1/000126_10.png
testing/colored_0/000127_10.png testing/colored_1/000127_10.png
testing/colored_0/000128_10.png testing/colored_1/000128_10.png
testing/colored_0/000129_10.png testing/colored_1/000129_10.png
testing/colored_0/000130_10.png testing/colored_1/000130_10.png
testing/colored_0/000131_10.png testing/colored_1/000131_10.png
testing/colored_0/000132_10.png testing/colored_1/000132_10.png
testing/colored_0/000133_10.png testing/colored_1/000133_10.png
testing/colored_0/000134_10.png testing/colored_1/000134_10.png
testing/colored_0/000135_10.png testing/colored_1/000135_10.png
testing/colored_0/000136_10.png testing/colored_1/000136_10.png
testing/colored_0/000137_10.png testing/colored_1/000137_10.png
testing/colored_0/000138_10.png testing/colored_1/000138_10.png
testing/colored_0/000139_10.png testing/colored_1/000139_10.png
testing/colored_0/000140_10.png testing/colored_1/000140_10.png
testing/colored_0/000141_10.png testing/colored_1/000141_10.png
testing/colored_0/000142_10.png testing/colored_1/000142_10.png
testing/colored_0/000143_10.png testing/colored_1/000143_10.png
testing/colored_0/000144_10.png testing/colored_1/000144_10.png
testing/colored_0/000145_10.png testing/colored_1/000145_10.png
testing/colored_0/000146_10.png testing/colored_1/000146_10.png
testing/colored_0/000147_10.png testing/colored_1/000147_10.png
testing/colored_0/000148_10.png testing/colored_1/000148_10.png
testing/colored_0/000149_10.png testing/colored_1/000149_10.png
testing/colored_0/000150_10.png testing/colored_1/000150_10.png
testing/colored_0/000151_10.png testing/colored_1/000151_10.png
testing/colored_0/000152_10.png testing/colored_1/000152_10.png
testing/colored_0/000153_10.png testing/colored_1/000153_10.png
testing/colored_0/000154_10.png testing/colored_1/000154_10.png
testing/colored_0/000155_10.png testing/colored_1/000155_10.png
testing/colored_0/000156_10.png testing/colored_1/000156_10.png
testing/colored_0/000157_10.png testing/colored_1/000157_10.png
testing/colored_0/000158_10.png testing/colored_1/000158_10.png
testing/colored_0/000159_10.png testing/colored_1/000159_10.png
testing/colored_0/000160_10.png testing/colored_1/000160_10.png
testing/colored_0/000161_10.png testing/colored_1/000161_10.png
testing/colored_0/000162_10.png testing/colored_1/000162_10.png
testing/colored_0/000163_10.png testing/colored_1/000163_10.png
testing/colored_0/000164_10.png testing/colored_1/000164_10.png
testing/colored_0/000165_10.png testing/colored_1/000165_10.png
testing/colored_0/000166_10.png testing/colored_1/000166_10.png
testing/colored_0/000167_10.png testing/colored_1/000167_10.png
testing/colored_0/000168_10.png testing/colored_1/000168_10.png
testing/colored_0/000169_10.png testing/colored_1/000169_10.png
testing/colored_0/000170_10.png testing/colored_1/000170_10.png
testing/colored_0/000171_10.png testing/colored_1/000171_10.png
testing/colored_0/000172_10.png testing/colored_1/000172_10.png
testing/colored_0/000173_10.png testing/colored_1/000173_10.png
testing/colored_0/000174_10.png testing/colored_1/000174_10.png
testing/colored_0/000175_10.png testing/colored_1/000175_10.png
testing/colored_0/000176_10.png testing/colored_1/000176_10.png
testing/colored_0/000177_10.png testing/colored_1/000177_10.png
testing/colored_0/000178_10.png testing/colored_1/000178_10.png
testing/colored_0/000179_10.png testing/colored_1/000179_10.png
testing/colored_0/000180_10.png testing/colored_1/000180_10.png
testing/colored_0/000181_10.png testing/colored_1/000181_10.png
testing/colored_0/000182_10.png testing/colored_1/000182_10.png
testing/colored_0/000183_10.png testing/colored_1/000183_10.png
testing/colored_0/000184_10.png testing/colored_1/000184_10.png
testing/colored_0/000185_10.png testing/colored_1/000185_10.png
testing/colored_0/000186_10.png testing/colored_1/000186_10.png
testing/colored_0/000187_10.png testing/colored_1/000187_10.png
testing/colored_0/000188_10.png testing/colored_1/000188_10.png
testing/colored_0/000189_10.png testing/colored_1/000189_10.png
testing/colored_0/000190_10.png testing/colored_1/000190_10.png
testing/colored_0/000191_10.png testing/colored_1/000191_10.png
testing/colored_0/000192_10.png testing/colored_1/000192_10.png
testing/colored_0/000193_10.png testing/colored_1/000193_10.png
testing/colored_0/000194_10.png testing/colored_1/000194_10.png

180
filenames/kitti12_train.txt Normal file
View File

@ -0,0 +1,180 @@
training/colored_0/000000_10.png training/colored_1/000000_10.png training/disp_occ/000000_10.png
training/colored_0/000001_10.png training/colored_1/000001_10.png training/disp_occ/000001_10.png
training/colored_0/000002_10.png training/colored_1/000002_10.png training/disp_occ/000002_10.png
training/colored_0/000003_10.png training/colored_1/000003_10.png training/disp_occ/000003_10.png
training/colored_0/000004_10.png training/colored_1/000004_10.png training/disp_occ/000004_10.png
training/colored_0/000005_10.png training/colored_1/000005_10.png training/disp_occ/000005_10.png
training/colored_0/000006_10.png training/colored_1/000006_10.png training/disp_occ/000006_10.png
training/colored_0/000007_10.png training/colored_1/000007_10.png training/disp_occ/000007_10.png
training/colored_0/000008_10.png training/colored_1/000008_10.png training/disp_occ/000008_10.png
training/colored_0/000009_10.png training/colored_1/000009_10.png training/disp_occ/000009_10.png
training/colored_0/000010_10.png training/colored_1/000010_10.png training/disp_occ/000010_10.png
training/colored_0/000011_10.png training/colored_1/000011_10.png training/disp_occ/000011_10.png
training/colored_0/000012_10.png training/colored_1/000012_10.png training/disp_occ/000012_10.png
training/colored_0/000013_10.png training/colored_1/000013_10.png training/disp_occ/000013_10.png
training/colored_0/000014_10.png training/colored_1/000014_10.png training/disp_occ/000014_10.png
training/colored_0/000015_10.png training/colored_1/000015_10.png training/disp_occ/000015_10.png
training/colored_0/000016_10.png training/colored_1/000016_10.png training/disp_occ/000016_10.png
training/colored_0/000017_10.png training/colored_1/000017_10.png training/disp_occ/000017_10.png
training/colored_0/000018_10.png training/colored_1/000018_10.png training/disp_occ/000018_10.png
training/colored_0/000019_10.png training/colored_1/000019_10.png training/disp_occ/000019_10.png
training/colored_0/000020_10.png training/colored_1/000020_10.png training/disp_occ/000020_10.png
training/colored_0/000021_10.png training/colored_1/000021_10.png training/disp_occ/000021_10.png
training/colored_0/000022_10.png training/colored_1/000022_10.png training/disp_occ/000022_10.png
training/colored_0/000023_10.png training/colored_1/000023_10.png training/disp_occ/000023_10.png
training/colored_0/000024_10.png training/colored_1/000024_10.png training/disp_occ/000024_10.png
training/colored_0/000025_10.png training/colored_1/000025_10.png training/disp_occ/000025_10.png
training/colored_0/000026_10.png training/colored_1/000026_10.png training/disp_occ/000026_10.png
training/colored_0/000027_10.png training/colored_1/000027_10.png training/disp_occ/000027_10.png
training/colored_0/000028_10.png training/colored_1/000028_10.png training/disp_occ/000028_10.png
training/colored_0/000029_10.png training/colored_1/000029_10.png training/disp_occ/000029_10.png
training/colored_0/000030_10.png training/colored_1/000030_10.png training/disp_occ/000030_10.png
training/colored_0/000031_10.png training/colored_1/000031_10.png training/disp_occ/000031_10.png
training/colored_0/000032_10.png training/colored_1/000032_10.png training/disp_occ/000032_10.png
training/colored_0/000033_10.png training/colored_1/000033_10.png training/disp_occ/000033_10.png
training/colored_0/000034_10.png training/colored_1/000034_10.png training/disp_occ/000034_10.png
training/colored_0/000035_10.png training/colored_1/000035_10.png training/disp_occ/000035_10.png
training/colored_0/000036_10.png training/colored_1/000036_10.png training/disp_occ/000036_10.png
training/colored_0/000037_10.png training/colored_1/000037_10.png training/disp_occ/000037_10.png
training/colored_0/000038_10.png training/colored_1/000038_10.png training/disp_occ/000038_10.png
training/colored_0/000039_10.png training/colored_1/000039_10.png training/disp_occ/000039_10.png
training/colored_0/000040_10.png training/colored_1/000040_10.png training/disp_occ/000040_10.png
training/colored_0/000041_10.png training/colored_1/000041_10.png training/disp_occ/000041_10.png
training/colored_0/000042_10.png training/colored_1/000042_10.png training/disp_occ/000042_10.png
training/colored_0/000043_10.png training/colored_1/000043_10.png training/disp_occ/000043_10.png
training/colored_0/000044_10.png training/colored_1/000044_10.png training/disp_occ/000044_10.png
training/colored_0/000045_10.png training/colored_1/000045_10.png training/disp_occ/000045_10.png
training/colored_0/000046_10.png training/colored_1/000046_10.png training/disp_occ/000046_10.png
training/colored_0/000047_10.png training/colored_1/000047_10.png training/disp_occ/000047_10.png
training/colored_0/000048_10.png training/colored_1/000048_10.png training/disp_occ/000048_10.png
training/colored_0/000049_10.png training/colored_1/000049_10.png training/disp_occ/000049_10.png
training/colored_0/000050_10.png training/colored_1/000050_10.png training/disp_occ/000050_10.png
training/colored_0/000051_10.png training/colored_1/000051_10.png training/disp_occ/000051_10.png
training/colored_0/000052_10.png training/colored_1/000052_10.png training/disp_occ/000052_10.png
training/colored_0/000053_10.png training/colored_1/000053_10.png training/disp_occ/000053_10.png
training/colored_0/000054_10.png training/colored_1/000054_10.png training/disp_occ/000054_10.png
training/colored_0/000055_10.png training/colored_1/000055_10.png training/disp_occ/000055_10.png
training/colored_0/000056_10.png training/colored_1/000056_10.png training/disp_occ/000056_10.png
training/colored_0/000057_10.png training/colored_1/000057_10.png training/disp_occ/000057_10.png
training/colored_0/000058_10.png training/colored_1/000058_10.png training/disp_occ/000058_10.png
training/colored_0/000059_10.png training/colored_1/000059_10.png training/disp_occ/000059_10.png
training/colored_0/000060_10.png training/colored_1/000060_10.png training/disp_occ/000060_10.png
training/colored_0/000061_10.png training/colored_1/000061_10.png training/disp_occ/000061_10.png
training/colored_0/000062_10.png training/colored_1/000062_10.png training/disp_occ/000062_10.png
training/colored_0/000063_10.png training/colored_1/000063_10.png training/disp_occ/000063_10.png
training/colored_0/000064_10.png training/colored_1/000064_10.png training/disp_occ/000064_10.png
training/colored_0/000065_10.png training/colored_1/000065_10.png training/disp_occ/000065_10.png
training/colored_0/000066_10.png training/colored_1/000066_10.png training/disp_occ/000066_10.png
training/colored_0/000067_10.png training/colored_1/000067_10.png training/disp_occ/000067_10.png
training/colored_0/000068_10.png training/colored_1/000068_10.png training/disp_occ/000068_10.png
training/colored_0/000069_10.png training/colored_1/000069_10.png training/disp_occ/000069_10.png
training/colored_0/000070_10.png training/colored_1/000070_10.png training/disp_occ/000070_10.png
training/colored_0/000071_10.png training/colored_1/000071_10.png training/disp_occ/000071_10.png
training/colored_0/000072_10.png training/colored_1/000072_10.png training/disp_occ/000072_10.png
training/colored_0/000073_10.png training/colored_1/000073_10.png training/disp_occ/000073_10.png
training/colored_0/000074_10.png training/colored_1/000074_10.png training/disp_occ/000074_10.png
training/colored_0/000075_10.png training/colored_1/000075_10.png training/disp_occ/000075_10.png
training/colored_0/000076_10.png training/colored_1/000076_10.png training/disp_occ/000076_10.png
training/colored_0/000077_10.png training/colored_1/000077_10.png training/disp_occ/000077_10.png
training/colored_0/000078_10.png training/colored_1/000078_10.png training/disp_occ/000078_10.png
training/colored_0/000079_10.png training/colored_1/000079_10.png training/disp_occ/000079_10.png
training/colored_0/000080_10.png training/colored_1/000080_10.png training/disp_occ/000080_10.png
training/colored_0/000081_10.png training/colored_1/000081_10.png training/disp_occ/000081_10.png
training/colored_0/000082_10.png training/colored_1/000082_10.png training/disp_occ/000082_10.png
training/colored_0/000083_10.png training/colored_1/000083_10.png training/disp_occ/000083_10.png
training/colored_0/000084_10.png training/colored_1/000084_10.png training/disp_occ/000084_10.png
training/colored_0/000085_10.png training/colored_1/000085_10.png training/disp_occ/000085_10.png
training/colored_0/000086_10.png training/colored_1/000086_10.png training/disp_occ/000086_10.png
training/colored_0/000087_10.png training/colored_1/000087_10.png training/disp_occ/000087_10.png
training/colored_0/000088_10.png training/colored_1/000088_10.png training/disp_occ/000088_10.png
training/colored_0/000089_10.png training/colored_1/000089_10.png training/disp_occ/000089_10.png
training/colored_0/000090_10.png training/colored_1/000090_10.png training/disp_occ/000090_10.png
training/colored_0/000091_10.png training/colored_1/000091_10.png training/disp_occ/000091_10.png
training/colored_0/000092_10.png training/colored_1/000092_10.png training/disp_occ/000092_10.png
training/colored_0/000093_10.png training/colored_1/000093_10.png training/disp_occ/000093_10.png
training/colored_0/000094_10.png training/colored_1/000094_10.png training/disp_occ/000094_10.png
training/colored_0/000095_10.png training/colored_1/000095_10.png training/disp_occ/000095_10.png
training/colored_0/000096_10.png training/colored_1/000096_10.png training/disp_occ/000096_10.png
training/colored_0/000097_10.png training/colored_1/000097_10.png training/disp_occ/000097_10.png
training/colored_0/000098_10.png training/colored_1/000098_10.png training/disp_occ/000098_10.png
training/colored_0/000099_10.png training/colored_1/000099_10.png training/disp_occ/000099_10.png
training/colored_0/000100_10.png training/colored_1/000100_10.png training/disp_occ/000100_10.png
training/colored_0/000101_10.png training/colored_1/000101_10.png training/disp_occ/000101_10.png
training/colored_0/000102_10.png training/colored_1/000102_10.png training/disp_occ/000102_10.png
training/colored_0/000103_10.png training/colored_1/000103_10.png training/disp_occ/000103_10.png
training/colored_0/000104_10.png training/colored_1/000104_10.png training/disp_occ/000104_10.png
training/colored_0/000105_10.png training/colored_1/000105_10.png training/disp_occ/000105_10.png
training/colored_0/000106_10.png training/colored_1/000106_10.png training/disp_occ/000106_10.png
training/colored_0/000107_10.png training/colored_1/000107_10.png training/disp_occ/000107_10.png
training/colored_0/000108_10.png training/colored_1/000108_10.png training/disp_occ/000108_10.png
training/colored_0/000109_10.png training/colored_1/000109_10.png training/disp_occ/000109_10.png
training/colored_0/000110_10.png training/colored_1/000110_10.png training/disp_occ/000110_10.png
training/colored_0/000111_10.png training/colored_1/000111_10.png training/disp_occ/000111_10.png
training/colored_0/000112_10.png training/colored_1/000112_10.png training/disp_occ/000112_10.png
training/colored_0/000113_10.png training/colored_1/000113_10.png training/disp_occ/000113_10.png
training/colored_0/000114_10.png training/colored_1/000114_10.png training/disp_occ/000114_10.png
training/colored_0/000115_10.png training/colored_1/000115_10.png training/disp_occ/000115_10.png
training/colored_0/000116_10.png training/colored_1/000116_10.png training/disp_occ/000116_10.png
training/colored_0/000117_10.png training/colored_1/000117_10.png training/disp_occ/000117_10.png
training/colored_0/000118_10.png training/colored_1/000118_10.png training/disp_occ/000118_10.png
training/colored_0/000119_10.png training/colored_1/000119_10.png training/disp_occ/000119_10.png
training/colored_0/000120_10.png training/colored_1/000120_10.png training/disp_occ/000120_10.png
training/colored_0/000121_10.png training/colored_1/000121_10.png training/disp_occ/000121_10.png
training/colored_0/000122_10.png training/colored_1/000122_10.png training/disp_occ/000122_10.png
training/colored_0/000123_10.png training/colored_1/000123_10.png training/disp_occ/000123_10.png
training/colored_0/000124_10.png training/colored_1/000124_10.png training/disp_occ/000124_10.png
training/colored_0/000125_10.png training/colored_1/000125_10.png training/disp_occ/000125_10.png
training/colored_0/000126_10.png training/colored_1/000126_10.png training/disp_occ/000126_10.png
training/colored_0/000127_10.png training/colored_1/000127_10.png training/disp_occ/000127_10.png
training/colored_0/000128_10.png training/colored_1/000128_10.png training/disp_occ/000128_10.png
training/colored_0/000129_10.png training/colored_1/000129_10.png training/disp_occ/000129_10.png
training/colored_0/000130_10.png training/colored_1/000130_10.png training/disp_occ/000130_10.png
training/colored_0/000131_10.png training/colored_1/000131_10.png training/disp_occ/000131_10.png
training/colored_0/000132_10.png training/colored_1/000132_10.png training/disp_occ/000132_10.png
training/colored_0/000133_10.png training/colored_1/000133_10.png training/disp_occ/000133_10.png
training/colored_0/000134_10.png training/colored_1/000134_10.png training/disp_occ/000134_10.png
training/colored_0/000135_10.png training/colored_1/000135_10.png training/disp_occ/000135_10.png
training/colored_0/000136_10.png training/colored_1/000136_10.png training/disp_occ/000136_10.png
training/colored_0/000137_10.png training/colored_1/000137_10.png training/disp_occ/000137_10.png
training/colored_0/000138_10.png training/colored_1/000138_10.png training/disp_occ/000138_10.png
training/colored_0/000139_10.png training/colored_1/000139_10.png training/disp_occ/000139_10.png
training/colored_0/000140_10.png training/colored_1/000140_10.png training/disp_occ/000140_10.png
training/colored_0/000141_10.png training/colored_1/000141_10.png training/disp_occ/000141_10.png
training/colored_0/000142_10.png training/colored_1/000142_10.png training/disp_occ/000142_10.png
training/colored_0/000143_10.png training/colored_1/000143_10.png training/disp_occ/000143_10.png
training/colored_0/000144_10.png training/colored_1/000144_10.png training/disp_occ/000144_10.png
training/colored_0/000145_10.png training/colored_1/000145_10.png training/disp_occ/000145_10.png
training/colored_0/000146_10.png training/colored_1/000146_10.png training/disp_occ/000146_10.png
training/colored_0/000147_10.png training/colored_1/000147_10.png training/disp_occ/000147_10.png
training/colored_0/000148_10.png training/colored_1/000148_10.png training/disp_occ/000148_10.png
training/colored_0/000149_10.png training/colored_1/000149_10.png training/disp_occ/000149_10.png
training/colored_0/000150_10.png training/colored_1/000150_10.png training/disp_occ/000150_10.png
training/colored_0/000151_10.png training/colored_1/000151_10.png training/disp_occ/000151_10.png
training/colored_0/000152_10.png training/colored_1/000152_10.png training/disp_occ/000152_10.png
training/colored_0/000153_10.png training/colored_1/000153_10.png training/disp_occ/000153_10.png
training/colored_0/000154_10.png training/colored_1/000154_10.png training/disp_occ/000154_10.png
training/colored_0/000155_10.png training/colored_1/000155_10.png training/disp_occ/000155_10.png
training/colored_0/000156_10.png training/colored_1/000156_10.png training/disp_occ/000156_10.png
training/colored_0/000157_10.png training/colored_1/000157_10.png training/disp_occ/000157_10.png
training/colored_0/000158_10.png training/colored_1/000158_10.png training/disp_occ/000158_10.png
training/colored_0/000159_10.png training/colored_1/000159_10.png training/disp_occ/000159_10.png
training/colored_0/000160_10.png training/colored_1/000160_10.png training/disp_occ/000160_10.png
training/colored_0/000161_10.png training/colored_1/000161_10.png training/disp_occ/000161_10.png
training/colored_0/000162_10.png training/colored_1/000162_10.png training/disp_occ/000162_10.png
training/colored_0/000163_10.png training/colored_1/000163_10.png training/disp_occ/000163_10.png
training/colored_0/000164_10.png training/colored_1/000164_10.png training/disp_occ/000164_10.png
training/colored_0/000165_10.png training/colored_1/000165_10.png training/disp_occ/000165_10.png
training/colored_0/000166_10.png training/colored_1/000166_10.png training/disp_occ/000166_10.png
training/colored_0/000167_10.png training/colored_1/000167_10.png training/disp_occ/000167_10.png
training/colored_0/000168_10.png training/colored_1/000168_10.png training/disp_occ/000168_10.png
training/colored_0/000169_10.png training/colored_1/000169_10.png training/disp_occ/000169_10.png
training/colored_0/000170_10.png training/colored_1/000170_10.png training/disp_occ/000170_10.png
training/colored_0/000171_10.png training/colored_1/000171_10.png training/disp_occ/000171_10.png
training/colored_0/000172_10.png training/colored_1/000172_10.png training/disp_occ/000172_10.png
training/colored_0/000173_10.png training/colored_1/000173_10.png training/disp_occ/000173_10.png
training/colored_0/000174_10.png training/colored_1/000174_10.png training/disp_occ/000174_10.png
training/colored_0/000175_10.png training/colored_1/000175_10.png training/disp_occ/000175_10.png
training/colored_0/000176_10.png training/colored_1/000176_10.png training/disp_occ/000176_10.png
training/colored_0/000177_10.png training/colored_1/000177_10.png training/disp_occ/000177_10.png
training/colored_0/000178_10.png training/colored_1/000178_10.png training/disp_occ/000178_10.png
training/colored_0/000179_10.png training/colored_1/000179_10.png training/disp_occ/000179_10.png

14
filenames/kitti12_val.txt Normal file
View File

@ -0,0 +1,14 @@
training/colored_0/000180_10.png training/colored_1/000180_10.png training/disp_occ/000180_10.png
training/colored_0/000181_10.png training/colored_1/000181_10.png training/disp_occ/000181_10.png
training/colored_0/000182_10.png training/colored_1/000182_10.png training/disp_occ/000182_10.png
training/colored_0/000183_10.png training/colored_1/000183_10.png training/disp_occ/000183_10.png
training/colored_0/000184_10.png training/colored_1/000184_10.png training/disp_occ/000184_10.png
training/colored_0/000185_10.png training/colored_1/000185_10.png training/disp_occ/000185_10.png
training/colored_0/000186_10.png training/colored_1/000186_10.png training/disp_occ/000186_10.png
training/colored_0/000187_10.png training/colored_1/000187_10.png training/disp_occ/000187_10.png
training/colored_0/000188_10.png training/colored_1/000188_10.png training/disp_occ/000188_10.png
training/colored_0/000189_10.png training/colored_1/000189_10.png training/disp_occ/000189_10.png
training/colored_0/000190_10.png training/colored_1/000190_10.png training/disp_occ/000190_10.png
training/colored_0/000191_10.png training/colored_1/000191_10.png training/disp_occ/000191_10.png
training/colored_0/000192_10.png training/colored_1/000192_10.png training/disp_occ/000192_10.png
training/colored_0/000193_10.png training/colored_1/000193_10.png training/disp_occ/000193_10.png

200
filenames/kitti15_test.txt Normal file
View File

@ -0,0 +1,200 @@
testing/image_2/000000_10.png testing/image_3/000000_10.png
testing/image_2/000001_10.png testing/image_3/000001_10.png
testing/image_2/000002_10.png testing/image_3/000002_10.png
testing/image_2/000003_10.png testing/image_3/000003_10.png
testing/image_2/000004_10.png testing/image_3/000004_10.png
testing/image_2/000005_10.png testing/image_3/000005_10.png
testing/image_2/000006_10.png testing/image_3/000006_10.png
testing/image_2/000007_10.png testing/image_3/000007_10.png
testing/image_2/000008_10.png testing/image_3/000008_10.png
testing/image_2/000009_10.png testing/image_3/000009_10.png
testing/image_2/000010_10.png testing/image_3/000010_10.png
testing/image_2/000011_10.png testing/image_3/000011_10.png
testing/image_2/000012_10.png testing/image_3/000012_10.png
testing/image_2/000013_10.png testing/image_3/000013_10.png
testing/image_2/000014_10.png testing/image_3/000014_10.png
testing/image_2/000015_10.png testing/image_3/000015_10.png
testing/image_2/000016_10.png testing/image_3/000016_10.png
testing/image_2/000017_10.png testing/image_3/000017_10.png
testing/image_2/000018_10.png testing/image_3/000018_10.png
testing/image_2/000019_10.png testing/image_3/000019_10.png
testing/image_2/000020_10.png testing/image_3/000020_10.png
testing/image_2/000021_10.png testing/image_3/000021_10.png
testing/image_2/000022_10.png testing/image_3/000022_10.png
testing/image_2/000023_10.png testing/image_3/000023_10.png
testing/image_2/000024_10.png testing/image_3/000024_10.png
testing/image_2/000025_10.png testing/image_3/000025_10.png
testing/image_2/000026_10.png testing/image_3/000026_10.png
testing/image_2/000027_10.png testing/image_3/000027_10.png
testing/image_2/000028_10.png testing/image_3/000028_10.png
testing/image_2/000029_10.png testing/image_3/000029_10.png
testing/image_2/000030_10.png testing/image_3/000030_10.png
testing/image_2/000031_10.png testing/image_3/000031_10.png
testing/image_2/000032_10.png testing/image_3/000032_10.png
testing/image_2/000033_10.png testing/image_3/000033_10.png
testing/image_2/000034_10.png testing/image_3/000034_10.png
testing/image_2/000035_10.png testing/image_3/000035_10.png
testing/image_2/000036_10.png testing/image_3/000036_10.png
testing/image_2/000037_10.png testing/image_3/000037_10.png
testing/image_2/000038_10.png testing/image_3/000038_10.png
testing/image_2/000039_10.png testing/image_3/000039_10.png
testing/image_2/000040_10.png testing/image_3/000040_10.png
testing/image_2/000041_10.png testing/image_3/000041_10.png
testing/image_2/000042_10.png testing/image_3/000042_10.png
testing/image_2/000043_10.png testing/image_3/000043_10.png
testing/image_2/000044_10.png testing/image_3/000044_10.png
testing/image_2/000045_10.png testing/image_3/000045_10.png
testing/image_2/000046_10.png testing/image_3/000046_10.png
testing/image_2/000047_10.png testing/image_3/000047_10.png
testing/image_2/000048_10.png testing/image_3/000048_10.png
testing/image_2/000049_10.png testing/image_3/000049_10.png
testing/image_2/000050_10.png testing/image_3/000050_10.png
testing/image_2/000051_10.png testing/image_3/000051_10.png
testing/image_2/000052_10.png testing/image_3/000052_10.png
testing/image_2/000053_10.png testing/image_3/000053_10.png
testing/image_2/000054_10.png testing/image_3/000054_10.png
testing/image_2/000055_10.png testing/image_3/000055_10.png
testing/image_2/000056_10.png testing/image_3/000056_10.png
testing/image_2/000057_10.png testing/image_3/000057_10.png
testing/image_2/000058_10.png testing/image_3/000058_10.png
testing/image_2/000059_10.png testing/image_3/000059_10.png
testing/image_2/000060_10.png testing/image_3/000060_10.png
testing/image_2/000061_10.png testing/image_3/000061_10.png
testing/image_2/000062_10.png testing/image_3/000062_10.png
testing/image_2/000063_10.png testing/image_3/000063_10.png
testing/image_2/000064_10.png testing/image_3/000064_10.png
testing/image_2/000065_10.png testing/image_3/000065_10.png
testing/image_2/000066_10.png testing/image_3/000066_10.png
testing/image_2/000067_10.png testing/image_3/000067_10.png
testing/image_2/000068_10.png testing/image_3/000068_10.png
testing/image_2/000069_10.png testing/image_3/000069_10.png
testing/image_2/000070_10.png testing/image_3/000070_10.png
testing/image_2/000071_10.png testing/image_3/000071_10.png
testing/image_2/000072_10.png testing/image_3/000072_10.png
testing/image_2/000073_10.png testing/image_3/000073_10.png
testing/image_2/000074_10.png testing/image_3/000074_10.png
testing/image_2/000075_10.png testing/image_3/000075_10.png
testing/image_2/000076_10.png testing/image_3/000076_10.png
testing/image_2/000077_10.png testing/image_3/000077_10.png
testing/image_2/000078_10.png testing/image_3/000078_10.png
testing/image_2/000079_10.png testing/image_3/000079_10.png
testing/image_2/000080_10.png testing/image_3/000080_10.png
testing/image_2/000081_10.png testing/image_3/000081_10.png
testing/image_2/000082_10.png testing/image_3/000082_10.png
testing/image_2/000083_10.png testing/image_3/000083_10.png
testing/image_2/000084_10.png testing/image_3/000084_10.png
testing/image_2/000085_10.png testing/image_3/000085_10.png
testing/image_2/000086_10.png testing/image_3/000086_10.png
testing/image_2/000087_10.png testing/image_3/000087_10.png
testing/image_2/000088_10.png testing/image_3/000088_10.png
testing/image_2/000089_10.png testing/image_3/000089_10.png
testing/image_2/000090_10.png testing/image_3/000090_10.png
testing/image_2/000091_10.png testing/image_3/000091_10.png
testing/image_2/000092_10.png testing/image_3/000092_10.png
testing/image_2/000093_10.png testing/image_3/000093_10.png
testing/image_2/000094_10.png testing/image_3/000094_10.png
testing/image_2/000095_10.png testing/image_3/000095_10.png
testing/image_2/000096_10.png testing/image_3/000096_10.png
testing/image_2/000097_10.png testing/image_3/000097_10.png
testing/image_2/000098_10.png testing/image_3/000098_10.png
testing/image_2/000099_10.png testing/image_3/000099_10.png
testing/image_2/000100_10.png testing/image_3/000100_10.png
testing/image_2/000101_10.png testing/image_3/000101_10.png
testing/image_2/000102_10.png testing/image_3/000102_10.png
testing/image_2/000103_10.png testing/image_3/000103_10.png
testing/image_2/000104_10.png testing/image_3/000104_10.png
testing/image_2/000105_10.png testing/image_3/000105_10.png
testing/image_2/000106_10.png testing/image_3/000106_10.png
testing/image_2/000107_10.png testing/image_3/000107_10.png
testing/image_2/000108_10.png testing/image_3/000108_10.png
testing/image_2/000109_10.png testing/image_3/000109_10.png
testing/image_2/000110_10.png testing/image_3/000110_10.png
testing/image_2/000111_10.png testing/image_3/000111_10.png
testing/image_2/000112_10.png testing/image_3/000112_10.png
testing/image_2/000113_10.png testing/image_3/000113_10.png
testing/image_2/000114_10.png testing/image_3/000114_10.png
testing/image_2/000115_10.png testing/image_3/000115_10.png
testing/image_2/000116_10.png testing/image_3/000116_10.png
testing/image_2/000117_10.png testing/image_3/000117_10.png
testing/image_2/000118_10.png testing/image_3/000118_10.png
testing/image_2/000119_10.png testing/image_3/000119_10.png
testing/image_2/000120_10.png testing/image_3/000120_10.png
testing/image_2/000121_10.png testing/image_3/000121_10.png
testing/image_2/000122_10.png testing/image_3/000122_10.png
testing/image_2/000123_10.png testing/image_3/000123_10.png
testing/image_2/000124_10.png testing/image_3/000124_10.png
testing/image_2/000125_10.png testing/image_3/000125_10.png
testing/image_2/000126_10.png testing/image_3/000126_10.png
testing/image_2/000127_10.png testing/image_3/000127_10.png
testing/image_2/000128_10.png testing/image_3/000128_10.png
testing/image_2/000129_10.png testing/image_3/000129_10.png
testing/image_2/000130_10.png testing/image_3/000130_10.png
testing/image_2/000131_10.png testing/image_3/000131_10.png
testing/image_2/000132_10.png testing/image_3/000132_10.png
testing/image_2/000133_10.png testing/image_3/000133_10.png
testing/image_2/000134_10.png testing/image_3/000134_10.png
testing/image_2/000135_10.png testing/image_3/000135_10.png
testing/image_2/000136_10.png testing/image_3/000136_10.png
testing/image_2/000137_10.png testing/image_3/000137_10.png
testing/image_2/000138_10.png testing/image_3/000138_10.png
testing/image_2/000139_10.png testing/image_3/000139_10.png
testing/image_2/000140_10.png testing/image_3/000140_10.png
testing/image_2/000141_10.png testing/image_3/000141_10.png
testing/image_2/000142_10.png testing/image_3/000142_10.png
testing/image_2/000143_10.png testing/image_3/000143_10.png
testing/image_2/000144_10.png testing/image_3/000144_10.png
testing/image_2/000145_10.png testing/image_3/000145_10.png
testing/image_2/000146_10.png testing/image_3/000146_10.png
testing/image_2/000147_10.png testing/image_3/000147_10.png
testing/image_2/000148_10.png testing/image_3/000148_10.png
testing/image_2/000149_10.png testing/image_3/000149_10.png
testing/image_2/000150_10.png testing/image_3/000150_10.png
testing/image_2/000151_10.png testing/image_3/000151_10.png
testing/image_2/000152_10.png testing/image_3/000152_10.png
testing/image_2/000153_10.png testing/image_3/000153_10.png
testing/image_2/000154_10.png testing/image_3/000154_10.png
testing/image_2/000155_10.png testing/image_3/000155_10.png
testing/image_2/000156_10.png testing/image_3/000156_10.png
testing/image_2/000157_10.png testing/image_3/000157_10.png
testing/image_2/000158_10.png testing/image_3/000158_10.png
testing/image_2/000159_10.png testing/image_3/000159_10.png
testing/image_2/000160_10.png testing/image_3/000160_10.png
testing/image_2/000161_10.png testing/image_3/000161_10.png
testing/image_2/000162_10.png testing/image_3/000162_10.png
testing/image_2/000163_10.png testing/image_3/000163_10.png
testing/image_2/000164_10.png testing/image_3/000164_10.png
testing/image_2/000165_10.png testing/image_3/000165_10.png
testing/image_2/000166_10.png testing/image_3/000166_10.png
testing/image_2/000167_10.png testing/image_3/000167_10.png
testing/image_2/000168_10.png testing/image_3/000168_10.png
testing/image_2/000169_10.png testing/image_3/000169_10.png
testing/image_2/000170_10.png testing/image_3/000170_10.png
testing/image_2/000171_10.png testing/image_3/000171_10.png
testing/image_2/000172_10.png testing/image_3/000172_10.png
testing/image_2/000173_10.png testing/image_3/000173_10.png
testing/image_2/000174_10.png testing/image_3/000174_10.png
testing/image_2/000175_10.png testing/image_3/000175_10.png
testing/image_2/000176_10.png testing/image_3/000176_10.png
testing/image_2/000177_10.png testing/image_3/000177_10.png
testing/image_2/000178_10.png testing/image_3/000178_10.png
testing/image_2/000179_10.png testing/image_3/000179_10.png
testing/image_2/000180_10.png testing/image_3/000180_10.png
testing/image_2/000181_10.png testing/image_3/000181_10.png
testing/image_2/000182_10.png testing/image_3/000182_10.png
testing/image_2/000183_10.png testing/image_3/000183_10.png
testing/image_2/000184_10.png testing/image_3/000184_10.png
testing/image_2/000185_10.png testing/image_3/000185_10.png
testing/image_2/000186_10.png testing/image_3/000186_10.png
testing/image_2/000187_10.png testing/image_3/000187_10.png
testing/image_2/000188_10.png testing/image_3/000188_10.png
testing/image_2/000189_10.png testing/image_3/000189_10.png
testing/image_2/000190_10.png testing/image_3/000190_10.png
testing/image_2/000191_10.png testing/image_3/000191_10.png
testing/image_2/000192_10.png testing/image_3/000192_10.png
testing/image_2/000193_10.png testing/image_3/000193_10.png
testing/image_2/000194_10.png testing/image_3/000194_10.png
testing/image_2/000195_10.png testing/image_3/000195_10.png
testing/image_2/000196_10.png testing/image_3/000196_10.png
testing/image_2/000197_10.png testing/image_3/000197_10.png
testing/image_2/000198_10.png testing/image_3/000198_10.png
testing/image_2/000199_10.png testing/image_3/000199_10.png

180
filenames/kitti15_train.txt Normal file
View File

@ -0,0 +1,180 @@
training/image_2/000000_10.png training/image_3/000000_10.png training/disp_occ_0/000000_10.png
training/image_2/000002_10.png training/image_3/000002_10.png training/disp_occ_0/000002_10.png
training/image_2/000003_10.png training/image_3/000003_10.png training/disp_occ_0/000003_10.png
training/image_2/000004_10.png training/image_3/000004_10.png training/disp_occ_0/000004_10.png
training/image_2/000005_10.png training/image_3/000005_10.png training/disp_occ_0/000005_10.png
training/image_2/000007_10.png training/image_3/000007_10.png training/disp_occ_0/000007_10.png
training/image_2/000008_10.png training/image_3/000008_10.png training/disp_occ_0/000008_10.png
training/image_2/000009_10.png training/image_3/000009_10.png training/disp_occ_0/000009_10.png
training/image_2/000010_10.png training/image_3/000010_10.png training/disp_occ_0/000010_10.png
training/image_2/000011_10.png training/image_3/000011_10.png training/disp_occ_0/000011_10.png
training/image_2/000012_10.png training/image_3/000012_10.png training/disp_occ_0/000012_10.png
training/image_2/000013_10.png training/image_3/000013_10.png training/disp_occ_0/000013_10.png
training/image_2/000014_10.png training/image_3/000014_10.png training/disp_occ_0/000014_10.png
training/image_2/000015_10.png training/image_3/000015_10.png training/disp_occ_0/000015_10.png
training/image_2/000016_10.png training/image_3/000016_10.png training/disp_occ_0/000016_10.png
training/image_2/000017_10.png training/image_3/000017_10.png training/disp_occ_0/000017_10.png
training/image_2/000018_10.png training/image_3/000018_10.png training/disp_occ_0/000018_10.png
training/image_2/000019_10.png training/image_3/000019_10.png training/disp_occ_0/000019_10.png
training/image_2/000020_10.png training/image_3/000020_10.png training/disp_occ_0/000020_10.png
training/image_2/000021_10.png training/image_3/000021_10.png training/disp_occ_0/000021_10.png
training/image_2/000022_10.png training/image_3/000022_10.png training/disp_occ_0/000022_10.png
training/image_2/000023_10.png training/image_3/000023_10.png training/disp_occ_0/000023_10.png
training/image_2/000024_10.png training/image_3/000024_10.png training/disp_occ_0/000024_10.png
training/image_2/000025_10.png training/image_3/000025_10.png training/disp_occ_0/000025_10.png
training/image_2/000027_10.png training/image_3/000027_10.png training/disp_occ_0/000027_10.png
training/image_2/000028_10.png training/image_3/000028_10.png training/disp_occ_0/000028_10.png
training/image_2/000029_10.png training/image_3/000029_10.png training/disp_occ_0/000029_10.png
training/image_2/000030_10.png training/image_3/000030_10.png training/disp_occ_0/000030_10.png
training/image_2/000031_10.png training/image_3/000031_10.png training/disp_occ_0/000031_10.png
training/image_2/000032_10.png training/image_3/000032_10.png training/disp_occ_0/000032_10.png
training/image_2/000033_10.png training/image_3/000033_10.png training/disp_occ_0/000033_10.png
training/image_2/000034_10.png training/image_3/000034_10.png training/disp_occ_0/000034_10.png
training/image_2/000035_10.png training/image_3/000035_10.png training/disp_occ_0/000035_10.png
training/image_2/000036_10.png training/image_3/000036_10.png training/disp_occ_0/000036_10.png
training/image_2/000037_10.png training/image_3/000037_10.png training/disp_occ_0/000037_10.png
training/image_2/000039_10.png training/image_3/000039_10.png training/disp_occ_0/000039_10.png
training/image_2/000040_10.png training/image_3/000040_10.png training/disp_occ_0/000040_10.png
training/image_2/000041_10.png training/image_3/000041_10.png training/disp_occ_0/000041_10.png
training/image_2/000042_10.png training/image_3/000042_10.png training/disp_occ_0/000042_10.png
training/image_2/000044_10.png training/image_3/000044_10.png training/disp_occ_0/000044_10.png
training/image_2/000045_10.png training/image_3/000045_10.png training/disp_occ_0/000045_10.png
training/image_2/000046_10.png training/image_3/000046_10.png training/disp_occ_0/000046_10.png
training/image_2/000047_10.png training/image_3/000047_10.png training/disp_occ_0/000047_10.png
training/image_2/000048_10.png training/image_3/000048_10.png training/disp_occ_0/000048_10.png
training/image_2/000050_10.png training/image_3/000050_10.png training/disp_occ_0/000050_10.png
training/image_2/000051_10.png training/image_3/000051_10.png training/disp_occ_0/000051_10.png
training/image_2/000052_10.png training/image_3/000052_10.png training/disp_occ_0/000052_10.png
training/image_2/000053_10.png training/image_3/000053_10.png training/disp_occ_0/000053_10.png
training/image_2/000054_10.png training/image_3/000054_10.png training/disp_occ_0/000054_10.png
training/image_2/000055_10.png training/image_3/000055_10.png training/disp_occ_0/000055_10.png
training/image_2/000056_10.png training/image_3/000056_10.png training/disp_occ_0/000056_10.png
training/image_2/000057_10.png training/image_3/000057_10.png training/disp_occ_0/000057_10.png
training/image_2/000058_10.png training/image_3/000058_10.png training/disp_occ_0/000058_10.png
training/image_2/000059_10.png training/image_3/000059_10.png training/disp_occ_0/000059_10.png
training/image_2/000060_10.png training/image_3/000060_10.png training/disp_occ_0/000060_10.png
training/image_2/000061_10.png training/image_3/000061_10.png training/disp_occ_0/000061_10.png
training/image_2/000062_10.png training/image_3/000062_10.png training/disp_occ_0/000062_10.png
training/image_2/000063_10.png training/image_3/000063_10.png training/disp_occ_0/000063_10.png
training/image_2/000064_10.png training/image_3/000064_10.png training/disp_occ_0/000064_10.png
training/image_2/000065_10.png training/image_3/000065_10.png training/disp_occ_0/000065_10.png
training/image_2/000066_10.png training/image_3/000066_10.png training/disp_occ_0/000066_10.png
training/image_2/000068_10.png training/image_3/000068_10.png training/disp_occ_0/000068_10.png
training/image_2/000069_10.png training/image_3/000069_10.png training/disp_occ_0/000069_10.png
training/image_2/000070_10.png training/image_3/000070_10.png training/disp_occ_0/000070_10.png
training/image_2/000071_10.png training/image_3/000071_10.png training/disp_occ_0/000071_10.png
training/image_2/000072_10.png training/image_3/000072_10.png training/disp_occ_0/000072_10.png
training/image_2/000073_10.png training/image_3/000073_10.png training/disp_occ_0/000073_10.png
training/image_2/000074_10.png training/image_3/000074_10.png training/disp_occ_0/000074_10.png
training/image_2/000075_10.png training/image_3/000075_10.png training/disp_occ_0/000075_10.png
training/image_2/000076_10.png training/image_3/000076_10.png training/disp_occ_0/000076_10.png
training/image_2/000077_10.png training/image_3/000077_10.png training/disp_occ_0/000077_10.png
training/image_2/000078_10.png training/image_3/000078_10.png training/disp_occ_0/000078_10.png
training/image_2/000079_10.png training/image_3/000079_10.png training/disp_occ_0/000079_10.png
training/image_2/000080_10.png training/image_3/000080_10.png training/disp_occ_0/000080_10.png
training/image_2/000082_10.png training/image_3/000082_10.png training/disp_occ_0/000082_10.png
training/image_2/000083_10.png training/image_3/000083_10.png training/disp_occ_0/000083_10.png
training/image_2/000084_10.png training/image_3/000084_10.png training/disp_occ_0/000084_10.png
training/image_2/000085_10.png training/image_3/000085_10.png training/disp_occ_0/000085_10.png
training/image_2/000086_10.png training/image_3/000086_10.png training/disp_occ_0/000086_10.png
training/image_2/000087_10.png training/image_3/000087_10.png training/disp_occ_0/000087_10.png
training/image_2/000088_10.png training/image_3/000088_10.png training/disp_occ_0/000088_10.png
training/image_2/000090_10.png training/image_3/000090_10.png training/disp_occ_0/000090_10.png
training/image_2/000091_10.png training/image_3/000091_10.png training/disp_occ_0/000091_10.png
training/image_2/000092_10.png training/image_3/000092_10.png training/disp_occ_0/000092_10.png
training/image_2/000093_10.png training/image_3/000093_10.png training/disp_occ_0/000093_10.png
training/image_2/000094_10.png training/image_3/000094_10.png training/disp_occ_0/000094_10.png
training/image_2/000095_10.png training/image_3/000095_10.png training/disp_occ_0/000095_10.png
training/image_2/000096_10.png training/image_3/000096_10.png training/disp_occ_0/000096_10.png
training/image_2/000097_10.png training/image_3/000097_10.png training/disp_occ_0/000097_10.png
training/image_2/000098_10.png training/image_3/000098_10.png training/disp_occ_0/000098_10.png
training/image_2/000099_10.png training/image_3/000099_10.png training/disp_occ_0/000099_10.png
training/image_2/000100_10.png training/image_3/000100_10.png training/disp_occ_0/000100_10.png
training/image_2/000101_10.png training/image_3/000101_10.png training/disp_occ_0/000101_10.png
training/image_2/000102_10.png training/image_3/000102_10.png training/disp_occ_0/000102_10.png
training/image_2/000103_10.png training/image_3/000103_10.png training/disp_occ_0/000103_10.png
training/image_2/000104_10.png training/image_3/000104_10.png training/disp_occ_0/000104_10.png
training/image_2/000105_10.png training/image_3/000105_10.png training/disp_occ_0/000105_10.png
training/image_2/000106_10.png training/image_3/000106_10.png training/disp_occ_0/000106_10.png
training/image_2/000107_10.png training/image_3/000107_10.png training/disp_occ_0/000107_10.png
training/image_2/000108_10.png training/image_3/000108_10.png training/disp_occ_0/000108_10.png
training/image_2/000110_10.png training/image_3/000110_10.png training/disp_occ_0/000110_10.png
training/image_2/000111_10.png training/image_3/000111_10.png training/disp_occ_0/000111_10.png
training/image_2/000112_10.png training/image_3/000112_10.png training/disp_occ_0/000112_10.png
training/image_2/000113_10.png training/image_3/000113_10.png training/disp_occ_0/000113_10.png
training/image_2/000114_10.png training/image_3/000114_10.png training/disp_occ_0/000114_10.png
training/image_2/000115_10.png training/image_3/000115_10.png training/disp_occ_0/000115_10.png
training/image_2/000116_10.png training/image_3/000116_10.png training/disp_occ_0/000116_10.png
training/image_2/000117_10.png training/image_3/000117_10.png training/disp_occ_0/000117_10.png
training/image_2/000118_10.png training/image_3/000118_10.png training/disp_occ_0/000118_10.png
training/image_2/000119_10.png training/image_3/000119_10.png training/disp_occ_0/000119_10.png
training/image_2/000120_10.png training/image_3/000120_10.png training/disp_occ_0/000120_10.png
training/image_2/000121_10.png training/image_3/000121_10.png training/disp_occ_0/000121_10.png
training/image_2/000123_10.png training/image_3/000123_10.png training/disp_occ_0/000123_10.png
training/image_2/000124_10.png training/image_3/000124_10.png training/disp_occ_0/000124_10.png
training/image_2/000125_10.png training/image_3/000125_10.png training/disp_occ_0/000125_10.png
training/image_2/000126_10.png training/image_3/000126_10.png training/disp_occ_0/000126_10.png
training/image_2/000127_10.png training/image_3/000127_10.png training/disp_occ_0/000127_10.png
training/image_2/000128_10.png training/image_3/000128_10.png training/disp_occ_0/000128_10.png
training/image_2/000130_10.png training/image_3/000130_10.png training/disp_occ_0/000130_10.png
training/image_2/000131_10.png training/image_3/000131_10.png training/disp_occ_0/000131_10.png
training/image_2/000133_10.png training/image_3/000133_10.png training/disp_occ_0/000133_10.png
training/image_2/000134_10.png training/image_3/000134_10.png training/disp_occ_0/000134_10.png
training/image_2/000135_10.png training/image_3/000135_10.png training/disp_occ_0/000135_10.png
training/image_2/000136_10.png training/image_3/000136_10.png training/disp_occ_0/000136_10.png
training/image_2/000137_10.png training/image_3/000137_10.png training/disp_occ_0/000137_10.png
training/image_2/000138_10.png training/image_3/000138_10.png training/disp_occ_0/000138_10.png
training/image_2/000139_10.png training/image_3/000139_10.png training/disp_occ_0/000139_10.png
training/image_2/000140_10.png training/image_3/000140_10.png training/disp_occ_0/000140_10.png
training/image_2/000142_10.png training/image_3/000142_10.png training/disp_occ_0/000142_10.png
training/image_2/000143_10.png training/image_3/000143_10.png training/disp_occ_0/000143_10.png
training/image_2/000144_10.png training/image_3/000144_10.png training/disp_occ_0/000144_10.png
training/image_2/000145_10.png training/image_3/000145_10.png training/disp_occ_0/000145_10.png
training/image_2/000146_10.png training/image_3/000146_10.png training/disp_occ_0/000146_10.png
training/image_2/000147_10.png training/image_3/000147_10.png training/disp_occ_0/000147_10.png
training/image_2/000148_10.png training/image_3/000148_10.png training/disp_occ_0/000148_10.png
training/image_2/000149_10.png training/image_3/000149_10.png training/disp_occ_0/000149_10.png
training/image_2/000150_10.png training/image_3/000150_10.png training/disp_occ_0/000150_10.png
training/image_2/000151_10.png training/image_3/000151_10.png training/disp_occ_0/000151_10.png
training/image_2/000153_10.png training/image_3/000153_10.png training/disp_occ_0/000153_10.png
training/image_2/000154_10.png training/image_3/000154_10.png training/disp_occ_0/000154_10.png
training/image_2/000155_10.png training/image_3/000155_10.png training/disp_occ_0/000155_10.png
training/image_2/000156_10.png training/image_3/000156_10.png training/disp_occ_0/000156_10.png
training/image_2/000157_10.png training/image_3/000157_10.png training/disp_occ_0/000157_10.png
training/image_2/000158_10.png training/image_3/000158_10.png training/disp_occ_0/000158_10.png
training/image_2/000160_10.png training/image_3/000160_10.png training/disp_occ_0/000160_10.png
training/image_2/000161_10.png training/image_3/000161_10.png training/disp_occ_0/000161_10.png
training/image_2/000162_10.png training/image_3/000162_10.png training/disp_occ_0/000162_10.png
training/image_2/000163_10.png training/image_3/000163_10.png training/disp_occ_0/000163_10.png
training/image_2/000164_10.png training/image_3/000164_10.png training/disp_occ_0/000164_10.png
training/image_2/000165_10.png training/image_3/000165_10.png training/disp_occ_0/000165_10.png
training/image_2/000166_10.png training/image_3/000166_10.png training/disp_occ_0/000166_10.png
training/image_2/000167_10.png training/image_3/000167_10.png training/disp_occ_0/000167_10.png
training/image_2/000168_10.png training/image_3/000168_10.png training/disp_occ_0/000168_10.png
training/image_2/000169_10.png training/image_3/000169_10.png training/disp_occ_0/000169_10.png
training/image_2/000170_10.png training/image_3/000170_10.png training/disp_occ_0/000170_10.png
training/image_2/000172_10.png training/image_3/000172_10.png training/disp_occ_0/000172_10.png
training/image_2/000173_10.png training/image_3/000173_10.png training/disp_occ_0/000173_10.png
training/image_2/000174_10.png training/image_3/000174_10.png training/disp_occ_0/000174_10.png
training/image_2/000175_10.png training/image_3/000175_10.png training/disp_occ_0/000175_10.png
training/image_2/000176_10.png training/image_3/000176_10.png training/disp_occ_0/000176_10.png
training/image_2/000177_10.png training/image_3/000177_10.png training/disp_occ_0/000177_10.png
training/image_2/000178_10.png training/image_3/000178_10.png training/disp_occ_0/000178_10.png
training/image_2/000180_10.png training/image_3/000180_10.png training/disp_occ_0/000180_10.png
training/image_2/000181_10.png training/image_3/000181_10.png training/disp_occ_0/000181_10.png
training/image_2/000182_10.png training/image_3/000182_10.png training/disp_occ_0/000182_10.png
training/image_2/000183_10.png training/image_3/000183_10.png training/disp_occ_0/000183_10.png
training/image_2/000185_10.png training/image_3/000185_10.png training/disp_occ_0/000185_10.png
training/image_2/000186_10.png training/image_3/000186_10.png training/disp_occ_0/000186_10.png
training/image_2/000188_10.png training/image_3/000188_10.png training/disp_occ_0/000188_10.png
training/image_2/000189_10.png training/image_3/000189_10.png training/disp_occ_0/000189_10.png
training/image_2/000190_10.png training/image_3/000190_10.png training/disp_occ_0/000190_10.png
training/image_2/000191_10.png training/image_3/000191_10.png training/disp_occ_0/000191_10.png
training/image_2/000192_10.png training/image_3/000192_10.png training/disp_occ_0/000192_10.png
training/image_2/000193_10.png training/image_3/000193_10.png training/disp_occ_0/000193_10.png
training/image_2/000194_10.png training/image_3/000194_10.png training/disp_occ_0/000194_10.png
training/image_2/000195_10.png training/image_3/000195_10.png training/disp_occ_0/000195_10.png
training/image_2/000196_10.png training/image_3/000196_10.png training/disp_occ_0/000196_10.png
training/image_2/000197_10.png training/image_3/000197_10.png training/disp_occ_0/000197_10.png
training/image_2/000198_10.png training/image_3/000198_10.png training/disp_occ_0/000198_10.png
training/image_2/000199_10.png training/image_3/000199_10.png training/disp_occ_0/000199_10.png

20
filenames/kitti15_val.txt Normal file
View File

@ -0,0 +1,20 @@
training/image_2/000001_10.png training/image_3/000001_10.png training/disp_occ_0/000001_10.png
training/image_2/000006_10.png training/image_3/000006_10.png training/disp_occ_0/000006_10.png
training/image_2/000026_10.png training/image_3/000026_10.png training/disp_occ_0/000026_10.png
training/image_2/000038_10.png training/image_3/000038_10.png training/disp_occ_0/000038_10.png
training/image_2/000043_10.png training/image_3/000043_10.png training/disp_occ_0/000043_10.png
training/image_2/000049_10.png training/image_3/000049_10.png training/disp_occ_0/000049_10.png
training/image_2/000067_10.png training/image_3/000067_10.png training/disp_occ_0/000067_10.png
training/image_2/000081_10.png training/image_3/000081_10.png training/disp_occ_0/000081_10.png
training/image_2/000089_10.png training/image_3/000089_10.png training/disp_occ_0/000089_10.png
training/image_2/000109_10.png training/image_3/000109_10.png training/disp_occ_0/000109_10.png
training/image_2/000122_10.png training/image_3/000122_10.png training/disp_occ_0/000122_10.png
training/image_2/000129_10.png training/image_3/000129_10.png training/disp_occ_0/000129_10.png
training/image_2/000132_10.png training/image_3/000132_10.png training/disp_occ_0/000132_10.png
training/image_2/000141_10.png training/image_3/000141_10.png training/disp_occ_0/000141_10.png
training/image_2/000152_10.png training/image_3/000152_10.png training/disp_occ_0/000152_10.png
training/image_2/000159_10.png training/image_3/000159_10.png training/disp_occ_0/000159_10.png
training/image_2/000171_10.png training/image_3/000171_10.png training/disp_occ_0/000171_10.png
training/image_2/000179_10.png training/image_3/000179_10.png training/disp_occ_0/000179_10.png
training/image_2/000184_10.png training/image_3/000184_10.png training/disp_occ_0/000184_10.png
training/image_2/000187_10.png training/image_3/000187_10.png training/disp_occ_0/000187_10.png

4370
filenames/sceneflow_test.txt Normal file

File diff suppressed because it is too large Load Diff

35454
filenames/sceneflow_train.txt Normal file

File diff suppressed because it is too large Load Diff

8
kitti12.sh Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -x
DATAPATH="/home/xyguo/data/kitti_2012/"
python main.py --dataset kitti \
--datapath $DATAPATH --trainlist ./filenames/kitti12_train.txt --testlist ./filenames/kitti12_val.txt \
--epochs 300 --lrepochs "200:10" \
--model gwcnet-gc --logdir ./checkpoints/kitti12/gwcnet-gc --loadckpt ./checkpoints/sceneflow/gwcnet-gc/pretrained.ckpt \
--test_batch_size 1

8
kitti15.sh Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -x
DATAPATH="/home/xyguo/data/kitti_2015/"
python main.py --dataset kitti \
--datapath $DATAPATH --trainlist ./filenames/kitti15_train.txt --testlist ./filenames/kitti15_val.txt \
--epochs 300 --lrepochs "200:10" \
--model gwcnet-g --logdir ./checkpoints/kitti15/gwcnet-g --loadckpt ./checkpoints/sceneflow/gwcnet-g/pretrained.ckpt \
--test_batch_size 1

202
main.py Normal file
View File

@ -0,0 +1,202 @@
from __future__ import print_function, division
import argparse
import os
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.utils.data
from torch.autograd import Variable
import torchvision.utils as vutils
import torch.nn.functional as F
import numpy as np
import time
from tensorboardX import SummaryWriter
from datasets import __datasets__
from models import __models__
from models import *
from utils import *
from torch.utils.data import DataLoader
import skimage
import gc
import datetime
import cv2
cudnn.benchmark = True
parser = argparse.ArgumentParser(description='Group-wise Correlation Stereo Network (GwcNet)')
parser.add_argument('--model', default='gwcnet-g', help='select a model structure', choices=__models__.keys())
parser.add_argument('--dataset', required=True, help='dataset name', choices=__datasets__.keys())
parser.add_argument('--datapath', required=True, help='data path')
parser.add_argument('--trainlist', required=True, help='training list')
parser.add_argument('--testlist', required=True, help='testing list')
parser.add_argument('--lr', type=float, default=0.001, help='base learning rate')
parser.add_argument('--batch_size', type=int, default=16, help='training batch size')
parser.add_argument('--test_batch_size', type=int, default=8, help='testing batch size')
parser.add_argument('--maxdisp', type=int, default=192, help='maximum disparity')
parser.add_argument('--epochs', type=int, required=True, help='number of epochs to train')
parser.add_argument('--lrepochs', type=str, required=True, help='the epochs to decay lr: the downscale rate')
parser.add_argument('--logdir', required=True, help='the directory to save logs and checkpoints')
parser.add_argument('--loadckpt', help='load the weights from a specific checkpoint')
parser.add_argument('--resume', action='store_true', help='continue training the model')
parser.add_argument('--seed', type=int, default=1, metavar='S', help='random seed (default: 1)')
parser.add_argument('--summary_freq', type=int, default=20, help='the frequency of saving summary')
parser.add_argument('--save_freq', type=int, default=1, help='the frequency of saving checkpoint')
# parse arguments, set seeds
args = parser.parse_args()
torch.manual_seed(args.seed)
torch.cuda.manual_seed(args.seed)
os.makedirs(args.logdir, exist_ok=True)
# create summary logger
print("creating new summary file")
logger = SummaryWriter(args.logdir)
# dataset, dataloader
StereoDataset = __datasets__[args.dataset]
train_dataset = StereoDataset(args.datapath, args.trainlist, True)
test_dataset = StereoDataset(args.datapath, args.testlist, False)
TrainImgLoader = DataLoader(train_dataset, args.batch_size, shuffle=True, num_workers=8, drop_last=True)
TestImgLoader = DataLoader(test_dataset, args.test_batch_size, shuffle=False, num_workers=4, drop_last=False)
# model, optimizer
model = __models__[args.model](args.maxdisp)
model = nn.DataParallel(model)
model.cuda()
optimizer = optim.Adam(model.parameters(), lr=args.lr, betas=(0.9, 0.999))
# load parameters
start_epoch = 0
if args.resume:
# find all checkpoints file and sort according to epoch id
all_saved_ckpts = [fn for fn in os.listdir(args.logdir) if fn.endswith(".ckpt")]
all_saved_ckpts = sorted(all_saved_ckpts, key=lambda x: int(x.split('_')[-1].split('.')[0]))
# use the latest checkpoint file
loadckpt = os.path.join(args.logdir, all_saved_ckpts[-1])
print("loading the lastest model in logdir: {}".format(loadckpt))
state_dict = torch.load(loadckpt)
model.load_state_dict(state_dict['model'])
optimizer.load_state_dict(state_dict['optimizer'])
start_epoch = state_dict['epoch'] + 1
elif args.loadckpt:
# load the checkpoint file specified by args.loadckpt
print("loading model {}".format(args.loadckpt))
state_dict = torch.load(args.loadckpt)
model.load_state_dict(state_dict['model'])
print("start at epoch {}".format(start_epoch))
def train():
for epoch_idx in range(start_epoch, args.epochs):
adjust_learning_rate(optimizer, epoch_idx, args.lr, args.lrepochs)
# training
for batch_idx, sample in enumerate(TrainImgLoader):
global_step = len(TrainImgLoader) * epoch_idx + batch_idx
start_time = time.time()
do_summary = global_step % args.summary_freq == 0
loss, scalar_outputs, image_outputs = train_sample(sample, compute_metrics=do_summary)
if do_summary:
save_scalars(logger, 'train', scalar_outputs, global_step)
save_images(logger, 'train', image_outputs, global_step)
del scalar_outputs, image_outputs
print('Epoch {}/{}, Iter {}/{}, train loss = {:.3f}, time = {:.3f}'.format(epoch_idx, args.epochs,
batch_idx,
len(TrainImgLoader), loss,
time.time() - start_time))
# saving checkpoints
if (epoch_idx + 1) % args.save_freq == 0:
checkpoint_data = {'epoch': epoch_idx, 'model': model.state_dict(), 'optimizer': optimizer.state_dict()}
torch.save(checkpoint_data, "{}/checkpoint_{:0>6}.ckpt".format(args.logdir, epoch_idx))
gc.collect()
# testing
avg_test_scalars = AverageMeterDict()
for batch_idx, sample in enumerate(TestImgLoader):
global_step = len(TrainImgLoader) * epoch_idx + batch_idx
start_time = time.time()
do_summary = global_step % args.summary_freq == 0
loss, scalar_outputs, image_outputs = test_sample(sample, compute_metrics=do_summary)
if do_summary:
save_scalars(logger, 'test', scalar_outputs, global_step)
save_images(logger, 'test', image_outputs, global_step)
avg_test_scalars.update(scalar_outputs)
del scalar_outputs, image_outputs
print('Epoch {}/{}, Iter {}/{}, test loss = {:.3f}, time = {:3f}'.format(epoch_idx, args.epochs,
batch_idx,
len(TestImgLoader), loss,
time.time() - start_time))
avg_test_scalars = avg_test_scalars.mean()
save_scalars(logger, 'fulltest', avg_test_scalars, len(TrainImgLoader) * (epoch_idx + 1))
print("avg_test_scalars", avg_test_scalars)
gc.collect()
# train one sample
def train_sample(sample, compute_metrics=False):
model.train()
imgL, imgR, disp_gt = sample['left'], sample['right'], sample['disparity']
imgL = imgL.cuda()
imgR = imgR.cuda()
disp_gt = disp_gt.cuda()
optimizer.zero_grad()
disp_ests = model(imgL, imgR)
mask = (disp_gt < args.maxdisp) & (disp_gt > 0)
loss = model_loss(disp_ests, disp_gt, mask)
scalar_outputs = {"loss": loss}
image_outputs = {"disp_est": disp_ests, "disp_gt": disp_gt, "imgL": imgL, "imgR": imgR}
if compute_metrics:
with torch.no_grad():
image_outputs["errormap"] = [disp_error_image_func()(disp_est, disp_gt) for disp_est in disp_ests]
scalar_outputs["EPE"] = [EPE_metric(disp_est, disp_gt, mask) for disp_est in disp_ests]
scalar_outputs["D1"] = [D1_metric(disp_est, disp_gt, mask) for disp_est in disp_ests]
scalar_outputs["Thres1"] = [Thres_metric(disp_est, disp_gt, mask, 1.0) for disp_est in disp_ests]
scalar_outputs["Thres2"] = [Thres_metric(disp_est, disp_gt, mask, 2.0) for disp_est in disp_ests]
scalar_outputs["Thres3"] = [Thres_metric(disp_est, disp_gt, mask, 3.0) for disp_est in disp_ests]
loss.backward()
optimizer.step()
return tensor2float(loss), tensor2float(scalar_outputs), image_outputs
# test one sample
@make_nograd_func
def test_sample(sample, compute_metrics=True):
model.eval()
imgL, imgR, disp_gt = sample['left'], sample['right'], sample['disparity']
imgL = imgL.cuda()
imgR = imgR.cuda()
disp_gt = disp_gt.cuda()
disp_ests = model(imgL, imgR)
mask = (disp_gt < args.maxdisp) & (disp_gt > 0)
loss = model_loss(disp_ests, disp_gt, mask)
scalar_outputs = {"loss": loss}
image_outputs = {"disp_est": disp_ests, "disp_gt": disp_gt, "imgL": imgL, "imgR": imgR}
scalar_outputs["D1"] = [D1_metric(disp_est, disp_gt, mask) for disp_est in disp_ests]
scalar_outputs["EPE"] = [EPE_metric(disp_est, disp_gt, mask) for disp_est in disp_ests]
scalar_outputs["Thres1"] = [Thres_metric(disp_est, disp_gt, mask, 1.0) for disp_est in disp_ests]
scalar_outputs["Thres2"] = [Thres_metric(disp_est, disp_gt, mask, 2.0) for disp_est in disp_ests]
scalar_outputs["Thres3"] = [Thres_metric(disp_est, disp_gt, mask, 3.0) for disp_est in disp_ests]
if compute_metrics:
image_outputs["errormap"] = [disp_error_image_func()(disp_est, disp_gt) for disp_est in disp_ests]
return tensor2float(loss), tensor2float(scalar_outputs), image_outputs
if __name__ == '__main__':
train()

7
models/__init__.py Normal file
View File

@ -0,0 +1,7 @@
from models.gwcnet import GwcNet_G, GwcNet_GC
from models.loss import model_loss
__models__ = {
"gwcnet-g": GwcNet_G,
"gwcnet-gc": GwcNet_GC
}

231
models/gwcnet.py Normal file
View File

@ -0,0 +1,231 @@
from __future__ import print_function
import torch
import torch.nn as nn
import torch.utils.data
from torch.autograd import Variable
import torch.nn.functional as F
import math
from models.submodule import *
class feature_extraction(nn.Module):
def __init__(self, concat_feature=False, concat_feature_channel=12):
super(feature_extraction, self).__init__()
self.concat_feature = concat_feature
self.inplanes = 32
self.firstconv = nn.Sequential(convbn(3, 32, 3, 2, 1, 1),
nn.ReLU(inplace=True),
convbn(32, 32, 3, 1, 1, 1),
nn.ReLU(inplace=True),
convbn(32, 32, 3, 1, 1, 1),
nn.ReLU(inplace=True))
self.layer1 = self._make_layer(BasicBlock, 32, 3, 1, 1, 1)
self.layer2 = self._make_layer(BasicBlock, 64, 16, 2, 1, 1)
self.layer3 = self._make_layer(BasicBlock, 128, 3, 1, 1, 1)
self.layer4 = self._make_layer(BasicBlock, 128, 3, 1, 1, 2)
if self.concat_feature:
self.lastconv = nn.Sequential(convbn(320, 128, 3, 1, 1, 1),
nn.ReLU(inplace=True),
nn.Conv2d(128, concat_feature_channel, kernel_size=1, padding=0, stride=1,
bias=False))
def _make_layer(self, block, planes, blocks, stride, pad, dilation):
downsample = None
if stride != 1 or self.inplanes != planes * block.expansion:
downsample = nn.Sequential(
nn.Conv2d(self.inplanes, planes * block.expansion,
kernel_size=1, stride=stride, bias=False),
nn.BatchNorm2d(planes * block.expansion), )
layers = []
layers.append(block(self.inplanes, planes, stride, downsample, pad, dilation))
self.inplanes = planes * block.expansion
for i in range(1, blocks):
layers.append(block(self.inplanes, planes, 1, None, pad, dilation))
return nn.Sequential(*layers)
def forward(self, x):
x = self.firstconv(x)
x = self.layer1(x)
l2 = self.layer2(x)
l3 = self.layer3(l2)
l4 = self.layer4(l3)
gwc_feature = torch.cat((l2, l3, l4), dim=1)
if not self.concat_feature:
return {"gwc_feature": gwc_feature}
else:
concat_feature = self.lastconv(gwc_feature)
return {"gwc_feature": gwc_feature, "concat_feature": concat_feature}
class hourglass(nn.Module):
def __init__(self, in_channels):
super(hourglass, self).__init__()
self.conv1 = nn.Sequential(convbn_3d(in_channels, in_channels * 2, 3, 2, 1),
nn.ReLU(inplace=True))
self.conv2 = nn.Sequential(convbn_3d(in_channels * 2, in_channels * 2, 3, 2, 1),
nn.ReLU(inplace=True))
self.conv3 = nn.Sequential(convbn_3d(in_channels * 2, in_channels * 4, 3, 2, 1),
nn.ReLU(inplace=True))
self.conv4 = nn.Sequential(convbn_3d(in_channels * 4, in_channels * 4, 3, 2, 1),
nn.ReLU(inplace=True))
self.conv5 = nn.Sequential(
nn.ConvTranspose3d(in_channels * 4, in_channels * 2, 3, padding=1, output_padding=1, stride=2, bias=False),
nn.BatchNorm3d(in_channels * 2))
self.conv6 = nn.Sequential(
nn.ConvTranspose3d(in_channels * 2, in_channels, 3, padding=1, output_padding=1, stride=2, bias=False),
nn.BatchNorm3d(in_channels))
self.redir1 = convbn_3d(in_channels, in_channels, kernel_size=1, stride=1, pad=0)
self.redir2 = convbn_3d(in_channels * 2, in_channels * 2, kernel_size=1, stride=1, pad=0)
def forward(self, x):
conv1 = self.conv1(x)
conv2 = self.conv2(conv1)
conv3 = self.conv3(conv2)
conv4 = self.conv4(conv3)
conv5 = F.relu(self.conv5(conv4) + self.redir2(conv2), inplace=True)
conv6 = F.relu(self.conv6(conv5) + self.redir1(x), inplace=True)
return conv6
class GwcNet(nn.Module):
def __init__(self, maxdisp, use_concat_volume=False):
super(GwcNet, self).__init__()
self.maxdisp = maxdisp
self.use_concat_volume = use_concat_volume
self.num_groups = 40
if self.use_concat_volume:
self.concat_channels = 12
self.feature_extraction = feature_extraction(concat_feature=True,
concat_feature_channel=self.concat_channels)
else:
self.concat_channels = 0
self.feature_extraction = feature_extraction(concat_feature=False)
self.dres0 = nn.Sequential(convbn_3d(self.num_groups + self.concat_channels * 2, 32, 3, 1, 1),
nn.ReLU(inplace=True),
convbn_3d(32, 32, 3, 1, 1),
nn.ReLU(inplace=True))
self.dres1 = nn.Sequential(convbn_3d(32, 32, 3, 1, 1),
nn.ReLU(inplace=True),
convbn_3d(32, 32, 3, 1, 1))
self.dres2 = hourglass(32)
self.dres3 = hourglass(32)
self.dres4 = hourglass(32)
self.classif0 = nn.Sequential(convbn_3d(32, 32, 3, 1, 1),
nn.ReLU(inplace=True),
nn.Conv3d(32, 1, kernel_size=3, padding=1, stride=1, bias=False))
self.classif1 = nn.Sequential(convbn_3d(32, 32, 3, 1, 1),
nn.ReLU(inplace=True),
nn.Conv3d(32, 1, kernel_size=3, padding=1, stride=1, bias=False))
self.classif2 = nn.Sequential(convbn_3d(32, 32, 3, 1, 1),
nn.ReLU(inplace=True),
nn.Conv3d(32, 1, kernel_size=3, padding=1, stride=1, bias=False))
self.classif3 = nn.Sequential(convbn_3d(32, 32, 3, 1, 1),
nn.ReLU(inplace=True),
nn.Conv3d(32, 1, kernel_size=3, padding=1, stride=1, bias=False))
for m in self.modules():
if isinstance(m, nn.Conv2d):
n = m.kernel_size[0] * m.kernel_size[1] * m.out_channels
m.weight.data.normal_(0, math.sqrt(2. / n))
elif isinstance(m, nn.Conv3d):
n = m.kernel_size[0] * m.kernel_size[1] * m.kernel_size[2] * m.out_channels
m.weight.data.normal_(0, math.sqrt(2. / n))
elif isinstance(m, nn.BatchNorm2d):
m.weight.data.fill_(1)
m.bias.data.zero_()
elif isinstance(m, nn.BatchNorm3d):
m.weight.data.fill_(1)
m.bias.data.zero_()
elif isinstance(m, nn.Linear):
m.bias.data.zero_()
def forward(self, left, right):
features_left = self.feature_extraction(left)
features_right = self.feature_extraction(right)
gwc_volume = build_gwc_volume(features_left["gwc_feature"], features_right["gwc_feature"], self.maxdisp // 4,
self.num_groups)
if self.use_concat_volume:
concat_volume = build_concat_volume(features_left["concat_feature"], features_right["concat_feature"],
self.maxdisp // 4)
volume = torch.cat((gwc_volume, concat_volume), 1)
else:
volume = gwc_volume
cost0 = self.dres0(volume)
cost0 = self.dres1(cost0) + cost0
out1 = self.dres2(cost0)
out2 = self.dres3(out1)
out3 = self.dres4(out2)
if self.training:
cost0 = self.classif0(cost0)
cost1 = self.classif1(out1)
cost2 = self.classif2(out2)
cost3 = self.classif3(out3)
cost0 = F.upsample(cost0, [self.maxdisp, left.size()[2], left.size()[3]], mode='trilinear')
cost0 = torch.squeeze(cost0, 1)
pred0 = F.softmax(cost0, dim=1)
pred0 = disparity_regression(pred0, self.maxdisp)
cost1 = F.upsample(cost1, [self.maxdisp, left.size()[2], left.size()[3]], mode='trilinear')
cost1 = torch.squeeze(cost1, 1)
pred1 = F.softmax(cost1, dim=1)
pred1 = disparity_regression(pred1, self.maxdisp)
cost2 = F.upsample(cost2, [self.maxdisp, left.size()[2], left.size()[3]], mode='trilinear')
cost2 = torch.squeeze(cost2, 1)
pred2 = F.softmax(cost2, dim=1)
pred2 = disparity_regression(pred2, self.maxdisp)
cost3 = F.upsample(cost3, [self.maxdisp, left.size()[2], left.size()[3]], mode='trilinear')
cost3 = torch.squeeze(cost3, 1)
pred3 = F.softmax(cost3, dim=1)
pred3 = disparity_regression(pred3, self.maxdisp)
return [pred0, pred1, pred2, pred3]
else:
cost3 = self.classif3(out3)
cost3 = F.upsample(cost3, [self.maxdisp, left.size()[2], left.size()[3]], mode='trilinear')
cost3 = torch.squeeze(cost3, 1)
pred3 = F.softmax(cost3, dim=1)
pred3 = disparity_regression(pred3, self.maxdisp)
return [pred3]
def GwcNet_G(d):
return GwcNet(d, use_concat_volume=False)
def GwcNet_GC(d):
return GwcNet(d, use_concat_volume=True)

9
models/loss.py Normal file
View File

@ -0,0 +1,9 @@
import torch.nn.functional as F
def model_loss(disp_ests, disp_gt, mask):
weights = [0.5, 0.5, 0.7, 1.0]
all_losses = []
for disp_est, weight in zip(disp_ests, weights):
all_losses.append(weight * F.smooth_l1_loss(disp_est[mask], disp_gt[mask], size_average=True))
return sum(all_losses)

90
models/submodule.py Normal file
View File

@ -0,0 +1,90 @@
from __future__ import print_function
import torch
import torch.nn as nn
import torch.utils.data
from torch.autograd import Variable
from torch.autograd.function import Function
import torch.nn.functional as F
import math
import numpy as np
def convbn(in_channels, out_channels, kernel_size, stride, pad, dilation):
return nn.Sequential(nn.Conv2d(in_channels, out_channels, kernel_size=kernel_size, stride=stride,
padding=dilation if dilation > 1 else pad, dilation=dilation, bias=False),
nn.BatchNorm2d(out_channels))
def convbn_3d(in_channels, out_channels, kernel_size, stride, pad):
return nn.Sequential(nn.Conv3d(in_channels, out_channels, kernel_size=kernel_size, stride=stride,
padding=pad, bias=False),
nn.BatchNorm3d(out_channels))
def disparity_regression(x, maxdisp):
assert len(x.shape) == 4
disp_values = torch.arange(0, maxdisp, dtype=x.dtype, device=x.device)
disp_values = disp_values.view(1, maxdisp, 1, 1)
return torch.sum(x * disp_values, 1, keepdim=False)
def build_concat_volume(refimg_fea, targetimg_fea, maxdisp):
B, C, H, W = refimg_fea.shape
volume = refimg_fea.new_zeros([B, 2 * C, maxdisp, H, W])
for i in range(maxdisp):
if i > 0:
volume[:, :C, i, :, i:] = refimg_fea[:, :, :, i:]
volume[:, C:, i, :, i:] = targetimg_fea[:, :, :, :-i]
else:
volume[:, :C, i, :, :] = refimg_fea
volume[:, C:, i, :, :] = targetimg_fea
volume = volume.contiguous()
return volume
def groupwise_correlation(fea1, fea2, num_groups):
B, C, H, W = fea1.shape
assert C % num_groups == 0
channels_per_group = C // num_groups
cost = (fea1 * fea2).view([B, num_groups, channels_per_group, H, W]).mean(dim=2)
assert cost.shape == (B, num_groups, H, W)
return cost
def build_gwc_volume(refimg_fea, targetimg_fea, maxdisp, num_groups):
B, C, H, W = refimg_fea.shape
volume = refimg_fea.new_zeros([B, num_groups, maxdisp, H, W])
for i in range(maxdisp):
if i > 0:
volume[:, :, i, :, i:] = groupwise_correlation(refimg_fea[:, :, :, i:], targetimg_fea[:, :, :, :-i],
num_groups)
else:
volume[:, :, i, :, :] = groupwise_correlation(refimg_fea, targetimg_fea, num_groups)
volume = volume.contiguous()
return volume
class BasicBlock(nn.Module):
expansion = 1
def __init__(self, inplanes, planes, stride, downsample, pad, dilation):
super(BasicBlock, self).__init__()
self.conv1 = nn.Sequential(convbn(inplanes, planes, 3, stride, pad, dilation),
nn.ReLU(inplace=True))
self.conv2 = convbn(planes, planes, 3, 1, pad, dilation)
self.downsample = downsample
self.stride = stride
def forward(self, x):
out = self.conv1(x)
out = self.conv2(out)
if self.downsample is not None:
x = self.downsample(x)
out += x
return out

7
sceneflow.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -x
DATAPATH="/home/xyguo/data/scene_flow/"
python main.py --dataset sceneflow \
--datapath $DATAPATH --trainlist ./filenames/sceneflow_train.txt --testlist ./filenames/sceneflow_test.txt \
--epochs 16 --lrepochs "10,12,14,16:2" \
--model gwcnet-gc --logdir ./checkpoints/sceneflow/gwcnet-gc

3
utils/__init__.py Normal file
View File

@ -0,0 +1,3 @@
from utils.experiment import *
from utils.visualization import *
from utils.metrics import D1_metric, Thres_metric, EPE_metric

157
utils/experiment.py Normal file
View File

@ -0,0 +1,157 @@
from __future__ import print_function, division
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
from torch.autograd import Variable
import torchvision.utils as vutils
import torch.nn.functional as F
import numpy as np
import time
from datasets import *
from models import *
import copy
import yaml
import sys
import argparse
def make_iterative_func(func):
def wrapper(vars):
if isinstance(vars, list):
return [wrapper(x) for x in vars]
elif isinstance(vars, tuple):
return tuple([wrapper(x) for x in vars])
elif isinstance(vars, dict):
return {k: wrapper(v) for k, v in vars.items()}
else:
return func(vars)
return wrapper
def make_nograd_func(func):
def wrapper(*f_args, **f_kwargs):
with torch.no_grad():
ret = func(*f_args, **f_kwargs)
return ret
return wrapper
@make_iterative_func
def tensor2float(vars):
if isinstance(vars, float):
return vars
elif isinstance(vars, torch.Tensor):
return vars.data.item()
else:
raise NotImplementedError("invalid input type for tensor2float")
@make_iterative_func
def tensor2numpy(vars):
if isinstance(vars, np.ndarray):
return vars
elif isinstance(vars, torch.Tensor):
return vars.data.cpu().numpy()
else:
raise NotImplementedError("invalid input type for tensor2numpy")
@make_iterative_func
def check_allfloat(vars):
assert isinstance(vars, float)
def save_scalars(logger, mode_tag, scalar_dict, global_step):
scalar_dict = tensor2float(scalar_dict)
for tag, values in scalar_dict.items():
if not isinstance(values, list) and not isinstance(values, tuple):
values = [values]
for idx, value in enumerate(values):
scalar_name = '{}/{}'.format(mode_tag, tag)
# if len(values) > 1:
scalar_name = scalar_name + "_" + str(idx)
logger.add_scalar(scalar_name, value, global_step)
def save_images(logger, mode_tag, images_dict, global_step):
images_dict = tensor2numpy(images_dict)
for tag, values in images_dict.items():
if not isinstance(values, list) and not isinstance(values, tuple):
values = [values]
for idx, value in enumerate(values):
if len(value.shape) == 3:
value = value[:, np.newaxis, :, :]
value = value[:1]
value = torch.from_numpy(value)
image_name = '{}/{}'.format(mode_tag, tag)
if len(values) > 1:
image_name = image_name + "_" + str(idx)
logger.add_image(image_name, vutils.make_grid(value, padding=0, nrow=1, normalize=True, scale_each=True),
global_step)
def adjust_learning_rate(optimizer, epoch, base_lr, lrepochs):
splits = lrepochs.split(':')
assert len(splits) == 2
# parse the epochs to downscale the learning rate (before :)
downscale_epochs = [int(eid_str) for eid_str in splits[0].split(',')]
# parse downscale rate (after :)
downscale_rate = float(splits[1])
print("downscale epochs: {}, downscale rate: {}".format(downscale_epochs, downscale_rate))
lr = base_lr
for eid in downscale_epochs:
if epoch >= eid:
lr /= downscale_rate
else:
break
print("setting learning rate to {}".format(lr))
for param_group in optimizer.param_groups:
param_group['lr'] = lr
class AverageMeter(object):
def __init__(self):
self.sum_value = 0.
self.count = 0
def update(self, x):
check_allfloat(x)
self.sum_value += x
self.count += 1
def mean(self):
return self.sum_value / self.count
class AverageMeterDict(object):
def __init__(self):
self.data = None
self.count = 0
def update(self, x):
check_allfloat(x)
self.count += 1
if self.data is None:
self.data = copy.deepcopy(x)
else:
for k1, v1 in x.items():
if isinstance(v1, float):
self.data[k1] += v1
elif isinstance(v1, tuple) or isinstance(v1, list):
for idx, v2 in enumerate(v1):
self.data[k1][idx] += v2
else:
assert NotImplementedError("error input type for update AvgMeterDict")
def mean(self):
@make_iterative_func
def get_mean(v):
return v / float(self.count)
return get_mean(self.data)

65
utils/metrics.py Normal file
View File

@ -0,0 +1,65 @@
import torch
import torch.nn.functional as F
from utils.experiment import make_nograd_func
from torch.autograd import Variable
from torch import Tensor
# Update D1 from >3px to >=3px & >5%
# matlab code:
# E = abs(D_gt - D_est);
# n_err = length(find(D_gt > 0 & E > tau(1) & E. / abs(D_gt) > tau(2)));
# n_total = length(find(D_gt > 0));
# d_err = n_err / n_total;
def check_shape_for_metric_computation(*vars):
assert isinstance(vars, tuple)
for var in vars:
assert len(var.size()) == 3
assert var.size() == vars[0].size()
# a wrapper to compute metrics for each image individually
def compute_metric_for_each_image(metric_func):
def wrapper(D_ests, D_gts, masks, *nargs):
check_shape_for_metric_computation(D_ests, D_gts, masks)
bn = D_gts.shape[0] # batch size
results = [] # a list to store results for each image
# compute result one by one
for idx in range(bn):
# if tensor, then pick idx, else pass the same value
cur_nargs = [x[idx] if isinstance(x, (Tensor, Variable)) else x for x in nargs]
if masks[idx].float().mean() / (D_gts[idx] > 0).float().mean() < 0.1:
print("masks[idx].float().mean() too small, skip")
else:
ret = metric_func(D_ests[idx], D_gts[idx], masks[idx], *cur_nargs)
results.append(ret)
if len(results) == 0:
print("masks[idx].float().mean() too small for all images in this batch, return 0")
return torch.tensor(0, dtype=torch.float32, device=D_gts.device)
else:
return torch.stack(results).mean()
return wrapper
@make_nograd_func
@compute_metric_for_each_image
def D1_metric(D_est, D_gt, mask):
D_est, D_gt = D_est[mask], D_gt[mask]
E = torch.abs(D_gt - D_est)
err_mask = (E > 3) & (E / D_gt.abs() > 0.05)
return torch.mean(err_mask.float())
@make_nograd_func
@compute_metric_for_each_image
def Thres_metric(D_est, D_gt, mask, thres):
assert isinstance(thres, (int, float))
D_est, D_gt = D_est[mask], D_gt[mask]
E = torch.abs(D_gt - D_est)
err_mask = E > thres
return torch.mean(err_mask.float())
# NOTE: please do not use this to build up training loss
@make_nograd_func
@compute_metric_for_each_image
def EPE_metric(D_est, D_gt, mask):
D_est, D_gt = D_est[mask], D_gt[mask]
return F.l1_loss(D_est, D_gt, size_average=True)

62
utils/visualization.py Normal file
View File

@ -0,0 +1,62 @@
from __future__ import print_function
import torch
import torch.nn as nn
import torch.utils.data
from torch.autograd import Variable, Function
import torch.nn.functional as F
import math
import numpy as np
import cv2
# disable multi-thread
cv2.setNumThreads(0)
def gen_error_colormap():
cols = np.array(
[[0 / 3.0, 0.1875 / 3.0, 49, 54, 149],
[0.1875 / 3.0, 0.375 / 3.0, 69, 117, 180],
[0.375 / 3.0, 0.75 / 3.0, 116, 173, 209],
[0.75 / 3.0, 1.5 / 3.0, 171, 217, 233],
[1.5 / 3.0, 3 / 3.0, 224, 243, 248],
[3 / 3.0, 6 / 3.0, 254, 224, 144],
[6 / 3.0, 12 / 3.0, 253, 174, 97],
[12 / 3.0, 24 / 3.0, 244, 109, 67],
[24 / 3.0, 48 / 3.0, 215, 48, 39],
[48 / 3.0, np.inf, 165, 0, 38]], dtype=np.float32)
cols[:, 2: 5] /= 255.
return cols
error_colormap = gen_error_colormap()
class disp_error_image_func(Function):
def forward(self, D_est_tensor, D_gt_tensor, abs_thres=3., rel_thres=0.05, dilate_radius=1):
D_gt_np = D_gt_tensor.detach().cpu().numpy()
D_est_np = D_est_tensor.detach().cpu().numpy()
B, H, W = D_gt_np.shape
# valid mask
mask = D_gt_np > 0
# error in percentage. When error <= 1, the pixel is valid since <= 3px & 5%
error = np.abs(D_gt_np - D_est_np)
error[np.logical_not(mask)] = 0
error[mask] = np.minimum(error[mask] / abs_thres, (error[mask] / D_gt_np[mask]) / rel_thres)
# get colormap
cols = error_colormap
# create error image
error_image = np.zeros([B, H, W, 3], dtype=np.float32)
for i in range(cols.shape[0]):
error_image[np.logical_and(error >= cols[i][0], error < cols[i][1])] = cols[i, 2:]
# TODO: imdilate
# error_image = cv2.imdilate(D_err, strel('disk', dilate_radius));
error_image[np.logical_not(mask)] = 0.
# show color tag in the top-left cornor of the image
for i in range(cols.shape[0]):
distance = 20
error_image[:, :10, i * distance:(i + 1) * distance, :] = cols[i, 2:]
return torch.from_numpy(np.ascontiguousarray(error_image.transpose([0, 3, 1, 2])))
def backward(self, grad_output):
return None