EfficientDet python sample script: create_onnx.py fail for EfficientDetD4 checkpoint
@zerollzeng is already working on this.
Since Jul 8, 2022.
- Dominant language
- C++
- Stars
- 13.4k
- Forks
- 2.4k
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 2
Description
Description
/TensorRT/samples/python/efficientdet/python/create_onnx.py sample script fails in update_shapes() function for checkpoint created via finetuning an efficientdet-d4 pretrained model (no error when repeating process based on efficientdet-d7 model).
Traceback (most recent call last):
File "create_onnx.py", line 453, in <module>
main(args)
File "create_onnx.py", line 424, in main
effdet_gs.update_shapes()
File "create_onnx.py", line 228, in update_shapes
scale_h = concat.inputs[1].values[0] / node.inputs[0].shape[2]
TypeError: ufunc 'divide' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
I found that the node.inputs[0].shape[2] is of size None
the following (hacky) code change enabled me to get past this problem and i successfully created an engine from the onnx file created. However, i do not know if my code change resulted in the 'optimal' graph.

Environment
**Container **: nvcr.io/nvidia/tensorflow:22.06-tf2-py3
all of the following libraries exist by default the container specified
TensorRT Version: libnvinfer-bin 8.2.5-1+cuda11.4
NVIDIA GPU: 3080ti
NVIDIA Driver Version: 510.73.05
CUDA Version: Build cuda_11.7.r11.7/compiler.31442593_0
CUDNN Version: libcudnn8 8.4.1.50-1+cuda11.6
Operating System: ubuntu 18.04
Python Version (if applicable): 3.8.10
Tensorflow Version (if applicable): 2.8
PyTorch Version (if applicable): N/A
Steps To Reproduce
option A:
- git clone https://github.com/ece85/Deploy_EfficientDet.git
- run setup_and_repro.sh (this will build a docker image and run a script to reproduce the problem).
option B:
if you are confident that you current dev environment is similar enough to mine then just download the folder linked by :
https://drive.google.com/drive/folders/1yWTzCxeDUiM93Se4tOL29c7VBnuCUuHN?usp=sharing
and point that to the following python script call:
cd /TensorRT/samples/python/efficientdet
python3 create_onnx.py \
--input_size 1024,1024 \
--saved_model $saved_model \
--onnx model.onnx
where $saved_model points to folder downloaded from link.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.