Open Jinnrry opened 6 years ago
At which point does it fail? What is the exact error message? Which version worked? To which version did you update?
As it is, your post does not contain any information that could let us help you. Please review the guidelines for submitting issues and update your post with relevant information.
Thank you very much ! About a half year,It's work. It not work on the lastest caffe. The error point the file 95 line. And error is
' float' object cannot be interpreted as an integer'
def getGender(img):
input_image = caffe.io.load_image(img)
prediction = gender_net.predict([input_image]) #here get error
return gender_list[prediction[0].argmax()]
This is code
This code works good for me on Python 2.7 as well as 3.4, I am unable to try 3.5 at the moment but I don't suppose it would be very different.
Can you track down what code has changed when you updated?
PS: Is this the exact code you run? Because the print
line is not even valid Python3.
@Noiredd Thank you! My code is python3 , Here error because I copy from Age and Gender Classification Using Convolutional Neural Networks - Demo and I don't amend print
. I will try python2 later.
@jiangwei1995910 Did you fix this?
@aeeladawy This is my new code.
def getGender(img):
input_image = caffe.io.load_image(img)
net.blobs['data'].data[...] = transformer.preprocess('data', input_image)
out = net.forward()
out_prob = out['prob'][0]
index = out_prob.argmax()
return gender_list[index]
When I run Age and Gender Classification Using Convolutional Neural Networks - Demo ,I get a error 'float' object cannot be interpreted as an integer'. It's work before update.
Exception Location: /usr/lib/python3/dist-packages/caffe/classifier.py in predict,line 95
Your system configuration
Operating system: Ubuntu 17.10 Compiler: CUDA version (if applicable): CUDNN version (if applicable): BLAS: Python or MATLAB version (for pycaffe and matcaffe respectively):python 3.5