Reputation: 7304
I am working on Constitutional Neural Network using Caffe.
I have a prototxt file with layer "hungarian". That layer has two additional top layers box_confidences
and box_assignments
.
layer {
name: "hungarian"
type: "HungarianLoss"
bottom: "bbox_concat"
bottom: "boxes"
bottom: "box_flags"
top: "hungarian"
top: "box_confidences"
top: "box_assignments"
loss_weight: 0.03
hungarian_loss_param {
match_ratio: 0.5
permute_matches: true
}
}
Then that box_confidences
is used in another layer box_loss
as bottom
layer{
name: "box_loss"
type: "SoftmaxWithLoss"
bottom: "score_concat"
bottom: "box_confidences"
top: "box_loss"
}
My queries are
(1)Do I need to setup layers for these box_confidences
and box_assignments
?
(2)If necessary, how to setup layer in this prototxt file? That layer is just holding blob data and how these two layers are used in the HungarianLossLayer
class member function can be seen as
void HungarianLossLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top){
...............
...............
...............
Dtype* top_confidences = top[1]->mutable_cpu_data();
...............
...............
...............
for (int i = 0; i < num_pred; ++i) {
top_confidences[n * num_pred + i] =
assignment[i] < num_gt_[n] ? Dtype(1) : Dtype(0);
Dtype* top_assignments = top[2]->mutable_cpu_data();
top_assignments[n * num_pred + i] =
assignment[i] < num_gt_[n] ? assignment[i] : Dtype(-1);
}
...............
...............
}
I just put .....
for some other codes not to be messy.
So box_confidences
and box_assignments
are just data blobs and size is num_pred
. WIthout running the code, it is hard for me to know the value of num_pred
.
What could be the best way to setup these two layers in prototxt file?
Upvotes: 0
Views: 159
Reputation: 356
box_confidences
and box_assignments
are the feature maps (or intermediate activations) output by the HungarianLoss
layer. No manual setup for this memory is necessary and you can safely provide them as bottom blobs for subsequent layers (like your SoftmaxWithLoss
) in the network
Upvotes: 0