Created
August 19, 2022 13:58
-
-
Save SubhadityaMukherjee/de1ba6ca7a63ac6e1092b5b1f830c2c0 to your computer and use it in GitHub Desktop.
training part
This file contains hidden or 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
root_dir = "/media/hdd/Datasets/Fish_Dataset/Fish_Dataset/" | |
path = Path(root_dir) | |
fields = DataBlock( | |
blocks=(ImageBlock, CategoryBlock), | |
get_items=get_image_files, | |
get_y=parent_label, | |
splitter=RandomSplitter(valid_pct=0.2, seed=42), | |
item_tfms=RandomResizedCrop(224, min_scale=0.5), | |
batch_tfms=aug_transforms(), | |
) | |
dls = fields.dataloaders(path) | |
learn = vision_learner(dls, resnet34, metrics=[accuracy, error_rate]).to_fp16() | |
learn.fine_tune(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment