Giter VIP home page Giter VIP logo

fastai_extensions's Introduction

fastai_extensions

If you are interested in times series and fastai you may want to visit the new time series library tsai. It supports Pytorch 1.7 & fastai v2.

0_data_augmentation_notebook.ipynb

  • Includes a version of ricap and a modified version of cutmix (that fixes a bug in the lambda calculation).
  • It also includes 2 functions to visualize the impact of single-image transforms (show_single_img_tfms) or multi-image transforms (show_multi_img_tfms).
  • To use the code you can either clone the repo, or copy the exp/nb_new_data_augmentation.py code into your code.

fastai_extensions's People

Contributors

oguiza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fastai_extensions's Issues

With greyscale images

I get errors when I use it with greyscale images. May be some corrections required while torch.cat?

updated for fastai V2

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) ?

Specifying size of the images for using with datasets beside CIFAR-10

@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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.