How to train one model with two datasets

Before starting the fastai course I read something here that one can train one model using two different datasets.

I have images with high quality and some with low quality. When I train a cnn_learner on the quality images alone I get a higher accuracy on the test set. The problem is that the high-quality images are short 2 classes…

How can I train on the high quality and then save the model and train it more on the low qualities?

To clarify do you want to train on ‘n’ labels then save the model and retrain on ‘n+2’ labels?

I want to train on the high quality then save then train on the low quality

the labels will be the same since i Included a few images of the missing lebels in the high quality image databunch

I think it’s like using the progressing resizing.

Check out this notebook: https://github.com/fastai/fastbook/blob/master/07_sizing_and_tta.ipynb

Basically, you can define your learner with some data and train it. Then you override the data inside the learner and continue training.

1 Like

You can do that with things from the initial lessons as well.

  • Create dl1 and learner1
  • Train and save the learner1
  • Create new dl2 and recreate learner1
  • Load the saved model in learner1
  • Train learner1 again
1 Like

Thank you

@Unplug_Charger did you get this work? I’d love to see what you coded to make this work.