-
Notifications
You must be signed in to change notification settings - Fork 13
/
evaluate.py
45 lines (32 loc) · 979 Bytes
/
evaluate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# This file contains a short example of the evaluation process
# including training and testing.
# Author: Stefan Kahl, 2018, Chemnitz University of Technology
import os
import numpy as np
import config as cfg
from model import lasagne_net as birdnet
from model import lasagne_io as io
from utils import stats
from utils import log
import train
import test
###################### EVALUATION #######################
def evaluate():
# Clear stats
stats.clearStats(True)
# Parse Dataset
cfg.CLASSES, TRAIN, VAL = train.parseDataset()
# Build Model
NET = birdnet.build_model()
# Train and return best net
best_net = train.train(NET, TRAIN, VAL)
# Load trained net
SNAPSHOT = io.loadModel(best_net)
# Test snapshot
MLRAP, TIME_PER_EPOCH = test.test(SNAPSHOT)
result = np.array([[MLRAP]], dtype='float32')
return result
if __name__ == '__main__':
cfg.LOG_MODE = 'all'
r = evaluate()
log.export()