PingoLH / FCHarDNet

Fully Convolutional HarDNet for Segmentation in Pytorch
MIT License
195 stars 52 forks source link

validate problem #37

Closed ASONG0506 closed 4 years ago

ASONG0506 commented 4 years ago

Hi, when I run the validate.py file using this commond

python validate.py --config=configs/hardnet.yml --model_path=./weights/hardnet70_cityscapes_model.pkl

I got this error, How to fix it, Thank you!

validate.py:237: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  cfg = yaml.load(fp)
Found 500 val images
Traceback (most recent call last):
  File "validate.py", line 239, in <module>
    validate(cfg, args)
  File "validate.py", line 56, in validate
    model.v2_transform(trt=False)
  File "/home/cjs/trunk_ws/segmentation/env_hardnet/FCHarDNet/ptsemseg/models/hardnet.py", line 327, in v2_transform
    self.base[i].transform(blk, trt)
  File "/home/cjs/trunk_ws/segmentation/env_hardnet/FCHarDNet/ptsemseg/models/hardnet.py", line 96, in transform
    self.conv_layers[i].weight[0:part[0], :, :,:] = w_src[:, 0:in_ch, :,:]
RuntimeError: a leaf Variable that requires grad has been used in an in-place operation.
PingoLH commented 4 years ago

Hi, please try: with torch.no_grad(): model.v2_transform(trt=False)

ASONG0506 commented 4 years ago

ok, get it , I made it by commenting this line in validate.py:

    # model.v2_transform(trt=False)
ASONG0506 commented 4 years ago

Hi, please try: with torch.no_grad(): model.v2_transform(trt=False)

thank you, it works.