python - Bilinear upsample in tensorflow? -


i want simple bilinear resize (not integer factor) in tensorflow. example, starting (32,3,64,64) tensor, (32,3,96,96) tensor, each 64x64 has been rescaled factor of 1.5 using bilinear interpolation. best way that?

i support arbitrary factors > 1, not 1.5 specifically.

note: operation on each 64x64 same skimage.transform.rescale (scale=1.5, order=1) does.

tf.image.resize_images should need. accepts both 3d (single image) , 4d (batch of images) tensors, arbitrary depth (number of channels). should work:

# it's height, width in tf - not width, height new_height = int(round(old_height * scale)) new_width = int(round(old_width * scale)) resized = tf.image.resize_images(input_tensor, [new_height, new_width]) 

bilinear interpolation default don't need specify it. use resize_bilinear directly.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -