GithubHelp home page GithubHelp logo

Comments (8)

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

👋 Hello @KKopilka, 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 20, 2024

Hello! It looks like you encountered an AttributeError because the method you're trying to use isn't available in the Pose class of YOLOv8m-pose.

For the pose estimation model, you should use the .predict() method instead of .detect() which is typically used with detection models. From the snippets you've shown, it appears you're using .predict() correctly. However, to avoid any possible errors, ensure all your syntax matches exactly as it should be when employing the .predict() method.

Here's a simple usage example:

results = model.predict(frame)
keypoints = results[0].keypoints.xy.cpu().numpy()

Ensure your installation is updated and correctly configured, particularly if transitioning between different environments like VS Code and Google Colab that might have different package versions.

If issues persist, verifying paths and ensuring that your environment aligns with the requirements of the Ultralytics library could help pinpoint discrepancies. If still unresolved, please provide further details or the specific line that continues to raise errors.

Thank you for reaching out!

from ultralytics.

KKopilka avatar KKopilka commented on June 20, 2024

@glenn-jocher OK, I tried changing the code to yours, but the error persists:

results = model.predict(frame)
kps = results[0].keypoints.xy.cpu().numpy()
Traceback (most recent call last):
  File "D:\AI-Trainer\manual.py", line 156, in <module>
    main()
  File "D:\AI-Trainer\manual.py", line 59, in main
    results = model.predict(frame)
              ^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\ultralytics\engine\model.py", line 451, in predict
    return self.predictor.predict_cli(source=source) if is_cli else self.predictor(source=source, stream=stream)
                                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\ultralytics\engine\predictor.py", line 168, in __call__
    return list(self.stream_inference(source, model, *args, **kwargs))  # merge list of Result into one
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\torch\utils\_contextlib.py", line 35, in generator_context
    response = gen.send(None)
               ^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\ultralytics\engine\predictor.py", line 228, in stream_inference
    self.model.warmup(imgsz=(1 if self.model.pt or self.model.triton else self.dataset.bs, 3, *self.imgsz))
  File "C:\Python311\Lib\site-packages\ultralytics\nn\autobackend.py", line 589, in warmup
    self.forward(im)  # warmup
    ^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\ultralytics\nn\autobackend.py", line 423, in forward
    y = self.model(im, augment=augment, visualize=visualize, embed=embed)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\ultralytics\nn\tasks.py", line 89, in forward
    return self.predict(x, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\ultralytics\nn\tasks.py", line 107, in predict
    return self._predict_once(x, profile, visualize, embed)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\ultralytics\nn\tasks.py", line 128, in _predict_once
    x = m(x)  # run
        ^^^^
  File "C:\Python311\Lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\ultralytics\nn\modules\head.py", line 165, in forward
    x = self.detect(self, x)
        ^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\torch\nn\modules\module.py", line 1688, in __getattr__
    raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'Pose' object has no attribute 'detect'

from ultralytics.

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

Hello! It looks like there's a mix-up with the methods in use. The error 'Pose' object has no attribute 'detect' suggests trying to access functionality that doesn't exist in the pose estimation model.

Here's how you should configure your predictor:

results = model.predict(frame)  # Correct method for prediction
keypoints = results[0].keypoints.xy.cpu().numpy()  # Extracting keypoints

Ensure your model instantiation (YOLO('path_to_model')) is correctly referenced to the model you intend to use and that it's appropriately configured for pose detection, not object detection.

If the problem persists and all setups look correct, it might help to reinstall the Ultralytics library to ensure there are no corrupted or mismatched files. 👍 Let us know how it goes!

from ultralytics.

oOvOio avatar oOvOio commented on June 20, 2024

This may be due to inconsistencies between the version of Ultralytics used for inference and the version of Ultralytics used for training

from ultralytics.

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

Hello! It sounds like you might be right about the version inconsistency. Please make sure that both the training and inference environments are using the same version of Ultralytics YOLO. You can check the version in your environment with:

pip show ultralytics

If they differ, consider updating to the latest version using:

pip install --upgrade ultralytics

This should help maintain compatibility across your processes. Let us know how it goes! 😊

from ultralytics.

KKopilka avatar KKopilka commented on June 20, 2024

@glenn-jocher
@oOvOio
Good afternoon! Yes, I already realized that the problem was in the version update ultralytics :)
Thank u!

from ultralytics.

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

Hello! Great to hear that you figured out the issue with the version update! 🎉 If you have any more questions or run into any other issues, feel free to reach out. Happy coding with Ultralytics! 😊🚀

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.