diff --git a/mmdnn/conversion/tensorflow/tensorflow_emitter.py b/mmdnn/conversion/tensorflow/tensorflow_emitter.py index 891f62a..fca8a31 100644 --- a/mmdnn/conversion/tensorflow/tensorflow_emitter.py +++ b/mmdnn/conversion/tensorflow/tensorflow_emitter.py @@ -403,6 +403,21 @@ def KitModel(weight_file = None): padding, IR_node.name)) + def emit_Crop(self, IR_node): + border = IR_node.get_attr('border') + assert len(border) == 4 + + output_shape = IR_node.get_attr('_output_shapes')[0] + output_shape = shape_to_list(output_shape) + + self.add_body(1, "{:<15} = tf.image.crop_to_bounding_box({}, offset_height={}, offset_width={}, target_height={}, target_width={})".format( + IR_node.variable_name, + self.parent_variable_name(IR_node), + border[0], + border[2], + output_shape[1], + output_shape[2])) + def _layer_Conv(self): self.add_body(0, """ diff --git a/tests/test_conversion_imagenet.py b/tests/test_conversion_imagenet.py index 9189c1b..01bd5c8 100644 --- a/tests/test_conversion_imagenet.py +++ b/tests/test_conversion_imagenet.py @@ -200,7 +200,7 @@ class TestModels(CorrectnessTest): 'densenet' : [CntkEmit, TensorflowEmit, KerasEmit], 'xception' : [TensorflowEmit, KerasEmit], 'mobilenet' : [TensorflowEmit, KerasEmit], - 'nasnet' : [KerasEmit], + 'nasnet' : [TensorflowEmit, KerasEmit], } }