voting.py 400 字节
Newer Older
J
jerrywgz 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
import numpy as np
try:
    import cPickle as pickle
except ImportError:
    import pickle
import sys, os

model_path = 'paddle_predict'
fl = os.listdir(model_path)
labels = np.load('labels.npz')['arr_0']
pred = np.zeros((10000, 10))
fl.sort()
i = 0
for f in fl:
    print(f)
    pred += pickle.load(open(os.path.join(model_path, f)))
    print(np.mean(np.argmax(pred, axis=1) == labels))
    i += 1