tensorflow / models

Models and examples built with TensorFlow
Other
77k stars 45.79k forks source link

Pre-trained CenterNet with MobileNet v2 FPN produces no detections #10506

Open Bidski opened 2 years ago

Bidski commented 2 years ago

Prerequisites

Please answer the following questions for yourself before submitting an issue.

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

Running https://github.com/tensorflow/models/blob/master/research/object_detection/colab_tutorials/inference_tf2_colab.ipynb (modified to not be a python notebook and to use the referenced model) only generates detections with a score <= 1e-7

3. Steps to reproduce

Follow the steps described in the notebook.

4. Expected behavior

At least 1 detection with a "positive" score

5. Additional context

The output from running the script

WARNING:tensorflow:`input_shape` is undefined or non-square, or `rows` is not in [96, 128, 160, 192, 224]. Weights for input shape (224, 224) will be loaded as the default.
2022-02-17 16:38:37.502211: I tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-02-17 16:38:39.079733: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1525] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 8829 MB memory:  -> device: 0, name: NVIDIA GeForce GTX 1080 Ti, pci bus id: 0000:09:00.0, compute capability: 6.1
2022-02-17 16:38:39.080309: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1525] Created device /job:localhost/replica:0/task:0/device:GPU:1 with 10407 MB memory:  -> device: 1, name: NVIDIA GeForce GTX 1080 Ti, pci bus id: 0000:0a:00.0, compute capability: 6.1
2022-02-17 16:38:39.080797: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1525] Created device /job:localhost/replica:0/task:0/device:GPU:2 with 10405 MB memory:  -> device: 2, name: NVIDIA GeForce GTX 1080 Ti, pci bus id: 0000:43:00.0, compute capability: 6.1
2022-02-17 16:38:47.909083: I tensorflow/stream_executor/cuda/cuda_dnn.cc:368] Loaded cuDNN version 8301                                                                                                                                                                       tf.Tensor(
[[2.6671066e-07 2.3892198e-07 2.3317602e-07 1.7589170e-07 9.5514459e-08
  7.8194894e-08 7.0393163e-08 6.9936938e-08 6.0256994e-08 3.7475342e-08
  3.2252693e-08 2.8360157e-08 1.5607364e-08 1.2781412e-08 8.6965866e-09
  8.4613019e-09 7.2930542e-09 7.0490271e-09 5.1227773e-09 4.5339954e-09]], shape=(1, 20), dtype=float32)

6. System information

Bidski commented 2 years ago

Also, how was the SavedModel generated for this network? I have tried to train my own centernet+mobilenet+fpn network with the provided pipeline.config and when I then convert it to an ONNX model it contains a while loop and two extra network outputs (detection_boxes_strided, detection_multiclass_scores) which this downloaded model doesn't have

Bidski commented 2 years ago

Is there any update on this?

EdenBelouadah commented 2 years ago

Hello I'm facing the same problem. Did you fix it? thanks

Bidski commented 2 years ago

@EdenBelouadah I have not managed to fix this yet

Mypathissional commented 2 years ago

@Bidski I am also facing the same problem. Also, the strange thing is that ONNX graph does not contain the "keep_aspect_ratio" image resizer. The architecture seem to mismatch the config.

Bidski commented 2 years ago

@tombstone @jch1 @pkulzc can you provide any insights into what is going on with this model?

Mypathissional commented 2 years ago

I think the problem is happening when restoring the pretrained model from the checkpoint, it seems to work when restoring from the saved model format. Can anybody give update on this @tombstone @jch1 @pkulzc @kumariko