-
-
Save aribornstein/23d0953c3eec6c464a52ffea750fa0cc 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
from flash.core.data.data_source import DataSource, DefaultDataKeys | |
class CustomFolderDataSource(DataSource): | |
def load_data(self, folder, auto_dataset): | |
paths, labels = make_dataset(folder) | |
return [(p, l) for p, l in zip(paths, labels)] | |
def load_sample(self, sample, auto_dataset): | |
path, label = sample | |
return {DefaultDataKeys.INPUT: loader(path), DefaultDataKeys.TARGET: label} | |
def predict_load_data(self, folder, auto_dataset): | |
return predict_make_dataset(folder) | |
def predict_load_sample(self, path, auto_dataset): | |
return {DefaultDataKeys.INPUT: loader(path)} | |
def default_transforms(self): | |
return None | |
def train_default_transforms(self): | |
return None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment