@@ -72,7 +72,7 @@ def TransformLandmarks(operator, custom_options, tensors, interpreter, landmarks
72
72
return landmarks2d_transformed
73
73
74
74
#Affine transform images using bilinear interpolation
75
- def TransformTensorBilinear (operator , custom_options , tensors , interpreter , optimizing_barracuda , features = None , mat = None ):
75
+ def TransformTensorBilinear (operator , custom_options , tensors , interpreter , optimizing_barracuda , optimaization_for_myriad , features = None , mat = None ):
76
76
if features is None :
77
77
features = tensors [operator ['inputs' ][0 ]] #float32 [b,48,48,32] feature maps
78
78
if mat is None :
@@ -110,8 +110,8 @@ def TransformTensorBilinear(operator, custom_options, tensors, interpreter, opti
110
110
weight_floor = tf .subtract (tf .ones (2 ), weight_ceil_ ) #[b,h,w,2]
111
111
weight_ceilX = tf .multiply (weight_ceil_ [:,:,:,0 :1 ], weight_floor [:,:,:,1 :2 ]) #[b,h,w]
112
112
weight_ceilY = tf .multiply (weight_floor [:,:,:,0 :1 ], weight_ceil_ [:,:,:,1 :2 ]) #[b,h,w]
113
- weight_ceil_ = tf .reduce_prod (weight_ceil_ , axis = 3 , keepdims = True ) #[b,h,w,1 ]
114
- weight_floor = tf .reduce_prod (weight_floor , axis = 3 , keepdims = True ) #[b,h,w,1 ]
113
+ weight_ceil_ = tf .multiply (weight_ceil_ [:,:,:, 0 : 1 ], weight_ceil_ [:,:,:, 1 : 2 ] ) #[b,h,w]
114
+ weight_floor = tf .multiply (weight_floor [:,:,:, 0 : 1 ], weight_floor [:,:,:, 1 : 2 ] ) #[b,h,w]
115
115
116
116
# Find nearest 4 points.
117
117
# Make sure they are in the input image
@@ -157,7 +157,7 @@ def barracuda_gather_nd(params, indices):
157
157
return tf .expand_dims (tf .reshape (result_flat , tf .concat ([idx_shape [:- 1 ], gather_shape ], axis = 0 )), axis = 0 )
158
158
159
159
# calc final pixel value
160
- if not optimizing_barracuda :
160
+ if not optimizing_barracuda and not optimaization_for_myriad :
161
161
value_floor = tf .gather_nd (params = features , indices = in_coord_floor , batch_dims = 1 ) #[b,h,w,32]
162
162
value_ceilX = tf .gather_nd (params = features , indices = in_coord_ceilX , batch_dims = 1 ) #[b,h,w,32]
163
163
value_ceilY = tf .gather_nd (params = features , indices = in_coord_ceilY , batch_dims = 1 ) #[b,h,w,32]
0 commit comments