xwjabc / hed

A PyTorch reimplementation of Holistically-Nested Edge Detection
170 stars 42 forks source link

How can I use a pretrained torch model in .pth or .pkl? #24

Closed rrryan2016 closed 3 years ago

rrryan2016 commented 4 years ago

Thanks for your good jobs and nice sharing.

I just wonder how can I use the pretrained model by Pytorch instead of caffe.

Is there any existing job?

Thanks again.

xwjabc commented 4 years ago

Hi, We also provide the pretrained PyTorch model. See below in README.md:

python hed.py --checkpoint ./data/hed_checkpoint.pt --output ./output-mypretrain --test

You can refer to hed.py for the loading procedure of pretrained PyTorch model.

rrryan2016 commented 4 years ago

Hi, We also provide the pretrained PyTorch model. See below in README.md:

python hed.py --checkpoint ./data/hed_checkpoint.pt --output ./output-mypretrain --test

You can refer to hed.py for the loading procedure of pretrained PyTorch model.

Feel so sorry. It is my fault to miss the message in README :P

rrryan2016 commented 4 years ago

python hed.py --checkpoint ./data/hed_checkpoint.pt --output ./output-mypretrain --test

Hey, feel sorry to disturb again.

When I am trying to use my own pretrained VGG16 model, I feels like I may misunderstanding the paper and codes.

The pth file I dumped into the code (by '--checkpoint') is a VGG16 pretrained on ImageNet, so I couldn't get the param of score_dsn_1-5 and score_final (in my understanding, score_dsn_1-5 and score_final are in the structure of HED and nothing to do with VGG16, am I right?)

BTW, have you ever released the code to get hed_checkpoint.pt, or what can I do now.

Thanks a lot. It really helps.

xwjabc commented 4 years ago

python hed.py --checkpoint ./data/hed_checkpoint.pt --output ./output-mypretrain --test

Hey, feel sorry to disturb again.

When I am trying to use my own pretrained VGG16 model, I feels like I may misunderstanding the paper and codes.

The pth file I dumped into the code (by '--checkpoint') is a VGG16 pretrained on ImageNet, so I couldn't get the param of score_dsn_1-5 and score_final (in my understanding, score_dsn_1-5 and score_final are in the structure of HED and nothing to do with VGG16, am I right?)

BTW, have you ever released the code to get hed_checkpoint.pt, or what can I do now.

Thanks a lot. It really helps.

  1. Yes, score_dsn_1-5 and score_final are in the structure of HED and not in VGG-16.

  2. The pretrained checkpoint is in the data file: https://cseweb.ucsd.edu/~weijian/static/datasets/hed/hed-data.tar