Comments (7)
hey it's because the current version only supports a single channel. Let me add support for that right now and get back to you
EDIT: ok, it should be fixed. Try that code again. The thing is that multi-channel support makes it a littttle slower. I don't plan to add multi-channel support for 3D affines right now.
from torchsample.
Now there is another issue.
In th_affine2d
we assume matrix has dimensions (2, 3) seen:
if matrix.dim() == 2:
matrix = matrix.view(-1,2,3)
But in the affine_transforms.py
the matrix has size (3, 3)
from torchsample.
should be fixed... lol i desperately need to write some tests, sorry.
I fix it by just indexing to the second row so if there is a third row it'll get cut off. This is what Keras does.
from torchsample.
Haven't looked closely, but having trouble with both Pad() and Rotate() passing in a tensor (3,256,256) which works for the other Tensor transform types..
Here's the error I see when I call AffineTransforms like Rotate(), Shear(), Zoom(), etc
rotated_img = torchsample.transforms.Rotate(10)(img_tns)
Error:
`/torchsample/utils.py in th_affine2d(x, matrix, mode, center)
---> 86 if matrix.dim() == 2:
87 matrix = matrix[:2,:]
88 matrix = matrix.view(-1,2,3)
RuntimeError: size '[-1 x 2 x 3]' is invalid for input of with 9 elements at /py/conda-bld/pytorch_1490980628440/work/torch/lib/TH/THStorage.c:55`
from torchsample.
Sorry I'm not sure what the issue is without seeing more code. These all work for me:
from torchsample.transforms import *
import torch as th
x = th.ones(3,256,256)
xr = Rotate(10)(x)
xs = Shear(0.1)(x)
xz = Zoom((0.8,1.2))(x)
xp = Pad((3,300,300))(x)
print(xp.size()) # torch.Size([3, 300, 300])
Maybe has to do with the new pytorch version? Are you using 0.1.11 or 0.1.12? Let me upgrade. EDIT: Still works on 0.1.12.
from torchsample.
This works! I was "slicing" my tensor with narrow() to remove an extra dimension, but I wasn't doing it right. Thanks
from torchsample.
Great!
from torchsample.
Related Issues (20)
- Binary Classification not working HOT 1
- Using Pre-Trained models
- How to set the learning rate for the optimizer in the ModuleTrainer compile function
- Are there any tutorials and documents for this repo? HOT 1
- How can I use torchsample with vae
- Range Normalization divide by 0?
- is this still under development?
- Pytorch1.3 upgradations welcome??
- Callbacks.ReduceLROnPlateau seems not work for small learning rate
- Can torchsample augment 3D medical image directly? HOT 1
- callback with input data (and targets)
- AlphaPose Project for python don't run on my windows10 (2020)
- Contact HOT 1
- Installing torchsample and ModuleTrainer
- customized loss function HOT 1
- Index error in module_trainer.py HOT 1
- Missing data type conversion for interpolation
- Support for torch Variables
- pip3 install
- Binary Classification Accuracy calculation error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from torchsample.