You are browsing as a guest. Sign up (or log in) to start making projects!

1h 22m 30s logged

MIRA — Day 5: Transfer Learning, and Two-Stage Fine-Tuning

1. Summary

Since the last update, which was quite a while ago because I needed to learn some more basics, MIRA has evolved. By implementing transfer learning with MobileNetV2, and performing partial layer fine-tuning, overall validation accuracy was raised from 61% to 87.42%, while validation loss dropped from 1.06 to 0.31. Which is very important.


3. Key Technical Breakthroughs & Refactors

The “Paper” Class Feature Extraction Bottleneck

In the initial baseline model, paper recall was extremely poor (0.07). The model regularly confused paper with metal or plastic.

  • The Fix: Using the pre-trained ImageNet weights of MobileNetV2 resolved this. The model now extracts high-level semantic texture and edge properties. In EXP-003, paper reached a 96% precision rate. but instead metal got a bit worse and has now reached 77% from its orignal 86%

Refactoring src/evaluate.py

To prevent difficulties in strcuturing and avoid having multiple different evaluation scripts for each model , I refactored evaluate.py using Python’s argparse library. The script now accepts command-line arguments to evaluate any model dynamically so i can just use a comand and where it should save its finding and it will run the script acording to that:

python src/evaluate.py --model mira_fine_tuned_model.keras --exp EXP-003_FineTuning

It also dynamically scales the loaded image resolution (224x224 for MobileNetV2 vs. 180x180 for baseline) to avoid input shape mismatches

Implementation of Two-Stage Fine-Tuning

After training the custom dense classification head on frozen MobileNetV2 features, I wrote train_fine_tune.py to unfreeze the base model from layer 100 onwards (leaving the low-level edge-detection layers 0–99 intact). Recompiling with an ultra-low learning rate (1e-5) allowed the model to subtly adjust its deep weights to the recycling dataset:

This successfully drove validation loss down to 0.3148, showing that the network is making predictions with significantly higher statistical confidence.

Automated Latency Benchmarking

I integrated CPU latency tracking directly into the evaluation loop using time.perf_counter() to record inference times in milliseconds per image, This will be used later to see how it performs on small hardware and different

I would advise everybody who wants to do something similar to use the resources i linked.


4. Next Milestones

  1. Real-time Live Webcam Inference (src/live_inference.py): Deploying the mira_fine_tuned_model.keras on a live video stream to evaluate performance and classification stability under varying lighting and structural angles and add these kinds of borders which state what the computer thinks the object i show is
  2. Embedded Planning: Utilising INT8 to quantize the model to a fracture of its size to run on a standalone, onboard single-board computer (Raspberry Pi), moving closer to an autonomous physical robot. Which will then be able to automatically sort them.

5. Resources Used

0
1

Comments 0

No comments yet. Be the first!