frontend/__init__.py: general improvements, but still kinda wip

main
Nils Koch 2 years ago
parent ed80c3056f
commit 6f2697de1c
  1. 26
      frontend/__init__.py

@ -20,6 +20,8 @@ img_dir = '../../usable_imgs/'
cv2.namedWindow('Input Image') cv2.namedWindow('Input Image')
cv2.namedWindow('Predicted Disparity') cv2.namedWindow('Predicted Disparity')
signal.signal(signal.SIGUSR1, lambda *args: print('not setup yet'))
vis = o3d.visualization.VisualizerWithKeyCallback() vis = o3d.visualization.VisualizerWithKeyCallback()
viscont = o3d.visualization.ViewControl() viscont = o3d.visualization.ViewControl()
# vis.register_key_callback(99) # vis.register_key_callback(99)
@ -31,7 +33,7 @@ K = np.array([[567.6, 0, 324.7], [0, 570.2, 250.1], [0, 0, 1]], dtype=np.float32
good_models = [260, 183] good_models = [260, 183]
interesting = [214, ] interesting = [214, ]
# new ganz gut bei ca 175 # new ganz gut bei ca 175, 235
verbose = False verbose = False
running_tasks = set() running_tasks = set()
@ -90,7 +92,7 @@ def normalize_and_colormap(img):
def reproject(disparity_img): def reproject(disparity_img):
print('reprojecting') print('reprojecting')
baseline = 0.075 baseline = 0.075
depth_img = baseline * K[0][0] / disparity_img depth_img = baseline * K[0][0] / (disparity_img + 1)
pointcloud = o3d.geometry.PointCloud() pointcloud = o3d.geometry.PointCloud()
intrinsics = o3d.pybind.camera.PinholeCameraIntrinsic() intrinsics = o3d.pybind.camera.PinholeCameraIntrinsic()
print('setting intrinsics') print('setting intrinsics')
@ -131,10 +133,14 @@ def reproject(disparity_img):
# dpcd.transform(flip_transform) # dpcd.transform(flip_transform)
pcd.remove_statistical_outlier(nb_neighbors=20, std_ratio=2.0) pcd.remove_statistical_outlier(nb_neighbors=20, std_ratio=2.0)
print('drawing pointcloud') print('drawing pointcloud')
# vis.clear_geometries() vis.clear_geometries()
# vis.add_geometry(pcd, reset_bounding_box=True) vis.add_geometry(pcd, reset_bounding_box=True)
# viscont.rotate(250, 500) viscont = vis.get_view_control()
vis.update_geometry(pcd) viscont.translate(280, 800, yo=-900)
viscont.camera_local_rotate(-180, 250)
viscont.rotate(100, 0)
# viscont.camera_local_translate(forward=-5., right=-10., up=10.)
# vis.update_geometry(pcd)
vis.poll_events() vis.poll_events()
vis.update_renderer() vis.update_renderer()
@ -294,9 +300,6 @@ def create_task(*args):
# return task # return task
signal.signal(signal.SIGUSR1, create_task)
async def run_test(img_dir, iterate_checkpoints): async def run_test(img_dir, iterate_checkpoints):
img_dir = list(os.scandir(img_dir)) img_dir = list(os.scandir(img_dir))
for epoch in range(175, 270): for epoch in range(175, 270):
@ -322,10 +325,11 @@ async def main():
# change_epoch(good_models[1]) # change_epoch(good_models[1])
# change_epoch('latest') # change_epoch('latest')
o3d.utility.set_verbosity_level(o3d.utility.VerbosityLevel.Info) o3d.utility.set_verbosity_level(o3d.utility.VerbosityLevel.Info)
signal.signal(signal.SIGUSR1, create_task)
change_epoch(150) change_epoch(150)
change_minimal_data(False) change_minimal_data(False)
await asyncio.sleep(50000) # await asyncio.sleep(50000)
# signal.signal(signal.SIGBUS, lambda x: print('received sigbus')) # signal.signal(signal.SIGBUS, lambda x: print('received sigbus'))
# loop = asyncio.get_running_loop() # loop = asyncio.get_running_loop()
@ -335,7 +339,7 @@ async def main():
# create_task() # create_task()
# await asyncio.sleep(0.1) # await asyncio.sleep(0.1)
# await run_test(img_dir, iterate_checkpoints) # await run_test(img_dir, iterate_checkpoints)
await asyncio.sleep(50000) await asyncio.sleep(5)
# print('[main] slept') # print('[main] slept')
# if use_live_data: # if use_live_data:
# signal.pause() # signal.pause()

Loading…
Cancel
Save