pppoe / tensorflow-sphereface-asoftmax Goto Github PK
View Code? Open in Web Editor NEWa re-implementation of asoftmax in tensorflow
a re-implementation of asoftmax in tensorflow
cos_sign = tf.sign(cos_th)
res = 2*tf.multiply(tf.sign(cos_th), tf.square(cos_th)) - 1
what's the mean of the sign function in calculate the cos(m*th)
Since m=3 hasn't been implemented, will you please provide the formula for that.
what is the meaning of 'f' and 'ff' ? 0.5???
Hi author.
There is a new published paper proposed additive margin softmax(AM-softmax), which seems easier to train than sphereface.
https://arxiv.org/abs/1801.05599
I implemented main part of this paper here by tensorflow:
https://github.com/Joker316701882/Additive-Margin-Softmax
With exact hyper-parameters with author, I can also only achieve 98.x% accu. So I'm wondering is it the problem of tensorflow low-level implementation (like optimizer) different from caffe so that with same parameters, it's hard to reach exact performance. Have you ever tried loss in paper like AM-softmax(cosface), arcface etc.
Will be glad to know your idea about this.
hi, I change the Network from TFlearn code to TF slim code, the tf-slim code as follow
`def prelu(_x, scope=None):
"""parametric ReLU activation"""
with tf.variable_scope(name_or_scope=scope, default_name="prelu"):
_alpha = tf.get_variable("prelu", shape=_x.get_shape()[-1],
dtype=_x.dtype, initializer=tf.constant_initializer(0.1))
return tf.maximum(0.0, _x) + _alpha * tf.minimum(0.0, _x)
def Network(data_input, training = True):
x = slim.conv2d(data_input, 32, [3,3], stride = 1, activation_fn=prelu)
x = slim.conv2d(x, 32, [3, 3], stride = 2, activation_fn=prelu)
x = slim.conv2d(x, 64, [3, 3], activation_fn=prelu)
x = slim.conv2d(x, 64, [3, 3], stride = 2, activation_fn=prelu)
x = slim.conv2d(x, 128, [3, 3], activation_fn=prelu)
x = slim.conv2d(x, 128, [3, 3], stride = 2, activation_fn=prelu)
x = slim.flatten(x)
feat = slim.fully_connected(x, 2)
return feat
`
when I train the network, the loss does not decline, how can i solve this problem?Thanks
0 2.3063145
100 2.3025854
200 2.3025854
300 2.3025854
400 2.3025854
500 2.3025854
600 2.3025854
sloved! just change "feat = slim.fully_connected(x, 2)" to "feat = slim.fully_connected(x, 2,activation_fn=prelu)"
I tested your code for 20-layer setting of Sphereface paper with the CNN and residual units but the loss value for m=4 became weirdly huge.
I tried to reproduce sphereface via tensorflow on CASIA-WebFace, but I found the loss function is very difficult to convey, and loss function sometimes be very large (10e6). Are there any solutions?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.