Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
AMBS
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
Container registry
Model registry
Operate
Environments
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
esde
machine-learning
AMBS
Commits
6f3b4588
Commit
6f3b4588
authored
2 years ago
by
gong1
Browse files
Options
Downloads
Patches
Plain Diff
update WeatherBench
parent
ddf29111
No related branches found
No related tags found
No related merge requests found
Pipeline
#102866
passed
2 years ago
Stage: build
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
video_prediction_tools/model_modules/video_prediction/models/weatherBench3DCNN.py
+22
-7
22 additions, 7 deletions
...odel_modules/video_prediction/models/weatherBench3DCNN.py
with
22 additions
and
7 deletions
video_prediction_tools/model_modules/video_prediction/models/weatherBench3DCNN.py
+
22
−
7
View file @
6f3b4588
...
@@ -57,11 +57,12 @@ class WeatherBenchModel(object):
...
@@ -57,11 +57,12 @@ class WeatherBenchModel(object):
"""
"""
hparams
=
dict
(
hparams
=
dict
(
sequence_length
=
12
,
sequence_length
=
12
,
context_frames
=
1
,
max_epochs
=
20
,
max_epochs
=
20
,
batch_size
=
40
,
batch_size
=
40
,
lr
=
0.001
,
lr
=
0.001
,
shuffle_on_val
=
True
,
shuffle_on_val
=
True
,
filters
=
[
64
,
64
,
64
,
64
,
2
],
filters
=
[
64
,
64
,
64
,
64
,
3
],
kernels
=
[
5
,
5
,
5
,
5
,
5
]
kernels
=
[
5
,
5
,
5
,
5
,
5
]
)
)
return
hparams
return
hparams
...
@@ -75,9 +76,10 @@ class WeatherBenchModel(object):
...
@@ -75,9 +76,10 @@ class WeatherBenchModel(object):
original_global_variables
=
tf
.
global_variables
()
original_global_variables
=
tf
.
global_variables
()
# Architecture
# Architecture
x_hat
=
self
.
build_model
(
self
.
x
[:,
0
,:,
:,
0
:
1
],
self
.
filters
,
self
.
kernels
)
x_hat
=
self
.
build_model
(
self
.
x
[:,
0
,:,
:,
:
],
self
.
filters
,
self
.
kernels
)
# Loss
# Loss
self
.
total_loss
=
l1_loss
(
self
.
x
[:,
0
,:,
:,
0
:
1
],
x_hat
)
self
.
total_loss
=
l1_loss
(
self
.
x
[:,
0
,:,
:,
0
],
x_hat
[:,:,:,
0
])
# Optimizer
# Optimizer
self
.
train_op
=
tf
.
train
.
AdamOptimizer
(
self
.
train_op
=
tf
.
train
.
AdamOptimizer
(
...
@@ -86,6 +88,10 @@ class WeatherBenchModel(object):
...
@@ -86,6 +88,10 @@ class WeatherBenchModel(object):
# outputs
# outputs
self
.
outputs
[
"
total_loss
"
]
=
self
.
total_loss
self
.
outputs
[
"
total_loss
"
]
=
self
.
total_loss
# inferences
self
.
outputs
[
"
gen_images
"
]
=
self
.
forecast
(
self
.
x
[:,
0
,:,
:,
0
:
1
],
12
,
self
.
filters
,
self
.
kernels
)
# Summary op
# Summary op
tf
.
summary
.
scalar
(
"
total_loss
"
,
self
.
total_loss
)
tf
.
summary
.
scalar
(
"
total_loss
"
,
self
.
total_loss
)
self
.
summary_op
=
tf
.
summary
.
merge_all
()
self
.
summary_op
=
tf
.
summary
.
merge_all
()
...
@@ -100,13 +106,22 @@ class WeatherBenchModel(object):
...
@@ -100,13 +106,22 @@ class WeatherBenchModel(object):
idx
=
0
idx
=
0
for
f
,
k
in
zip
(
filters
[:
-
1
],
kernels
[:
-
1
]):
for
f
,
k
in
zip
(
filters
[:
-
1
],
kernels
[:
-
1
]):
print
(
"
1
"
,
x
)
print
(
"
1
"
,
x
)
with
tf
.
variable_scope
(
"
conv_layer_
"
+
str
(
idx
),
reuse
=
tf
.
AUTO_REUSE
):
x
=
ld
.
conv_layer
(
x
,
kernel_size
=
k
,
stride
=
1
,
num_features
=
f
,
idx
=
"
conv_layer_
"
+
str
(
idx
)
,
activate
=
"
leaky_relu
"
)
x
=
ld
.
conv_layer
(
x
,
kernel_size
=
k
,
stride
=
1
,
num_features
=
f
,
idx
=
"
conv_layer_
"
+
str
(
idx
)
,
activate
=
"
leaky_relu
"
)
print
(
"
2
"
,
x
)
print
(
"
2
"
,
x
)
idx
+=
1
idx
+=
1
with
tf
.
variable_scope
(
"
Conv_last_layer
"
,
reuse
=
tf
.
AUTO_REUSE
):
output
=
ld
.
conv_layer
(
x
,
kernel_size
=
kernels
[
-
1
],
stride
=
1
,
num_features
=
filters
[
-
1
],
idx
=
"
Conv_last_layer
"
,
activate
=
"
linear
"
)
output
=
ld
.
conv_layer
(
x
,
kernel_size
=
kernels
[
-
1
],
stride
=
1
,
num_features
=
filters
[
-
1
],
idx
=
"
Conv_last_layer
"
,
activate
=
"
linear
"
)
print
(
"
output dimension
"
,
output
)
return
output
return
output
def
forecast
(
self
,
inputs
,
forecast_time
,
filters
,
kernels
):
x_hat
=
[]
for
i
in
range
(
forecast_time
):
x_pred
=
self
.
build_model
(
self
.
x
[:,
i
,:,
:,:],
filters
,
kernels
)
x_hat
.
append
(
x_pred
)
x_hat
=
tf
.
stack
(
x_hat
)
x_hat
=
tf
.
transpose
(
x_hat
,
[
1
,
0
,
2
,
3
,
4
])
return
x_hat
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