PeterL1n / BackgroundMattingV2

Real-Time High-Resolution Background Matting
MIT License
6.81k stars 950 forks source link

solve the undefined nn error #18

Closed jinzishuai closed 3 years ago

jinzishuai commented 3 years ago

it solves the problem reported in https://github.com/jinzishuai/BackgroundMattingV2/issues/3#issuecomment-752304242

(bgm2) C:\ZeroBox\src\BackgroundMattingV2> python inference_images.py --model-type mattingrefine --model-backbone resnet101 --model-checkpoint PyTorch\pytorch_resnet101.pth --images-src Group15BOriginals --images-bgr Group15BBackground --output-dir output1 --output-type com fgr pha  --model-refine-mode full
Traceback (most recent call last):
  File "inference_images.py", line 97, in <module>
    HomographicAlignment() if args.preprocess_alignment else A.PairApply(nn.Identity()),
NameError: name 'nn' is not defined
PeterL1n commented 3 years ago

Good catch.

Can you change it to from torch import nn notation and put it before line 25 in sorted order?

PeterL1n commented 3 years ago

I actually added it myself. I will close this pull request. Thank you still!