GilLevi / AgeGenderDeepLearning

633 stars 285 forks source link

hello, can I use your trained model for age estimating ? for Chinese face.. #11

Closed 9crk closed 6 years ago

9crk commented 7 years ago

I'v got money short and have no GPU computer by hand... and I dont want to cost days on trainning the model, and I dont have huge amount of pictures.

It seems not much precise in my test.. the input is the face I cuted from pictures. it both turn to 0 when I put in a 1year baby and a 70 year old lady.

net_def='../models/c9e99062283c719c03de/deploy_age.prototxt' net_mod='../models/c9e99062283c719c03de/age_net.caffemodel' net = caffe.Classifier(net_def,net_mod , image_dims=[256,256], mean=None, input_scale=None, raw_scale=255.0, channel_swap=[2,1,0]) inputs = [caffe.io.load_image(filename)] predictions = net.predict(inputs,0) print predictions.argmax()

9crk commented 7 years ago

or if you have any test imageset ? pls give it to me.

9crk commented 7 years ago

after loading the mean file,I got a right classification. you might need to declear this https://github.com/BVLC/caffe/wiki/Model-Zoo#models-for-age-and-gender-classification

mention that age estimate should load the mean file too.

btw, is the gender model load the same mean file too ?

GilLevi commented 7 years ago

Hi,

Yes, the gender model uses the same mean file.

Gil

9crk commented 7 years ago

thank you for reply. I got a bad result when using the caffemodel you give on googledrive. this is all my code:

net_def='../models/c9e99062283c719c03de/deploy_age.prototxt'
net_mod='../models/c9e99062283c719c03de/age_net.caffemodel'
net_mean='../models/c9e99062283c719c03de/mean.binaryproto'

proto_data = open(net_mean, "rb").read()
a = caffe.io.caffe_pb2.BlobProto.FromString(proto_data)
mean  = caffe.io.blobproto_to_array(a)[0]

net = caffe.Classifier(net_def,net_mod ,
            image_dims=[256,256], mean=mean,
            input_scale=None, raw_scale=255,
            channel_swap=[2,1,0])
def work(filename):
    inputs = [caffe.io.load_image(filename)]
    start = time.time()
    predictions = net.predict(inputs,0)
    print("Done in %.2f s." % (time.time() - start))
    print predictions
    return predictions.argmax()
if __name__ == '__main__':
    print work(sys.argv[1]);

once the man's face in the picture is smooth. then it turns to be the age belong to a child... I want to know if there is some certain condition when using this model. like the resolution

or is this caffemodel file is not well trained yet?

this image turns to be ![Uploading WX20170327-134034.png…]() 8-12year old.

9crk commented 7 years ago

![Uploading WX20170327-134034.png…]()

9crk commented 7 years ago

oh..I miss-clicked it...

GilLevi commented 7 years ago

Can you upload the image?

9crk commented 7 years ago

Its nice of you to reply..thanks!

wx20170327-142117 2x

wx20170327-135806

I got trouble to upload pictures to GitHub in China.....

as you see. the two picture is the same face. but one turns a male and one to female...

9crk commented 7 years ago

wx20170327-134034 and this is the face turned to be 8 years old..

GilLevi commented 7 years ago

When I ran it on my laptop I actually got 'Male" in both of those image. I also got that the bottom face is 8 years old. The model is not perfect, but given a larger training set, you can improve it.

gittigxuy commented 7 years ago

the accuracy seems to be not good.So,how can I improve the accuracy?Should I change the network structure? If I just increase the number of the train set picture.will the result be better?the last question is that if I increase the nunber of the train set picture,can I continue to use caffemodel you provide to me.how can I improve the accuracy rate of the caffemodel?