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
1146b108
Commit
1146b108
authored
3 years ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot...
parent
5871e462
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/icing_fcn.py
+44
-5
44 additions, 5 deletions
modules/deeplearning/icing_fcn.py
with
44 additions
and
5 deletions
modules/deeplearning/icing_fcn.py
+
44
−
5
View file @
1146b108
...
...
@@ -523,9 +523,9 @@ class IcingIntensityFCN:
print
(
'
num test samples:
'
,
tst_idxs
.
shape
[
0
])
print
(
'
setup_test_pipeline: Done
'
)
def
setup_eval_pipeline
(
self
,
data_dct
):
def
setup_eval_pipeline
(
self
,
data_dct
,
num_tiles
=
1
):
self
.
data_dct
=
data_dct
idxs
=
np
.
arange
(
1
)
idxs
=
np
.
arange
(
num_tiles
)
self
.
num_data_samples
=
idxs
.
shape
[
0
]
self
.
get_evaluate_dataset
(
idxs
)
...
...
@@ -1124,7 +1124,46 @@ def run_evaluate_static_avg(data_dct, ll, cc, ckpt_dir_s_path, day_night='DAY',
return
ice_lons
,
ice_lats
,
preds_2d
def
run_evaluate_static_fcn
(
data_dct
,
ckpt_dir_s_path
,
day_night
=
'
DAY
'
,
l1b_or_l2
=
'
both
'
,
prob_thresh
=
0.5
,
# def run_evaluate_static_fcn(data_dct, ckpt_dir_s_path, day_night='DAY', l1b_or_l2='both', prob_thresh=0.5,
# flight_levels=[0, 1, 2, 3, 4], use_flight_altitude=False):
#
# ckpt_dir_s = os.listdir(ckpt_dir_s_path)
# ckpt_dir = ckpt_dir_s_path + ckpt_dir_s[0]
#
# if not use_flight_altitude:
# flight_levels = [0]
#
# probs_dct = {flvl: None for flvl in flight_levels}
# preds_dct = {flvl: None for flvl in flight_levels}
#
# nn = IcingIntensityFCN(day_night=day_night, l1b_or_l2=l1b_or_l2, use_flight_altitude=use_flight_altitude)
# nn.num_data_samples = 1
# nn.build_model()
# nn.build_training()
# nn.build_evaluation()
#
# ckpt = tf.train.Checkpoint(step=tf.Variable(1), model=nn.model)
# ckpt_manager = tf.train.CheckpointManager(ckpt, ckpt_dir, max_to_keep=3)
# ckpt.restore(ckpt_manager.latest_checkpoint)
#
# for flvl in flight_levels:
# nn.flight_level = flvl
# nn.setup_eval_pipeline(data_dct)
# nn.do_evaluate(ckpt_dir)
#
# probs = nn.test_probs
# if NumClasses == 2:
# preds = np.where(probs > prob_thresh, 1, 0)
# else:
# preds = np.argmax(probs, axis=1)
#
# probs_dct[flvl] = probs
# preds_dct[flvl] = preds
#
# return preds_dct, probs_dct
def
run_evaluate_static_fcn
(
data_dct
,
num_tiles
,
ckpt_dir_s_path
,
day_night
=
'
DAY
'
,
l1b_or_l2
=
'
both
'
,
prob_thresh
=
0.5
,
flight_levels
=
[
0
,
1
,
2
,
3
,
4
],
use_flight_altitude
=
False
):
ckpt_dir_s
=
os
.
listdir
(
ckpt_dir_s_path
)
...
...
@@ -1137,7 +1176,7 @@ def run_evaluate_static_fcn(data_dct, ckpt_dir_s_path, day_night='DAY', l1b_or_l
preds_dct
=
{
flvl
:
None
for
flvl
in
flight_levels
}
nn
=
IcingIntensityFCN
(
day_night
=
day_night
,
l1b_or_l2
=
l1b_or_l2
,
use_flight_altitude
=
use_flight_altitude
)
nn
.
num_data_samples
=
1
nn
.
num_data_samples
=
num_tiles
nn
.
build_model
()
nn
.
build_training
()
nn
.
build_evaluation
()
...
...
@@ -1148,7 +1187,7 @@ def run_evaluate_static_fcn(data_dct, ckpt_dir_s_path, day_night='DAY', l1b_or_l
for
flvl
in
flight_levels
:
nn
.
flight_level
=
flvl
nn
.
setup_eval_pipeline
(
data_dct
)
nn
.
setup_eval_pipeline
(
data_dct
,
num_tiles
)
nn
.
do_evaluate
(
ckpt_dir
)
probs
=
nn
.
test_probs
...
...
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