Code Monkey home page Code Monkey logo

Comments (4)

UltralyticsAssistant avatar UltralyticsAssistant commented on May 24, 2024

@davidemerolla hello!

Great to hear that your YOLOv8n model is performing well! To change the class names for inference without retraining, you can simply modify the names list in the *.yaml file that corresponds to your model's classes. This file is used during inference to map class IDs to class names. Just update the names there, and your best.pt model will output the new class names during inference.

Regarding using your best.pt file with the Ultralytics HUB app, you can upload your model and the modified *.yaml file directly to the app. The HUB Docs provide detailed instructions on how to do this.

If you have any further questions or need more assistance, feel free to ask. Happy inferencing! 😊

from hub.

github-actions avatar github-actions commented on May 24, 2024

👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.

For additional resources and information, please see the links below:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLO 🚀 and Vision AI ⭐

from hub.

BitCode-in avatar BitCode-in commented on May 24, 2024

Hello! You can rename a class in this way.

import torch
from ultralytics import YOLO

model = torch.load("best.pt", map_location="cpu")

model["model"].names[0] = "New name"

torch.save(model, "save_best.pt")

model = YOLO(r"save_best.pt")
print(model.names)

https://github.com/BitCode-in/rename_torch_or_yolov_names/tree/main

from hub.

UltralyticsAssistant avatar UltralyticsAssistant commented on May 24, 2024

@BitCode-in hello! While the code snippet you shared outlines a method to rename class names in a PyTorch model file, it's important to note that directly manipulating .pt files should be done with caution and understanding of the model structure. Also, we typically recommend making name changes in the *.yaml file for simplicity and to avoid potential issues with model integrity.

However, your approach provides an alternative for those comfortable with PyTorch and direct model manipulation. Just be sure to verify the model's performance and output accuracy after such changes.

Happy to see community members sharing their solutions! If there's anything specific you're trying to achieve or any further questions, feel free to ask. 🌟

from hub.

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.