summaryrefslogtreecommitdiff
path: root/models/model.py
diff options
context:
space:
mode:
authorJordan Gong <jordan.gong@protonmail.com>2021-02-18 18:37:02 +0800
committerJordan Gong <jordan.gong@protonmail.com>2021-02-18 18:37:02 +0800
commit434f0e706649c68125c782060926ba39307c6cf1 (patch)
treee5a5f8555567ad20b8c0096eb615ba10306d6120 /models/model.py
parent3cc4c018c214c4a0e0fbaaa2996390e66fd8ff2b (diff)
parentf075fde91e6e5e7ac5d0f146df9cfde2b22fa150 (diff)
Merge branch 'python3.8' into python3.7
Diffstat (limited to 'models/model.py')
-rw-r--r--models/model.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/models/model.py b/models/model.py
index 27c648c..a3b6d3a 100644
--- a/models/model.py
+++ b/models/model.py
@@ -52,6 +52,7 @@ class Model:
self.is_train: bool = True
self.in_channels: int = 3
+ self.in_size: Tuple[int, int] = (64, 48)
self.pr: Optional[int] = None
self.k: Optional[int] = None
@@ -144,7 +145,7 @@ class Model:
hpm_optim_hp = optim_hp.pop('hpm', {})
fc_optim_hp = optim_hp.pop('fc', {})
sched_hp = self.hp.get('scheduler', {})
- self.rgb_pn = RGBPartNet(self.in_channels, **model_hp,
+ self.rgb_pn = RGBPartNet(self.in_channels, self.in_size, **model_hp,
image_log_on=self.image_log_on)
# Try to accelerate computation using CUDA or others
self.rgb_pn = self.rgb_pn.to(self.device)
@@ -220,16 +221,16 @@ class Model:
if self.image_log_on:
i_a, i_c, i_p = images
self.writer.add_images(
+ 'Appearance image', i_a, self.curr_iter
+ )
+ self.writer.add_images(
'Canonical image', i_c, self.curr_iter
)
- for (i, (o, a, p)) in enumerate(zip(x_c1, i_a, i_p)):
+ for i, (o, p) in enumerate(zip(x_c1, i_p)):
self.writer.add_images(
f'Original image/batch {i}', o, self.curr_iter
)
self.writer.add_images(
- f'Appearance image/batch {i}', a, self.curr_iter
- )
- self.writer.add_images(
f'Pose image/batch {i}', p, self.curr_iter
)
time_used = datetime.now() - start_time
@@ -296,7 +297,7 @@ class Model:
# Init models
model_hp = self.hp.get('model', {})
- self.rgb_pn = RGBPartNet(ae_in_channels=self.in_channels, **model_hp)
+ self.rgb_pn = RGBPartNet(self.in_channels, self.in_size, **model_hp)
# Try to accelerate computation using CUDA or others
self.rgb_pn = self.rgb_pn.to(self.device)
self.rgb_pn.eval()
@@ -456,6 +457,7 @@ class Model:
dataset_config: Dict
) -> Union[CASIAB]:
self.in_channels = dataset_config.get('num_input_channels', 3)
+ self.in_size = dataset_config.get('frame_size', (64, 48))
self._dataset_sig = self._make_signature(
dataset_config,
popped_keys=['root_dir', 'cache_on']