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

Remove detection head #13317

Open
1 task done
Neloy262 opened this issue Sep 16, 2024 · 2 comments
Open
1 task done

Remove detection head #13317

Neloy262 opened this issue Sep 16, 2024 · 2 comments
Labels
question Further information is requested

Comments

@Neloy262
Copy link

Search before asking

Question

I have trained a yolov5n model on a custom dataset. Now i want to remove the detection head so i can get the features immediately before the detection head. How might I do this?

Additional

No response

@Neloy262 Neloy262 added the question Further information is requested label Sep 16, 2024
@UltralyticsAssistant
Copy link
Member

👋 Hello @Neloy262, thank you for reaching out and for using YOLOv5 🚀! This is an automated response, and an Ultralytics engineer will assist you soon.

For now, I recommend starting with our ⭐️ Tutorials to explore various tasks related to custom model training and configuration.

For your question about modifying the model architecture, including removing parts like the detection head, you might want to dive into our Custom Data Training guides.

If this is related to a 🐛 Bug, please ensure you provide a minimum reproducible example to help us debug.

For custom training configurations ❓, please include more details where possible, such as your model setup, dataset examples, and any modifications applied.

Requirements

Make sure your environment meets our requirements:

Python>=3.8.0 and all requirements.txt installed. You can start by running:

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

Helpful Environments

YOLOv5 can be developed in any verified environment:

  • Notebooks with free GPUs: Run on Gradient Open In Colab
  • Cloud Providers: Check our GCP and AWS guides
  • Docker Image: See our Docker Guide Docker Pulls

Stay Updated

YOLOv5 CI
The green badge indicates passing CI tests for operations like training and validation.

Discover YOLOv8 🚀

You can also explore our latest model YOLOv8, optimized for a range of tasks and improved performance. Get started by installing:

pip install ultralytics

Check out our YOLOv8 Docs for more.

Happy coding! 😊

@glenn-jocher
Copy link
Member

@Neloy262 to remove the detection head and access features before it, you can modify the model by excluding the final layers responsible for detection. You can achieve this by editing the model's architecture in the models/yolov5n.yaml file, removing or commenting out the Detect module. Then, load the modified model for inference. For detailed guidance, refer to the YOLOv5 architecture documentation.

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

No branches or pull requests

3 participants