This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def load_weights_from_by_layers(self, source): | |
self._output_layer = self.initialize_layers() | |
if isinstance(source, str): | |
source = np.load(source) | |
sourcelayers = {'Conv2DLayer':[],'DenseLayer':[]} | |
for l in source.get_all_layers(): | |
if 'Conv2DLayer' in str(type(l)): | |
sourcelayers['Conv2DLayer'].append(l) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is an example nolearn NeuralNet to do supervised learning. This network is being used to do supervised learning on black and white images, which are 135 * 240 in size. The same network can be modified to bgr images just by modifying the input_shape to None,3,..,.. and output_num_unit to 3*135 * 240 | |
net_unsupervised_bw = NeuralNet( | |
layers=[ | |
('input', layers.InputLayer), | |
('noise1', GaussianNoiseLayer), | |
('conv1', Conv2DLayer), | |
('pool1', MaxPool2DLayer), | |
('dropout1', layers.DropoutLayer), # ! | |
('conv2', Conv2DLayer), |