Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize import speed load time #29

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions modules/ImageSegmentation.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import torch
from PIL import Image
from rembg import remove, new_session

import time
import folder_paths

from ..session.CustomSession import CustomAbstractSession
from ..session.CustomSession import CustomSessionContainer
from ..session.ModnetPhotographicSession import ModnetPhotographicSession
from ..session.ModnetWebcamSession import ModnetWebcamSession


class ImageSegmentation:
def __init__(self):
pass
Expand Down Expand Up @@ -64,6 +57,9 @@ def node(
post_process_mask,
session=None
):
from rembg import remove, new_session
from ..session.ModnetPhotographicSession import ModnetPhotographicSession
from ..session.ModnetWebcamSession import ModnetWebcamSession
if session is None:
if model == "isnetis":
session = new_session("isnet-anime")
Expand Down Expand Up @@ -150,8 +146,10 @@ def node(
std,
size
):
from ..session.CustomSession import CustomSessionContainer
container = CustomSessionContainer(mean, mean, mean, std, std, std, size, size)

from ..session.CustomSession import CustomAbstractSession
class CustomSession(CustomAbstractSession):
def __init__(self):
super().__init__(model)
Expand Down