Skip to content

Commit

Permalink
support Activations without fps (e.g. multi-task TCN tempo output)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Böck committed Jan 6, 2022
1 parent bb4a8f5 commit 1933f4d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions madmom/features/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ def __new__(cls, data, fps=None, sep=None, dtype=np.float32):
obj = cls.load(data, fps, sep)
else:
raise TypeError("wrong input data for Activations")
# frame rate must be set
if obj.fps is None:
raise TypeError("frame rate for Activations must be set")
# return the object
return obj

Expand Down Expand Up @@ -121,9 +118,12 @@ def load(cls, infile, fps=None, sep=None):
# numpy binary format
data = np.load(infile)
if isinstance(data, np.lib.npyio.NpzFile):
# .npz file, set the frame rate if none is given
if fps is None:
fps = float(data['fps'])
# .npz file, extract the frame rate if given
if 'fps' in data.files:
try:
fps = float(data['fps'])
except ValueError:
fps = None
# and overwrite the data
data = data['activations']
else:
Expand Down

0 comments on commit 1933f4d

Please sign in to comment.