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

config.py 2.1 kB

5 years ago
5 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # Copyright 2020 Huawei Technologies Co., Ltd
  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. """
  16. network config setting, will be used in main.py
  17. """
  18. from easydict import EasyDict as edict
  19. cifar_cfg = edict({
  20. 'name': 'cifar10',
  21. 'pre_trained': False,
  22. 'num_classes': 10,
  23. 'lr_init': 0.1,
  24. 'batch_size': 128,
  25. 'epoch_size': 125,
  26. 'momentum': 0.9,
  27. 'weight_decay': 5e-4,
  28. 'image_height': 224,
  29. 'image_width': 224,
  30. 'data_path': './cifar10',
  31. 'device_target': 'Ascend',
  32. 'device_id': 0,
  33. 'keep_checkpoint_max': 10,
  34. 'checkpoint_path': './train_googlenet_cifar10-125_390.ckpt',
  35. 'onnx_filename': 'googlenet',
  36. 'air_filename': 'googlenet'
  37. })
  38. imagenet_cfg = edict({
  39. 'name': 'imagenet',
  40. 'pre_trained': False,
  41. 'num_classes': 1000,
  42. 'lr_init': 0.1,
  43. 'batch_size': 256,
  44. 'epoch_size': 300,
  45. 'momentum': 0.9,
  46. 'weight_decay': 1e-4,
  47. 'image_height': 224,
  48. 'image_width': 224,
  49. 'data_path': './ImageNet_Original/train/',
  50. 'val_data_path': './ImageNet_Original/val/',
  51. 'device_target': 'Ascend',
  52. 'device_id': 0,
  53. 'keep_checkpoint_max': 10,
  54. 'checkpoint_path': None,
  55. 'onnx_filename': 'googlenet',
  56. 'air_filename': 'googlenet',
  57. # optimizer and lr related
  58. 'lr_scheduler': 'exponential',
  59. 'lr_epochs': [70, 140, 210, 280],
  60. 'lr_gamma': 0.3,
  61. 'eta_min': 0.0,
  62. 'T_max': 150,
  63. 'warmup_epochs': 0,
  64. # loss related
  65. 'is_dynamic_loss_scale': 0,
  66. 'loss_scale': 1024,
  67. 'label_smooth_factor': 0.1,
  68. 'use_label_smooth': True,
  69. })