Skip to content

Commit

Permalink
update control-travel; notify #21, bugfix #23
Browse files Browse the repository at this point in the history
make filename correctly ordered
add RIFE for cond interp
add skip_fuse
add reset cuda button
  • Loading branch information
Kahsolt committed Apr 13, 2023
1 parent d3c8944 commit 6261364
Show file tree
Hide file tree
Showing 4 changed files with 315 additions and 406 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
![:stable-diffusion-webui-prompt-travel](https://count.getloli.com/get/@:stable-diffusion-webui-prompt-travel)

Try interpolating on the hidden vectors of conditioning prompt to make seemingly-continuous image sequence, or let's say a pseudo-animation. 😀
Not only prompts! We also support non-prompt conditions, read => [README_ext.md](README_ext.md) ~

⚠ 我们成立了插件反馈 QQ 群: 616795645 (赤狐屿),欢迎出建议、意见、报告bug等 (w
⚠ We have a QQ chat group (616795645) now, any suggestions, discussions and bug reports are highly wellllcome!!
Expand All @@ -29,6 +30,7 @@ Try interpolating on the hidden vectors of conditioning prompt to make seemingly

⚪ Features

- 2023/04/13: `v2.7` add RIFE to controlnet-travel, skip fusion (experimental)
- 2023/03/31: `v2.6` add a tkinter [GUI](#run-each-time) for postprocess toolchain
- 2023/03/30: `v2.5` add controlnet-travel script (experimental), interpolating between hint conditions **instead of prompts**, thx for the code base from [sd-webui-controlnet](https://github.com/Mikubill/sd-webui-controlnet)
- 2023/02/14: `v2.3` integrate basic function of [depth-image-io](https://github.com/AnonymousCervine/depth-image-io-for-SDWebui) for depth2img models
Expand Down
34 changes: 34 additions & 0 deletions README_ext.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# stable-diffusion-webui-non-prompt-travel (extensions)

Of course not only prompts! -- You shall also be able to travel through any other conditions. 😀

----

### ControlNet-Travel

Travel through ControlNet's control conditions like canny, depth, openpose, etc...

⚠ Memory (not VRAM) usage grows linearly with sampling steps, and fusion layers count, this is its nature 😥

Quickstart instructions:

- prepare a folder of images, might be frames from a video
- check enble `sd-webui-controlnet`, set all parameters as you want, but it's ok to **leave the ref image box empty**
- reference images will be read from the image folder given in controlnet-travel :)
- find `ControlNet Travel` in the script dropdown, set all parameters again, specify your image folder path here
- click Generate button

Options:

- interp_meth: (categorical)
- `linear`: linear weighted sum, better for area-based annotaions like `depth`, `seg`
- `rife`: optical flow model (requires to install postprocess tools first), better for edge-base annotaions like `canny`, `openpose`
- skip_latent_fusion: (list of bool), experimental
- skip some latent layers fusion for saving memory, but might get wierd results 🤔
- ℹ the `mid` and `out` blocks are safe to skip in my experiences
- save_rife: (bool), save the rife interpolated condtion images


----
by Armit
2023/04/12
24 changes: 14 additions & 10 deletions manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ def run_ffmpeg(fps:float, fmt:str, in_dp:Path, out_dp:Path) -> bool:


WINDOW_TITLE = f'Prompt Travel Manager v{__version__}'
WINDOW_SIZE = (700, 660)
WINDOW_SIZE = (710, 660)
IMAGE_SIZE = 512
LIST_HEIGHT = 100
COMBOX_WIDTH = 16
COMBOX_WIDTH1 = 5
ENTRY_WIDTH = 8
COMBOX_WIDTH = 18
COMBOX_WIDTH1 = 4
ENTRY_WIDTH = 7
MEMINFO_REFRESH = 16 # refresh status memory info every k-image loads

HELP_INFO = '''
Expand Down Expand Up @@ -172,7 +172,7 @@ def setup_gui(self):
W, H = wnd.winfo_screenwidth(), wnd.winfo_screenheight()
w, h = WINDOW_SIZE
wnd.geometry(f'{w}x{h}+{(W-w)//2}+{(H-h)//2}')
#wnd.resizable(False, False)
wnd.resizable(False, False)
wnd.title(WINDOW_TITLE)
wnd.protocol('WM_DELETE_WINDOW', wnd.quit)
self.wnd = wnd
Expand All @@ -195,6 +195,7 @@ def menu_show(evt):
self.var_root_dp = tk.StringVar(wnd)
tk.Entry(frm1, textvariable=self.var_root_dp).pack(side=tk.LEFT, expand=tk.YES, fill=tk.X)
tk.Button(frm1, text='Open..', command=self.open_).pack(side=tk.RIGHT)
tk.Button(frm1, text='Refresh', command=lambda: self.open_(refresh=True)).pack(side=tk.RIGHT)

# bottom status
# NOTE: do not know why the display order is messy...
Expand Down Expand Up @@ -364,11 +365,11 @@ def mem_clear(self):
self.cnt_pv_load = 0
self.var_status.set(self._mem_info_str())

def open_(self, root_dp:Path=None):
def open_(self, root_dp:Path=None, refresh=False):
''' Open a new travel root folder '''

if root_dp is None:
root_dp = tkfdlg.askdirectory(initialdir=str(OUTPUT_PATH))
if refresh: root_dp = self.var_root_dp.get()
if root_dp is None: root_dp = tkfdlg.askdirectory(initialdir=str(OUTPUT_PATH))
if not root_dp: return
if not Path(root_dp).exists():
tkmsg.showerror('Error', f'invalid path: {root_dp} not exist')
Expand Down Expand Up @@ -397,8 +398,11 @@ def _ls_change(self):

self.cur_name = name
if name not in self.cache:
dp = Path(self.var_root_dp.get()) / name
self.cache[name] = sorted([fp for fp in dp.iterdir() if fp.suffix.lower() in ['.png', '.jpg', '.jpeg'] and fp.stem != 'embryo'])
dp: Path = Path(self.var_root_dp.get()) / name
if dp.exists():
self.cache[name] = sorted([fp for fp in dp.iterdir() if fp.suffix.lower() in ['.png', '.jpg', '.jpeg'] and fp.stem != 'embryo'])
else:
self.ls.delete(idx)

n_imgs = len(self.cache[name])
self.sc.config(to=n_imgs-1)
Expand Down
Loading

0 comments on commit 6261364

Please sign in to comment.