Skip to content

Commit a2f6986

Browse files
committed
modified infer_dir.py
1 parent a8ee2bb commit a2f6986

81 files changed

Lines changed: 4 additions & 5 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
32 Bytes
Binary file not shown.
32 Bytes
Binary file not shown.
32 Bytes
Binary file not shown.
32 Bytes
Binary file not shown.

infer_dir.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import torch
1414
import yaml
1515
from PIL import Image
16-
from Texture_eval_mk import *
1716
from tqdm import tqdm
1817

1918
import configs.sr3 as SR3
@@ -24,7 +23,6 @@
2423
from llava.constants import DEFAULT_IMAGE_TOKEN, IMAGE_TOKEN_INDEX
2524
from llava.conversation import conv_templates
2625
from llava.mm_utils import process_images
27-
from models.dataloader import *
2826
from models.util import *
2927

3028

@@ -117,7 +115,7 @@ def _load_all_models(self):
117115
self.llava_model.to(self.cfg.base_device)
118116

119117
# 3. Refinement Model
120-
self.refinement_model = create_SR_model(self.cfg.model_yaml, 'Q')
118+
self.refinement_model = create_SR_model(self.cfg.model_yaml)
121119
self.refinement_model.to(self.cfg.sr_device)
122120

123121
# 4. Prompt Template
@@ -135,7 +133,9 @@ def _process_single_image(self, image_path: Path):
135133
self.sr3_diffusion.feed_data(next(iter(loader)))
136134
self.sr3_diffusion.test(continous=True)
137135

138-
sr_tensor = self.sr3_diffusion.SR.squeeze()
136+
sr_tensor = self.sr3_diffusion.SR
137+
if sr_tensor.dim() == 4:
138+
sr_tensor = sr_tensor[-1]
139139
sr_img_np = T2I.tensor2img(sr_tensor, min_max=(-1, 1))
140140
sr_pil = Image.fromarray(sr_img_np)
141141

32 Bytes
Binary file not shown.
32 Bytes
Binary file not shown.
32 Bytes
Binary file not shown.
32 Bytes
Binary file not shown.
32 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)