I have the problem. I want to visualize this code, but my code had _error:_
ValueError: model input param must be a PyTorch, TensorFlow, or Keras-with-TensorFlow-backend model**. I don't know, how do I set the input number? ( I am using the pytorch tool)
I did:
[ ]
" import hiddenlayer as hl
input = torch.zeros([1, 3, 64, 64, 64])
model = VoxResNet()
hl.build_graph(model, (input))"
def call(self, x):
h = F.relu(self.bnorm1(x))
h = self.conv1(h)
h = F.relu(self.bnorm2(h))
h = self.conv2(h)
return h + x
class VoxResNet(chainer.Chain):
"""Voxel Residual Network"""
def call(self, x, train=False):
print(x.shape, '-------begin------------')
"""
calculate output of VoxResNet given input x
Parameters
----------
x : (batch_size, in_channels, xlen, ylen, zlen) ndarray
image to perform semantic segmentation
Returns
-------
proba: (batch_size, n_classes, xlen, ylen, zlen) ndarray
probability of each voxel belonging each class
elif train=True, returns list of logits
"""
with chainer.using_config("train", train):
h = self.conv1a(x)
h = F.relu(self.bnorm1a(h))
h = self.conv1b(h)
c1 = F.clipped_relu(self.c1deconv(h))
c1 = self.c1conv(c1)
h = F.relu(self.bnorm1b(h))
h = self.conv1c(h)
h = self.voxres2(h)
h = self.voxres3(h)
c2 = F.clipped_relu(self.c2deconv(h))
c2 = self.c2conv(c2)
h = F.relu(self.bnorm3(h))
h = self.conv4(h)
h = self.voxres5(h)
h = self.voxres6(h)
c3 = F.clipped_relu(self.c3deconv(h))
c3 = self.c3conv(c3)
h = F.relu(self.bnorm6(h))
h = self.conv7(h)
h = self.voxres8(h)
h = self.voxres9(h)
c4 = F.clipped_relu(self.c4deconv(h))
c4 = self.c4conv(c4)
c = c1 + c2 + c3 + c4
if train:
return [c1, c2, c3, c4, c]
else:
return F.softmax(c)
I have the problem. I want to visualize this code, but my code had _error:_ ValueError: model input param must be a PyTorch, TensorFlow, or Keras-with-TensorFlow-backend model**. I don't know, how do I set the input number? ( I am using the pytorch tool) I did:
[ ]
I am following this code from GitHub: https://github.com/Ryo-Ito/brain_segmentation. Please, help me, visualizer. Thank you.**
import chainer import chainer.functions as F import chainer.links as L import torch
class VoxResModule(chainer.Chain): """ Voxel Residual Module input BatchNormalization, ReLU Conv 64, 3x3x3 BatchNormalization, ReLU Conv 64, 3x3x3 output """
def init(self): initW = chainer.initializers.HeNormal(scale=0.01) super().init()
def call(self, x): h = F.relu(self.bnorm1(x)) h = self.conv1(h) h = F.relu(self.bnorm2(h)) h = self.conv2(h) return h + x class VoxResNet(chainer.Chain): """Voxel Residual Network"""
def init(self, in_channels=1, n_classes=4): init = chainer.initializers.HeNormal(scale=0.01) super().init()
def call(self, x, train=False): print(x.shape, '-------begin------------') """ calculate output of VoxResNet given input x
import hiddenlayer as hl input = torch.zeros([1, 3, 64, 64, 64])
model = VoxResNet() hl.build_graph(model, (input))