Skip to content

Commit a23f0bf

Browse files
Update notebook formatting test
1 parent 22ec27e commit a23f0bf

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

idl/test/client-e2e/notebooks/notebook-to-pro-code/dl_training_example_output_all.pro

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ compile_opt idl2
88
;+ start ENVI with the UI
99
e = envi()
1010

11+
1112
; Get folders for input and output
1213

1314
;+ get this directory
@@ -24,8 +25,10 @@ timestamp = (strsplit(timestamp, '.', /extract))[0]
2425
modelDir = strjoin([thisDir, 'models-air', timestamp], path_sep())
2526
if ~file_test(modelDir, /directory) then file_mkdir, modelDir
2627

28+
2729
extension = '.dat'
2830

31+
2932
; Where we want the model to go
3033

3134
;+ best model, updated as we go with lowest validation loss
@@ -34,6 +37,7 @@ bestUri = modelDir + path_sep() + 'best.h5'
3437
;+ last mode (last epoch of training)
3538
lastUri = modelDir + path_sep() + 'last.h5'
3639

40+
3741
; Training parameters
3842

3943
;+ random seed for splitting data
@@ -48,6 +52,7 @@ bpr = 0.3
4852
;+ how many times we run through all positive examples of our features
4953
epochs = 100
5054

55+
5156
; Load data and split into training and validation buckets
5257

5358
; make list for ENVI DL rasters
@@ -75,6 +80,7 @@ idx = sort(randomu(seed, nFiles))
7580
training = rasters[*]
7681
validation = rasters[idx[-nValidation : -1]]
7782

83+
7884
; Create our training task and specify model parameters
7985

8086
; Get the task from the catalog of ENVITasks
@@ -93,31 +99,41 @@ Task.background_patch_ratio = bpr
9399
Task.output_model_uri = bestUri
94100
Task.output_last_model_uri = lastUri
95101

102+
96103
Task.execute
97104

105+
98106
Task.execute
99107

108+
100109
Task.execute
101110

111+
102112
orig = e.openRaster('D:\luno\sky-sat\mosaics\SkySatScene.ntf')
103113
raster = dlAutoPrepareRaster(orig)
104114
e.data.add, raster
105115

116+
106117
stop
107118

119+
108120
Task.execute
109121

122+
110123
Task.execute
111124

125+
112126
; Train! Now this will take a while, so don't close VSCode or run any other notebooks.
113127

114128
Task.execute
115129

130+
116131
; Optionally, classify some of our validation images so we can see what our results look like.
117132

118133
; stopped so we dont accidentally process all of our images which will take a while!
119134
stop
120135

136+
121137
; Specify the output folder and open our model
122138

123139
;+ specify output folder
@@ -126,11 +142,13 @@ validationDir = modelDir + path_sep() + 'validation'
126142
; make sure it exists
127143
if ~file_test(validationDir, /directory) then file_mkdir, validationDir
128144

145+
129146
; Open our model!
130147

131148
;+ restore the model to process our data with
132149
model = ENVITensorFlowObjectModel(lastUri)
133150

151+
134152
; Process our data!
135153

136154
; specify the number of files to process
@@ -166,4 +184,5 @@ foreach file, validationUris, i do begin
166184
; clean up
167185
raster.close
168186
endforeach
187+
169188
end

0 commit comments

Comments
 (0)