Giter VIP home page Giter VIP logo

Comments (23)

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

πŸ‘‹ Hello @lapllibary, 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.

lapllibary avatar lapllibary commented on August 24, 2024

Done all of the above before. Previous issues regarding this also didn't solve the problem.
Python 3.10 by the way.

from ultralytics.

harshdhamecha avatar harshdhamecha commented on August 24, 2024

I think you might have had a look at the old docs. I have referred this code and it works on my machine. You can try the following code:

from ultralytics import YOLO
from PIL import Image

model = YOLO('yolov8n.pt')
results = model('./assets/bus.jpg')

# Visualize the results
for i, r in enumerate(results):
    # Plot results image
    im_bgr = r.plot()  # BGR-order numpy array
    im_rgb = Image.fromarray(im_bgr[..., ::-1])  # RGB-order PIL image

    # Show results to screen (in supported environments)
    r.show()

    # Save results to disk
    r.save(filename=f"results{i}.jpg")

from ultralytics.

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

@harshdhamecha hi there,

Thank you for reaching out! It sounds like you're encountering an issue with the plot method on the Results object. Let's ensure we're on the same page and troubleshoot this together.

Steps to Verify and Troubleshoot:

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

    pip install --upgrade torch ultralytics
  2. Minimum Reproducible Example: If the issue persists, please provide a minimum reproducible code example. This helps us understand the context and reproduce the issue on our end. You can refer to this guide for more details on creating a reproducible example.

  3. Code Example: Here's a code snippet that should work with the latest versions:

    from ultralytics import YOLO
    from PIL import Image
    
    # Load the model
    model = YOLO('yolov8n.pt')
    
    # Run inference on an image
    results = model('face1.jpeg')
    
    # Visualize the results
    for i, r in enumerate(results):
        # Plot results image
        im_bgr = r.plot()  # BGR-order numpy array
        im_rgb = Image.fromarray(im_bgr[..., ::-1])  # RGB-order PIL image
    
        # Show results to screen (in supported environments)
        r.show()
    
        # Save results to disk
        r.save(filename=f"results{i}.jpg")
  4. Check Dependencies: Ensure all required dependencies are installed and up-to-date. Here are the key dependencies:

    pip install matplotlib numpy opencv-python Pillow PyYAML requests scipy torch torchvision tqdm
  5. Environment Consistency: Since the code works on one machine but not the other, ensure that both environments are consistent in terms of Python version and installed packages.

If you follow these steps and still encounter issues, please share the exact error message and any additional context. This will help us assist you more effectively.

Looking forward to your response, and thank you for your patience! 😊

from ultralytics.

lapllibary avatar lapllibary commented on August 24, 2024

Ran the two updates, still the same error for both of the above code.
I installed python 3.10 via miniconda.
Screenshot 2024-06-14 090832

from ultralytics.

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

Hi @lapllibary,

Thank you for the update and for providing the screenshot. Let's get this sorted out!

Next Steps:

  1. Minimum Reproducible Example: To help us investigate further, could you please provide a minimum reproducible code example? This will allow us to replicate the issue on our end. You can refer to our guide for more details on creating one.

  2. Environment Check: Since you mentioned using Miniconda, let's ensure your environment is clean and consistent. You can create a new environment and install the necessary packages:

    conda create -n yolov8_env python=3.10
    conda activate yolov8_env
    pip install torch ultralytics matplotlib numpy opencv-python Pillow PyYAML requests scipy torchvision tqdm
  3. Verify Installation: After setting up the new environment, try running the following code:

    from ultralytics import YOLO
    from PIL import Image
    
    # Load the model
    model = YOLO('yolov8n.pt')
    
    # Run inference on an image
    results = model('face1.jpeg')
    
    # Visualize the results
    for i, r in enumerate(results):
        # Plot results image
        im_bgr = r.plot()  # BGR-order numpy array
        im_rgb = Image.fromarray(im_bgr[..., ::-1])  # RGB-order PIL image
    
        # Show results to screen (in supported environments)
        r.show()
    
        # Save results to disk
        r.save(filename=f"results{i}.jpg")

If the issue persists, please share the exact error message and any additional context. This will help us assist you more effectively.

Looking forward to your response, and thank you for your patience! 😊

from ultralytics.

lapllibary avatar lapllibary commented on August 24, 2024

Thank you for your timely reply. Doing the exact steps given(copying the exact program):
After creating new environment:
added / updated specs:
- python=3.10

The following NEW packages will be INSTALLED:

bzip2 pkgs/main/win-64::bzip2-1.0.8-h2bbff1b_6
ca-certificates pkgs/main/win-64::ca-certificates-2024.3.11-haa95532_0
libffi pkgs/main/win-64::libffi-3.4.4-hd77b12b_1
openssl pkgs/main/win-64::openssl-3.0.13-h2bbff1b_2
pip pkgs/main/win-64::pip-24.0-py310haa95532_0
python pkgs/main/win-64::python-3.10.14-he1021f5_1
setuptools pkgs/main/win-64::setuptools-69.5.1-py310haa95532_0
sqlite pkgs/main/win-64::sqlite-3.45.3-h2bbff1b_0
tk pkgs/main/win-64::tk-8.6.14-h0416ee5_0
tzdata pkgs/main/noarch::tzdata-2024a-h04d1e81_0
vc pkgs/main/win-64::vc-14.2-h2eaa2aa_1
vs2015_runtime pkgs/main/win-64::vs2015_runtime-14.29.30133-h43f2093_3
wheel pkgs/main/win-64::wheel-0.43.0-py310haa95532_0
xz pkgs/main/win-64::xz-5.4.6-h8cc25b3_1
zlib pkgs/main/win-64::zlib-1.2.13-h8cc25b3_1

Proceed ([y]/n)? y

I enterd y, activated yolo and installed the packages copying your code directly.
I get:
(... line 1, in
from ultralytics import YOLO)
ModuleNotFoundError: No module named 'IPython'

After pip install ipython:
(... line 1, in
from ultralytics import YOLO)
ModuleNotFoundError: No module named 'sentry_sdk'
After pip install sentry_sdk

line 8, in
results = model('face1.jpeg')
ModuleNotFoundError: No module named 'tensorboard'
Sentry is attempting to send 2 pending events
Waiting up to 2 seconds
Press Ctrl-Break to quit

After installing tensorboard:
Screenshot 2024-06-14 172520

from ultralytics.

harshdhamecha avatar harshdhamecha commented on August 24, 2024

Ran the two updates, still the same error for both of the above code. I installed python 3.10 via miniconda. Screenshot 2024-06-14 090832

The very first line in the terminal shows Ultralytics version 8.0.17. That might be the issue. Try running it on the latest version. I ran it on v8.2.31

from ultralytics.

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

Hi @harshdhamecha,

Thank you for the detailed update and for providing the screenshot. It looks like the issue might be related to the version of the ultralytics package you're using. The terminal shows that you're on version 8.0.17, while the latest version is 8.2.31.

Steps to Resolve:

  1. Upgrade Ultralytics Package: Let's ensure you're using the latest version of the ultralytics package. You can upgrade it using the following command:

    pip install --upgrade ultralytics
  2. Verify Installation: After upgrading, verify the installation by checking the version:

    python -c "import ultralytics; print(ultralytics.__version__)"
  3. Run the Code Again: Once you've confirmed that you're on the latest version, try running the code again:

    from ultralytics import YOLO
    from PIL import Image
    
    # Load the model
    model = YOLO('yolov8n.pt')
    
    # Run inference on an image
    results = model('face1.jpeg')
    
    # Visualize the results
    for i, r in enumerate(results):
        # Plot results image
        im_bgr = r.plot()  # BGR-order numpy array
        im_rgb = Image.fromarray(im_bgr[..., ::-1])  # RGB-order PIL image
    
        # Show results to screen (in supported environments)
        r.show()
    
        # Save results to disk
        r.save(filename=f"results{i}.jpg")

If you continue to face issues, please ensure that all dependencies are up-to-date and consistent across your environments. If the problem persists, providing a minimum reproducible example will help us investigate further. You can refer to our guide for more details on creating one.

Thank you for your patience, and I hope this resolves the issue! 😊

from ultralytics.

lapllibary avatar lapllibary commented on August 24, 2024

Ran the two updates, still the same error for both of the above code. I installed python 3.10 via miniconda. Screenshot 2024-06-14 090832

The very first line in the terminal shows Ultralytics version 8.0.17. That might be the issue. Try running it on the latest version. I ran it on v8.2.31

That's very strange, when I try ultralytics -version I get:
Uploading image.png…

Probably an issue with using Python 3.10
Thanks for the help

from ultralytics.

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

Hi @lapllibary,

Thank you for the update! It looks like the version discrepancy might be causing the issue. Let's ensure you're using the latest version of the ultralytics package.

Steps to Resolve:

  1. Upgrade Ultralytics Package: Please upgrade to the latest version of ultralytics:

    pip install --upgrade ultralytics
  2. Verify Installation: After upgrading, verify the installation by checking the version:

    python -c "import ultralytics; print(ultralytics.__version__)"
  3. Run the Code Again: Once you've confirmed that you're on the latest version, try running the code again:

    from ultralytics import YOLO
    from PIL import Image
    
    # Load the model
    model = YOLO('yolov8n.pt')
    
    # Run inference on an image
    results = model('face1.jpeg')
    
    # Visualize the results
    for i, r in enumerate(results):
        # Plot results image
        im_bgr = r.plot()  # BGR-order numpy array
        im_rgb = Image.fromarray(im_bgr[..., ::-1])  # RGB-order PIL image
    
        # Show results to screen (in supported environments)
        r.show()
    
        # Save results to disk
        r.save(filename=f"results{i}.jpg")

If the issue persists, please ensure all dependencies are up-to-date and consistent across your environments. If the problem continues, providing a minimum reproducible example will help us investigate further. You can refer to our guide for more details on creating one.

Thank you for your patience, and I hope this resolves the issue! 😊

from ultralytics.

lapllibary avatar lapllibary commented on August 24, 2024

After updating still:
image
I guess the latest ultralytics isn't compatible with python 3.10

from ultralytics.

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

Hi @lapllibary,

Thank you for the update and for providing the screenshot. Let's get this sorted out!

Steps to Resolve:

  1. Verify Minimum Reproducible Example: Could you please provide a minimum reproducible code example? This helps us replicate the issue on our end. You can refer to our guide for more details.

  2. Ensure Latest Versions: Please ensure you're using the latest versions of both torch and ultralytics. You can upgrade them using the following commands:

    pip install --upgrade torch ultralytics
  3. Check Python Compatibility: The latest version of ultralytics should be compatible with Python 3.10. Let's verify the installation:

    python -c "import ultralytics; print(ultralytics.__version__)"
  4. Run the Code Again: Once you've confirmed that you're on the latest version, try running the code again:

    from ultralytics import YOLO
    from PIL import Image
    
    # Load the model
    model = YOLO('yolov8n.pt')
    
    # Run inference on an image
    results = model('face1.jpeg')
    
    # Visualize the results
    for i, r in enumerate(results):
        # Plot results image
        im_bgr = r.plot()  # BGR-order numpy array
        im_rgb = Image.fromarray(im_bgr[..., ::-1])  # RGB-order PIL image
    
        # Show results to screen (in supported environments)
        r.show()
    
        # Save results to disk
        r.save(filename=f"results{i}.jpg")

If the issue persists, please share the exact error message and any additional context. This will help us assist you more effectively.

Thank you for your patience, and I hope this resolves the issue! 😊

from ultralytics.

lapllibary avatar lapllibary commented on August 24, 2024

Sorry for the late reply :
After running pip install --upgrade torch ultralytics
and python -c "import ultralytics; print(ultralytics.version)"
image
Same environment (yolo) as created above. I don't get why the version isn't correct.

from ultralytics.

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

Hi @lapllibary,

Thank you for your patience and for providing the details. Let's get this resolved!

Steps to Resolve:

  1. Verify Environment: Ensure you're in the correct environment where ultralytics and torch were upgraded. You can activate the environment using:

    conda activate yolov8_env
  2. Check Installed Packages: Verify the installed versions of ultralytics and torch:

    pip show ultralytics torch
  3. Reinstall Ultralytics: If the version is still incorrect, try reinstalling ultralytics:

    pip uninstall ultralytics
    pip install ultralytics
  4. Run the Code Again: Once confirmed, run the code again:

    from ultralytics import YOLO
    from PIL import Image
    
    # Load the model
    model = YOLO('yolov8n.pt')
    
    # Run inference on an image
    results = model('face1.jpeg')
    
    # Visualize the results
    for i, r in enumerate(results):
        # Plot results image
        im_bgr = r.plot()  # BGR-order numpy array
        im_rgb = Image.fromarray(im_bgr[..., ::-1])  # RGB-order PIL image
    
        # Show results to screen (in supported environments)
        r.show()
    
        # Save results to disk
        r.save(filename=f"results{i}.jpg")

If the issue persists, please provide a minimum reproducible code example to help us investigate further. You can refer to our guide for more details.

Thank you for your cooperation, and I hope this helps! 😊

from ultralytics.

lapllibary avatar lapllibary commented on August 24, 2024

The following two ways of getting ultralytics version show different results:
image

image

from ultralytics.

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

Hi @lapllibary,

Thank you for bringing this to our attention. It looks like there might be a discrepancy between the versions shown by different methods. Let's address this step-by-step:

  1. Environment Verification: Ensure that you are in the correct environment where ultralytics was installed. You can activate your environment using:

    conda activate yolov8_env
  2. Check Installed Packages: Verify the installed versions of ultralytics and torch:

    pip show ultralytics torch
  3. Reinstall Ultralytics: If the version is still incorrect, try reinstalling ultralytics:

    pip uninstall ultralytics
    pip install ultralytics
  4. Run the Code Again: Once confirmed, run the code again to ensure everything is working as expected.

If the issue persists, please provide a minimum reproducible code example to help us investigate further. You can refer to our guide for more details.

Thank you for your cooperation, and I hope this helps! 😊

from ultralytics.

lapllibary avatar lapllibary commented on August 24, 2024

After reinstalling:
image

image
Same error running the code (no surprise there)

from ultralytics.

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

Hi @lapllibary,

Thank you for the detailed update and for your patience. It seems like there might still be an issue with the environment setup.

Steps to Resolve:

  1. Verify Environment: Ensure you're in the correct environment where ultralytics was installed:

    conda activate yolov8_env
  2. Check Installed Packages: Verify the installed versions of ultralytics and torch:

    pip show ultralytics torch
  3. Reinstall Ultralytics: If the version is still incorrect, try reinstalling ultralytics:

    pip uninstall ultralytics
    pip install ultralytics
  4. Run the Code Again: Once confirmed, run the code again to ensure everything is working as expected.

If the issue persists, please provide a minimum reproducible code example to help us investigate further. You can refer to our guide for more details.

Thank you for your cooperation, and I hope this helps! 😊

from ultralytics.

lapllibary avatar lapllibary commented on August 24, 2024

Thank you for all your time and patience.
The suggestions are the exact same as the last one which I tried. I have an environment/version issue but reinstalling/creating new environment didn't help it.

from ultralytics.

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

Hi @lapllibary,

Thank you for your patience and for providing detailed updates. It seems like we're dealing with a persistent environment/version issue. Let's try a few more steps to resolve this:

  1. Verify Environment Activation: Ensure that the correct environment is activated before running your commands:

    conda activate yolov8_env
  2. Check Installed Packages: Verify the installed versions of ultralytics and torch:

    pip show ultralytics torch
  3. Create a Fresh Environment: Sometimes, starting from scratch can help. Let's create a new environment and install the necessary packages:

    conda create -n new_yolo_env python=3.10
    conda activate new_yolo_env
    pip install ultralytics torch
  4. Run the Code: Once the new environment is set up, try running your code again:

    from ultralytics import YOLO
    from PIL import Image
    
    # Load the model
    model = YOLO('yolov8n.pt')
    
    # Run inference on an image
    results = model('face1.jpeg')
    
    # Visualize the results
    for i, r in enumerate(results):
        # Plot results image
        im_bgr = r.plot()  # BGR-order numpy array
        im_rgb = Image.fromarray(im_bgr[..., ::-1])  # RGB-order PIL image
    
        # Show results to screen (in supported environments)
        r.show()
    
        # Save results to disk
        r.save(filename=f"results{i}.jpg")

If the issue persists, could you please provide a minimum reproducible code example? This will help us investigate further. You can refer to our guide for more details.

Thank you for your cooperation, and I hope this helps! 😊

from ultralytics.

lapllibary avatar lapllibary commented on August 24, 2024

Complete stupidity on my part, I had a local ultralytics 8.10.17 version in the folder. Thanks for all your help

from ultralytics.

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

Hi @lapllibary,

No worries at allβ€”these things happen! 😊 I'm glad we could help you identify the issue. It's great to hear that you've pinpointed the local version conflict.

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

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.