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

Script for one inference #95

Open
Fqlox opened this issue Nov 28, 2024 · 0 comments
Open

Script for one inference #95

Fqlox opened this issue Nov 28, 2024 · 0 comments

Comments

@Fqlox
Copy link

Fqlox commented Nov 28, 2024

I wanted to generate pulse outputs from a single image

so far I got :

from PULSE import PULSE
from torch.utils.data import Dataset, DataLoader
from torch.nn import DataParallel
from pathlib import Path
from PIL import Image
import torchvision
from math import log10, ceil
import argparse
import dlib
import cv2
toPIL = torchvision.transforms.ToPILImage()



model = PULSE("cache")

im = cv2.imread("test.jpg")
# ...
resized_image = cv2.resize(im, (1024, 1024))

g = model(resized_image,
      seed = 42, loss_str = "100*L2+0.05*GEOCROSS", 
      eps = 2e-3, 
      noise_type = "trainable",
      num_trainable_noise_layers = 5,
      tile_latent = True , 
      bad_noise_layers = "17" , opt_name = "adam", learning_rate=.4, steps =  100, lr_schedule = "linear1cycledrop", save_intermediate = True)

for a, b in enumerate(g):
    print(b)

And got :

assert ref_im.shape[2]==ref_im.shape[3] 
IndexError: tuple index out of range

I tested to reshape the inputs like imgs = np.array([resized_image]) and it still give me the same error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant