File tree 2 files changed +10
-1
lines changed
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,13 @@ def image_loader(img_path):
32
32
return img_tensor
33
33
34
34
35
+ def get_feature (vgg19 , img_tensor , feature_id ):
36
+ feature_tensor = vgg19 .features [:feature_id ](img_tensor )
37
+ feature = feature_tensor .data .squeeze ().cpu ().numpy ().transpose (LEFT_SHIFT )
38
+
39
+ return feature
40
+
41
+
35
42
def main (config ):
36
43
device = torch .device (('cuda:' + str (config .gpu )) if config .cuda else 'cpu' )
37
44
@@ -44,6 +51,9 @@ def main(config):
44
51
vgg19 = torchvision .models .vgg19 (pretrained = True )
45
52
vgg19 .to (device )
46
53
54
+ feat5S = get_feature (vgg19 , imgS , FEATURE_IDS [4 ])
55
+ feat5R = get_feature (vgg19 , imgR , FEATURE_IDS [4 ])
56
+
47
57
# FastGuidedFilter
48
58
# labOrigS = torch.from_numpy(color.rgb2lab(np.array(origS)).transpose(RIGHT_SHIFT)).float()
49
59
rgbOrigS = transforms .ToTensor ()(origS )
Original file line number Diff line number Diff line change 1
1
import numpy as np
2
- import torch
3
2
4
3
5
4
class PatchMatch :
You can’t perform that action at this time.
0 commit comments