bruceyang2012 / Face-identification-with-cnn-triplet-loss

Face identification with cnn+triplet-loss written by Keras.
48 stars 17 forks source link

tpe, tpe_pred = build_tpe(n_in, n_out, W_pca.T) #4

Open noelcodes opened 5 years ago

noelcodes commented 5 years ago

HI I'm stuck here. keras merge keep error me out.

In [13]: tpe, tpe_pred = build_tpe(n_in, n_out, W_pca.T) D:\xrvision\XRV_projects\Face-identification-with-cnn-triplet-loss\model.py:67: UserWarning: Update your Dense call to the Keras 2 API: Dense(18, input_dim=18, weights=[array([[-..., activation="linear", use_bias=False) base_model.add(Dense(n_out, input_dim=n_in, bias=False, weights=[W_pca], activation='linear')) Traceback (most recent call last):

File "", line 1, in tpe, tpe_pred = build_tpe(n_in, n_out, W_pca.T)

File "D:\xrvision\XRV_projects\Face-identification-with-cnn-triplet-loss\model.py", line 75, in build_tpe e = merge([a_emb, p_emb, n_emb], mode=triplet_merge, output_shape=triplet_merge_shape)

TypeError: 'module' object is not callable

noelcodes commented 5 years ago

downgrade to keras=2.0.4 seem to work. But hit into next error at eer = test()

In [21]: eer, , , _ = calc_metrics(tsc, isc) Traceback (most recent call last):

File "", line 1, in eer, , , _ = calc_metrics(tsc, isc)

File "D:\xrvision\XRV_projects\Face-identification-with-cnn-triplet-loss\identification.py", line 12, in calc_metrics min_score = np.minimum(np.min(targets_scores), np.min(imposter_scores))

File "C:\Users\Noel Tam\AppData\Local\conda\conda\envs\tripletloss\lib\site-packages\numpy\core\fromnumeric.py", line 2442, in amin initial=initial)

File "C:\Users\Noel Tam\AppData\Local\conda\conda\envs\tripletloss\lib\site-packages\numpy\core\fromnumeric.py", line 83, in _wrapreduction return ufunc.reduce(obj, axis, dtype, out, **passkwargs)

ValueError: zero-size array to reduction operation minimum which has no identity

noelcodes commented 5 years ago

no matter what, "isc" always comes out empty, which triggers the error. It just seems the model is unable to separate the imposer and target well. I'm stuck here... If i hard code a random value into isc (just to move on), the prediction is meaningless, it doesn't recognize an imposer. So this part is kind of important.