yangxy / GPEN

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SyntaxWarning: "is" with a literal

liudonghua123 opened this issue · comments

I tried to execute the code in GPEN.ipynb, however, I got the following warnings.

D:\code\python\GPEN>python app.py
C:\Users\Liu.D.H\AppData\Local\Programs\Python\Python310\lib\site-packages\torchvision\models\detection\anchor_utils.py:63: UserWarning: Failed to initialize NumPy: module compiled against API version 0x10 but this version of numpy is 0xf (Triggered internally at  ..\torch\csrc\utils\tensor_numpy.cpp:68.)
  device: torch.device = torch.device("cpu"),
D:\code\python\GPEN\align_faces.py:251: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if align_type is 'cv2_affine':
D:\code\python\GPEN\align_faces.py:254: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif align_type is 'affine':
C:\Users\Liu.D.H\AppData\Local\Programs\Python\Python310\lib\site-packages\torchvision\models\_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and will be removed in 0.15, please use 'weights' instead.
  warnings.warn(
C:\Users\Liu.D.H\AppData\Local\Programs\Python\Python310\lib\site-packages\torchvision\models\_utils.py:223: UserWarning: Arguments other than a weight enum or `None` for 'weights' are deprecated since 0.13 and will be removed in 0.15. The current behavior is equivalent to passing `weights=None`.
  warnings.warn(msg)
Traceback (most recent call last):
  File "D:\code\python\GPEN\app.py", line 58, in <module>
    img_out, orig_faces, enhanced_faces = faceenhancer.process(img, aligned=False)
  File "D:\code\python\GPEN\face_enhancement.py", line 69, in process
    facebs, landms = self.facedetector.detect(img)
  File "D:\code\python\GPEN\face_detect\retinaface_detection.py", line 74, in detect
    img = torch.from_numpy(img).unsqueeze(0)
RuntimeError: Numpy is not available

D:\code\python\GPEN>

I have solved RuntimeError: Numpy is not available problems by re-installing numpy. see pytorch/pytorch#78341 (comment).