Last active
February 7, 2018 23:10
-
-
Save bparaj/9b6bcad04bc9df362229927df80db366 to your computer and use it in GitHub Desktop.
Example Caffe layers
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
# 1. | |
# Flip the label values. Change 0's to 1's and viceversa. | |
# PowerLayer computes outputs y = (shift + scale * x) ^ power | |
layer { | |
name: "flip_label" | |
type: "Power" | |
bottom: "label" | |
top: "flip_label" | |
power_param { | |
power: 1 | |
scale: -1 | |
shift: 1 | |
} | |
} | |
# 2. | |
# Slice input blob. | |
layer { | |
name: "slice_blob" | |
type: "Slice" | |
bottom: "myblob" | |
top: "left_blob" | |
top: "right_blob" | |
slice_param { | |
axis: 1 | |
slice_point: 1 | |
} | |
} | |
# 3. | |
# If "bot" is a two channeled blob, it converts the two numbers per location into probabilities with SoftMax. | |
layer { | |
name: "prob" | |
type: "Softmax" | |
bottom: "bot" | |
top: "prob" | |
softmax_param {engine: CAFFE} | |
} | |
# 4. | |
# Obtain predictions with ArgMax. Gives channel indices with max probability. | |
layer { | |
name: "prediction" | |
type: "ArgMax" | |
bottom: "prob" | |
top: "pred" | |
argmax_param { | |
axis: 1 | |
top_k: 1 | |
} | |
} | |
# 5. | |
# Reduce a blob to a single number by doing an operation (here, sum). | |
layer { | |
name: "reduce" | |
type: "Reduction" | |
bottom: "bot" | |
top: "top" | |
reduction_param { | |
axis: 0 | |
operation: SUM | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment