oguiza / fastai_extensions Goto Github PK
View Code? Open in Web Editor NEWCode you can use jointly with fastai
Code you can use jointly with fastai
I get errors when I use it with greyscale images. May be some corrections required while torch.cat?
Hello, I am the maintainer of the fastai-extensions-repository and I am currently updating my link and description to take into accout the fact that fastai V2 is now the default.
Are your extensions all up to date with V2 (by default I marked them as V1) ?
RuntimeError: expected backend CUDA and dtype Float but got backend CUDA and dtype Half
@oguiza thanks for sharing this repo, great code!
To make nb_MixMatch.py
fully compatible with datasets beside CIFAR-10, one needs to be able to specify the target image sizes. By default, you cannot but it can be done with a minor tweak to the def mixmatch(...)
function as such:
def mixmatch(learn: Learner, ulist: ItemList, num_workers:int=None, size:Union[int,tuple]=64,
K: int = 2, T: float = .5, α: float = .75, λ: float = 100) -> Learner:
labeled_data = learn.data
if num_workers is None: num_workers = 1
labeled_data.train_dl.num_workers = num_workers
bs = labeled_data.train_dl.batch_size
tfms = [labeled_data.train_ds.tfms, labeled_data.valid_ds.tfms]
ulist = ulist.split_none()
ulist.train._label_list = partial(MultiTfmLabelList, K=K)
train_ul = ulist.label_empty().train # Train unlabeled Labelist
valid_ll = learn.data.label_list.valid # Valid labeled Labelist
# --------------------------------------------------------------------------
udata = (LabelLists('.', train_ul, valid_ll)
.transform(tfms, size=size)
.databunch(bs=min(bs, len(train_ul)),val_bs=min(bs * 2, len(valid_ll)),
num_workers=num_workers,dl_tfms=learn.data.dl_tfms,device=device,
collate_fn=MultiCollate)
.normalize(learn.data.stats))
# --------------------------------------------------------------------------
learn.data = udata
learn.callback_fns.append(partial(MixMatchCallback, labeled_data=labeled_data, T=T, K=K, α=α, λ=λ))
return learn
Just for reference, I'm using a tweaked version of your code here
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.