Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it easier to do transfer learning by adding --freeze as an option #3685

Closed
wants to merge 2 commits into from

Conversation

timstokman
Copy link
Contributor

@timstokman timstokman commented Jun 18, 2021

I've been doing some experiments with transfer learning. This small tweak makes it little easier to do transfer learning. It supports the most common use-case for freezing layers: freezing layers up to a point. It's still possible to manually edit the freeze array if more control is required over what exactly to freeze.

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Improving layer freezing options in YOLOv5 training.

πŸ“Š Key Changes

  • --freeze argument added to parse_opt(), allowing users to specify the last layer number to freeze during training.
  • Model parameter freezing logic updated in train() to handle the new --freeze option.
  • Logging enhancement to display which model layers are being frozen or not during initialization.

🎯 Purpose & Impact

  • Purpose: This change allows for more precise control over which layers of the model are frozen, which can be beneficial for transfer learning or fine-tuning models where certain layers' weights are desired to remain unchanged.
  • Impact: Users now have the flexibility to easily freeze a specific range of layers by providing a layer number, potentially improving training times and preserving pre-trained feature detection capabilities in earlier layers. This can be especially useful when working with limited computational resources or wanting to maintain certain aspects of a pre-trained model.

Kubi94
Kubi94 previously approved these changes Jul 6, 2021
@timstokman
Copy link
Contributor Author

Had some merge conflicts, so I fixed those

@IneovaAI
Copy link
Contributor

Hi please have a look at my implementation and tell me what you think. IneovaAI:patch-1 #4238

@glenn-jocher
Copy link
Member

/rebase

@glenn-jocher
Copy link
Member

@timstokman @IneovaAI closing this PR and merging --freeze PR #4238. Thank you for your contributions to YOLOv5 πŸš€ and Vision AI ⭐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants