I'm trying to implement Google's Facenet paper:
First of all, is it possible to implement this paper using the Sequential API of Keras or should I go for the Graph API?
In either case, could you please tell me how do I pass the custom loss function tripletLoss
to the model compile and how do I receive the anchor embedding
, positive embedding
and the negative embedding
as parameters to calculate the loss?
Also, what should be the second parameter Y in model.fit(), I do not have any in this case...
This issue explains how to create a custom objective (loss) in Keras:
def dummy_objective(y_true, y_pred):
return 0.5 # your implem of tripletLoss here
model.compile(loss=dummy_objective, optimizer='adadelta')
Regarding the y
parameter of .fit()
, since you are the one handling it in the end (the y_true
parameter of the objective function is taken from it), I would say you can pass whatever you need that can fit through Keras plumbing. And maybe a dummy vector to pass dimension checks if your really don't need any supervision.
Eventually, as to how to implement this particular paper, looking for triplet
or facenet
in Keras doc didn't return anything. So you'll probably have to either implement it yourself or find someone who has.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.