This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
www.netflix.com##.episodeSynopsis | |
www.netflix.com##.nfa-w-60.nfa-m-0.nfa-c-gray-80.nfa-fs-1-6-em | |
www.netflix.com##.synopsis | |
www.netflix.com##.WatchNext-episode-synopsis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add_axis_angle_rotations(rv1, rv2): | |
""" Given angle*axis rotation vectors a*l and b*m, result angle*axis: c*n | |
cos(c/2) = cos(a/2)cos(b/2) - sin(a/2)sin(b/2) (l . m) | |
sin(c/2) (n) = | |
sin(a/2)cos(b/2) (l) + cos(a/2)sin(b/2) (m) + sin(a/2)sin(b/2) (l x m) | |
Args: | |
rv1, rv2: Axis-angle rotation Tensors with shape [batch_size, 3] | |
Returns: | |
Axis-angle rotation in [batch_size, 3] Tensor which when applied is | |
equivalent to application of rv2 then rv1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gaussian_blur(img, kernel_size=11, sigma=5): | |
def gauss_kernel(channels, kernel_size, sigma): | |
ax = tf.range(-kernel_size // 2 + 1.0, kernel_size // 2 + 1.0) | |
xx, yy = tf.meshgrid(ax, ax) | |
kernel = tf.exp(-(xx ** 2 + yy ** 2) / (2.0 * sigma ** 2)) | |
kernel = kernel / tf.reduce_sum(kernel) | |
kernel = tf.tile(kernel[..., tf.newaxis], [1, 1, channels]) | |
return kernel | |
gaussian_kernel = gauss_kernel(tf.shape(img)[-1], kernel_size, sigma) |