forked from chenglong0313/FADNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
blackjack2015
committed
Sep 24, 2019
1 parent
c96f96b
commit de99a7b
Showing
133 changed files
with
50,747 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
## ginore this file ## | ||
*.pth | ||
*.log | ||
*.pyc | ||
*.swp | ||
*.pfm | ||
*.exr | ||
*.obj | ||
*.png | ||
*.jpg | ||
*.bmp | ||
*.model | ||
*.db | ||
*.so | ||
*.so.* | ||
*.npy | ||
*.o | ||
*.egg | ||
tmp | ||
./data | ||
data | ||
./models | ||
./detect_results | ||
./tools/FusionPortal/lib | ||
core | ||
trained/ | ||
submit_results/ | ||
submit_results | ||
models | ||
trained | ||
tags | ||
runs/ | ||
runs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
no=0063 | ||
girl=02 | ||
#girl02_R_camera8_R_XNCG_ep0001_cam01_rd_lgt.0125.png.pfm | ||
#girl02_R_camera7_R_XNCG_ep0001_cam01_rd_lgt.0095.png.pfm | ||
#girl02_R_camera5_R_XNCG_ep0001_cam01_rd_lgt.0001.png.pfm | ||
dist=/media/sf_Shared_Data/dispnet/FusionPortal/data | ||
#left_dis_root=./detect_result/girl-crop-noscale-3nd-epe0.152 | ||
#left_dis_root=./detect_result/girl-crop-noscale-2nd-epe0.182 | ||
left_dis_root=./detect_results/virtual | ||
k=0 | ||
for ((cam=1;cam <= 8;cam++)) | ||
do | ||
#left_rgb_root=/media/sf_Shared_Data/gpuhomedataset/dispnet/virtual/girl$girl/camera${cam}_R # >= girl05 | ||
#left_rgb_root=/media/sf_Shared_Data/gpuhomedataset/dispnet/virtual/girl$girl/R/camera${cam}_R | ||
left_rgb_root=/media/sf_Shared_Data/gpuhomedataset/dispnet/virtual/ep0010/camera${cam}_R | ||
#img=XNCG_ep00${girl}_cam01_rd_lgt.${no}.png # >= girl 05 | ||
#img=XNCG_ep0001_cam01_rd_lgt.${no}.png # <= girl 04 | ||
img=XNCG_ep0010_cam01_rd_lgt.${no}.png | ||
target=$dist/${k} | ||
#disp=girl${girl}_camera${cam}_R_XNCG_ep00${girl}_cam01_rd_lgt.${no}.png.pfm # >= girl 05 | ||
#disp=girl${girl}_R_camera${cam}_R_XNCG_ep0001_cam01_rd_lgt.${no}.png.pfm # <= girl 04 | ||
disp=camera${cam}_R/${img}.pfm | ||
mkdir $target | ||
cp $left_rgb_root/$img $target/0.png | ||
#./tools/pfm_viewer ${left_dis_root}/${disp} test.exr | ||
cp ${left_dis_root}/${disp} $target/0.pfm | ||
k=$(expr $k + 1) | ||
done | ||
python tools/process_cam_data.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
img=img00044 | ||
inv_baseline=0.0038 | ||
focal=1800 | ||
maxdisp=200 | ||
mindisp=1 | ||
#real_release_frames_cleanpass_left_img00008.bmp.pfm | ||
disp_root=./detect_results/real-dispnet3 | ||
#left_rgb_root=/media/sf_Shared_Data/gpuhomedataset/dispnet/real_release/frames_cleanpass/left | ||
left_rgb_root=/home/vradmin/dispflownet-release/data/real_release/frames_cleanpass/left | ||
# nn 3d model | ||
rgb=${left_rgb_root}/${img}.bmp | ||
disp=${disp_root}/real_release_frames_cleanpass_left_${img}.bmp.pfm | ||
#jview $rgb | ||
#jview $disp | ||
#disp_root=./detect_result/domain_adaptation | ||
#disp_root=./detect_result/flyingthings_model | ||
#disp_root=./detect_results/flyingthings_model/disp3 | ||
#disp_root=./detect_result/cropfrom1024model_real_detect_cleandata_scale1024 | ||
#left_rgb_root=/media/sf_Shared_Data/gpuhomedataset/dispnet/real_release/frames_cleanpass/left | ||
#left_rgb_root=/media/sf_Shared_Data/gpuhomedataset/dispnet/custom/left | ||
#rgb=${left_rgb_root}/${img}.png | ||
#disp=${disp_root}/custom_left_${img}.png.pfm | ||
# nn 3d model | ||
#rgb=${left_rgb_root}/${img}.bmp | ||
#disp=${disp_root}/real_release_frames_cleanpass_left_${img}.bmp.pfm | ||
#disp=${disp_root}/real_release_frames_cleanpass_left_${img}.pfm | ||
#jview $rgb | ||
#jview $disp | ||
./tools/pfm_viewer $disp predict_${img}.exr | ||
./tools/DisparityTo3D predict_${img}.exr ${img}.obj $rgb ${inv_baseline} ${focal} ${maxdisp} ${mindisp} | ||
#cp ${img}.obj /media/sf_Shared_Data/dispnet/ | ||
|
||
# # sgm 3d model | ||
# pfm_viewer ./data_local/dispnet/real_release/sgm_disp/left/${img}.pfm ./real_detect_result_sgm/predict_${img}.exr | ||
# DisparityTo3D ./real_detect_result_sgm/predict_${img}.exr ./real_obj/${img}.obj ./data_local/dispnet/real_release/frames_cleanpass/left/${img}.bmp | ||
# cd ./real_obj | ||
# meshlab ${img}.obj | ||
# cd .. | ||
|
||
|
||
# # flyingthing3D | ||
# f1=A | ||
# f2=0027 | ||
# f3=0015 | ||
# #left_rgb_root=/home/gpgpu-sim/gpuhome/pytorch-dispnet/data/FlyingThings3D_release/frames_cleanpass/ | ||
# left_rgb_root=/media/gpuhomedataset/FlyingThings3D_release/frames_cleanpass/ | ||
# #left_dis_root=/home/gpgpu-sim/gpuhome/pytorch-dispnet/data_local/clean_dispnet/FlyingThings3D_release/clean_disparity/ | ||
# #left_dis_root=/home/gpgpu-sim/gpuhome/pytorch-dispnet/data_local/FlyingThings3D_release/disparity/ | ||
# left_dis_root=/home/gpgpu-sim/gpuhome/pytorch-dispnet/detect_results/flying_detect_cleandata | ||
# #left_dis_root=/home/gpgpu-sim/gpuhome/pytorch-dispnet/flying_detect_result | ||
# img=TEST/${f1}/${f2}/left/${f3} | ||
# inv_baseline=0.0038 | ||
# focal=500 | ||
# maxdisp=800 | ||
# mindisp=10 | ||
# jview ${left_rgb_root}/${img}.png | ||
# #jview ${left_dis_root}/${img}.pfm | ||
# jview ${left_dis_root}/predict_${f1}_${f2}_${f3}.pfm | ||
# #pfm_viewer ${left_dis_root}/${img}.pfm test.exr | ||
# ./tools/pfm_viewer ${left_dis_root}/predict_${f1}_${f2}_${f3}.pfm test.exr | ||
# ./tools/DisparityTo3D test.exr test.obj ${left_rgb_root}/${img}.png ${inv_baseline} ${focal} ${maxdisp} ${mindisp} | ||
# meshlab test.obj | ||
|
||
# girl | ||
#no=0226 | ||
#left_rgb_root=/media/sf_Shared_Data/gpuhomedataset/dispnet/virtual/girl | ||
##left_dis_root=/media/sf_Shared_Data/gpuhomedataset/dispnet/virtual/girl | ||
#left_dis_root=./girl_detect_cleandata | ||
#img=girl_camera1_Rcamera1_R.${no}.png | ||
##disp=girl_camera1_Rcamera1_R.Z.${no}.pfm | ||
#disp=predict_girl_camera1_Rcamera1_R.${no}.png.pfm | ||
#inv_baseline=0.05 | ||
#focal=1050 | ||
#maxdisp=480 | ||
#mindisp=0 | ||
#jview ${left_rgb_root}/${img} | ||
#jview ${left_dis_root}/${disp} | ||
#./tools/pfm_viewer ${left_dis_root}/${disp} test.exr | ||
#./tools/DisparityTo3D test.exr test.obj ${left_rgb_root}/${img} ${inv_baseline} ${focal} ${maxdisp} ${mindisp} | ||
#cp test.obj /media/sf_Shared_Data/dispnet/ | ||
#meshlab test.obj | ||
|
||
|
||
# girl02 | ||
#girl05_camera8_R_XNCG_ep0005_cam01_rd_lgt.0053.png.pfm | ||
#no=0053 | ||
#cam=8 | ||
#girl=05 | ||
#left_rgb_root=/media/sf_Shared_Data/gpuhomedataset/dispnet/virtual/girl$girl/camera${cam}_R | ||
#img=XNCG_ep00${girl}_cam01_rd_lgt.${no}.png | ||
##left_dis_root=/media/sf_Shared_Data/gpuhomedataset/dispnet/virtual/girl02/R_Z/camera${cam}_R_Z/Z_color | ||
##disp=XNCG_ep0001_cam01_rd_lgt_Z.Z.${no}.pfm | ||
# | ||
##girl05_camera2_R_XNCG_ep0005_cam01_rd_lgt.0009.png.pfm | ||
#left_dis_root=./detect_result/girl-crop-noscale-2nd | ||
##disp=girl05_R_camera${cam}_R_XNCG_ep0005_cam01_rd_lgt.${no}.png.pfm | ||
#disp=girl${girl}_camera${cam}_R_XNCG_ep00${girl}_cam01_rd_lgt.${no}.png.pfm | ||
#inv_baseline=0.05 | ||
#focal=1050 | ||
#maxdisp=480 | ||
#mindisp=0 | ||
#jview ${left_rgb_root}/${img} | ||
#jview ${left_dis_root}/${disp} | ||
#./tools/pfm_viewer ${left_dis_root}/${disp} test.exr | ||
#./tools/DisparityTo3D test.exr test.obj ${left_rgb_root}/${img} ${inv_baseline} ${focal} ${maxdisp} ${mindisp} | ||
##cp test.obj /media/sf_Shared_Data/dispnet/test2.obj | ||
#cp test.obj /media/sf_Shared_Data/dispnet/ | ||
|
||
# original 3d fusion | ||
img=img00003 | ||
|
||
python fusion.py ${img} | ||
jview ./test.pfm | ||
pfm_viewer ./test.pfm ./real_detect_result_s1.5/predict_${img}.exr | ||
DisparityTo3D ./real_detect_result_s1.5/predict_${img}.exr ./real_obj/${img}.obj ./data_local/dispnet/real_release/frames_cleanpass/left/${img}.bmp | ||
cd ./real_obj | ||
meshlab ${img}.obj | ||
cd .. | ||
|
||
# img=img00000 | ||
# | ||
# # pfm_viewer ./real_detect_result_s1.4/predict_${img}.pfm ./real_detect_result_s1.4/predict_${img}.exr | ||
# pfm_viewer /media/sf_Shared_Data/gpuhome/pytorch-dispnet/data/dispnet/real_release/sgm_disp/left/${img}.pfm ./real_detect_result_s1.4/predict_${img}.exr | ||
# DisparityTo3D ./real_detect_result_s1.4/predict_${img}.exr ./${img}.obj ./data/dispnet/real_release/frames_cleanpass/left/${img}.bmp | ||
# meshlab ${img}.obj | ||
# girl | ||
directory=ep0010 | ||
no=0015 | ||
cam=camera2_R | ||
left_rgb_root=/media/sf_Shared_Data/gpuhomedataset/dispnet/virtual/ep0010 | ||
left_dis_root=./detect_results/virtual | ||
img=XNCG_${directory}_cam01_rd_lgt.${no}.png | ||
disp=${cam}/XNCG_${directory}_cam01_rd_lgt.${no}.png.pfm | ||
inv_baseline=0.05 | ||
focal=1050 | ||
maxdisp=480 | ||
mindisp=0 | ||
jview ${left_rgb_root}/${cam}/${img} | ||
jview ${left_dis_root}/${disp} | ||
./tools/pfm_viewer ${left_dis_root}/${disp} test.exr | ||
./tools/DisparityTo3D test.exr test.obj ${left_rgb_root}/${cam}/${img} ${inv_baseline} ${focal} ${maxdisp} ${mindisp} | ||
cp test.obj /media/sf_Shared_Data/dispnet/${img}.obj | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#export LD_LIBRARY_PATH="/home/feihu/anaconda3/lib:$LD_LIBRARY_PATH" | ||
#export LD_INCLUDE_PATH="/home/feihu/anaconda3/include:$LD_INCLUDE_PATH" | ||
#export CUDA_HOME="/usr/local/cuda-10.0" | ||
#export PATH="/home/feihu/anaconda3/bin:/usr/local/cuda-10.0/bin:$PATH" | ||
#export CPATH="/usr/local/cuda-10.0/include" | ||
#export CUDNN_INCLUDE_DIR="/usr/local/cuda-10.0/include" | ||
#export CUDNN_LIB_DIR="/usr/local/cuda-10.0/lib64" | ||
|
||
#export LD_LIBRARY_PATH="/home/zhangfeihu/anaconda3/lib:$LD_LIBRARY_PATH" | ||
#export LD_INCLUDE_PATH="/home/zhangfeihu/anaconda3/include:$LD_INCLUDE_PATH" | ||
#export CUDA_HOME="/home/work/cuda-9.2" | ||
#export PATH="/home/zhangfeihu/anaconda3/bin:/home/work/cuda-9.2/bin:$PATH" | ||
#export CPATH="/home/work/cuda-9.2/include" | ||
#export CUDNN_INCLUDE_DIR="/home/work/cudnn/cudnn_v7/include" | ||
#export CUDNN_LIB_DIR="/home/work/cudnn/cudnn_v7/lib64" | ||
TORCH=$(python -c "import os; import torch; print(os.path.dirname(torch.__file__))") | ||
#echo $TORCH | ||
cd libs/GANet | ||
python setup.py clean | ||
rm -rf build | ||
python setup.py build | ||
cp -r build/lib* build/lib | ||
|
||
cd ../sync_bn | ||
python setup.py clean | ||
rm -rf build | ||
python setup.py build | ||
cp -r build/lib* build/lib | ||
|
||
cd ../.. | ||
echo "" > libs/GANet/build/__init__.py | ||
echo "" > libs/GANet/build/lib/__init__.py | ||
echo "" > libs/sync_bn/build/__init__.py | ||
echo "" > libs/sync_bn/build/lib/__init__.py | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import numpy | ||
import OpenEXR | ||
import Imath | ||
import imageio | ||
import glob | ||
import os | ||
|
||
def exr2hdr(exrpath): | ||
File = OpenEXR.InputFile(exrpath) | ||
PixType = Imath.PixelType(Imath.PixelType.FLOAT) | ||
DW = File.header()['dataWindow'] | ||
CNum = len(File.header()['channels'].keys()) | ||
if (CNum > 1): | ||
Channels = ['R', 'G', 'B'] | ||
CNum = 3 | ||
else: | ||
Channels = ['G'] | ||
Size = (DW.max.x - DW.min.x + 1, DW.max.y - DW.min.y + 1) | ||
Pixels = [numpy.fromstring(File.channel(c, PixType), dtype=numpy.float32) for c in Channels] | ||
hdr = numpy.zeros((Size[1],Size[0],CNum),dtype=numpy.float32) | ||
if (CNum == 1): | ||
hdr[:,:,0] = numpy.reshape(Pixels[0],(Size[1],Size[0])) | ||
else: | ||
hdr[:,:,0] = numpy.reshape(Pixels[0],(Size[1],Size[0])) | ||
hdr[:,:,1] = numpy.reshape(Pixels[1],(Size[1],Size[0])) | ||
hdr[:,:,2] = numpy.reshape(Pixels[2],(Size[1],Size[0])) | ||
return hdr | ||
|
||
def writehdr(hdrpath,hdr): | ||
h, w, c = hdr.shape | ||
if c == 1: | ||
hdr = numpy.pad(hdr, ((0, 0), (0, 0), (0, 2)), 'constant') | ||
hdr[:,:,1] = hdr[:,:,0] | ||
hdr[:,:,2] = hdr[:,:,0] | ||
imageio.imwrite(hdrpath,hdr,format='hdr') | ||
|
||
def load_exr(filename): | ||
hdr = exr2hdr(filename) | ||
h, w, c = hdr.shape | ||
if c == 1: | ||
hdr = numpy.squeeze(hdr) | ||
return hdr | ||
|
||
|
||
def test_exr(): | ||
files = glob.glob('D:/MLProjects/data/home/*.exr') | ||
savepath = 'D:/MLProjects/data/home' | ||
total = len(files) | ||
count = 0 | ||
print ('Files Num:', total) | ||
for file in files: | ||
hdr = exr2hdr(file) | ||
filename,file_ext = os.path.splitext(file) | ||
filename = os.path.basename(filename) | ||
filename = filename + '.hdr' | ||
curpath = os.path.join(savepath,filename) | ||
writehdr(curpath,hdr) | ||
count = count + 1 | ||
print ('process:', count, '/', total) | ||
|
||
if __name__ == '__main__': | ||
test_exr() |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from .dataset import DatasetFromList | ||
|
||
def get_training_set(data_path, train_list, crop_size=[256,256], left_right=False, kitti=False, kitti2015=False, shift=0): | ||
return DatasetFromList(data_path, train_list, | ||
crop_size, True, left_right, kitti, kitti2015, shift) | ||
|
||
|
||
def get_test_set(data_path, test_list, crop_size=[256,256], left_right=False, kitti=False, kitti2015=False): | ||
return DatasetFromList(data_path, test_list, | ||
crop_size, False, left_right, kitti, kitti2015) |
Oops, something went wrong.