Created
August 6, 2021 01:18
-
-
Save tom-doerr/138de0d49224d765cc81c7cb492150dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How do I start the fastai class label cleaner? | |
You can start it by executing | |
``` | |
import ipywidgets | |
from fastai.vision.widgets import ImageClassifierCleaner | |
cleaner = ImageClassifierCleaner(learn) | |
cleaner | |
``` | |
# How do I save the results of the cleaning process? | |
Assuming your dataset is structured with samples in folders | |
with the corrosponding class labels you can directly update your | |
dataset by running | |
``` | |
for idx in cleaner.delete(): | |
cleaner.fns[idx].unlink() | |
``` | |
to delete the items marked for deletion and running | |
``` | |
for idx, cat in cleaner.change(): | |
print(cat) | |
print(cleaner.fns[idx]) | |
shutil.move(str(cleaner.fns[idx]), 'data/train/' + cat) | |
``` | |
to move the files into the directory which matches their new label. | |
You will likely need to adjust the destination path in the `shutil.move` | |
command. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment