Coder Social home page Coder Social logo

Comments (3)

glenn-jocher avatar glenn-jocher commented on May 19, 2024

Hello! 😊

Absolutely, you can achieve this by tweaking the dataset loading part of the code, specifically in the datasets.py file. Before your data is passed into the training loop, you can adjust the class indices on the fly. Here's a quick snippet to give you an idea:

for label in labels:
    if label[0] == 1:  # Change vans to cars
        label[0] = 0
    elif label[0] == 3 or label[0] == 4:  # Combine people and pedestrian classes
        label[0] = 2
    # Adjust indices for other classes accordingly

Place this snippet right after the labels for your images are loaded and before they are used for training. This way, you modify the annotations in memory without altering your dataset locally.

Remember, changes made this way are not permanent and will reset each time the data is loaded for training. Ensure this adjustment aligns with your data handling policies and practices.

Happy coding! 😊

from yolov5.

killich8 avatar killich8 commented on May 19, 2024

Hello @glenn-jocher

Thank you very much for your response.
I can't find the file datasets.py

from yolov5.

glenn-jocher avatar glenn-jocher commented on May 19, 2024

Hello! 😊

My apologies for any confusion. The correct file to look for modifications would be in your YOLOv5 setup; it's likely named slightly differently or the functionality could be encapsulated somewhere within the data loading and preprocessing mechanisms.

For adjusting labels in YOLOv5, you'd typically look into the dataset loading section, which as of the latest versions, involves modifying the behavior within the load function that pertains to dataset handling, potentially in files like load.py or similar.

If you're navigating the latest structure and still can't locate the precise spot for this adjustment, I'd recommend reviewing the documentation or exploring the source where datasets are loaded and preprocessed. Understanding how data flows through these starting points will give you a clear indication of where to implement the class index adjustments.

Keep the exploration going, and you're doing great! 😊

from yolov5.

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.