@@ -8,7 +8,6 @@ compile_opt idl2
88; + start ENVI with the UI
99e = envi()
1010
11-
1211; Get folders for input and output
1312
1413; + get this directory
@@ -25,10 +24,8 @@ timestamp = (strsplit(timestamp, '.', /extract))[0]
2524modelDir = strjoin ([thisDir, 'models-air' , timestamp], path_sep ())
2625if ~file_test (modelDir, / directory) then file_mkdir , modelDir
2726
28-
2927extension = '.dat'
3028
31-
3229; Where we want the model to go
3330
3431; + best model, updated as we go with lowest validation loss
@@ -37,7 +34,6 @@ bestUri = modelDir + path_sep() + 'best.h5'
3734; + last mode (last epoch of training)
3835lastUri = modelDir + path_sep () + 'last.h5'
3936
40-
4137; Training parameters
4238
4339; + random seed for splitting data
@@ -52,7 +48,6 @@ bpr = 0.3
5248; + how many times we run through all positive examples of our features
5349epochs = 100
5450
55-
5651; Load data and split into training and validation buckets
5752
5853; make list for ENVI DL rasters
@@ -80,7 +75,6 @@ idx = sort(randomu(seed, nFiles))
8075training = rasters[* ]
8176validation = rasters[idx[- nValidation : - 1 ]]
8277
83-
8478; Create our training task and specify model parameters
8579
8680; Get the task from the catalog of ENVITasks
@@ -99,41 +93,31 @@ Task.background_patch_ratio = bpr
9993Task.output_model_uri = bestUri
10094Task.output_last_model_uri = lastUri
10195
102-
10396Task.execute
10497
105-
10698Task.execute
10799
108-
109100Task.execute
110101
111-
112102orig = e.openRaster('D:\luno\sky-sat\mosaics\SkySatScene.ntf' )
113103raster = dlAutoPrepareRaster(orig)
114104e.data.add, raster
115105
116-
117106stop
118107
119-
120108Task.execute
121109
122-
123110Task.execute
124111
125-
126112; Train! Now this will take a while, so don't close VSCode or run any other notebooks.
127113
128114Task.execute
129115
130-
131116; Optionally, classify some of our validation images so we can see what our results look like.
132117
133118; stopped so we dont accidentally process all of our images which will take a while!
134119stop
135120
136-
137121; Specify the output folder and open our model
138122
139123; + specify output folder
@@ -142,13 +126,11 @@ validationDir = modelDir + path_sep() + 'validation'
142126; make sure it exists
143127if ~file_test (validationDir, / directory) then file_mkdir , validationDir
144128
145-
146129; Open our model!
147130
148131; + restore the model to process our data with
149132model = ENVITensorFlowObjectModel(lastUri)
150133
151-
152134; Process our data!
153135
154136; specify the number of files to process
@@ -184,5 +166,4 @@ foreach file, validationUris, i do begin
184166 ; clean up
185167 raster.close
186168endforeach
187-
188169end
0 commit comments