MCPcopy Index your code
hub / github.com/thygate/stable-diffusion-webui-depthmap-script / doubleestimate

Function doubleestimate

src/depthmap_generation.py:1028–1049  ·  view source on GitHub ↗
(img, size1, size2, pix2pixsize, model, net_type, pix2pixmodel)

Source from the content-addressed store, hash-verified

1026
1027# Generate a double-input depth estimation
1028def doubleestimate(img, size1, size2, pix2pixsize, model, net_type, pix2pixmodel):
1029 # Generate the low resolution estimation
1030 estimate1 = singleestimate(img, size1, model, net_type)
1031 # Resize to the inference size of merge network.
1032 estimate1 = cv2.resize(estimate1, (pix2pixsize, pix2pixsize), interpolation=cv2.INTER_CUBIC)
1033
1034 # Generate the high resolution estimation
1035 estimate2 = singleestimate(img, size2, model, net_type)
1036 # Resize to the inference size of merge network.
1037 estimate2 = cv2.resize(estimate2, (pix2pixsize, pix2pixsize), interpolation=cv2.INTER_CUBIC)
1038
1039 # Inference on the merge model
1040 pix2pixmodel.set_input(estimate1, estimate2)
1041 pix2pixmodel.test()
1042 visuals = pix2pixmodel.get_current_visuals()
1043 prediction_mapped = visuals['fake_B']
1044 prediction_mapped = (prediction_mapped + 1) / 2
1045 prediction_mapped = (prediction_mapped - torch.min(prediction_mapped)) / (
1046 torch.max(prediction_mapped) - torch.min(prediction_mapped))
1047 prediction_mapped = prediction_mapped.squeeze().cpu().numpy()
1048
1049 return prediction_mapped
1050
1051
1052# Generate a single-input depth estimation

Callers 1

estimateboostFunction · 0.85

Calls 4

singleestimateFunction · 0.85
set_inputMethod · 0.45
testMethod · 0.45
get_current_visualsMethod · 0.45

Tested by

no test coverage detected