Commit Graph

295 Commits (d3463ae7f2f2e2c44848d0545ae586e31dfcd7e1)

Author SHA1 Message Date
reallybigname 2826e6d476 removed extra generation after generation for Image and Video Input
It wasn't working anyway, so I removed that mechanism and restored it to the previous behavior of just color matching after generation when using Image of Video Input.

Also cleaned up some code and added console reporting about Redo cycles.
2023-04-24 13:37:10 -07:00
reallybigname 5f3c4ac82e consolidated prompt code
saw an easy area where I could get some prompt code out of render_animation and into prompt.py
2023-04-24 11:57:40 -07:00
reallybigname 96e374844e Updates to Hybrid Video & More + Temporary Removal of RAFT
Discovered that RAFT wasn't actually working due to an issue with the function that got the flows.  There was a missing "elif".  So, the RAFT flow would get calculated and stored in the variable 'r', but then 'r' would always be overwritten by the default Farneback at the end.  We were fooling ourselves into thinking that was RAFT, when in actuality the RAFT flow is invalid and causes an error if actually used.
  - Changed function call for flow methods so that this can never happen. Now, each case returns directly.
  - Added to deprecation utils for now. We can remove the RAFT to Farneback conversion when we get RAFT working

Realignment of the way I handled frame indexes in motion routines to align everything more clearly

Major improvement to motion using prev_img during cadence!
  - added a prev_img during cadence so that there is a prev_img to refer to for the flow

Fixed color matching issue with first frame on Image and Video Init modes
  - first frame color match can't be done beforehand, so it's done afterwards. But, that normally makes for a very bad first frame. So, I added a redo for it to clean up the color matched image on first frame.

Major improvement to RANSAC
  - switched to use SIFT for feature matching instead of Lucas-Kanade
  - changed all border_mode to REFLECT_101, which matched how optical flow handled it, removed all the excess silly border_mode translations. This works much better.
2023-04-22 06:22:15 -07:00
hithereai 18c5c5aab7 set raft quality default to 50 instead of 12, fix optical flow cadence always being Farnback 2023-04-21 22:32:27 +03:00
hithereai 41b9e5220c fix 3d depth glitches 2023-04-20 16:28:52 +03:00
hithereai 2d66ccbb85 Update render.py 2023-04-18 12:05:22 +03:00
hithereai 7a1bec43a5 activate raft on redo_generation 2023-04-18 12:04:38 +03:00
hithereai 599fef64f5 fix raft error 2023-04-18 11:39:23 +03:00
rewbs 20c4fac824 Parseq: when delegating seed control to Deforum, prevent "AttributeError: 'DeformAnimKeys' object has no attribute 'subseed_series'" 2023-04-18 14:18:24 +10:00
hithereai 13b6acbdaf Add RAFT Optical Flow 2023-04-17 21:57:01 +03:00
reallybigname 65f9c3bf19 Made Optical flow cadence work in 2D mode
I figured out a hack to make optical flow cadence work in 2D.  To do optical flow cadence, I have to warp the flow field.  But, the 2D animation warping function, usually used on images, would mess with the values of the flow (as if they were colors).  So, I scaled them down by 1000 going in and scale them back up doing out, and it eliminates the effect it had which would make the image wobble around.

The same scaling actually messes with 3D optical flow cadence, so I leave that working at the normal scale factor.

I also made one modification to 3D optical flow cadence where it temporarily changes the sampling mehod (used by 3d warping function) to 'nearest' just for the flow warping, then restores it to it's previous value. This should help to minimize any pixel effects from warping.
2023-04-15 17:12:41 -07:00
hithereai 5c544f952a fix depth errors 2023-04-14 12:06:11 +03:00
hithereai 740f248ce6 initialize ZoeDepth with img size instead of fixes 384*512 2023-04-13 01:42:22 +03:00
hithereai ab6805a555 add debug_mode IF to print 2023-04-11 22:39:07 +03:00
hithereai 381008e133 clean 2023-04-11 22:36:24 +03:00
hithereai b987feb5d3 Introducing Zoe(Depth) 2023-04-11 22:31:19 +03:00
hithereai 3cfa2c0744 add .srt subtitles generation info support 2023-04-11 00:42:39 +03:00
reallybigname b665c36b36 Made overlay_mask work
Overlay mask working properly with static mask or video mask.
- made new masks.py file that we can use to consolidate other mask functions from main render code
- Overlay mask NOW WORKS WITH CADENCE.  I made the function switchable between PIL rgb and np bgr and inject the function during cadence and for normal saves
- I didn't use old code. I just made this work myself.

Fixed one-off issue with hybrid video where the first frame was duplicated. (it became obvious when doing overlay video masking)

re-commented a few lines, removed some whitespace
2023-04-09 03:49:38 -07:00
reallybigname 1e6eb6201b Removed extra color match code for resume
This was an afterthought, and after further testing, I don't think it's working quite right. I'm not sure why, but removing for now. Will re-examine later.

I accidentally had color matching against video on instead of LAB at first when I was testing, so I didn't see it.  Maybe I just need to convert to BGR?

Anyway, this restores the previous behavior of color matching, where if it resumes, it just matches against the prev_img.
2023-04-07 22:00:20 -07:00
reallybigname 35194fc2e6 Fixed resume
Now requires at least two actual frames to resume, but it works.
So,
at cadence 1, you need 2 frames
at cadence 3, you need 3 frames
at cadence 10, you need 10 frames
etc.

It gets the first and last frames, reads them, and feeds them to cadence cycle properly for turbo_prev_img AND turbo_next_img, then it recreates the last frame cycle.

It automatically accounts for cadence interruptions, like if you ran out of disk space during cadence or it got interrupted. (or you delete the last few frames or whatever)

Basically, I can't make it fail now, no matter how many times I resume, or how many random frames I delete going backwards before resuming.

Try it out!

I did consider saving out any frames that were recreated, but then realized that has it's own issues with possible duplicates as well, and after testing, I just don't think it's necessary either.  It works, every time, as far as I can tell.
2023-04-07 19:25:37 -07:00
hithereai 251ccc6f9f add DEBUG_MODE 2023-04-07 18:57:48 +03:00
hithereai 8eac754421 print to printf fix 2023-04-06 12:50:16 +03:00
reallybigname bf536d87a0 Fixed accidental newb error is not 'None'
I was using: is not 'None'
instead of: != 'None'

Ugh...
2023-04-05 11:45:06 -07:00
reallybigname 69990993fe Hybrid Image, new flow factor schedules, optical flow guidance
new option to use init image as hybrid video
- you can use all normal compositing stuff with that mode.
- you can't use optical flow, because it's not a video - but - if there are already video frames in the directory, well - you should be able to still use flow and ransac modes, although I haven't tested that

changed Optical flow redo to a selection of optical flow type with None as default
- added Redo flow factor schedule
- made optical flow redo look nicer by warping the same image that it is using to compare to prev_img, then it goes in for final generation
changed Optical flow cadence to a selection of optical flow type with None as default
- added cadence flow factor schedule

Added flow guidance from last flow
- no UI change - it just works by default with hybrid motion optical flow types. It just uses the last flow as guidance, so it's a minor difference, but a little better temporal coherence on flow

changed hybrid composite to a selection with None as default
- now can set hybrid compositing to Normal (After Motion), Before Motion, or After Generation!
2023-04-05 11:01:54 -07:00
hithereai 63f08d0938 add pause/resume for interpolation mode as well 2023-04-04 22:08:39 +03:00
hithereai fd7a57c304 fix interrupt behavior - no longer yields errors 2023-04-04 21:55:12 +03:00
hithereai 8c9b4b08a3 stop/resume using Skip button 2023-04-04 20:28:15 +03:00
hithereai 6dab9ee76c
Merge pull request #510 from reallybigname/automatic1111-webui
Fixed flow factor only working in integers
2023-03-30 12:10:14 +03:00
hithereai f2eefe4856 Merge remote-tracking branch 'upstream/automatic1111-webui' into blank-frames-reroll-fix 2023-03-30 12:06:26 +03:00
reallybigname 19b42e96f2 Merge branch 'automatic1111-webui' of https://github.com/reallybigname/deforum-for-automatic1111-webui into automatic1111-webui 2023-03-30 02:05:32 -07:00
reallybigname 35b20e2756 Fixed flow factor only working in integers
I have no idea why I left an int() in there... I only tested integers. My bad. Now, you can do very small amounts of flow. Derp.
2023-03-30 02:03:49 -07:00
kabachuha c321e62050 fix #496 2023-03-22 19:56:44 +03:00
kabachuha d866772ad8 wrap generate with vae failure checks 2023-03-19 22:13:49 +03:00
kabachuha 38d37a7240 move bfr to more correct place 2023-03-19 21:43:45 +03:00
kabachuha 891e7c69d3 add garbage collector runs after var deletions 2023-03-19 21:21:53 +03:00
kabachuha d60f3c3c3b
Merge pull request #474 from reallybigname/automatic1111-webui
Added Optical flow redo generation
2023-03-19 21:16:08 +03:00
reallybigname c6b8779d4a Added optical flow cadence method selection
- Uses the same variable, optical_flow_cadence but now uses "None" for disabled and has the three optical flow methods.
- Improved reporting of cadence frames to include optical flow cadence type if one is selected
2023-03-18 19:52:51 -07:00
hithereai 370e66e564 reorder and tiny bugfix 2023-03-19 03:07:08 +02:00
hithereai 525b9f0813 bugfix for midas > 1 2023-03-19 03:00:15 +02:00
hithereai 68d618e395 READY?! 2023-03-19 01:58:23 +02:00
hithereai f7ea36adc7 save --> keep name chane 2023-03-19 01:52:22 +02:00
hithereai 3f92d0a086 move keep 3d models in vram to webui's settings-->Deforum tab
Not complete yet
2023-03-19 01:51:00 +02:00
hithereai d34a6f1432 add option to keep 3d models in vram between runs 2023-03-18 20:53:00 +02:00
reallybigname 4a6315060a Removed test code.. whoops.
Sorry, I'm tired... I had added this to test something and forgot to remove, and didn't notice I commited it.
2023-03-17 12:46:36 -07:00
reallybigname c3c2a4c9ad Fixed one-off error in Redo
My most embarrassing commit.. I tested a bunch of different numbers of redos... except for 1... which caused an error and made me realize I had a one off problem... Tested 0, 1, 2, 3... working properly now. 1 redo yields 2 generations... as it should.
2023-03-17 12:38:47 -07:00
reallybigname 165a479519 made diffusion redo only color match on last one out
After testing it became obvious that part of the magic of the redo was letting the colors drift during redo... so, I just color matched on the way out, and it maintains it's cool factor, while maintaining colors!
2023-03-17 10:21:44 -07:00
reallybigname 94d21c95b7 fixed colors drifting during redo and optical flow redo
I just forgot that color would drift during repeated generations. Fixed. Now it's really consistent... and redo is incredible.
2023-03-17 09:34:46 -07:00
reallybigname 0c1440b80b Added Diffusion Redo feature
Added slider for diffusion redo.
 - llterally does a diffusion multiple extra times, feeding it back into itself. It is suggested to turn steps down if you turn redo up.
- while redoing, seed is randomized and restored
- fixed Optical Flow Redo so that it also randomizes and restores the seed, making it less muddy.
2023-03-17 08:48:55 -07:00
reallybigname 649472d200 Fixed mistake
accidentally removed this crucial division! all better
2023-03-16 23:56:20 -07:00
reallybigname e1ddff8747 Hybrid Video Update
- Adds DIS Fine mode, and sets it as the new default
- Optical flow cadence and optical flow redo generation will now use DIS Fine, for pixel accuracy
- Adds flow guidance to hybrid flow. No setting needed, it just happens automatically, assisting the flow calculation by feeding in the last flow.
- Adds flow_factor_schedule for hybrid flow
- reduced some code for bordermode by setting a variable for the cv2 border mode translated from the user setting
2023-03-16 23:32:15 -07:00
reallybigname 3d008badbd Fixed PIL version conflict
- replaced Image,Resampling.LANCZOS with PIL.Image.LANCZOS
- had to add import PIL
- had heard of people on colab encountering this issue. Should fix both hybrid video and image/video color matching.
- tested, works fine locally, so I see no reason not to change
2023-03-16 04:45:39 -07:00
reallybigname 55aebfd032 prevent color match on strength 0 if using Video or Image color coherence
Follow up to strength 0 color match reset... prevents color match sample being replaced when strength goes to 0 if using color coherence Video or color coherence Image.
2023-03-16 02:40:07 -07:00
reallybigname e0a4337d8b Added Optical flow redo generation
Option works in 2D/3D mode
Does a disposable generation before the actual generation to get the flow between previous image and the generation.  Then, it discards that generation and warps the init_sample based on the captured flow before the actual generation happens.
- Takes twice as long (obviously)
- It can introduce smoothing, especially over time, but also adds a type of artistic consistency between frames.
- can be mixed and matched with any other modes, optical flow cadence, video, etc...
2023-03-16 01:39:41 -07:00
reallybigname df3071c3b4 Added color_coherence 'Image'
You can now color match against an image!
- the one caveat is that normal color matching is done with the prev_img. There is no prev_img for the 1st frame, so I had to force the color match on the output rather than the input. It makes the first frame look sharpened at times, since the histogram is forced on it.

I also fixed video color coherence
- I realized that it was never color matching on the first frame for video. You usually just wouldn't notice, since you're using the video.
- I also realized it was one frame off, fixed.
2023-03-14 14:39:44 -07:00
kabachuha 2366bfdb47 use strength schedule in video input
closes #455
2023-03-14 15:24:16 +03:00
kabachuha 07760403e1 fixup 2023-03-14 00:16:04 +03:00
kabachuha 89b46124d4 auto-set the needed args for the GI mode 2023-03-13 22:51:11 +03:00
kabachuha d4a48b1e0a re-add matisse's changes 2023-03-13 22:22:22 +03:00
hithereai 4e827e7c81 Merge remote-tracking branch 'upstream/automatic1111-webui' into pr/452 2023-03-13 17:01:27 +02:00
reallybigname 60fcc288e5 fix for color match sample incorrect colors
Once I tried some different images I realized that the color balance was RGB/BGR swapped on the color matches. Ooops! This fixes it. Perfect color matching after strength 0.
2023-03-13 06:54:04 -07:00
reallybigname bb3b7bbd72 Fix for optical flow cadence on strength 0
I wasn't thinking about it quite right before, and I was cancelling the wrong cadence section based on strength 0. This repairs it.

It now looks at the proper strength key (from the tween frame_start_idx) to see if strength is 0 and skip optical flow cadence if it is.

Also, fixes and condenses the reporting of whether it's a cadence frame or an optical flow cadence by combining the info with the tween reporting.
2023-03-13 06:04:17 -07:00
reallybigname 48027d11ed Fixed color match and optical flow on strength 0
I made cadence skip optical flow on frames with strength 0.  This won't actually help you unless your cadence start is aligned perfectly with your strength 0.

Made strength 0 reset color match, as if it were the first frame in an animation.

I plan to make a scene change schedule, at which point I can add a strength threshold value for scene changes and replace this code.
2023-03-12 21:53:27 -07:00
hithereai f06c222ba7 Merge remote-tracking branch 'upstream/automatic1111-webui' into some_tests_12_03_23 2023-03-13 01:40:08 +02:00
hithereai e67339c837 change order to align with other new lines of code 2023-03-13 01:38:05 +02:00
hithereai 4387ab586d fix wrong cli printing when not in 3d mode 2023-03-13 01:36:06 +02:00
reallybigname a3ed3a2a5b Disabled optical flow cadence in 2D mode
I'll have to do some more work to track down a method to warp the flow properly in 2D mode. For now, optical flow cadence is a 3D only thing.

Made it say Optical flow cadence (3D only)
Made it hidden by default
Made it show when you switch to 3D mode
Made it not do the routines on the back end if not in 3D mode
2023-03-12 15:44:48 -07:00
hithereai 04537641de auto disable "with img2img do exactly x steps" from general settings 2023-03-12 23:50:37 +02:00
hithereai 368e471dd8 clean code 2023-03-12 23:35:04 +02:00
hithereai 71e38815c6 add noise_multiplier scheduling 2023-03-12 23:29:37 +02:00
kabachuha 652bda9e61 drop the last frame if using video mask 2023-03-12 19:13:29 +03:00
kabachuha 60b186e664 Merge branch 'main-mask' of https://github.com/deforum-art/deforum-for-automatic1111-webui into main-mask 2023-03-11 23:28:08 +03:00
kabachuha caeb0204f4 fix masks not moving 2023-03-11 23:27:59 +03:00
hithereai 52500d0a0f Merge remote-tracking branch 'upstream/automatic1111-webui' into main-mask 2023-03-11 22:24:39 +02:00
reallybigname 651ddb9358 Improvement to optical flow cadence
slight changes, big improvement
2023-03-11 00:54:52 -08:00
hithereai 6b28bfc65b Merge remote-tracking branch 'upstream/automatic1111-webui' into main-mask 2023-03-10 19:07:54 +02:00
hithereai 2de505e915 Merge remote-tracking branch 'upstream/automatic1111-webui' into pr/443 2023-03-10 11:32:21 +02:00
hithereai 7a6d814332 revert try 1 2023-03-10 09:26:17 +02:00
hithereai 37a58a556f another code clean 2023-03-10 00:04:33 +02:00
hithereai 79183f8d7c clean code 2023-03-09 23:57:35 +02:00
hithereai 7e0110a954 add cli printing before in-between cadence frames 2023-03-09 23:51:29 +02:00
reallybigname db003c5c97 Merge branch 'automatic1111-webui' of https://github.com/reallybigname/deforum-for-automatic1111-webui into automatic1111-webui 2023-03-09 08:26:22 -08:00
reallybigname 0c8b8e0aff added optical flow cadence
optional checkbox to include optical flow in normal cadence

-starts by getting flow between turbo_prev_image and turbo_next_image.
- after getting the flow, it warps the turbo_next_image with negative flow to match prev
- then, normal image warping during cadence happens
- then it warps the flow field to match the animation, first converting it to relative for warp, then back to absolute flow
- I calculate the flow division for each tween value and divide that by two.
- it then applies that tweened flow to the prev and next image
2023-03-09 08:25:56 -08:00
kabachuha d209157ad7 use only one mask preset
fixes "There is a bug where it is checking the mask_file path for no good reason, when it should only be using video masks" in #386
2023-03-09 13:11:54 +03:00
Matisse 19aeaa627d Adding max_f and math to interpolation mode 2023-03-09 00:22:03 -08:00
Matisse c91d8b7dfe Merge remote-tracking branch 'upstream/automatic1111-webui' into automatic1111-webui 2023-03-08 13:24:51 -08:00
hithereai 61975f68ac add saving of pos and neg prompts to anim_run sett file 2023-03-08 22:45:33 +02:00
hithereai 6fe8927499 fix missing prompts in save_settings_from_animation_run( 2023-03-08 22:05:24 +02:00
hithereai 33b574f776 Merge remote-tracking branch 'upstream/automatic1111-webui' into pr/420 2023-03-07 21:52:36 +02:00
hithereai 517c45b484 Merge remote-tracking branch 'upstream/automatic1111-webui' into pr/420 2023-03-07 19:28:07 +02:00
hithereai 1eb345d5a0 done? handle saving when running animations 2023-03-07 18:12:16 +02:00
kabachuha e8466b6bc2
Merge pull request #427 from hithereai/align_%09d_filenames
Align img filenames to be of length %09d.extension
2023-03-06 23:12:04 +03:00
hithereai acb9012f21 fix video input not using input frames with negative prompt present 2023-03-05 23:35:14 +02:00
hithereai 6e255f97c8 align img filenames to be of length 09.extension 2023-03-05 22:30:22 +02:00
Matisse 46577bd3aa Merge remote-tracking branch 'upstream/automatic1111-webui' into automatic1111-webui 2023-03-05 00:25:08 -08:00
Matisse 177ec8aa1b Revert "Merge remote-tracking branch 'upstream/automatic1111-webui' into automatic1111-webui"
This reverts commit c14e03f0aa, reversing
changes made to 80546752b3.
2023-03-03 23:49:33 -08:00
Matisse 1e91c01f57 Revert "reimplementation of max_f and t"
This reverts commit b222ca54f9.
2023-03-03 23:48:42 -08:00
Matisse b222ca54f9 reimplementation of max_f and t 2023-03-03 23:47:45 -08:00
hithereai fde2ea6cf6 p 2023-03-04 04:15:47 +02:00
hithereai 37a5665363 clean 2023-03-04 04:07:38 +02:00
hithereai 415a544c94 Merge remote-tracking branch 'upstream/automatic1111-webui' into combine_cli_tables 2023-03-04 03:54:50 +02:00