@@ -133,7 +133,6 @@ def compression_forward(self, x):
133133 if self .model_mode == ModelModes .EVALUATION and (self .training is False ):
134134 n_encoder_downsamples = self .Encoder .n_downsampling_layers
135135 factor = 2 ** n_encoder_downsamples
136- self .logger .info ('Padding input image by {}' .format (factor ))
137136 x = utils .pad_factor (x , x .size ()[2 :], factor )
138137
139138 # Encoder forward pass
@@ -142,7 +141,6 @@ def compression_forward(self, x):
142141 if self .model_mode == ModelModes .EVALUATION and (self .training is False ):
143142 n_hyperencoder_downsamples = self .Hyperprior .analysis_net .n_downsampling_layers
144143 factor = 2 ** n_hyperencoder_downsamples
145- self .logger .info ('Padding latents by {}' .format (factor ))
146144 y = utils .pad_factor (y , y .size ()[2 :], factor )
147145
148146 hyperinfo = self .Hyperprior (y , spatial_shape = x .size ()[2 :])
@@ -281,7 +279,6 @@ def compress(self, x):
281279 if self .model_mode == ModelModes .EVALUATION and (self .training is False ):
282280 n_encoder_downsamples = self .Encoder .n_downsampling_layers
283281 factor = 2 ** n_encoder_downsamples
284- self .logger .info ('Padding input image to {}' .format (factor ))
285282 x = utils .pad_factor (x , x .size ()[2 :], factor )
286283
287284 # Encoder forward pass
@@ -290,21 +287,23 @@ def compress(self, x):
290287 if self .model_mode == ModelModes .EVALUATION and (self .training is False ):
291288 n_hyperencoder_downsamples = self .Hyperprior .analysis_net .n_downsampling_layers
292289 factor = 2 ** n_hyperencoder_downsamples
293- self .logger .info ('Padding latents to {}' .format (factor ))
294290 y = utils .pad_factor (y , y .size ()[2 :], factor )
295291
296292 compression_output = self .Hyperprior .compress_forward (y , spatial_shape )
297293 attained_hbpp = 32 * len (compression_output .hyperlatents_encoded ) / np .prod (spatial_shape )
298294 attained_lbpp = 32 * len (compression_output .latents_encoded ) / np .prod (spatial_shape )
299295 attained_bpp = 32 * ((len (compression_output .hyperlatents_encoded ) +
300296 len (compression_output .latents_encoded )) / np .prod (spatial_shape ))
301- print ('BPP' , compression_output .total_bpp )
302- print ('h BPP' , compression_output .hyperlatent_bpp )
303- print ('l BPP' , compression_output .latent_bpp )
304297
305- print ('Actual BPP' , attained_bpp )
306- print ('h BPP' , attained_hbpp )
307- print ('l BPP' , attained_lbpp )
298+ self .logger .info ('[ESTIMATED]' )
299+ self .logger .info (f'BPP: { compression_output .total_bpp :.3f} ' )
300+ self .logger .info (f'HL BPP: { compression_output .hyperlatent_bpp :.3f} ' )
301+ self .logger .info (f'L BPP: { compression_output .latent_bpp :.3f} ' )
302+
303+ self .logger .info ('[ATTAINED]' )
304+ self .logger .info (f'BPP: { attained_bpp :.3f} ' )
305+ self .logger .info (f'HL BPP: { attained_hbpp :.3f} ' )
306+ self .logger .info (f'L BPP: { attained_lbpp :.3f} ' )
308307 return compression_output
309308
310309
0 commit comments