-
-
Notifications
You must be signed in to change notification settings - Fork 15
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 make a model less context-dependent? #1016
Comments
👋 Hello @matteo-ferraro, thank you for raising your issue about Ultralytics HUB 🚀! Please visit our HUB Docs for detailed guidance on using Ultralytics HUB:
It seems you’re tackling an interesting problem with your dataset 🌟! If this is a ❓ question, please ensure you’ve added all relevant details regarding your dataset, training parameters, and model settings to help us provide specific assistance. Additionally, consider these ideas:
If you believe this is a potential 🐛 bug or issue, providing a minimum reproducible example (MRE) with the specific settings and steps you followed would help us investigate further. Screenshots or detailed reproductions of your issue (as you’ve partially shared above) are also very welcome! 📸 An Ultralytics engineer will review and assist shortly. Thank you for your patience and contributions to the Ultralytics community! 😊 |
@matteo-ferraro thank you for sharing your bean classification challenge! 🌱 This appears to be a case of context overfitting, where the model is learning global image patterns rather than individual bean characteristics. Here's how to address this using Ultralytics HUB and best practices: 1. Dataset Enhancement
2. Model Adjustments
3. Color-Based Post-ProcessingSince bad beans are darker, add a simple HSV filter after detection: for result in results:
for box in result.boxes:
x1, y1, x2, y2 = box.xyxy[0]
bean_patch = image[int(y1):int(y2), int(x1):int(x2)]
hsv = cv2.cvtColor(bean_patch, cv2.COLOR_RGB2HSV)
if np.mean(hsv[:,:,2]) > 100: # Adjust brightness threshold
box.conf *= 0.5 # Demote "bad" classification confidence 4. Architecture ConsiderationsFor better localization of small objects:
5. EvaluationUse HUB's Confusion Matrix to analyze false positives. If class imbalance exists (more good than bad), try:
Would you like me to elaborate on any of these strategies? For immediate testing, I recommend starting with dataset mixing and confidence threshold adjustments, as these can be implemented directly in HUB without code changes. 🚀 |
Search before asking
Question
I have a really easy task: categorize beans into bad and good.
I have a training set of photos with either all good or all bad beans, where bad beans are darker than good ones ( link to two example pics ). I tried to train a model on this photos and, unsurprisingly, when I try to detect a bad bean among good beans, all good beans close to the bad bean become "bad" (here it is an example of a bad bean making every bean be detected as "bad"). How can I deal with it? Is there any custom setting in ultralytics hub I can set to make the model look at small (i.e. just the bounding box of a bean) area?
Additional
No response
The text was updated successfully, but these errors were encountered: