New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type Error when exporting TF2 OD API to SavedModel using efficientdet_d0 #8841
Comments
Could you please elaborate... I am trying to save a model from the demo ipynb and i am not sure where the above command goes in the said tf_utils.py file. |
anmol101093AIML is saying to edit this "if statement" line 128 https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/keras/utils/tf_utils.py#L128 in order to skip the TypeError Exception when I've not tested this quick fix, however I not sure editing the tensorflow/python/keras/utils package is a long term solution to this problem. |
Following this thread since I think there needs to be documentation about exporting the models (trained with TF 2 TFOD API) to SavedModel. Thanks for raising this. Update: I was able to use the exporter script to generated SavedModel. Here's the Colab Notebook. |
Agreed, documentation for saving the OD model part is sketchy... I couldn't find the exporter script you mentioned.. |
Could you please check now? I just pushed the updated one. @ronykroy |
Great.. will run that.. |
@sayakpaul - thanks for the notebook! How does your I am also receiving the same error tying to save weights for EfficientDet-d0 |
I did not change anything in that. |
1 similar comment
I did not change anything in that. |
This is an issue with EfficientDet-d0 returning a string as input. sayakpaul example shows that it seems fine when using ssd_mobilenet_v2_320x320_coco17_tpu-8. I'll try other models today and send a feedback asap .. Anyone familiar with the EfficientDet-d0 implementation could look into this please ? |
Yes, this might be a model-specific issue. I should have mentioned I did not actually use EfficientDet. Sorry about that. |
@m-brgs @sayakpaul - ah I see, thanks. We will have to stay tuned for efficientDet exports. I will write here if I find anything on my end. For those more familiar with this implementation: I think the error may be stemming from this line and the error message |
@Jacobsolawetz @m-brgs when you have a moment, could you take a look at #8854 and comment if I am missing something there? |
@m-brgs certainly not a long term solution, but the keras utils fix works 🎉 Adding check if x is a string in https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/keras/utils/tf_utils.py#L128
So now
yields an EfficientDet .pb file. Now I'm working on an inference script using that. |
Howdy, I get a similar error when trying to export SSD MobileNet V2 FPNLite 640x640 using
Using TF2 and model from TF2 Model Zoo |
@Jacobsolawetz @m-brgs what was the precise change you made to line 128? Was it:
Thanks :) |
@mackdelany it was on line 140 right before |
Ah, groovy. Thanks @Jacobsolawetz ! |
Hi @Jacobsolawetz Did inference script run successful? |
I did try running inference (not with EfficientDet models, though) with custom trained checkpoints and I was successful. Leaving a link to the notebook here if that's useful. |
That's cool, thanks @sayakpaul |
@ngoanpv I did not have success with the .pb inference due to how eager execution has changed how to infer frozen graphs. I did have luck from the checkpoint, however. I published a blog and Colab Notebook here training EfficientDet in TensorFlow2 |
@Jacobsolawetz this link is not found, I found this post from your profile: https://towardsdatascience.com/how-to-train-a-tensorflow-2-object-detection-model-25d4da64b817 That's great, thanks. |
@ngoanpv thank you! updated the link |
with @Jacobsolawetz solution I was able to export a efficientdet-d0 model |
Prerequisites
Please answer the following questions for yourself before submitting an issue.
1. The entire URL of the file you are using
https://github.com/tensorflow/models/blob/master/research/object_detection/exporter_main_v2.py
2. Describe the bug
I'm trying to export a TF2 OD API efficientdet_d0 that I just trained (using pretrained weights from model zoo 2 and 2GPUs in the tf2 docker image from OD API repo) with exporter_main_v2.py in order to serve this model with Tensorflow Serving.
When exporting, I'm getting a type error.
3. Steps to reproduce
Take the result of training a ssd_efficientdet_d0_512x512 model.
Inside TF2 container, (https://github.com/tensorflow/models/blob/master/research/object_detection/dockerfiles/tf2/Dockerfile), run :
4. Expected behavior
The model is exported in /home/tensorflow/outputs/efficientdet_d0_10k_16b_512_2gpu/export/ as described in https://github.com/tensorflow/models/blob/master/research/object_detection/exporter_main_v2.py
5. Additional context
Logs :
6. System information
v2.2.0-rc4-8-g2b96f3662b 2.2.0
The text was updated successfully, but these errors were encountered: