caffepycaffedeeplearning4jmatcaffe

What parts an parameters of train_val.prototxt, solver.prototxt, and deploy.prototxt should be changed based on our own data?


I am confused about changing the parameters for training a net in caffe based on our own data.

I tried to train FCN32 for semantic segmentation. I changed the number of outputs in Deconvolution layer (i.e.,upscore_sign) to the number of classes in my data, but it is giving an error.

I really appreciate if someone knows, please share your knowledge.

Thanks


Solution

  • Which layer of the net we should pay attention

    When finetuning a model to a new task, with probably different number of labels, one must change num_output of the last layer.
    The last layer serves as a probability prediction layer, outputting a vector of probabilities for each predicted variable: For image classification, the net predicts a prob vector per image; In FCN the net outputs prob vector pre pixel. The prob vector is of length = number of labels = num_output of last layer. Thus you must change this value to accommodate for the new number of labels in your new task.
    See this post for more details.

    What is the difference between 'deploy.prototxt' and 'train_val.prototxt'

    This difference is explained in this post.

    Should I change the layers in 'deploy.prototxt' based on the 'train_val.prototxt'?

    Yes!