TropComplique / mtcnn-pytorch

Joint Face Detection and Alignment using Multi-task Cascaded Convolutional Networks
MIT License
659 stars 161 forks source link

AttributeError: 'PNet' object has no attribute 'named_parameters' #8

Closed alexge233 closed 6 years ago

alexge233 commented 6 years ago
Python 3.5.2 (default, Nov 23 2017, 16:37:01) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from src import detect_faces
>>> from PIL import Image
>>> image = Image.open('images/example.png')
>>> bounding_boxes, landmarks = detect_faces(images)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'images' is not defined
>>> bounding_boxes, landmarks = detect_faces(image)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/mtcnn/src/detector.py", line 25, in detect_faces
    pnet = PNet()
  File "/home/ubuntu/mtcnn/src/get_nets.py", line 56, in __init__
    for n, p in self.named_parameters():
  File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 235, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'PNet' object has no attribute 'named_parameters'

I can see at get_nets.py line #56 the offending code, and I can see that PyTorch supports that function, so it seems a bit bizarre to me. I have PyTorch 0.1.10 on a Jetson TX2.

alexge233 commented 6 years ago

Nevermind I saw that you require min version of PyTorch 0.2 and tried with 0.5 and it works fine.