MCPcopy Index your code
hub / github.com/NVIDIA/FastPhotoStyle / transform

Method transform

photo_wct.py:25–54  ·  view source on GitHub ↗
(self, cont_img, styl_img, cont_seg, styl_seg)

Source from the content-addressed store, hash-verified

23 self.d4 = VGGDecoder(4)
24
25 def transform(self, cont_img, styl_img, cont_seg, styl_seg):
26 self.__compute_label_info(cont_seg, styl_seg)
27
28 sF4, sF3, sF2, sF1 = self.e4.forward_multiple(styl_img)
29
30 cF4, cpool_idx, cpool1, cpool_idx2, cpool2, cpool_idx3, cpool3 = self.e4(cont_img)
31 sF4 = sF4.data.squeeze(0)
32 cF4 = cF4.data.squeeze(0)
33 # print(cont_seg)
34 csF4 = self.__feature_wct(cF4, sF4, cont_seg, styl_seg)
35 Im4 = self.d4(csF4, cpool_idx, cpool1, cpool_idx2, cpool2, cpool_idx3, cpool3)
36
37 cF3, cpool_idx, cpool1, cpool_idx2, cpool2 = self.e3(Im4)
38 sF3 = sF3.data.squeeze(0)
39 cF3 = cF3.data.squeeze(0)
40 csF3 = self.__feature_wct(cF3, sF3, cont_seg, styl_seg)
41 Im3 = self.d3(csF3, cpool_idx, cpool1, cpool_idx2, cpool2)
42
43 cF2, cpool_idx, cpool = self.e2(Im3)
44 sF2 = sF2.data.squeeze(0)
45 cF2 = cF2.data.squeeze(0)
46 csF2 = self.__feature_wct(cF2, sF2, cont_seg, styl_seg)
47 Im2 = self.d2(csF2, cpool_idx, cpool)
48
49 cF1 = self.e1(Im2)
50 sF1 = sF1.data.squeeze(0)
51 cF1 = cF1.data.squeeze(0)
52 csF1 = self.__feature_wct(cF1, sF1, cont_seg, styl_seg)
53 Im1 = self.d1(csF1)
54 return Im1
55
56 def __compute_label_info(self, cont_seg, styl_seg):
57 if cont_seg.size == False or styl_seg.size == False:

Callers 2

stylizationFunction · 0.80
stylizationFunction · 0.80

Calls 3

__compute_label_infoMethod · 0.95
__feature_wctMethod · 0.95
forward_multipleMethod · 0.80

Tested by

no test coverage detected