question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Transfer Learning

See original GitHub issue

Code version (Git Hash) and PyTorch version

PyTorch: 1.0.1

Dataset used

Self-generated from youtube - similar to Kinetics-skeleton

Expected behavior

Being able to load pretrained weights from your kinetics-st_gcn.pt, freeze them, and only train new layers

Actual behavior

Able to load pretrained weights, but not able to freeze them.

Steps to reproduce the behavior

Add flag ‘–weights’, with path to the aformentioned pretrained pytorch model

Other comments

I am currently able to load the weights from your pretrained model. During this operation I am presented with this output: image Which I am interpreting to being the layers in the new model, which are not present in the old model, and therefore not getting its weights from the old model.

What I am wondering is how would I go about to freeze all layers, except for those in the output above? I.e. how can i freeze all pretrained layers, and only train the new layers?

I was thinking I could do it using torch’s .apply(), but I am unable to find a similarity between the names in the output above, and the names being used in your weights_init(m), i.e. finding a way to map st_gcn_networks.4.residual.1.num_batches_tracked to either Conv1D, Conv2d, etc.

Crossing my fingers that you are able to assist me 😃

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13

github_iconTop GitHub Comments

1reaction
Sindreedelangecommented, Mar 19, 2019

@645704621, yes - you can check out my forked repo: https://github.com/Sindreedelange/st-gcn/blob/master/torchlight/torchlight/io.py, lines 101 - 114. image Disclaimer: Needs refactoring, but only POC.

1reaction
yjxiongcommented, Mar 1, 2019

@Sindreedelange

When you load the network you will have the model creation code where you can find the param. You can also traverse the network layers by recursively using module.chidren() and find the layer you want.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Gentle Introduction to Transfer Learning for Deep Learning
Transfer learning is the improvement of learning in a new task through the transfer of knowledge from a related task that has already...
Read more >
Transfer learning - Wikipedia
Transfer learning (TL) is a research problem in machine learning (ML) that focuses on storing knowledge gained while solving one problem and applying...
Read more >
What Is Transfer Learning? A Guide for Deep Learning | Built In
Transfer learning, used in machine learning, is the reuse of a pre-trained model on a new problem. In transfer learning, a machine exploits...
Read more >
Transfer Learning - Machine Learning's Next Frontier
This blog post gives an overview of transfer learning, outlines why it is important, and presents applications and practical methods.
Read more >
A Practical Tutorial With Examples for Images and Text in Keras
Transfer learning is about leveraging feature representations from a pre-trained model, so you don't have to train a new model from scratch. The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found