GithubHelp home page GithubHelp logo

Adding an external feature input to head (concatenate with first convolution layers of head) of YOLOv8 object detector and finetune for custom data. about ultralytics HOT 4 OPEN

billalkuet07 avatar billalkuet07 commented on June 4, 2024
Adding an external feature input to head (concatenate with first convolution layers of head) of YOLOv8 object detector and finetune for custom data.

from ultralytics.

Comments (4)

github-actions avatar github-actions commented on June 4, 2024

πŸ‘‹ Hello @billalkuet07, thank you for your interest in Ultralytics YOLOv8 πŸš€! We recommend a visit to the Docs for new users where you can find many Python and CLI usage examples and where many of the most common questions may already be answered.

If this is a πŸ› Bug Report, please provide a minimum reproducible example to help us debug it.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results.

Join the vibrant Ultralytics Discord 🎧 community for real-time conversations and collaborations. This platform offers a perfect space to inquire, showcase your work, and connect with fellow Ultralytics users.

Install

Pip install the ultralytics package including all requirements in a Python>=3.8 environment with PyTorch>=1.8.

pip install ultralytics

Environments

YOLOv8 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

Ultralytics CI

If this badge is green, all Ultralytics CI tests are currently passing. CI tests verify correct operation of all YOLOv8 Modes and Tasks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

from ultralytics.

glenn-jocher avatar glenn-jocher commented on June 4, 2024

Hello! It's great to hear about your plans to experiment with enhancing YOLOv8 by adding an external feature input. For incorporating additional inputs into the model's architecture and tuning it for custom data, both options you've considered have their merits. However, the second option might give you a more straightforward path by leveraging the existing infrastructure of YOLOv8 for data handling, training, and testing workflows.

Here's a brief guide on how you might proceed with option 2:

  • Model Architecture Modification: You'll likely need to adjust the architecture to concatenate the external features. Look into the .yaml file defining the model structure, possibly modifying it to introduce your changes at specified layers.
  • Custom Dataset Loader: Since you have additional numerical data alongside the YOLO formatted annotations, you would need to modify the dataset loading mechanism. Extending datasets.py to incorporate the loading and preprocessing of your additional inputs will be required.
  • Finetuning: Utilize the pre-trained weights for YOLOv8 and commence training with your custom dataset ensuring your modified data loader is effectively used. The training script, possibly train.py, may need minimal adjustments here, mostly to ensure it properly calls your modified dataset loader.

Here's a very basic example snippet illustrating how you could potentially modify the dataset loader to include your external features:

# Pseudo-code for custom data loading with external features

class CustomDataset(Dataset):
    def __init__(self, path, img_size=640, augment=False, ...):
        self.path = path
        ...
        # Load your additional data here
        self.external_features = load_external_features(path)

    def __getitem__(self, index):
        ...
        # Normal image loading
        img, labels = load_image_and_labels()

        # Example to get the corresponding external features for the image
        ext_features = self.external_features[index]

        return img, labels, ext_features

This just scratches the surface, but it should give you a starting point. Modifications in models/common.py might also become necessary, depending on how you plan to integrate the external features into the YOLOv8 architecture.

I recommend deeply studying the specific files (models/yolo.py, utils/datasets.py, etc.) to better understand where and how to implement your changes efficiently.

Kudos on taking on such a project, and we're excited to see what enhancements you can bring to YOLOv8! Remember, experimenting is keyβ€”don't hesitate to test different approaches to find what works best for your needs. Good luck! πŸš€

from ultralytics.

billalkuet07 avatar billalkuet07 commented on June 4, 2024

Thanks for your prompt response. This is very helpful.

from ultralytics.

glenn-jocher avatar glenn-jocher commented on June 4, 2024

You're welcome! I'm glad to hear that you found the information useful. If you have any more questions or need further clarification as you progress with your project, don't hesitate to reach out. Happy coding! 😊

from ultralytics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.