Commit e25c014e authored by Zhichao Lu's avatar Zhichao Lu Committed by pkulzc
Browse files

use shape utils for assertion in feature extractor.

PiperOrigin-RevId: 192147130
parent a4d9c3a0
......@@ -17,6 +17,7 @@
import tensorflow as tf
from object_detection.meta_architectures import faster_rcnn_meta_arch
from object_detection.utils import shape_utils
from nets import mobilenet_v1
slim = tf.contrib.slim
......@@ -112,12 +113,9 @@ class FasterRCNNMobilenetV1FeatureExtractor(
"""
preprocessed_inputs.get_shape().assert_has_rank(4)
shape_assert = tf.Assert(
tf.logical_and(tf.greater_equal(tf.shape(preprocessed_inputs)[1], 33),
tf.greater_equal(tf.shape(preprocessed_inputs)[2], 33)),
['image size must at least be 33 in both height and width.'])
preprocessed_inputs = shape_utils.check_min_image_dim(
min_dim=33, image_tensor=preprocessed_inputs)
with tf.control_dependencies([shape_assert]):
with slim.arg_scope(
mobilenet_v1.mobilenet_v1_arg_scope(
is_training=self._train_batch_norm,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment