Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def prep_nnet_arch(n_depth, n_size, activation, colormode, alpha):
- layers = [5] #x, y, r, z1, z2
- for i in range(n_depth):
- layers.append(n_size)
- colormode = colormode.lower()
- ### Output layer. Append number of output neurons depending on which colormode is selected
- if colormode in ["rgb", "hsv", "hsl"] : #RGB
- if not alpha:
- layers.append(3)
- else:
- layers.append(4)
- elif colormode == "cmyk":
- if not alpha:
- layers.append(4)
- else:
- layers.append(5)
- elif colormode == "bw":
- if not alpha:
- layers.append(1)
- else:
- layers.append(2)
- else:
- print("Inserted colormode '{}' is not part ob supported ones: [rgb, bw, cmyk, hsv, hsl]".format(colormode))
- raise Exception("Non-supported colormode {}".format(colormode))
- possibles = ["sigmoid", "tanh", "relu", "identity", "softsign", "sin", "cos", "softmax"]
- if not activation.lower() in possibles:
- print('defined activation {} not supported in {}'.format(activation, str(possibles)))
- return None
- activations_fnc = [activation] * (len(layers)-2)
- activations_fnc.append("sigmoid")
- return layers, activations_fnc
Add Comment
Please, Sign In to add comment