Giter VIP home page Giter VIP logo

Comments (4)

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

πŸ‘‹ Hello @emilio-balda, 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 25, 2024

Hi there,

Thank you for bringing this to our attention and for providing a detailed report along with a reproducible example! This is very helpful. 😊

It appears that the issue stems from the URL lacking a file extension, which causes the library to misinterpret it as a webcam stream. This is indeed a bug that we need to address.

Before we proceed, could you please confirm that you are using the latest versions of both torch and ultralytics? You can update your packages using the following commands:

pip install --upgrade torch ultralytics

Once updated, please try running your script again to see if the issue persists. If it does, we will investigate further.

In the meantime, as a workaround, you might consider downloading the image locally and then running the inference on the local file. Here’s a quick example of how you could do this:

import requests
from ultralytics import YOLO

# Load a pretrained YOLOv8n model
model = YOLO("yolov8n.pt")

# Download the image
url = "https://figma-alpha-api.s3.us-west-2.amazonaws.com/images/be2cf638-7d2b-46f6-ab89-05be842adf78"
response = requests.get(url)
with open("temp_image.jpg", "wb") as file:
    file.write(response.content)

# Run inference on the downloaded image
results = model("temp_image.jpg")  # list of Results objects

# Display results
results[0].show()

This should help you continue your work while we look into a more permanent fix for the URL handling issue.

Thank you for your patience and for contributing to the improvement of our library. If you have any further questions or updates, please feel free to share them here.

from ultralytics.

emilio-balda avatar emilio-balda commented on June 25, 2024

Hi,

The issue happened on the sever side when using Ultralytics HUB. So the Ultralytics & Torch versions are the ones in Ultralytics' infraestructure.

You can replicate the error like this

curl -X POST "https://api.ultralytics.com/v1/predict/<your-model-id>" \
     -H "Content-Type: multipart/form-data" \
     -H "x-api-key: <your-api-key>" \
     -F "size=640" \
     -F "confidence=0.25" \
     -F "iou=0.45" \
     -F "url=https://figma-alpha-api.s3.us-west-2.amazonaws.com/images/be2cf638-7d2b-46f6-ab89-05be842adf78)"

The code snippet I provided is a way to replicate the issue locally. I originally ran it with these versions:

ultralytics               8.2.28
torch                     2.3.0

I just upgraded those libraries to their latest versions and I can confirm that the issue persists.

I can see where the issue is coming from, on the main branch of Ultralytics' GitHub repository. It is here

is_file = Path(source).suffix[1:] in (IMG_FORMATS | VID_FORMATS)

from ultralytics.

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

@emilio-balda hi there,

Thank you for the detailed follow-up and for providing the cURL command to replicate the issue on the Ultralytics HUB. This is very helpful! 😊

I understand that the issue occurs on the server side when using the Ultralytics HUB Inference API. Given that you've already confirmed the bug persists with the latest versions of ultralytics and torch, we'll need to investigate further.

The problem seems to be related to how URLs without file extensions are handled, causing the library to misinterpret them as webcam streams. This indeed appears to be a bug in the URL handling logic.

To help us address this issue more effectively, I've noted the specific line in the codebase that you mentioned:

is_file = Path(source).suffix[1:] in (IMG_FORMATS | VID_FORMATS)

We will look into this and work on a fix. In the meantime, as a temporary workaround, you might consider downloading the image locally and running the inference on the local file, as shown in the earlier example.

Thank you for your patience and for bringing this to our attention. If you have any further questions or updates, please feel free to share them here. We appreciate your support in improving our library!

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.