Exemplo n.º 1
0
 def test_ohc_simple_float(self):
     Y = np.array([[1, 0], [0, 1], [1, 0]])
     Y_ = np.array([[0.8, 0.2], [0.4, 0.6], [0.55, 0.45]])
     acc = ohc.accuracy(Y, Y_)
     self.assertEqual(acc, 1)
Exemplo n.º 2
0
root = Settings['data_root']
model_root = join(root, 'good_models')
#filepath = join(model_root, 'stacknet64x64_84acc.h5')
filepath = join(root, 'stacknet_64x64_model.h5')
checkpoint = ModelCheckpoint(filepath, monitor='loss', verbose=1, save_best_only=True, mode='min')
callbacks_list = [checkpoint, TerminateOnNaN()]

if isfile(filepath):
    model = load_model(filepath)
else:
    raise Exception("Could not find model!")

model.summary()

#sampler = ReId.DataSampler(root,64,64)
sampler = MOT16Sampler(root, (64, 64))

X, Y = sampler.get_named_batch('MOT16-02', 1000, 4000)
X = preprocess_input(X.astype('float64'))

Y_ = model.predict(X)

#Y_clipped = (Y_[:,0] > 0.5) * 1
#Yclipped =  (Y[:,0] > 0.5) * 1

#accuracy = np.sum( (Y_clipped == Yclipped) * 1) / len (Yclipped)

accuracy = ohc.accuracy(Y, Y_)

print("accuracy :   \t", accuracy)
Exemplo n.º 3
0
 def test_ohc_simple_half(self):
     Y = np.array([[1, 0], [0, 1], [1, 0], [0, 1]])
     Y_ = np.array([[0, 1], [1, 0], [1, 0], [0, 1]])
     acc = ohc.accuracy(Y, Y_)
     self.assertEqual(acc, 0.5)