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

ValueError: Variable pnet/conv1/weights already exists #15

Closed
ylmzkaan opened this issue Jul 22, 2018 · 3 comments
Closed

ValueError: Variable pnet/conv1/weights already exists #15

ylmzkaan opened this issue Jul 22, 2018 · 3 comments
Assignees

Comments

@ylmzkaan
Copy link

ylmzkaan commented Jul 22, 2018

When I run the code, I get the following error. I would appreciate if someone helped me.
I have:
python 3.6
mtcnn 0.0.7
tensorflow 1.9.0 running on CPU
All installed with pip

File "<ipython-input-1-59d1cc96181f>", line 1, in <module>
    runfile('D:/FaceRecognition/Main.py', wdir='D:/FaceRecognition')

  File "C:\Users\kaany\Anaconda3\envs\facerec\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 678, in runfile
    execfile(filename, namespace)

  File "C:\Users\kaany\Anaconda3\envs\facerec\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 106, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "D:/FaceRecognition/Main.py", line 32, in <module>
    main()

  File "D:/FaceRecognition/Main.py", line 19, in main
    addNewFace()

  File "D:\FaceRecognition\Engine.py", line 30, in addNewFace
    detector = MTCNN()

  File "C:\Users\kaany\Anaconda3\envs\facerec\lib\site-packages\mtcnn\mtcnn.py", line 193, in __init__
    self.__pnet = PNet(self.__session, False)

  File "C:\Users\kaany\Anaconda3\envs\facerec\lib\site-packages\mtcnn\network.py", line 44, in __init__
    self._config()

  File "C:\Users\kaany\Anaconda3\envs\facerec\lib\site-packages\mtcnn\mtcnn.py", line 55, in _config
    padding='VALID', relu=False)

  File "C:\Users\kaany\Anaconda3\envs\facerec\lib\site-packages\mtcnn\layer_factory.py", line 123, in new_conv
    kernel = self.__make_var('weights', shape=[kernel_size[1], kernel_size[0], channels_input // group, channels_output])

  File "C:\Users\kaany\Anaconda3\envs\facerec\lib\site-packages\mtcnn\layer_factory.py", line 78, in __make_var
    return tf.get_variable(name, shape, trainable=self.__network.is_trainable())

  File "C:\Users\kaany\Anaconda3\envs\facerec\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 1328, in get_variable
    constraint=constraint)

  File "C:\Users\kaany\Anaconda3\envs\facerec\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 1090, in get_variable
    constraint=constraint)

  File "C:\Users\kaany\Anaconda3\envs\facerec\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 435, in get_variable
    constraint=constraint)

  File "C:\Users\kaany\Anaconda3\envs\facerec\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 404, in _true_getter
    use_resource=use_resource, constraint=constraint)

  File "C:\Users\kaany\Anaconda3\envs\facerec\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 743, in _get_single_variable
    name, "".join(traceback.format_list(tb))))

ValueError: Variable pnet/conv1/weights already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope? Originally defined at:

  File "C:\Users\kaany\Anaconda3\envs\facerec\lib\site-packages\tensorflow\python\framework\ops.py", line 1740, in __init__
    self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access
  File "C:\Users\kaany\Anaconda3\envs\facerec\lib\site-packages\tensorflow\python\framework\ops.py", line 3414, in create_op
    op_def=op_def)
  File "C:\Users\kaany\Anaconda3\envs\facerec\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
@ylmzkaan ylmzkaan changed the title ValueError ValueError: Variable pnet/conv1/weights already exists Jul 22, 2018
@lazem
Copy link

lazem commented Jul 23, 2018

I have the same issue:

ValueError: Variable pnet/conv1/weights already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope? Originally defined at:

File "/root/anaconda3/lib/python3.6/site-packages/mtcnn/layer_factory.py", line 78, in __make_var
return tf.get_variable(name, shape, trainable=self.__network.is_trainable())
File "/root/anaconda3/lib/python3.6/site-packages/mtcnn/layer_factory.py", line 123, in new_conv
kernel = self.__make_var('weights', shape=[kernel_size[1], kernel_size[0], channels_input // group, channels_output])
File "/root/anaconda3/lib/python3.6/site-packages/mtcnn/mtcnn.py", line 55, in _config
padding='VALID', relu=False)

@ipazc ipazc self-assigned this Jul 23, 2018
@ipazc
Copy link
Owner

ipazc commented Jul 23, 2018

This issue was already solved, but not pushed as a new version into PyPi. The package have just been updated,

$ pip3 install --upgrade mtcnn

@ipazc
Copy link
Owner

ipazc commented Jul 23, 2018

Related issues #7 and #6 .

@ipazc ipazc closed this as completed Jul 23, 2018
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

3 participants