MCPcopy Create free account
hub / github.com/thygate/stable-diffusion-webui-depthmap-script / get_params

Function get_params

pix2pix/data/base_dataset.py:63–78  ·  view source on GitHub ↗
(opt, size)

Source from the content-addressed store, hash-verified

61
62
63def get_params(opt, size):
64 w, h = size
65 new_h = h
66 new_w = w
67 if opt.preprocess == 'resize_and_crop':
68 new_h = new_w = opt.load_size
69 elif opt.preprocess == 'scale_width_and_crop':
70 new_w = opt.load_size
71 new_h = opt.load_size * h // w
72
73 x = random.randint(0, np.maximum(0, new_w - opt.crop_size))
74 y = random.randint(0, np.maximum(0, new_h - opt.crop_size))
75
76 flip = random.random() > 0.5
77
78 return {'crop_pos': (x, y), 'flip': flip}
79
80
81def get_transform(opt, params=None, grayscale=False, method=Image.BICUBIC, convert=True):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected