models
models copied to clipboard
Cannot do inference from the saved model for the model centernet_mobilenetv2fpn_512x512_coco17_od
Prerequisites
Please answer the following questions for yourself before submitting an issue.
- [x] I am using the latest TensorFlow Model Garden release and TensorFlow 2.
- [x] I am reporting the issue to the correct repository. (Model Garden official or research directory)
- [x] I checked to make sure that this issue has not already been filed.
1. The entire URL of the file you are using
http://download.tensorflow.org/models/object_detection/tf2/20210210/centernet_mobilenetv2fpn_512x512_coco17_od.tar.gz
2. Describe the bug
detec_fn fails on an inference for the input tensor
3. Steps to reproduce
# Download the saved model and put it into models/research/object_detection/test_data/
!wget http://download.tensorflow.org/models/object_detection/tf2/20210210/centernet_mobilenetv2fpn_512x512_coco17_od.tar.gz
!tar -xf centernet_mobilenetv2fpn_512x512_coco17_od.tar.gz
!mv centernet_mobilenetv2_fpn_od/ models/research/object_detection/test_data/
start_time = time.time()
tf.keras.backend.clear_session()
detect_fn = tf.saved_model.load('models/research/object_detection/test_data/centernet_mobilenetv2_fpn_od//saved_model/')
end_time = time.time()
elapsed_time = end_time - start_time
print('Elapsed time: ' + str(elapsed_time) + 's')
import time
image_dir = 'models/research/object_detection/test_images'
elapsed = []
for i in range(2):
image_path = os.path.join(image_dir, 'image' + str(i + 1) + '.jpg')
image_np = load_image_into_numpy_array(image_path)
input_tensor = np.expand_dims(image_np, 0)
start_time = time.time()
detections = detect_fn(input_tensor)
end_time = time.time()
elapsed.append(end_time - start_time)
4. Expected behavior
I expected to be able to detect boxes directly from a saved model
5. Additional context
I ran the model both locally. and also using the colab tutorial https://colab.research.google.com/github/tensorflow/models/blob/master/research/object_detection/colab_tutorials/inference_from_saved_model_tf2_colab.ipynb#scrollTo=vukkhd5-9NSL with the mobilenet model and error remains the same
6. System information
I ran from the colab tutorial Tensorflow version v2.9.0-18-gd8ce9f9c301 2.9.1 https://colab.research.google.com/github/tensorflow/models/blob/master/research/object_detection/colab_tutorials/inference_from_saved_model_tf2_colab.ipynb#scrollTo=vukkhd5-9NSL
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
- Mobile device name if the issue happens on a mobile device:
- TensorFlow installed from (source or binary):
- TensorFlow version (use command below):
- Python version:
- Bazel version (if compiling from source):
- GCC/Compiler version (if compiling from source):
- CUDA/cuDNN version:
- GPU model and memory:
You are expecting these results ? I ran the colab file you linked above @Mypathissional