Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install failed: ModuleNotFoundError: No module named 'age_and_gender' #4

Open
Nomia opened this issue Jul 13, 2021 · 1 comment
Open

Comments

@Nomia
Copy link

Nomia commented Jul 13, 2021

Here is a simple colab installation steps to reproduce(just run all cells):
https://colab.research.google.com/drive/1qIO7nJinqQpZuL3Hp7jB-iI6XD3jSzBr?usp=sharing

Failed at last step:
image

@lawleenaja
Copy link

There is probably some path variable that you can set up.. but a simple workaround is to run the following command on colab

%cd /content/age-and-gender
!cp -r /root/.local/lib/python3.8/site-packages/age_and_gender-1.0.1-py3.8-linux-x86_64.egg/* .

you will have to find out where to copy from based upon the output of the age_and_gender build step... for example...

creating /root/.local/lib/python3.8/site-packages/age_and_gender-1.0.1-py3.8-linux-x86_64.egg
Extracting age_and_gender-1.0.1-py3.8-linux-x86_64.egg to /root/.local/lib/python3.8/site-packages

afterwards... results are as follows:

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
%cd /content/age-and-gender
from age_and_gender import AgeAndGender
from PIL import Image

data = AgeAndGender()
data.load_shape_predictor('/content/dlib-models/shape_predictor_5_face_landmarks.dat')
data.load_dnn_gender_classifier('/content/dlib-models/gender-classifier/dnn_gender_classifier_v1.dat')
data.load_dnn_age_predictor('/content/dlib-models/age-predictor/dnn_age_predictor_v1.dat')

image = Image.open('/content/age-and-gender/example/test-image.jpg').convert("RGB")
result = data.predict(image)

print(result)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[{'gender': {'value': 'female', 'confidence': 100}, 'age': {'value': 26, 'confidence': 95}, 'face': [419, 266, 506, 352]}, {'gender': {'value': 'male', 'confidence': 99}, 'age': {'value': 60, 'confidence': 74}, 'face': [780, 112, 883, 215]}, {'gender': {'value': 'male', 'confidence': 99}, 'age': {'value': 19, 'confidence': 73}, 'face': [595, 135, 699, 238]}, {'gender': {'value': 'female', 'confidence': 99}, 'age': {'value': 62, 'confidence': 61}, 'face': [227, 198, 314, 285]}, {'gender': {'value': 'female', 'confidence': 100}, 'age': {'value': 24, 'confidence': 66}, 'face': [352, 544, 438, 630]}]
result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants