You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.6 KiB

6 years ago
  1. # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # ==============================================================================
  15. """Hyperparameters for the object detection model in TF.learn.
  16. This file consolidates and documents the hyperparameters used by the model.
  17. """
  18. from __future__ import absolute_import
  19. from __future__ import division
  20. from __future__ import print_function
  21. import tensorflow as tf
  22. def create_hparams(hparams_overrides=None):
  23. """Returns hyperparameters, including any flag value overrides.
  24. Args:
  25. hparams_overrides: Optional hparams overrides, represented as a
  26. string containing comma-separated hparam_name=value pairs.
  27. Returns:
  28. The hyperparameters as a tf.HParams object.
  29. """
  30. hparams = tf.contrib.training.HParams(
  31. # Whether a fine tuning checkpoint (provided in the pipeline config)
  32. # should be loaded for training.
  33. load_pretrained=True)
  34. # Override any of the preceding hyperparameter values.
  35. if hparams_overrides:
  36. hparams = hparams.parse(hparams_overrides)
  37. return hparams