Advertisement
biplovbhandari

Untitled

Apr 1st, 2024
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.91 KB | None | 0 0
  1. # specify directory as data io info
  2. BASEDIR = "/content/"
  3.  
  4. # final DATADIR is BASEDIR / DATADIR if not accessing from gcs
  5. # if accessing from gcs, the given path is the DATADIR
  6. # training, testing and val data dir are then
  7. # DATADIR / "training", DATADIR / "testing", DATADIR / "validation" resp.
  8. DATADIR = "datasets"
  9.  
  10. # OUTPUT_DIR from BASEDIR
  11. # The OUTPUT_DIR is BASEDIR / OUTPUT_DIR
  12. OUTPUT_DIR = "output"
  13. MODEL_NAME = "aces"
  14. MODEL_CHECKPOINT_NAME = "modelCheckpoint"
  15. MODEL_DIR_NAME = "unet_v1"
  16.  
  17. # Auto generate model dir name
  18. # if so it is generated as trial_MODELTYPE + datetime.now() + _v + version
  19. AUTO_MODEL_DIR_NAME = False
  20.  
  21. # specify features and labels
  22. # keep them in this format for reading
  23. FEATURES = "red_before
  24. green_before
  25. blue_before
  26. nir_before
  27. red_during
  28. green_during
  29. blue_during
  30. nir_during"
  31.  
  32. # For model training, USE_ELEVATION extends FEATURES with "elevation" & "slope"
  33. # USE_S1 extends FEATURES with "vv_asc_before", "vh_asc_before", "vv_asc_during", "vh_asc_during",
  34. # "vv_desc_before", "vh_desc_before", "vv_desc_during", "vh_desc_during"
  35. # In case these are not useful and you have other bands in your training data, you can do set
  36. # USE_ELEVATION and USE_S1 to False and update FEATURES to include needed bands
  37. USE_ELEVATION = True
  38. USE_S1 = True
  39.  
  40. DERIVE_FEATURES = False
  41. ADDED_FEATURES = "ndvi_before
  42. ndvi_during
  43. evi_before
  44. evi_during
  45. ndwi_before
  46. ndwi_during
  47. savi_before
  48. savi_during
  49. msavi_before
  50. msavi_during
  51. mtvi2_before
  52. mtvi2_during
  53. vari_before
  54. vari_during
  55. tgi_before
  56. tgi_during"
  57.  
  58. LABELS = ["class"]
  59.  
  60. # Scale of computation
  61. SCALE = 10
  62.  
  63. # use seed for reproducibility
  64. USE_SEED = True
  65. SEED = 42
  66.  
  67. # print info of a single dataset while loading
  68. PRINT_INFO = True
  69.  
  70. # patch size for training
  71. PATCH_SHAPE = (256, 256)
  72. # buffer for prediction purpose
  73. # Half this will extend on the sides of each patch.
  74. # if zero; does not do buffer
  75. # else specify the size as tuple (e.g. 72 x 72)
  76. KERNEL_BUFFER = 0
  77.  
  78. # Sizes of the training and evaluation datasets.
  79. TRAIN_SIZE = 8531
  80. TEST_SIZE = 1222
  81. VAL_SIZE = 2404
  82.  
  83. # Specify model training parameters.
  84. BATCH_SIZE = 64
  85. EPOCHS = 5
  86. RAMPUP_EPOCHS = 25
  87. SUSTAIN_EPOCHS = 20
  88.  
  89. # Rates
  90. USE_ADJUSTED_LR = False
  91. MAX_LR = 1E-3
  92. MID_LR = 3E-4
  93. MIN_LR = 1E-4
  94. DROPOUT_RATE = 0.2
  95.  
  96. # other params w/ notes
  97. CALLBACK_PARAMETER = "val_loss"
  98. EARLY_STOPPING = False
  99. # choices are: cnn, dnn, unet,
  100. MODEL_TYPE = "unet"
  101. # Needs fixing;
  102. # using GCP AI Platform needs a wrapped model; wrapped and original model are obtained but inference not working
  103. USE_AI_PLATFORM = False
  104. # dnn does not do augmentation
  105. TRANSFORM_DATA = True
  106.  
  107. # ACTIVATION_FN autogenerated in the main script
  108. # if n_class = 1: activation_fn = "sigmoid"
  109. # else: activation_fn = "softmax"
  110. ACTIVATION_FN = "softmax"
  111. OPTIMIZER = "adam"
  112. # standard or custom available
  113. # current custom available are: "custom_focal_tversky_loss"
  114. LOSS = "categorical_crossentropy"
  115.  
  116. # "cropland_etc", "rice", "forest", "urban", "others_water_etc"
  117. OUT_CLASS_NUM = 5
  118.  
  119. # Needs fixing
  120. USE_BEST_MODEL_FOR_INFERENCE = False
  121.  
  122. # EE settings
  123. USE_SERVICE_ACCOUNT = False
  124. EE_SERVICE_CREDENTIALS = "your-service-credentials.json"
  125. # where the prediction output will be stored
  126. EE_OUTPUT_ASSET = "projects/aces/prediction"
  127. # output prediction name for both asset, locally (in TF Format) and gcs output (in TFRecord format)
  128. OUTPUT_NAME = "prediction_unet"
  129.  
  130. # GCS settings
  131. GCS_PROJECT = "mygcs-aces"
  132. GCS_BUCKET = "mygcs-aces"
  133. # prediction image directory
  134. GCS_IMAGE_DIR = "prediction_images"
  135. # prediction image prefix
  136. GCS_IMAGE_PREFIX = "image_2021"
  137.  
  138. # Vertex AI Settings
  139. # Vertex AI Model Save Directory
  140. GCS_VERTEX_MODEL_SAVE_DIR = "model_save"
  141. # Region
  142. GCS_REGION = "us-central1"
  143. GCS_VERTEX_CONTAINER_IMAGE = "us-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-11:latest"
  144.  
  145. # Get your machine type here: https://cloud.google.com/vertex-ai/docs/predictions/configure-compute
  146. GCP_MACHINE_TYPE = "c2-standard-60"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement