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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esde
machine-learning
AMBS
Commits
1b486d1c
Commit
1b486d1c
authored
4 years ago
by
Michael Langguth
Browse files
Options
Downloads
Patches
Plain Diff
Add model_helpers.py to repo which can be used by all video frame prediction models.
parent
00c4b4f5
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
video_prediction_tools/model_modules/video_prediction/models/model_helpers.py
+28
-0
28 additions, 0 deletions
...ls/model_modules/video_prediction/models/model_helpers.py
with
28 additions
and
0 deletions
video_prediction_tools/model_modules/video_prediction/models/model_helpers.py
0 → 100644
+
28
−
0
View file @
1b486d1c
__email__
=
"
b.gong@fz-juelich.de
"
__author__
=
"
Bing Gong, Michael Langguth
"
__date__
=
"
2021-20-05
"
"""
Some auxiliary functions that can be used by any video prediction model
"""
def
set_and_check_pred_frames
(
seq_length
,
context_frames
):
"""
Checks if sequence length and context_frames are set properly and returns number of frames to be predicted.
:param seq_length: number of frames/images per sequences
:param context_frames: number of context frames/images
:return: number of predicted frames
"""
method
=
set_and_check_pred_frames
.
__name__
# sanity checks
assert
isinstance
(
seq_length
,
int
),
"
%{0}: Sequence length (seq_length) must be an integer
"
.
format
(
method
)
assert
isinstance
(
context_frames
,
int
),
"
%{0}: Number of context frames must be an integer
"
.
format
(
method
)
if
seq_length
>
context_frames
:
return
seq_length
-
context_frames
else
:
raise
ValueError
(
"
%{0}: Sequence length ({1}) must be larger than context frames ({2}).
"
.
format
(
method
,
seq_length
,
context_frames
))
\ No newline at end of file
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