shamangary / ssr-net Goto Github PK
View Code? Open in Web Editor NEW[IJCAI18] SSR-Net: A Compact Soft Stagewise Regression Network for Age Estimation
License: Apache License 2.0
[IJCAI18] SSR-Net: A Compact Soft Stagewise Regression Network for Age Estimation
License: Apache License 2.0
hi,
In the pic
I find the gender prediction, so could you tell me where it is in the demo ?
I want to put it in the demo,
thx
Hey, Is it possible to make a demo which runs on input images rather than gifs and mp4 videos?
Thank you
Excuse me. I read your code and I didn't see any pooling layer(AvgPooling or MaxPooling) in Stage1(code: layer4). But it does actually exist in Stage3(code: layer1) and Stage2(code: layer2).
Why is this difference? Thank you.
In your paper, you got this result, is that on the training datasets or validation datasets? Cause I reimplement the SSRNet in pytorch, but the best results of 90 epochs is like :
train Loss: 22.0870 CA_3: 0.5108, CA_5: 0.7329
val Loss: 44.7439 CA_3: 0.4268, CA_5: 0.6225
the parameters are like:
batch_size = 50
input_size = 64
num_epochs = 90
learning_rate = 0.001 # originally 0.001
weight_decay = 1e-4 # originally 1e-4
augment = False
optimizer_ft = optim.Adam(params_to_update, lr=learning_rate, weight_decay=weight_decay)
criterion = nn.MSELoss()
lr_scheduler = optim.lr_scheduler.StepLR(optimizer_ft, step_size=30, gamma=0.1)
Thanks in advance~
Do we have to use the GTX1080 platform?is RTX2060 OK?
hello,
How to get the MORPH dataset ? If I want to use it as academic purpose ,can I apply the dataset by sending an official Email or I HAVE TO pay for it ?
thank you .
How accurate is your model with predicting older people (60+)? Does it predict them 95% always younger than their real age?
hello! @shamangary
I want to understand what “netType1”“netType2” and “lambda_local”“lambda_local” stand for?
Thank you very much for your answer!
Hi
Does it have plans to support C++?
Thank you for providing such an extrodinary image-processing solution, and I have already run the code and read the paper related to this project.
I have a question about parameters 'lambda_d' and 'lambda_local'. I can't understand their function and meaning. ( I noticed that you set them both as 1.0 in your demo).
it is amazing work, thank for u work. But the result is very poor except for gender . how can i improve the model
I have some problems to start training. See 2 errors below.
Error 1: it is looking for a pre-trained weights but not available from repo
cmd:> python SSRNET_train.py --input ../data/imdb_db.npz --db imdb--netType1 1 --netType2 1
OSError: Unable to open file (Unable to open file: name = 'imdb_models/ssrnet_3_3_3_64_0.25_0.25/ssrnet_3_3_3_64_0.25_0.25.h5', errno = 2, error message = 'no such file or directory', flags = 0, o_flags = 0)
Error 2: I solve error1 by replace the imdb_models with from another pre-train folder, I hv picked "ssrnet_3_3_3_64_1.0_1.0", it throws me another error below:
UnicodeDecodeError: 'rawunicodeescape' codec can't decode bytes in position 838-839: truncated \uXXXX
Details:
Total params: 40,915
Trainable params: 40,531
Non-trainable params: 384
DEBUG:root:Saving model...
Traceback (most recent call last):
File "SSRNET_train.py", line 136, in
main()
File "SSRNET_train.py", line 95, in main
f.write(model.to_json())
File "C:\Users\default.LAPTOP-2CI68M4P\Anaconda3\envs\xrvision2\lib\site-packages\keras\engine\topology.py", line 2618, in to_json
model_config = self._updated_config()
File "C:\Users\default.LAPTOP-2CI68M4P\Anaconda3\envs\xrvision2\lib\site-packages\keras\engine\topology.py", line 2585, in _updated_config
config = self.get_config()
File "C:\Users\default.LAPTOP-2CI68M4P\Anaconda3\envs\xrvision2\lib\site-packages\keras\engine\topology.py", line 2322, in get_config
layer_config = layer.get_config()
File "C:\Users\default.LAPTOP-2CI68M4P\Anaconda3\envs\xrvision2\lib\site-packages\keras\layers\core.py", line 656, in get_config
function = func_dump(self.function)
File "C:\Users\default.LAPTOP-2CI68M4P\Anaconda3\envs\xrvision2\lib\site-packages\keras\utils\generic_utils.py", line 175, in func_dump
code = marshal.dumps(func.code).decode('raw_unicode_escape')
UnicodeDecodeError: 'rawunicodeescape' codec can't decode bytes in position 838-839: truncated \uXXXX
您好,请问下如果需要将输入图片修改为112X112,是否可以在第一个卷积前面加一个正常的3*3 ,stride为2的卷积就可以了。效果会比64X64的应该也会好吧。
Hello!
I used megaage asian to train model, and use my images to test. My images was detected faces with MTCNN and saved with margin! When I use the trained model to test the gender with MTCNN detecting face again, and the results bad, but use images with margin (don't detect face with MTCNN), the results very good!
Whether it is related to the training set containing boundaries?
Is it reasonable for me to test like this?
Thank you!
Hello, how to test the model to get accuracy?
I need to engineer ssrnet. How do I plan my final age by getting 9 output nodes( pred_age_stage1、 pred_age_stage2、 pred_age_stage3、delta_s1、delta_s2、delta_s3、local_delta_stage1、local_delta_stage2、local_delta_stage3)?
Who can help me? Thank you
here , SSR-NET use MAE to be loss function, I try to write code using tensorflow ,
and the error is like that:
ValueError: No gradients provided for any variable, check your graph for ops that do not support gradients,
and the loss code like that:
logits_loss_age = tf.reduce_mean(tf.losses.absolute_difference(tf.cast(self.classifier_logits,tf.int32),age_labels))
optimizer = tf.train.AdamOptimizer(learning_rate,epsilon=1e-4)
train_op = optimizer.minimize(all_loss)
how can I resolve this quesiton?
hello, I find you use mtcnn to detect face in video demo code, and install mtcnn with pip. So I want to ask you, this mtcnn whether or not Joint Face Detection and Alignment using Multi-task Cascaded Convolutional Networks(MTCNN)?
thank you!
拿模型predict的时候,发现小孩儿and 婴儿,全部预测15+岁。我看那个megaage-asian数据集是0-70,所以为什么我预测没有小孩那一段的,是模型本身的局限还是我哪里没搞对??
Sorry to bother you ,why pred_xxx do not processed by softmax?
If it is not processed by softmax, is it probabilistic?
@shamangary 你好,求大佬在readme
的third party implementation
里多加个链接哈哈~~:
Pytorch: https://github.com/oukohou/SSR_Net_Pytorch
让我也能蹭一波大佬的热度~~~谢谢~~
could TYY_demo_mtcnn.py load age and gender model at the same time?
It seems like that the network architicture in the code of SSR_Net.py is different from paper.For example only one pooling layer in every stream of stage 1 but two in paper @shamangary
请问得到的性别识别的准确率有多高呢?
Hi,shamangary:
how did you evaluate your cpu time?I use the following code to evaluate the inference time:
start_CPU = timeit.default_timer()
results = model.predict(faces)
end_CPU = timeit.default_timer()
in the TYY_demo_mtcnn.py code,but it takes about 20-30ms in cpu time,is it correct?
您好,在预处理数据(create_db.py)时,我注意到你对原本数据集的图像进行了人脸识别,但好像并未对人脸部分进行裁剪。(若是看错,还请谅解)
当我利用MegaAsian的数据集进行训练时,我发现该数据集人脸外的背景并不小,担心“噪声”较大,这样训练的结果是否会对结果造成影响呢?(我裁剪后,对于小孩的判断有一定提升)
不知道您的看法如何?谢谢。
Hello. In paper 3.3 Dymamic Range part,
formula (4)
formula (6)
but there is sort of different in the code, the lambda_local
and lambda_d
respectively which (lambda_local
and lambda_d
) are assigned [0, 0.25, 0.5, 0.75, 1] in the SSRNET_train.py.
Why are they(lambda_local
and lambda_d
) exist?
Thank you.
Hello, I am running the program on 1080Ti, but the memory is very large, about 10 G, is it a memory leak? Does this happen to you? thank you very much
hello, I use SSR-Net to estimate gender with wiki pre-model, but the value obtained does not seem to be a confidence, the values of males are greater than 1, and the values of females is not less than 0.5, mostly is 0.9999.... , so there are many errors with 0.5 as threshold.
Is there a problem with my test?
Thank you!
检测的蓝色的框外面的红框有特殊的含义吗?
Morph2 dataset website is dead. Do you happen to have the dataset for download?
你好,模型中的V设置为101,是因为训练数据最大的年龄是101吗。如果自己的数据集,是不是也需要进行相应的调整
How about the performance without the pretrained weight (that is, training from scratch)?
HI, @shamangary can I use this net to train age and gender at the same time? and if gender has 3 classes ,ie (0: other, 1: female, 2: male) , in merge_age function V should be set V=1 or V=3?
Hi, in your paper, you have tested SSR-Net model on MegaAge-Asian dataset and got result [CA(3): 0.549, CA(5):0.741].
I modified the script TYY_demo_mtcnn.py, use your "pre-trained/megaface_asian/ssrnet_3_3_3_64_1.0_1.0/ssrnet_3_3_3_64_1.0_1.0.h5" and read MegaAge-Asian images as input to test.
But I can't get the approximate testing result, can you provide the testing script? Thank you!
hello ,would u plz give detailed information about the project environment ,such as keras and tensorflow version ,cuda and cudnn?
when i run "python3 SSRNET_train.py --input /home/xd/workspace/SSR-Net/data/imdb.npz --db imdb --netType1 4 --netType2 4", the folloing errors occur:
Epoch 1/90
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/usr/lib/python3.5/threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "/home/xx/.local/lib/python3.5/site-packages/keras/engine/training.py", line 606, in data_generator_task
generator_output = next(self._generator)
File "/home/xx/workspace/SSR-Net/training_and_testing/TYY_generators.py", line 49, in data_generator_reg
yield augment_data(np.array(p)),np.array(q)
File "/home/xx/workspace/SSR-Net/training_and_testing/TYY_generators.py", line 27, in augment_data
images[i] = tf.contrib.keras.preprocessing.image.random_rotation(images[i], 20, row_axis=0, col_axis=1, channel_axis=2)
AttributeError: module 'tensorflow.contrib' has no attribute 'keras'
File "/home/xx/.local/lib/python3.5/site-packages/keras/engine/training.py", line 1852, in fit_generator
str(generator_output))
ValueError: output of generator should be a tuple (x, y, sample_weight)
or (x, y)
. Found: None
Your reply would be appreciated greatly.
Hi, Thanks for sharing this awesome source code. It helps me a lot. Currently, I am trying to reproduce your result on morph2 dataset. Your script use morph2_db_align.npz file to train the network. Because the file's name has a '_align' at the end, so I suppose you made an preprocessing step for this dataset. Can you tell me which preprocessing you used?
Could someone please help me. Im getting the error and I cannot understand why. I get it when I run the code:
python3 create_db.py --output data/imdb_db.mat --db imdb --img_size 64
Is it something to do with a dependency not installed?
Please help me!
Code Error in full;
(EnVee) D:\FYP\FYP Platforms\SSR-Net-master\data>python TYY_IMDBWIKI_create_db.py --db imdb --output imdb.npz
Traceback (most recent call last):
File "TYY_IMDBWIKI_create_db.py", line 61, in
main()
File "TYY_IMDBWIKI_create_db.py", line 34, in main
full_path, dob, gender, photo_taken, face_score, second_face_score, age = get_meta(mat_path, db)
File "D:\FYP\FYP Platforms\SSR-Net-master\data\TYY_utils.py", line 17, in get_meta
meta = loadmat(mat_path)
File "C:\Users\VenuraKetipearachchi\Anaconda3\envs\EnVee\lib\site-packages\scipy\io\matlab\mio.py", line 142, in loadmat
matfile_dict = MR.get_variables(variable_names)
File "C:\Users\VenuraKetipearachchi\Anaconda3\envs\EnVee\lib\site-packages\scipy\io\matlab\mio5.py", line 272, in get_variables
hdr, next_position = self.read_var_header()
File "C:\Users\VenuraKetipearachchi\Anaconda3\envs\EnVee\lib\site-packages\scipy\io\matlab\mio5.py", line 226, in read_var_header
mdtype, byte_count = self._matrix_reader.read_full_tag()
File "mio5_utils.pyx", line 548, in scipy.io.matlab.mio5_utils.VarReader5.read_full_tag
File "mio5_utils.pyx", line 556, in scipy.io.matlab.mio5_utils.VarReader5.cread_full_tag
File "streams.pyx", line 171, in scipy.io.matlab.streams.ZlibInputStream.read_into
File "streams.pyx", line 158, in scipy.io.matlab.streams.ZlibInputStream._fill_buffer
zlib.error: Error -3 while decompressing data: invalid code lengths set
@shamangary In your demo code ,you dont use the alignment face ,Why?
Hi,shamangary:
In the age prediction process,the age is negative,is there a way to avoid this?
Thanks。
I have trained the SSR-Net on my private dataset and the best model has MAE of ~4yrs
Apart from heteroscedasticity, while the mean MAE for smaller ages is zero, for ages > 50 I am seeing large positive mean of errors. Is there any way to resolve this?
模型转换后得到的[pred_a_s1,pred_a_s2,pred_a_s3,delta_s1,delta_s2,delta_s3, local_s1, local_s2, local_s3]不太一致。 根据你的demo, 我把格式设成了一致的,mean设为0,scale设为1,图像类型为BGR,未做对齐。想向您确认一下预处理是否不当?
Hi there @shamangary ,
I am wondering whether your method is applicable to CACD dataset: https://bcsiriuschen.github.io/CARC/ ?
In addition, why did you not crop the face images when pre-processing? I am thinking that removing more background noise is possible to get better performance.
Regards,
你好,我能不能咨询一下,你在进行训练和测试的时候,采用的keras和Python的版本是多少呢?谢谢!
error in line 76 to 81 in master/training_and_testing/SSRNET_train.py
if db_name == "wiki":
weight_file = "wiki_models/"+save_name+"/"+save_name+".h5"
model.load_weights(weight_file)
elif db_name == "imdb":
weight_file = "imdb_models/"+save_name+"/"+save_name+".h5"
model.load_weights(weight_file)
elif db_name == "morph":
weight_file = "morph_models/"+save_name+"/"+save_name+".h5"
model.load_weights(weight_file)
Hello
it is amazing model.
but it doesn't give gender classification.
I know
https://github.com/shamangary/Keras-real-time-age-gender-estimation-demo
give gender but SSR-net is more good accuracy.
do you have plan to add gender classification?
Hi,shamangary:
I use imdb data to train the model, use the parameter in your paper,but the training and val loss is very high,about 9.2,is that correct?
i train ssrnet with Megaage-Asian and get the mae is 3.8,is this normal? what's your result about Megaage-Asian. Thanks
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.