Commit 6ff9b987 authored by Julian Dierkes's avatar Julian Dierkes

added GAN options and fixed tests

parent 5955c149
......@@ -117,6 +117,16 @@ public class CNNArch2GluonTemplateController extends CNNArchTemplateController {
return getStreamInputs(stream, outputAsArray).keySet();
}
public ArrayList<String> getStreamInputVariableNames(SerialCompositeElementSymbol stream, boolean outputAsArray) {
ArrayList<String> inputVariableNames = new ArrayList<String>();
for (ArchitectureElementSymbol element : stream.getFirstAtomicElements()) {
if (element.isInput()) {
inputVariableNames.add(getName(element));
}
}
return inputVariableNames;
}
public List<String> get(Map<String, List<String>> map, String name) {
return map.get(name);
}
......@@ -142,6 +152,16 @@ public class CNNArch2GluonTemplateController extends CNNArchTemplateController {
return getStreamOutputs(stream, false).values();
}
public ArrayList<String> getStreamOutputVariableNames(SerialCompositeElementSymbol stream, boolean outputAsArray) {
ArrayList<String> outputVariableNames = new ArrayList<String>();
for (ArchitectureElementSymbol element : stream.getLastAtomicElements()) {
if (element.isOutput()) {
outputVariableNames.add(getName(element));
}
}
return outputVariableNames;
}
public Collection<List<String>> getStreamInputInformation(SerialCompositeElementSymbol stream) {
Map<String, List<String>> dimensions = getStreamInputs(stream, false);
Map<String, List<String>> domains = getStreamInputDomains(stream);
......
......@@ -55,7 +55,7 @@ class ${tc.fileNameWithoutEnding}:
self.networks[${networkInstruction?index}] = Net_${networkInstruction?index}(data_mean=data_mean, data_std=data_std)
self.networks[${networkInstruction?index}].collect_params().initialize(self.weight_initializer, ctx=context)
self.networks[${networkInstruction?index}].hybridize()
self.networks[${networkInstruction?index}](<#list tc.getStreamInputDimensions(networkInstruction.body) as dimensions>mx.nd.zeros((1, ${tc.join(dimensions, ",")},), ctx=context)<#sep>, </#list>)
self.networks[${networkInstruction?index}](<#list tc.getStreamInputDimensions(networkInstruction.body) as dimensions>mx.nd.zeros((1, ${tc.join(tc.cutDimensions(dimensions), ",")},), ctx=context)<#sep>, </#list>)
</#list>
if not os.path.exists(self._model_dir_):
......
......@@ -15,21 +15,21 @@ def visualize(img_arr):
plt.axis('off')
def getDataIter(ctx, batch_size=64, Z=100):
img_number = 70
img_number = 70000
mnist_train = mx.gluon.data.vision.datasets.MNIST(train=True)
mnist_test = mx.gluon.data.vision.datasets.MNIST(train=False)
X = np.zeros((img_number, 28, 28))
for i in range(img_number/2):
X[i] = mnist_train[i][0].asnumpy()[:,:,0]
for i in range(img_number/2):
X[img_number/2+i] = mnist_test[i][0].asnumpy()[:,:,0]
#X = np.zeros((img_number, 28, 28))
#for i, (data, label) in enumerate(mnist_train):
#for i in range(img_number/2):
# X[i] = mnist_train[i][0].asnumpy()[:,:,0]
#for i, (data, label) in enumerate(mnist_test):
# X[len(mnist_train)+i] = data.asnumpy()[:,:,0]
#for i in range(img_number/2):
# X[img_number/2+i] = mnist_test[i][0].asnumpy()[:,:,0]
X = np.zeros((img_number, 28, 28))
for i, (data, label) in enumerate(mnist_train):
X[i] = mnist_train[i][0].asnumpy()[:,:,0]
for i, (data, label) in enumerate(mnist_test):
X[len(mnist_train)+i] = data.asnumpy()[:,:,0]
np.random.seed(1)
p = np.random.permutation(X.shape[0])
......@@ -244,7 +244,7 @@ class ${tc.fileNameWithoutEnding}:
# ugly start
#if batch_i % 200 == 0:
# fake_data[0].asnumpy()
if batch_i % 500 == 0:
if batch_i % 750 == 0:
#gen_net.save_parameters(self.parameter_path_gen() + '-' + str(num_epoch + begin_epoch).zfill(4) + '.params')
#gen_net.export(self.parameter_path_gen() + '_newest', epoch=0)
#dis_net.save_parameters(self.parameter_path_dis() + '-' + str(num_epoch + begin_epoch).zfill(4) + '.params')
......
......@@ -110,7 +110,7 @@ ${tc.include(networkInstruction.body, "FORWARD_FUNCTION")}
<#list tc.architecture.streams as stream>
<#assign dimensions = (tc.getStreamInputs(stream, false))>
<#assign domains = (tc.getStreamInputDomains(stream))>
<#list tc.getStreamInputNames(stream, false) as name>
<#list tc.getStreamInputVariableNames(stream, false) as name>
input_dimensions = (${tc.join(dimensions[name], ",")})
input_domains = (${tc.join(domains[name], ",")})
inputs["${name}"] = input_domains + (input_dimensions,)
......@@ -123,7 +123,7 @@ ${tc.include(networkInstruction.body, "FORWARD_FUNCTION")}
<#list tc.architecture.streams as stream>
<#assign dimensions = (tc.getStreamOutputs(stream, false))>
<#assign domains = (tc.getStreamOutputDomains(stream))>
<#list tc.getStreamOutputNames(stream, false) as name>
<#list tc.getStreamOutputVariableNames(stream, false) as name>
output_dimensions = (${tc.join(dimensions[name], ",")})
output_domains = (${tc.join(domains[name], ",")})
outputs["${name}"] = output_domains + (output_dimensions,)
......
......@@ -22,7 +22,7 @@ public:
<#list tc.getStreamInputNames(networkInstruction.body, true) as variable>"data${variable?index}"<#sep>, </#list>
</#if>
};
const std::vector<std::vector<mx_uint>> input_shapes = {<#list tc.getStreamInputDimensions(networkInstruction.body) as dimensions>{${tc.join(dimensions, ", ")}}<#sep>, </#list>};
const std::vector<std::vector<mx_uint>> input_shapes = {<#list tc.getStreamInputDimensions(networkInstruction.body) as dimensions>{1, ${tc.join(tc.cutDimensions(dimensions), ", ")}}<#sep>, </#list>};
const bool use_gpu = false;
PredictorHandle handle;
......
......@@ -3,6 +3,9 @@ import h5py
import mxnet as mx
import logging
import sys
import numpy as np
import cv2
import importlib
from mxnet import nd
class CNNDataLoader_Alexnet:
......@@ -65,6 +68,144 @@ class CNNDataLoader_Alexnet:
return train_iter, train_test_iter, test_iter, data_mean, data_std, train_images, test_images
def load_data(self, batch_size, img_size):
train_h5, test_h5 = self.load_h5_files()
width = img_size[0]
height = img_size[1]
comb_data = {}
data_mean = {}
data_std = {}
for input_name in self._input_names_:
train_data = train_h5[input_name][:]
test_data = test_h5[input_name][:]
train_shape = train_data.shape
test_shape = test_data.shape
comb_data[input_name] = mx.nd.zeros((train_shape[0]+test_shape[0], train_shape[1], width, height))
for i, img in enumerate(train_data):
img = img.transpose(1,2,0)
comb_data[input_name][i] = cv2.resize(img, (width, height)).reshape((train_shape[1],width,height))
for i, img in enumerate(test_data):
img = img.transpose(1, 2, 0)
comb_data[input_name][i+train_shape[0]] = cv2.resize(img, (width, height)).reshape((train_shape[1], width, height))
data_mean[input_name + '_'] = nd.array(comb_data[input_name][:].mean(axis=0))
data_std[input_name + '_'] = nd.array(comb_data[input_name][:].asnumpy().std(axis=0) + 1e-5)
comb_label = {}
for output_name in self._output_names_:
train_labels = train_h5[output_name][:]
test_labels = test_h5[output_name][:]
comb_label[output_name] = np.append(train_labels, test_labels, axis=0)
train_iter = mx.io.NDArrayIter(data=comb_data,
label=comb_label,
batch_size=batch_size)
test_iter = None
return train_iter, test_iter, data_mean, data_std
def load_preprocessed_data(self, batch_size, preproc_lib):
train_h5, test_h5 = self.load_h5_files()
wrapper = importlib.import_module(preproc_lib)
instance = getattr(wrapper, preproc_lib)()
instance.init()
lib_head, _sep, tail = preproc_lib.rpartition('_')
inp = getattr(wrapper, lib_head + "_input")()
train_data = {}
train_label = {}
data_mean = {}
data_std = {}
shape_output = self.preprocess_data(instance, inp, 0, train_h5)
train_len = len(train_h5[self._input_names_[0]])
for input_name in self._input_names_:
if type(getattr(shape_output, input_name + "_out")) == np.ndarray:
cur_shape = (train_len,) + getattr(shape_output, input_name + "_out").shape
else:
cur_shape = (train_len, 1)
train_data[input_name] = mx.nd.zeros(cur_shape)
for output_name in self._output_names_:
if type(getattr(shape_output, output_name + "_out")) == nd.array:
cur_shape = (train_len,) + getattr(shape_output, output_name + "_out").shape
else:
cur_shape = (train_len, 1)
train_label[output_name] = mx.nd.zeros(cur_shape)
for i in range(train_len):
output = self.preprocess_data(instance, inp, i, train_h5)
for input_name in self._input_names_:
train_data[input_name][i] = getattr(output, input_name + "_out")
for output_name in self._output_names_:
train_label[output_name][i] = getattr(shape_output, output_name + "_out")
for input_name in self._input_names_:
data_mean[input_name + '_'] = nd.array(train_data[input_name][:].mean(axis=0))
data_std[input_name + '_'] = nd.array(train_data[input_name][:].asnumpy().std(axis=0) + 1e-5)
train_iter = mx.io.NDArrayIter(data=train_data,
label=train_label,
batch_size=batch_size)
test_data = {}
test_label = {}
shape_output = self.preprocess_data(instance, inp, 0, test_h5)
test_len = len(test_h5[self._input_names_[0]])
for input_name in self._input_names_:
if type(getattr(shape_output, input_name + "_out")) == np.ndarray:
cur_shape = (test_len,) + getattr(shape_output, input_name + "_out").shape
else:
cur_shape = (test_len, 1)
test_data[input_name] = mx.nd.zeros(cur_shape)
for output_name in self._output_names_:
if type(getattr(shape_output, output_name + "_out")) == nd.array:
cur_shape = (test_len,) + getattr(shape_output, output_name + "_out").shape
else:
cur_shape = (test_len, 1)
test_label[output_name] = mx.nd.zeros(cur_shape)
for i in range(test_len):
output = self.preprocess_data(instance, inp, i, test_h5)
for input_name in self._input_names_:
test_data[input_name][i] = getattr(output, input_name + "_out")
for output_name in self._output_names_:
test_label[output_name][i] = getattr(shape_output, output_name + "_out")
test_iter = mx.io.NDArrayIter(data=test_data,
label=test_label,
batch_size=batch_size)
return train_iter, test_iter, data_mean, data_std
def preprocess_data(self, instance_wrapper, input_wrapper, index, data_h5):
for input_name in self._input_names_:
data = data_h5[input_name][0]
attr = getattr(input_wrapper, input_name)
if (type(data)) == np.ndarray:
data = np.asfortranarray(data).astype(attr.dtype)
else:
data = type(attr)(data)
setattr(input_wrapper, input_name, data)
for output_name in self._output_names_:
data = data_h5[output_name][0]
attr = getattr(input_wrapper, output_name)
if (type(data)) == np.ndarray:
data = np.asfortranarray(data).astype(attr.dtype)
else:
data = type(attr)(data)
setattr(input_wrapper, output_name, data)
return instance_wrapper.execute(input_wrapper)
def load_h5_files(self):
train_h5 = None
test_h5 = None
......@@ -73,6 +214,7 @@ class CNNDataLoader_Alexnet:
if os.path.isfile(train_path):
train_h5 = h5py.File(train_path, 'r')
print(train_path)
for input_name in self._input_names_:
if not input_name in train_h5:
......
......@@ -3,6 +3,9 @@ import h5py
import mxnet as mx
import logging
import sys
import numpy as np
import cv2
import importlib
from mxnet import nd
class CNNDataLoader_CifarClassifierNetwork:
......@@ -65,6 +68,144 @@ class CNNDataLoader_CifarClassifierNetwork:
return train_iter, train_test_iter, test_iter, data_mean, data_std, train_images, test_images
def load_data(self, batch_size, img_size):
train_h5, test_h5 = self.load_h5_files()
width = img_size[0]
height = img_size[1]
comb_data = {}
data_mean = {}
data_std = {}
for input_name in self._input_names_:
train_data = train_h5[input_name][:]
test_data = test_h5[input_name][:]
train_shape = train_data.shape
test_shape = test_data.shape
comb_data[input_name] = mx.nd.zeros((train_shape[0]+test_shape[0], train_shape[1], width, height))
for i, img in enumerate(train_data):
img = img.transpose(1,2,0)
comb_data[input_name][i] = cv2.resize(img, (width, height)).reshape((train_shape[1],width,height))
for i, img in enumerate(test_data):
img = img.transpose(1, 2, 0)
comb_data[input_name][i+train_shape[0]] = cv2.resize(img, (width, height)).reshape((train_shape[1], width, height))
data_mean[input_name + '_'] = nd.array(comb_data[input_name][:].mean(axis=0))
data_std[input_name + '_'] = nd.array(comb_data[input_name][:].asnumpy().std(axis=0) + 1e-5)
comb_label = {}
for output_name in self._output_names_:
train_labels = train_h5[output_name][:]
test_labels = test_h5[output_name][:]
comb_label[output_name] = np.append(train_labels, test_labels, axis=0)
train_iter = mx.io.NDArrayIter(data=comb_data,
label=comb_label,
batch_size=batch_size)
test_iter = None
return train_iter, test_iter, data_mean, data_std
def load_preprocessed_data(self, batch_size, preproc_lib):
train_h5, test_h5 = self.load_h5_files()
wrapper = importlib.import_module(preproc_lib)
instance = getattr(wrapper, preproc_lib)()
instance.init()
lib_head, _sep, tail = preproc_lib.rpartition('_')
inp = getattr(wrapper, lib_head + "_input")()
train_data = {}
train_label = {}
data_mean = {}
data_std = {}
shape_output = self.preprocess_data(instance, inp, 0, train_h5)
train_len = len(train_h5[self._input_names_[0]])
for input_name in self._input_names_:
if type(getattr(shape_output, input_name + "_out")) == np.ndarray:
cur_shape = (train_len,) + getattr(shape_output, input_name + "_out").shape
else:
cur_shape = (train_len, 1)
train_data[input_name] = mx.nd.zeros(cur_shape)
for output_name in self._output_names_:
if type(getattr(shape_output, output_name + "_out")) == nd.array:
cur_shape = (train_len,) + getattr(shape_output, output_name + "_out").shape
else:
cur_shape = (train_len, 1)
train_label[output_name] = mx.nd.zeros(cur_shape)
for i in range(train_len):
output = self.preprocess_data(instance, inp, i, train_h5)
for input_name in self._input_names_:
train_data[input_name][i] = getattr(output, input_name + "_out")
for output_name in self._output_names_:
train_label[output_name][i] = getattr(shape_output, output_name + "_out")
for input_name in self._input_names_:
data_mean[input_name + '_'] = nd.array(train_data[input_name][:].mean(axis=0))
data_std[input_name + '_'] = nd.array(train_data[input_name][:].asnumpy().std(axis=0) + 1e-5)
train_iter = mx.io.NDArrayIter(data=train_data,
label=train_label,
batch_size=batch_size)
test_data = {}
test_label = {}
shape_output = self.preprocess_data(instance, inp, 0, test_h5)
test_len = len(test_h5[self._input_names_[0]])
for input_name in self._input_names_:
if type(getattr(shape_output, input_name + "_out")) == np.ndarray:
cur_shape = (test_len,) + getattr(shape_output, input_name + "_out").shape
else:
cur_shape = (test_len, 1)
test_data[input_name] = mx.nd.zeros(cur_shape)
for output_name in self._output_names_:
if type(getattr(shape_output, output_name + "_out")) == nd.array:
cur_shape = (test_len,) + getattr(shape_output, output_name + "_out").shape
else:
cur_shape = (test_len, 1)
test_label[output_name] = mx.nd.zeros(cur_shape)
for i in range(test_len):
output = self.preprocess_data(instance, inp, i, test_h5)
for input_name in self._input_names_:
test_data[input_name][i] = getattr(output, input_name + "_out")
for output_name in self._output_names_:
test_label[output_name][i] = getattr(shape_output, output_name + "_out")
test_iter = mx.io.NDArrayIter(data=test_data,
label=test_label,
batch_size=batch_size)
return train_iter, test_iter, data_mean, data_std
def preprocess_data(self, instance_wrapper, input_wrapper, index, data_h5):
for input_name in self._input_names_:
data = data_h5[input_name][0]
attr = getattr(input_wrapper, input_name)
if (type(data)) == np.ndarray:
data = np.asfortranarray(data).astype(attr.dtype)
else:
data = type(attr)(data)
setattr(input_wrapper, input_name, data)
for output_name in self._output_names_:
data = data_h5[output_name][0]
attr = getattr(input_wrapper, output_name)
if (type(data)) == np.ndarray:
data = np.asfortranarray(data).astype(attr.dtype)
else:
data = type(attr)(data)
setattr(input_wrapper, output_name, data)
return instance_wrapper.execute(input_wrapper)
def load_h5_files(self):
train_h5 = None
test_h5 = None
......@@ -73,6 +214,7 @@ class CNNDataLoader_CifarClassifierNetwork:
if os.path.isfile(train_path):
train_h5 = h5py.File(train_path, 'r')
print(train_path)
for input_name in self._input_names_:
if not input_name in train_h5:
......
This diff is collapsed.
This diff is collapsed.
......@@ -3,6 +3,9 @@ import h5py
import mxnet as mx
import logging
import sys
import numpy as np
import cv2
import importlib
from mxnet import nd
class CNNDataLoader_VGG16:
......@@ -65,6 +68,144 @@ class CNNDataLoader_VGG16:
return train_iter, train_test_iter, test_iter, data_mean, data_std, train_images, test_images
def load_data(self, batch_size, img_size):
train_h5, test_h5 = self.load_h5_files()
width = img_size[0]
height = img_size[1]
comb_data = {}
data_mean = {}
data_std = {}
for input_name in self._input_names_:
train_data = train_h5[input_name][:]
test_data = test_h5[input_name][:]
train_shape = train_data.shape
test_shape = test_data.shape
comb_data[input_name] = mx.nd.zeros((train_shape[0]+test_shape[0], train_shape[1], width, height))
for i, img in enumerate(train_data):
img = img.transpose(1,2,0)
comb_data[input_name][i] = cv2.resize(img, (width, height)).reshape((train_shape[1],width,height))
for i, img in enumerate(test_data):
img = img.transpose(1, 2, 0)
comb_data[input_name][i+train_shape[0]] = cv2.resize(img, (width, height)).reshape((train_shape[1], width, height))
data_mean[input_name + '_'] = nd.array(comb_data[input_name][:].mean(axis=0))
data_std[input_name + '_'] = nd.array(comb_data[input_name][:].asnumpy().std(axis=0) + 1e-5)
comb_label = {}
for output_name in self._output_names_:
train_labels = train_h5[output_name][:]
test_labels = test_h5[output_name][:]
comb_label[output_name] = np.append(train_labels, test_labels, axis=0)
train_iter = mx.io.NDArrayIter(data=comb_data,
label=comb_label,
batch_size=batch_size)
test_iter = None
return train_iter, test_iter, data_mean, data_std
def load_preprocessed_data(self, batch_size, preproc_lib):
train_h5, test_h5 = self.load_h5_files()
wrapper = importlib.import_module(preproc_lib)
instance = getattr(wrapper, preproc_lib)()
instance.init()
lib_head, _sep, tail = preproc_lib.rpartition('_')
inp = getattr(wrapper, lib_head + "_input")()
train_data = {}
train_label = {}
data_mean = {}
data_std = {}
shape_output = self.preprocess_data(instance, inp, 0, train_h5)
train_len = len(train_h5[self._input_names_[0]])
for input_name in self._input_names_:
if type(getattr(shape_output, input_name + "_out")) == np.ndarray:
cur_shape = (train_len,) + getattr(shape_output, input_name + "_out").shape
else:
cur_shape = (train_len, 1)
train_data[input_name] = mx.nd.zeros(cur_shape)
for output_name in self._output_names_:
if type(getattr(shape_output, output_name + "_out")) == nd.array:
cur_shape = (train_len,) + getattr(shape_output, output_name + "_out").shape
else:
cur_shape = (train_len, 1)
train_label[output_name] = mx.nd.zeros(cur_shape)
for i in range(train_len):
output = self.preprocess_data(instance, inp, i, train_h5)
for input_name in self._input_names_:
train_data[input_name][i] = getattr(output, input_name + "_out")
for output_name in self._output_names_:
train_label[output_name][i] = getattr(shape_output, output_name + "_out")
for input_name in self._input_names_:
data_mean[input_name + '_'] = nd.array(train_data[input_name][:].mean(axis=0))
data_std[input_name + '_'] = nd.array(train_data[input_name][:].asnumpy().std(axis=0) + 1e-5)
train_iter = mx.io.NDArrayIter(data=train_data,
label=train_label,
batch_size=batch_size)
test_data = {}
test_label = {}
shape_output = self.preprocess_data(instance, inp, 0, test_h5)
test_len = len(test_h5[self._input_names_[0]])
for input_name in self._input_names_:
if type(getattr(shape_output, input_name + "_out")) == np.ndarray:
cur_shape = (test_len,) + getattr(shape_output, input_name + "_out").shape
else:
cur_shape = (test_len, 1)
test_data[input_name] = mx.nd.zeros(cur_shape)
for output_name in self._output_names_:
if type(getattr(shape_output, output_name + "_out")) == nd.array:
cur_shape = (test_len,) + getattr(shape_output, output_name + "_out").shape
else:
cur_shape = (test_len, 1)
test_label[output_name] = mx.nd.zeros(cur_shape)
for i in range(test_len):
output = self.preprocess_data(instance, inp, i, test_h5)
for input_name in self._input_names_:
test_data[input_name][i] = getattr(output, input_name + "_out")
for output_name in self._output_names_:
test_label[output_name][i] = getattr(shape_output, output_name + "_out")
test_iter = mx.io.NDArrayIter(data=test_data,
label=test_label,
batch_size=batch_size)
return train_iter, test_iter, data_mean, data_std
def preprocess_data(self, instance_wrapper, input_wrapper, index, data_h5):
for input_name in self._input_names_:
data = data_h5[input_name][0]
attr = getattr(input_wrapper, input_name)
if (type(data)) == np.ndarray:
data = np.asfortranarray(data).astype(attr.dtype)
else:
data = type(attr)(data)
setattr(input_wrapper, input_name, data)
for output_name in self._output_names_:
data = data_h5[output_name][0]
attr = getattr(input_wrapper, output_name)
if (type(data)) == np.ndarray:
data = np.asfortranarray(data).astype(attr.dtype)
else:
data = type(attr)(data)
setattr(input_wrapper, output_name, data)
return instance_wrapper.execute(input_wrapper)
def load_h5_files(self):
train_h5 = None
test_h5 = None
......@@ -73,6 +214,7 @@ class CNNDataLoader_VGG16:
if os.path.isfile(train_path):
train_h5 = h5py.File(train_path, 'r')
print(train_path)
for input_name in self._input_names_:
if not input_name in train_h5:
......
import mxnet as mx
import numpy as np
import math
from mxnet import gluon
......@@ -97,13 +98,14 @@ class Net_0(gluon.HybridBlock):
else:
self.input_normalization_data_ = NoNormalization()
self.conv1_padding = Padding(padding=(0,0,0,0,2,1,2,1))
self.conv1_padding = Padding(padding=(0,0,-1,0,0,0,0,0))
self.conv1_ = gluon.nn.Conv2D(channels=96,
kernel_size=(11,11),
strides=(4,4),
use_bias=True)
# conv1_, output shape: {[96,55,55]}
self.pool1_padding = Padding(padding=(0,0,-1,0,0,0,0,0))
self.pool1_ = gluon.nn.MaxPool2D(
pool_size=(3,3),
strides=(2,2))
......@@ -118,6 +120,7 @@ class Net_0(gluon.HybridBlock):
use_bias=True)
# conv2_1_, output shape: {[128,27,27]}
self.pool2_1_padding = Padding(padding=(0,0,-1,0,0,0,0,0))
self.pool2_1_ = gluon.nn.MaxPool2D(
pool_size=(3,3),
strides=(2,2))
......@@ -131,6 +134,7 @@ class Net_0(gluon.HybridBlock):
use_bias=True)
# conv2_2_, output shape: {[128,27,27]}
self.pool2_2_padding = Padding(padding=(0,0,-1,0,0,0,0,0))
self.pool2_2_ = gluon.nn.MaxPool2D(
pool_size=(3,3),
strides=(2,2))
......@@ -161,6 +165,7 @@ class Net_0(gluon.HybridBlock):
use_bias=True)
# conv5_1_, output shape: {[128,13,13]}
self.pool5_1_padding = Padding(padding=(0,0,-1,0,0,0,0,0))
self.pool5_1_ = gluon.nn.MaxPool2D(
pool_size=(3,3),
strides=(2,2))
......@@ -182,6 +187,7 @@ class Net_0(gluon.HybridBlock):
use_bias=True)
# conv5_2_, output shape: {[128,13,13]}