Skip to content

Commit

Permalink
add modelname
Browse files Browse the repository at this point in the history
  • Loading branch information
gferraro committed Mar 9, 2023
1 parent de6be93 commit 0e9da0a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Melt/identify_bird.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ def classify(file, model_file):
segment_stride = meta.get("segment_stride", 1.5)
hop_length = meta.get("hop_length", 640)
mean_sub = meta.get("mean_sub", False)
model_name = meta.get("name", False)

samples, length = load_samples(
file, segment_length, segment_stride, hop_length, mean_sub=mean_sub
)
Expand Down Expand Up @@ -161,7 +163,7 @@ def classify(file, model_file):
continue
track = active_tracks.get(label, None)
if track is None:
track = Track(label, start, start + segment_length, r[0])
track = Track(label, start, start + segment_length, r[0], model_name)
tracks.append(track)
active_tracks[label] = track
else:
Expand All @@ -179,14 +181,16 @@ def classify(file, model_file):


class Track:
def __init__(self, label, start, end, confidence):
def __init__(self, label, start, end, confidence, model_name):
self.start = start
self.label = label
self.end = end
self.confidences = [confidence]
self.model = model_name

def get_meta(self):
meta = {}
meta["model"] = self.model
meta["begin_s"] = self.start
meta["end_s"] = self.end
meta["species"] = self.label
Expand Down
1 change: 1 addition & 0 deletions Melt/identify_species.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def build_entry(begin, end, species, activation):
entry["end_s"] = end
entry["species"] = species
entry["likelihood"] = round(activation * 0.01, 2)
entry["model"] = "morepork"
return entry


Expand Down

0 comments on commit 0e9da0a

Please sign in to comment.