#95·pulse

Script for one inference

Author: FqloxCreated Nov 28, 2024Updated 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