GithubHelp home page GithubHelp logo

Comments (5)

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

@jurijsnazarovsambientai hello,

Thank you for reaching out! To adjust the confidence score threshold for predictions directly in the forward pass, you can modify the conf parameter within the predict method. However, if you want to set this parameter during the model initialization or forward pass, you can do so by specifying it in the predict method call.

Here's an example of how you can achieve this:

from ultralytics import YOLO

# Load the model
self.model = YOLO(model_path, task="detect")

# Run the forward pass with a custom confidence threshold
result = self.model.predict(images, conf=0.1, verbose=False)

In this example, the conf parameter is set to 0.1, which means that only predictions with a confidence score of 0.1 or higher will be included in the results.

If you need further customization or encounter any issues, please ensure you are using the latest versions of torch and ultralytics packages. You can update them using the following commands:

pip install --upgrade torch ultralytics

If the issue persists, please provide a minimum reproducible code example so we can investigate further. You can refer to our guide on creating a minimum reproducible example here: Minimum Reproducible Example.

Feel free to reach out if you have any more questions or need further assistance. Happy coding! 😊

from ultralytics.

jurijsnazarovsambientai avatar jurijsnazarovsambientai commented on July 24, 2024

If I don't want to use predict, but direct forward, is that the same? For example:

from ultralytics import YOLO
self.model = YOLO(model_path, task="detect")
result = self.model(images, conf=0.1, verbose=False)

from ultralytics.

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

Hello @jurijsnazarovsambientai,

Thank you for your question! If you prefer to use the direct forward pass instead of the predict method, you can still achieve the same result by setting the confidence threshold within the forward pass. However, the conf parameter is specifically designed for the predict method.

To use the direct forward pass and set the confidence threshold, you can modify the model's configuration before running the forward pass. Here's how you can do it:

from ultralytics import YOLO

# Load the model
self.model = YOLO(model_path, task="detect")

# Update the model's confidence threshold
self.model.overrides['conf'] = 0.1  # Set confidence threshold to 0.1

# Run the forward pass
result = self.model(images, verbose=False)

This way, you can adjust the confidence threshold for the direct forward pass without using the predict method.

If you encounter any issues or need further assistance, please ensure you are using the latest versions of torch and ultralytics. You can update them using:

pip install --upgrade torch ultralytics

Feel free to reach out if you have any more questions. Happy coding! 😊

from ultralytics.

jurijsnazarovsambientai avatar jurijsnazarovsambientai commented on July 24, 2024

Thanks!

from ultralytics.

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

Hello @jurijsnazarovsambientai,

Thank you for your question! To set the confidence threshold for a direct forward pass without using the predict method, you can modify the model's configuration before running the forward pass. Here's how you can do it:

from ultralytics import YOLO

# Load the model
self.model = YOLO(model_path, task="detect")

# Update the model's confidence threshold
self.model.overrides['conf'] = 0.1  # Set confidence threshold to 0.1

# Run the forward pass
result = self.model(images, verbose=False)

This approach allows you to adjust the confidence threshold directly within the forward pass.

If you encounter any issues, please ensure you are using the latest versions of torch and ultralytics. You can update them using:

pip install --upgrade torch ultralytics

If the issue persists, please provide a minimum reproducible code example so we can investigate further. You can refer to our guide on creating a minimum reproducible example here: Minimum Reproducible Example.

Feel free to reach out if you have any more questions. 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.