Center loss in Keras

I want to realize the center loss explained in [ http://ydwen.imtqy.com/papers/WenECCV16.pdf] in Keras

I started creating a network with two outputs, such as:

inputs = Input(shape=(100,100,3)) ... fc = Dense(100)(#previousLayer#) softmax = Softmax(fc) model = Model(input, output=[softmax, fc]) model.compile(optimizer='sgd', loss=['categorical_crossentropy', 'center_loss'], metrics=['accuracy'], loss_weights=[1., 0.2]) 

First of all, doing this is a good way to continue?

Secondly, I do not know how to implement center_loss in keras. Center_loss looks like an average square error, but instead of comparing values ​​with fixed labels, it compares the values ​​with the data updated at each iteration.

thanks for the help

+5
source share

Source: https://habr.com/ru/post/1258599/


All Articles