Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

N-dimensional CNN models #137

Closed
ToucheSir opened this issue Jul 13, 2021 · 4 comments · Fixed by #181
Closed

N-dimensional CNN models #137

ToucheSir opened this issue Jul 13, 2021 · 4 comments · Fixed by #181
Labels
enhancement New feature or request fastai-parity Feature that fastai has help wanted Contributions welcome!

Comments

@ToucheSir
Copy link
Member

fastai has this already for certain models to support audio and time series processing. We should be able to do that but even better, because Flux's Conv and Pooling layers can (theoretically) handle an arbitrary number of dimensions.

@ToucheSir ToucheSir added enhancement New feature or request help wanted Contributions welcome! fastai-parity Feature that fastai has labels Jul 13, 2021
@lorenzoh
Copy link
Member

lorenzoh commented Jul 14, 2021

Yeah, it's just a matter of adding models now which take in 3D images. Projections and augmentations work on N-D images, masks, keypoints already; so does one-hot encoding N-D masks.

Then you should be able to do

sz = (64, 64, 64)
Method(
    blocks=(Image{3}(), Mask{3}(classes)),
    encodings=[
        ProjectiveTransforms(sz),
        ImagePreprocessing(),
        OneHot()
    ]
)
learner = methodlearner(method, data, Models.conv3dbackbone)

@ToucheSir
Copy link
Member Author

Totally forgot I'd opened this issue! What do you think about an ndim parameter or something similar for XResNets and U-Nets to pass through to convx? Then instead of (ks, ks) on https://github.com/FluxML/FastAI.jl/blob/master/src/models/xresnet.jl#L5, you'd have ntuple(_ -> ks, ndim) (or maybe ntuple(Returns(ks), ndim) on 1.7+).

@lorenzoh
Copy link
Member

lorenzoh commented Oct 5, 2021

Sounds like a good idea! I guess pooling layers would have to take that in as well 🤔

@lorenzoh
Copy link
Member

See #181

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fastai-parity Feature that fastai has help wanted Contributions welcome!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants