Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom validation output issues #12148

Open
1 task done
zyy-xy opened this issue May 11, 2024 · 1 comment
Open
1 task done

Custom validation output issues #12148

zyy-xy opened this issue May 11, 2024 · 1 comment
Labels
question Further information is requested

Comments

@zyy-xy
Copy link

zyy-xy commented May 11, 2024

Search before asking

Question

Excuse me! I encountered two issues while conducting data validation:

  1. I validated using the official YOLOv8 model on a big dataset. According to the project requirements, I only need to identify two types of objects (such as 0-person and 59-bed). In order to improve efficiency, I want the network to only output the prediction results of these two categories (note that it is not simply blocking the prediction results of other categories, but rather directly not calculating other categories during the final operation, thereby reducing the computational complexity of the model). One attempt I made was to modify the yaml file to the following content, but this did not work. Is there any effective method?
    names:
        0: person
        59: bed            # `59: bed` would result in code errors and `1: bed` did not work as well.
  2. I want to visualize the predicted results of each image and save them, that is, draw the real and predicted boxes or masks on each image simultaneously as image files. How could I do it?

I would greatly appreciate it if you could reply to me and help me.

Additional

No response

@zyy-xy zyy-xy added the question Further information is requested label May 11, 2024
@glenn-jocher
Copy link
Member

Hi there! Thanks for reaching out. Let's tackle your questions one by one:

  1. Filtering Object Categories for Efficiency: To have the model only calculate the categories you're interested in, the model itself would need to be retrained with only the categories of interest (person, bed) in your dataset. This is because the current model architecture includes all trained categories by default. After retraining, it will naturally compute only for those categories.

  2. Visualizing and Saving Predictions:
    For visualizing and saving the predicted results on images, you can utilize the show() and save() methods after running predictions:

    from ultralytics import YOLO
    model = YOLO('yolov8n.pt')  # or your custom model path
    
    # Run prediction
    results = model.predict('path/to/your/image.jpg')
    
    # Visualize and save results
    results.show()
    results.save('path/where/to/save.jpg')

I hope this clarifies your queries! Let me know if there's anything else you need help with. 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants