I Got 100% Accuracy and Spent the Next Hour Trying to Prove It Was Wrong
Summary
An AI exploration to develop a coin-sorting robot initially faced a significant challenge: a ResNet-50 model, trained on mobile-captured images for 20 coin categories, achieved 0% accuracy when deployed on a robot using its own camera for 3 specific categories (AUS_1, AUS_20, AUS_50). This failure was attributed to "domain shift" between the mobile training environment and the robot's operational environment. The solution involved a two-stage fine-tuning process. First, the model learned general coin features from mobile images. Then, it was fine-tuned again using robot-captured images for the target 3 categories. This adaptation successfully bridged the domain gap, resulting in a verified 100% accuracy on a held-out test set for AUS_1, AUS_20, and AUS_50 coins. The high accuracy was confirmed by healthy training curves and the distinct visual characteristics of the target coins.
Key takeaway
For Machine Learning Engineers deploying computer vision models, recognize that domain shift can lead to complete failure, even with well-trained base models. If your model performs poorly in a new environment, consider a two-stage fine-tuning approach: first, train on a broad dataset, then adapt to the specific target environment and distinct classes. Always verify unexpectedly high accuracy by scrutinizing training curves and class separability to ensure legitimate performance.
Key insights
Domain shift can cause complete model failure, but targeted fine-tuning can bridge the gap effectively.
Principles
- Domain shift severely degrades model performance across environments.
- Two-stage fine-tuning can adapt models to new visual contexts.
- Visually distinct classes aid in achieving high classification accuracy.
Method
Fine-tune a base model on a source domain, then fine-tune it again on a target domain's specific visual environment and classes.
In practice
- Adapt pre-trained models to new camera systems via fine-tuning.
- Verify 100% accuracy claims by checking training curves.
- Ensure target classes are visually distinct for robust classification.
Topics
- Domain Shift
- Computer Vision
- ResNet-50
- Fine-tuning
- Model Deployment
- Image Classification
Best for: AI Student, Machine Learning Engineer, Robotics Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by Machine Learning on Medium.