Giter VIP home page Giter VIP logo

Comments (8)

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

👋 Hello @Hestinorwu, 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.

HduHestin avatar HduHestin commented on August 24, 2024

My problem is that i hope use "from ultralytics import YOLO" to load two different model.or use 'import YOLOv10'. because the precess and postcess of ultralytics is convenient.I can eastily get results.

from ultralytics.

glenn-jocher avatar glenn-jocher commented on August 24, 2024

Hello @Hestinorwu,

Thank you for reaching out! It's great to hear that you find the Ultralytics YOLO models convenient for your tasks. Let's address the issue you're encountering with loading both YOLOv9 and YOLOv10 models simultaneously.

The error you're seeing, AttributeError: Can't get attribute 'YOLOv10DetectionModel', suggests that there might be a compatibility issue with the specific versions of the models and the ultralytics package you are using.

Here are a few steps to help resolve this:

  1. Ensure Latest Versions: First, make sure you are using the latest versions of both torch and ultralytics. You can upgrade them using the following commands:

    pip install --upgrade torch ultralytics
  2. Separate Environments: If the issue persists, it might be due to the fact that YOLOv9 and YOLOv10 models require different versions of the ultralytics package. In such cases, using separate virtual environments for each model can be a good solution. Here’s how you can set it up:

    • Create Virtual Environments:
      # Create a virtual environment for YOLOv9
      python -m venv yolov9_env
      # Activate the environment
      yolov9_env\Scripts\activate  # On Windows
      source yolov9_env/bin/activate  # On macOS/Linux
      # Install the required packages
      pip install ultralytics==<specific_version_for_v9> torch
      
      # Create a virtual environment for YOLOv10
      python -m venv yolov10_env
      # Activate the environment
      yolov10_env\Scripts\activate  # On Windows
      source yolov10_env/bin/activate  # On macOS/Linux
      # Install the required packages
      pip install ultralytics==<specific_version_for_v10> torch
  3. Example Code: Here’s an example of how you can load and use both models in separate environments:

    • YOLOv9 Environment:

      # Activate YOLOv9 environment
      yolov9_env\Scripts\activate  # On Windows
      source yolov9_env/bin/activate  # On macOS/Linux
      
      from ultralytics import YOLO
      
      v9_model = YOLO('yolov9c.pt')
      v9_results = v9_model('path/to/image.jpg')
      print(v9_results)
    • YOLOv10 Environment:

      # Activate YOLOv10 environment
      yolov10_env\Scripts\activate  # On Windows
      source yolov10_env/bin/activate  # On macOS/Linux
      
      from ultralytics import YOLO
      
      v10_model = YOLO('yolov10m_handheld_20240611.pt')
      v10_results = v10_model('path/to/image.jpg')
      print(v10_results)

By using separate environments, you can ensure that each model has the appropriate dependencies and versions without conflicts.

If you continue to face issues, please provide a minimum reproducible example of your code so we can further investigate. You can refer to our Minimum Reproducible Example Guide for more details.

I hope this helps! If you have any further questions, feel free to ask. 😊

from ultralytics.

HduHestin avatar HduHestin commented on August 24, 2024

Thanks a lot!!! i try to download the folder'ultralytics' of yolov10,and use from ultralytics import yolov10 and successfully adapt it to my project. and i realize that v9 and v10 need different environment.So if i still to use yolov9 at the same time,i need to seperate both to exec each . Thanks again!

from ultralytics.

glenn-jocher avatar glenn-jocher commented on August 24, 2024

Hello @Hestinorwu,

You're very welcome! I'm glad to hear that you successfully adapted YOLOv10 to your project. 🎉

Indeed, separating the environments for YOLOv9 and YOLOv10 is a practical approach to avoid any compatibility issues. This way, you can ensure that each model operates with the appropriate dependencies and versions.

If you have any further questions or run into any issues, feel free to reach out. We're here to help! 😊

Happy coding and best of luck with your project!

from ultralytics.

HduHestin avatar HduHestin commented on August 24, 2024

Thanks for your reply,now i encounter a new problem. How to use Yolov9 cli to train data. it seems that in https://github.com/WongKinYiu/yolov9 the usage of cli is not supported.
Only usage like below:
python train_dual.py --workers 8 --device 0 --batch 16 --data data/coco.yaml --img 640 --cfg models/detect/yolov9-c.yaml --weights '' --name yolov9-c --hyp hyp.scratch-high.yaml --min-items 0 --epochs 500 --close-mosaic 15

image

from ultralytics.

glenn-jocher avatar glenn-jocher commented on August 24, 2024

Hello @HduHestin,

Thank you for your question! It appears that the YOLOv9 repository you mentioned (WongKinYiu/yolov9) does not support CLI commands in the same way as Ultralytics YOLO models. Instead, it uses Python scripts for training.

To train a YOLOv9 model using the provided script, you can follow the example command you mentioned:

python train_dual.py --workers 8 --device 0 --batch 16 --data data/coco.yaml --img 640 --cfg models/detect/yolov9-c.yaml --weights '' --name yolov9-c --hyp hyp.scratch-high.yaml --min-items 0 --epochs 500 --close-mosaic 15

Here's a brief breakdown of the command:

  • --workers 8: Number of data loading workers.
  • --device 0: GPU device to use.
  • --batch 16: Batch size.
  • --data data/coco.yaml: Path to the dataset configuration file.
  • --img 640: Image size.
  • --cfg models/detect/yolov9-c.yaml: Path to the model configuration file.
  • --weights '': Path to the weights file (empty string for training from scratch).
  • --name yolov9-c: Name of the training run.
  • --hyp hyp.scratch-high.yaml: Path to the hyperparameters file.
  • --min-items 0: Minimum number of items.
  • --epochs 500: Number of training epochs.
  • --close-mosaic 15: Number of epochs to disable mosaic augmentation before training ends.

If you encounter any issues or have specific questions about the training process, please provide more details or a minimum reproducible example so we can assist you better. You can refer to our Minimum Reproducible Example Guide for more information.

Feel free to reach out if you have any further questions. Happy training! 😊

from ultralytics.

github-actions avatar github-actions commented on August 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 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.