Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tom Rink
python
Commits
99cc43de
Commit
99cc43de
authored
2 years ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
add method to scale data
parent
512c1dc0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/deeplearning/unet_l1b_l2.py
+9
-6
9 additions, 6 deletions
modules/deeplearning/unet_l1b_l2.py
with
9 additions
and
6 deletions
modules/deeplearning/unet_l1b_l2.py
+
9
−
6
View file @
99cc43de
import
glob
import
glob
import
tensorflow
as
tf
import
tensorflow
as
tf
from
util.setup
import
logdir
,
modeldir
,
cachepath
,
now
,
ancillary_path
,
home_dir
from
util.setup
import
logdir
,
modeldir
,
cachepath
,
now
,
ancillary_path
,
home_dir
from
util.util
import
EarlyStop
,
normalize
,
make_for_full_domain_predict
from
util.util
import
EarlyStop
,
normalize
,
scale
,
make_for_full_domain_predict
import
os
,
datetime
import
os
,
datetime
import
numpy
as
np
import
numpy
as
np
import
pickle
import
pickle
...
@@ -26,7 +26,7 @@ BATCH_SIZE = 128
...
@@ -26,7 +26,7 @@ BATCH_SIZE = 128
NUM_EPOCHS
=
60
NUM_EPOCHS
=
60
TRACK_MOVING_AVERAGE
=
False
TRACK_MOVING_AVERAGE
=
False
EARLY_STOP
=
Tru
e
EARLY_STOP
=
Fals
e
TRIPLET
=
False
TRIPLET
=
False
CONV3D
=
False
CONV3D
=
False
...
@@ -54,11 +54,14 @@ mean_std_dct.update(mean_std_dct_l2)
...
@@ -54,11 +54,14 @@ mean_std_dct.update(mean_std_dct_l2)
emis_params
=
[
'
temp_10_4um_nom
'
,
'
temp_11_0um_nom
'
,
'
temp_12_0um_nom
'
,
'
temp_13_3um_nom
'
,
'
temp_3_9um_nom
'
,
emis_params
=
[
'
temp_10_4um_nom
'
,
'
temp_11_0um_nom
'
,
'
temp_12_0um_nom
'
,
'
temp_13_3um_nom
'
,
'
temp_3_9um_nom
'
,
'
temp_6_7um_nom
'
]
'
temp_6_7um_nom
'
]
l2_params
=
[
'
cloud_fraction
'
,
'
cld_temp_acha
'
,
'
cld_press_acha
'
]
# -- Zero out params (Experimentation Only) ------------
# -- Zero out params (Experimentation Only) ------------
zero_out_params
=
[
'
cld_reff_dcomp
'
,
'
cld_opd_dcomp
'
,
'
iwc_dcomp
'
,
'
lwc_dcomp
'
]
zero_out_params
=
[
'
cld_reff_dcomp
'
,
'
cld_opd_dcomp
'
,
'
iwc_dcomp
'
,
'
lwc_dcomp
'
]
DO_ZERO_OUT
=
False
DO_ZERO_OUT
=
False
label_param
=
l2_params
[
1
]
def
build_conv2d_block
(
conv
,
num_filters
,
activation
,
block_name
,
padding
=
'
SAME
'
):
def
build_conv2d_block
(
conv
,
num_filters
,
activation
,
block_name
,
padding
=
'
SAME
'
):
with
tf
.
name_scope
(
block_name
):
with
tf
.
name_scope
(
block_name
):
...
@@ -240,7 +243,7 @@ class UNET:
...
@@ -240,7 +243,7 @@ class UNET:
data_norm
.
append
(
tmp
)
data_norm
.
append
(
tmp
)
data
=
np
.
stack
(
data_norm
,
axis
=
3
)
data
=
np
.
stack
(
data_norm
,
axis
=
3
)
#
label =
normaliz
e(label,
'M15'
, mean_std_dct)
label
=
scal
e
(
label
,
label_param
,
mean_std_dct
)
if
is_training
and
DO_AUGMENT
:
if
is_training
and
DO_AUGMENT
:
data_ud
=
np
.
flip
(
data
,
axis
=
1
)
data_ud
=
np
.
flip
(
data
,
axis
=
1
)
...
@@ -358,14 +361,14 @@ class UNET:
...
@@ -358,14 +361,14 @@ class UNET:
self
.
test_data_files
=
test_data_files
self
.
test_data_files
=
test_data_files
self
.
test_label_files
=
test_label_files
self
.
test_label_files
=
test_label_files
trn_idxs
=
np
.
arange
(
10503
)
trn_idxs
=
np
.
arange
(
20925
)
np
.
random
.
shuffle
(
trn_idxs
)
np
.
random
.
shuffle
(
trn_idxs
)
tst_idxs
=
np
.
arange
(
1167
)
tst_idxs
=
np
.
arange
(
2325
)
self
.
get_train_dataset
(
trn_idxs
)
self
.
get_train_dataset
(
trn_idxs
)
self
.
get_test_dataset
(
tst_idxs
)
self
.
get_test_dataset
(
tst_idxs
)
self
.
num_data_samples
=
10503
self
.
num_data_samples
=
20925
print
(
'
datetime:
'
,
now
)
print
(
'
datetime:
'
,
now
)
print
(
'
training and test data:
'
)
print
(
'
training and test data:
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment