-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
How to change confidence threshold in model.train? #11707
Comments
I don't think that's a parameter https://docs.ultralytics.com/modes/train/#train-settings |
Hello, You're correct; the confidence threshold is not directly adjustable during the training phase using If you have further questions or need assistance with anything else, feel free to ask! Happy coding! 🚀 |
Umm... I understood your answer, but unsuitable at my case. by the way, To summarize what I want to do it is as follows.
|
@jihunddok hello! Thank you for providing the clear summary of your scenario. It seems like the challenge you're facing is mainly about handling overlapping masks and prioritizing certain detections when multiple models predict different objects in similar areas. One effective approach could be to implement a post-processing step where you can merge or prioritize overlapping masks based on certain criteria. Here’s a basic strategy:
Here’s a simple pseudocode implementation: def process_predictions(predictions, confidence_threshold=0.5, iou_threshold=0.5):
# Assuming predictions is a list of tuples (mask, confidence, class_id)
# Sort predictions by confidence score
predictions.sort(key=lambda x: x[1], reverse=True)
final_masks = []
for current_mask, current_conf, current_class in predictions:
keep = True
for final_mask, _, _ in final_masks:
iou = calculate_iou(current_mask, final_mask)
if iou > iou_threshold:
keep = False
break
if keep:
final_masks.append((current_mask, current_conf, current_class))
return final_masks
# Utility function to calculate IoU
def calculate_iou(mask1, mask2):
# Implement IoU calculation between two masks
pass This method does not require enhancing model performance but helps in intelligently managing the outputs from multiple models. Use OpenCV to draw masks from Please test and adapt the code as necessary for your specific application context. Hope this helps! Let me know if you have further questions or need more specific examples. Happy coding! 🚀 |
Thanks for your answer. |
Hello, Low recall often indicates that your model is missing detections, leading to fewer true positives. Here are a couple of suggestions that you might find helpful:
Here's a quick example on how to adjust the IoU threshold if you're using Ultralytics YOLO: from ultralytics import YOLO
# Load a model
model = YOLO('path_to_model.pt')
# Set lower IoU threshold
results = model.train(data='data.yaml', iou_t=0.3) Adapting the Reviewing the 'results.csv' you attached could provide more insight into specific reasons why recall might be low with your current settings. Looking forward to hearing back from you! 😊 |
Search before asking
Question
Hello,
I want to change the confidence threshold in train mode; how can I do that?
model = YOLO("yolov8m.pt")
results = model.train(data="data.yaml",optimizer="Adam")
Additional
No response
The text was updated successfully, but these errors were encountered: