But… it feels inefficient to not reuse the weights we already learned from making learn. However, some of the images in the original dataset were removed during cleanup, so we can’t just learn.fine_tune(1) either without getting errors. So is there a way to start training again with the weights we already calculated in the first round of training, but with the modified datasets?
and keep training your model using fit_one_cycle instead of fine_tune since your “head” layers are already trained and whole model is unfreezed:
learn.fit_one_cycle(4)
Also you need to be careful, in this example you used random split to get training and validation sets. So after cleaning of data new split will be made and images which were used for training before will and up in new validation set. This will cause overestimation of the model performance. To avoid this you need to split your data explicitly before training. For example you can create train and test folders and use GrandparentSplitter.
Hello, how do we get the images to download in separate ‘train’ and ‘test’ folders?
The code in the lessons only shows how to get all the images in a single folder, as below:
bear_types = 'grizzly','black','teddy'
path = Path('bears')
if not path.exists():
path.mkdir()
for o in bear_types:
dest = (path/o)
dest.mkdir(exist_ok=True)
results = search_images_bing(key, f'{o} bear')
download_images(dest, urls=results.attrgot('contentUrl'))