-
Notifications
You must be signed in to change notification settings - Fork 45.8k
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
fp16 support in the Object Detection API [Feature request] #3706
Comments
Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks. |
@tensorflowbutler this is a feature request |
How is the progress of this problem? I know that the official 2.0 code has FP16, but what about the old code? Who knows how to write? I tried but failed... @austinmw @eilifsolberg @tensorflowbutler |
I guess there have come two solutions for this (for tensorflow >= 1.14):
os.environ['TF_ENABLE_AUTO_MIXED_PRECISION'] = '1'
optimizer = tf.train.experimental.enable_mixed_precision_graph_rewrite(optimizer) See https://developer.nvidia.com/automatic-mixed-precision for more. |
I have modified this document yesterday and also configured the environment variable os.environ['TF_ENABLE_AUTO_MIXED_PRECISION'] = '1' as required. /research/object_detection/builders/optimizer_builder.py But I found that it didn't work, I don't know what happened. The pre-training is ssd_resnet101_v1_fpn_shared_box_predictor_oid_512x512_sync.config I was thinking that it might be caused by 2 problems: |
I am training with gpu. I am currently upgrading to tensorflow-gpu to 1.14, but tensorflow is still 1.13. Is this related? |
Do you use nvidia ngc containers >= 19.03? The environment variable only works in this case, and needs to be set before model_builder.py is called. This could be done by setting the environment variable in the shell before the script is run. Otherwise you need tensorflow 1.14 or higher and edit model_builder.py |
You should not both set the environment variable and wrap the optimizer, only one of them. |
What do you mean by saying that the environment variable ['TF_ENABLE_AUTO_MIXED_PRECISION'] = '1' and tf.train.experimental.enable_mixed_precision_graph_rewrite only need to use one at the same time? I have been troubled by this problem for a long time, I really hope to solve it, thank you very much. |
I ran the demo code of FP16, it is working |
Research/object_detection/builders/optimizer_builder.py:57 |
Another point is that my current training program will report this warning, which is the warning I have after I upgraded from tensorflow-gpu1.13 to 1.14. |
I guess you should do it in line 76 of https://github.com/tensorflow/models/blob/master/research/object_detection/builders/optimizer_builder.py as it will then be done independent of which optimizer you use. If you do this, don't change or set the environment variable. Not sure about the last question, seems like this is something that you might want to report as an issue on the tensorflow github page (not tensorflow/models, but tensorflow/tensorflow). |
I have added the relevant code to line 76, and other requirements are also made according to your guidelines. |
Sorry, not sure what the problem might be. I think you should ask a question on StackOverflow. |
Ok, I haven't researched it for the time being. I am using tensorRT for speeding up for the time being. |
I would like to ask how you use the mixing precision to speed up your project. thank |
bump.. no updates? |
In Object detection TF2, the feature can be enabled with keras mix precision api: https://www.tensorflow.org/guide/mixed_precision |
Featuere request: fp16/mixed precision support for training
System information
The text was updated successfully, but these errors were encountered: