question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to run age test.py

See original GitHub issue

Hello, How can I run the age/gender detection test.py file without using GPU? I get the following error regarding GPU value :

RuntimeError: simple_bind error. Arguments: data: (1, 3, 112, 112) [14:32:59] C:\Jenkins\workspace\mxnet-tag\mxnet\src\storage\storage.cc:143: Compile with USE_CUDA=1 to enable GPU usage

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
hopeaicommented, Apr 12, 2019

Hi, You can change set line 46 in face_model.py to elif args.gpu==-1: and pass -1 for --gpu while running the code. So, mxnet will run on CPU. python test.py --gpu -1

0reactions
JAYM629commented, Sep 22, 2019

Hi @ImOmid , thanks for the reply. There’s something I couldn’t understand in the solution you provided. In face_model.py file the lines 45-46 are:

45    self.args = args
46   ctx = mx.gpu(args.gpu)

How do I add this line “elif args.gpu==-1:” ? I would appreciate it if you could explain more specifically what to change. Based on my understanding I tried the below 2 ways but both failed. way 1:

self.args = args
if args.gpu==-1:
  ctx = mx.gpu(args.gpu)

resulted error:

  File "C:\Users\malabdou\Documents\Python\PyProj\GenderAge\X1insightface-master\deploy\helper.py", line 156, in detect_first_stage
    output = net.predict(input_buf)
  File "C:\Users\malabdou\Anaconda3\envs\py5cv-33\lib\site-packages\mxnet\model.py", line 699, in predict
    self._init_predictor(data_shapes, type_dict)
  File "C:\Users\malabdou\Anaconda3\envs\py5cv-33\lib\site-packages\mxnet\model.py", line 622, in _init_predictor
    self.ctx[0], grad_req='null', type_dict=type_dict, **shapes)
  File "C:\Users\malabdou\Anaconda3\envs\py5cv-33\lib\site-packages\mxnet\symbol\symbol.py", line 1529, in simple_bind
    raise RuntimeError(error_msg)
RuntimeError: simple_bind error. Arguments:
conv2_weight: (16, 10, 3, 3)
conv2_bias: (16,)
conv4_2_bias: (4,)
prelu1_gamma: (10,)
conv3_bias: (32,)
data: (1, 3, 68, 68)
conv4_1_bias: (2,)
prelu3_gamma: (32,)
conv4_2_weight: (4, 32, 1, 1)
conv3_weight: (32, 16, 3, 3)
conv1_weight: (10, 3, 3, 3)
prelu2_gamma: (16,)
conv1_bias: (10,)
conv4_1_weight: (2, 32, 1, 1)
[15:59:03] C:\Jenkins\workspace\mxnet-tag\mxnet\include\mxnet/base.h:299: Please compile with CUDA enabled for cuda features

2nd Way:

    self.args = args
    if args.gpu==-1: 
      ctx = mx.cpu()
    else:
      ctx = mx.gpu(args.gpu)

resulted error:

Traceback (most recent call last):
  File "test.py", line 23, in <module>
    gender, age = model.get_ga(img)
  File "C:\Users\malabdou\Documents\Python\PyProj\GenderAge\X1insightface-master\deploy\face_model.py", line 107, in get_ga
    self.ga_model.forward(db, is_train=False)
AttributeError: 'NoneType' object has no attribute 'forward'

Have you solve this problem? I also meet this problem

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python How to Calculate Age from Birthdate - codingem.com
To calculate age in Python, subtract today's year from the birthdate's year. Then subtract one if today precedes the birthdate's month/day.
Read more >
How to Create an Age Checker with Python Programming
Here I will be creating a program with Python that will check a user's age to see if the user is over the...
Read more >
unit testing - Writing a unittest - Stack Overflow
The first file is called Age.py which store the function. import datetime def age(birthday): todays = datetime.date(2001, ...
Read more >
Age Detection using OpenCV in Python
Learn how to predict someone's age from his front face picture using OpenCV ... pip install opencv-python numpy ... Let's test the code...
Read more >
AGE/GENDER PRT STANDARDS MALES - Careers
MALES: AGE 20 TO 24 YEARS. PERFORMANCE CATEGORY ... RUN. Outstanding ... (TEST SITE ELEVATION GREATER THAN 5,000 FT ABOVE SEA LEVEL). MALES:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found