luoyetx / OrdinalRegression

Caffe Loss Layer for Ordinal Regression with Multiple Output CNN for Age Estimation.
46 stars 24 forks source link

How to get a label of a new sample #6

Open Allen15rg opened 6 years ago

Allen15rg commented 6 years ago

thank you. I have compiled the OrdinalRegression loss in caffe successfully, but how can I get the label of a new sample by the trained model.

In my network, I have replaced the SoftmaxWithloss with OrdinalRegression loss and trained the network successfully. like this: I have 10 classes.

layer { name: "ip2" type: "InnerProduct" bottom: "ip1" top: "ip2" param { lr_mult: 1 } param { lr_mult: 2 } inner_product_param { num_output: 20 weight_filler { type: "xavier" } bias_filler { type: "constant" } } } layer { name: "accuracy" type: "Accuracy" bottom: "ip2" bottom: "label" top: "accuracy" include { phase: TEST } } layer { name: "loss" type: "OrdinalRegressionLoss" bottom: "ip2" bottom: "label" top: "loss" ordinal_regression_loss_param { k: 10 # k should be last layer's num_output / 2, which is num_classes } }

waiting for the reply, thank you