Code Monkey home page Code Monkey logo

Comments (4)

nshaud avatar nshaud commented on June 15, 2024

If you would closely, the examples are designed so that you never train with unclassified values. In the ISPRS dataset, there are 6 classes, 'unclassified' is not one of them.

Now, as far as I understand, you want to perform binary classification with undefined labels. So, what you should have is ignore_label: 2 in your prototxt file (assuming that 0 is 'A', 1 is 'B' and 2 is 'unclassified').

However, the number of outputs in the last convolutional layer has to match the number of labels, even if you ignore the last label. So, if you want to train with A, B and undefined, your final layers should be like those :

layer {
  name: "conv1_1_D"
  type: "Convolution"
  bottom: "conv1_2_D"
  top: "conv1_1_D"
  param {
    lr_mult: 1
    decay_mult: 1
  }
  convolution_param {
    num_output: 3 ### because you have 3 labels = A, B, undefined
    pad: 1
    kernel_size: 3
    weight_filler {
      type: "msra"
    }
  }
}
layer {
  name: "loss"
  type: "SoftmaxWithLoss"
  bottom: "conv1_1_D"
  bottom: "label"
  top: "loss"
  ignore_label: 2 ### Do not compute the loss (and do not train) on the 'undefined' labels
}

I hope this is clear enough.

from deepnetsforeo.

jorgenaya avatar jorgenaya commented on June 15, 2024

Yes, it's clear. I had tried something similar before, but it fails building the net, because "caffe.LayerParameter has no field named "ignore_label".

So, what I tried now is the following:

layer {
name: "conv1_1_D"
type: "Convolution"
bottom: "conv1_2_D"
top: "conv1_1_D"
param {
lr_mult: 1
decay_mult: 1
}
convolution_param {
num_output: 3 ### because you have 3 labels = A, B, undefined
pad: 1
kernel_size: 3
weight_filler {
type: "msra"
}
}
}
layer {
name: "loss"
type: "SoftmaxWithLoss"
bottom: "conv1_1_D"
bottom: "label"
top: "loss"
accuracy_param {
ignore_label: 2 ### Do not compute the loss (and do not train) on the 'undefined' labels
}
}

Is this correct?

from deepnetsforeo.

jorgenaya avatar jorgenaya commented on June 15, 2024

After all, i suppose that I also have to modify the net in the inference step.
Is this true?

from deepnetsforeo.

nshaud avatar nshaud commented on June 15, 2024

Yes, but it's not mandatory. What's important is that you do not train on unclassified labels. In the inference steps, unclassified labels should not be predicted anyway, although you can add the "ignore_label" parameter in the inference network so that you compute the accuracy and loss without taking those pixels into account.

from deepnetsforeo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.