Merge pull request #44 from alembics/fix-vr-translation-scale-issue

Fix VR translation scale issue
pull/45/head
Adam Letts 3 years ago committed by GitHub
commit db0962e386
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      Disco_Diffusion.ipynb
  2. 9
      disco.py

@ -1007,6 +1007,7 @@
" return (input - input.clamp(-1, 1)).pow(2).mean([1, 2, 3])\n",
"\n",
"stop_on_next_loop = False # Make sure GPU memory doesn't get corrupted from cancelling the run mid-way through, allow a full frame to complete\n",
"TRANSLATION_SCALE = 1.0/200.0\n",
"\n",
"def do_3d_step(img_filepath, frame_num, midas_model, midas_transform):\n",
" if args.key_frames:\n",
@ -1025,8 +1026,7 @@
" f'rotation_3d_z: {rotation_3d_z}',\n",
" )\n",
"\n",
" trans_scale = 1.0/200.0\n",
" translate_xyz = [-translation_x*trans_scale, translation_y*trans_scale, -translation_z*trans_scale]\n",
" translate_xyz = [-translation_x*TRANSLATION_SCALE, translation_y*TRANSLATION_SCALE, -translation_z*TRANSLATION_SCALE]\n",
" rotate_xyz_degrees = [rotation_3d_x, rotation_3d_y, rotation_3d_z]\n",
" print('translation:',translate_xyz)\n",
" print('rotation:',rotate_xyz_degrees)\n",
@ -1423,10 +1423,8 @@
" else:\n",
" image.save(f'{batchFolder}/{filename}')\n",
"\n",
" # TODO(VR): trans_scale wasn't set in the PR. This needs to be set to a reasonable value!\n",
" trans_scale = 1.0\n",
" if vr_mode:\n",
" generate_eye_views(trans_scale, batchFolder, filename, frame_num, midas_model, midas_transform)\n",
" generate_eye_views(TRANSLATION_SCALE, batchFolder, filename, frame_num, midas_model, midas_transform)\n",
"\n",
" # if frame_num != args.max_frames-1:\n",
" # display.clear_output()\n",
@ -2030,7 +2028,6 @@
"#======= VR MODE\n",
"#@markdown ---\n",
"#@markdown ####**VR Mode (3D anim only):**\n",
"#@markdown EXPERIMENTAL ALPHA: Need to look into trans_scale value\n",
"#@markdown Enables stereo rendering of left/right eye views (supporting Turbo) which use a different (fish-eye) camera projection matrix. \n",
"#@markdown Note the images you're prompting will work better if they have some inherent wide-angle aspect\n",
"#@markdown The generated images will need to be combined into left/right videos. These can then be stitched into the VR180 format.\n",

@ -969,6 +969,7 @@ def range_loss(input):
return (input - input.clamp(-1, 1)).pow(2).mean([1, 2, 3])
stop_on_next_loop = False # Make sure GPU memory doesn't get corrupted from cancelling the run mid-way through, allow a full frame to complete
TRANSLATION_SCALE = 1.0/200.0
def do_3d_step(img_filepath, frame_num, midas_model, midas_transform):
if args.key_frames:
@ -987,8 +988,7 @@ def do_3d_step(img_filepath, frame_num, midas_model, midas_transform):
f'rotation_3d_z: {rotation_3d_z}',
)
trans_scale = 1.0/200.0
translate_xyz = [-translation_x*trans_scale, translation_y*trans_scale, -translation_z*trans_scale]
translate_xyz = [-translation_x*TRANSLATION_SCALE, translation_y*TRANSLATION_SCALE, -translation_z*TRANSLATION_SCALE]
rotate_xyz_degrees = [rotation_3d_x, rotation_3d_y, rotation_3d_z]
print('translation:',translate_xyz)
print('rotation:',rotate_xyz_degrees)
@ -1385,10 +1385,8 @@ def do_run():
else:
image.save(f'{batchFolder}/{filename}')
# TODO(VR): trans_scale wasn't set in the PR. This needs to be set to a reasonable value!
trans_scale = 1.0
if vr_mode:
generate_eye_views(trans_scale, batchFolder, filename, frame_num, midas_model, midas_transform)
generate_eye_views(TRANSLATION_SCALE, batchFolder, filename, frame_num, midas_model, midas_transform)
# if frame_num != args.max_frames-1:
# display.clear_output()
@ -1972,7 +1970,6 @@ frames_skip_steps = '60%' #@param ['40%', '50%', '60%', '70%', '80%'] {type: 'st
#======= VR MODE
#@markdown ---
#@markdown ####**VR Mode (3D anim only):**
#@markdown EXPERIMENTAL ALPHA: Need to look into trans_scale value
#@markdown Enables stereo rendering of left/right eye views (supporting Turbo) which use a different (fish-eye) camera projection matrix.
#@markdown Note the images you're prompting will work better if they have some inherent wide-angle aspect
#@markdown The generated images will need to be combined into left/right videos. These can then be stitched into the VR180 format.

Loading…
Cancel
Save