Monodepth2和Lite-Mono准备数据集

  • 以KITTI为例
  • 下载解压后放在/home/lwd/tmp/2011_09_26

cd /home/lwd/tmp/2011_09_26
ls输出
2011_09_26_drive_0001_sync
2011_09_26_drive_0002_sync
2011_09_26_drive_0005_sync

python txt.py

  • txt.py
import os, sys

al=os.listdir('.')
al.sort()
f=open('train.txt', 'w')
for a in al:
	if not 'sync' in a: continue
	print(a)
	b=a+'/image_02/data'
	png=os.listdir(b)
	png.sort()
	for i in range(1, len(png)-1):
		f.write(a+' '+str(i)+' l\n')
f.close()

cat train.txt #最后的l(小写L)表示图片在image_02
2011_09_26_drive_0001_sync 1 l
2011_09_26_drive_0001_sync 2 l
2011_09_26_drive_0001_sync 3 l

  • 分析:数据加载代码会调用get_color读取图像,get_color调用get_image_path获取图像路径。以train.txt的第一行为例,图像路径是/home/lwd/tmp/2011_09_26/2011_09_26_drive_0001_sync/image_02/data/0000000001.png
  • 准备自己的数据集时,可以按照上述路径构建或修改读取数据代码

你可能感兴趣的:(deeplearning,pytorch,深度学习,深度估计)