Git Product home page Git Product logo

Comments (5)

JoeFannie avatar JoeFannie commented on July 26, 2024

I also met this problem and solved it by removing the last ip layer, which is the "fc9_1" layer. Since the "fc9_1" layer will magnify the norm of the feature to enlarge the distance between a and an, you can see the distance keeps increasing untill it overflows. I also recommend adding a "PReLU" layer after the last ip layer before normalizing it.

from tripletloss.

peternara avatar peternara commented on July 26, 2024

@JoeFannie thanks .
Do you mean to remove the embedding layer?

layer {
name: "norm2"
type: "Python"
bottom: "fc7"
top: "norm2"
python_param {
module: "norm2layer"
layer: "Norm2Layer"
}
}
layer {
name: "fc9_1"
type: "InnerProduct"
bottom: "norm2"
top: "fc9_1"
param {
lr_mult: 1
decay_mult: 0
}
inner_product_param {
num_output: 512
weight_filler {
type: "xavier"
}
}
}

Then, what kind of layer do you measure?
( I need a dimensionally reduced vector. So I want to know how to reduce it.)

from tripletloss.

JoeFannie avatar JoeFannie commented on July 26, 2024

layer {
name: "norm2"
type: "Python"
bottom: "fc7"
top: "norm2"
python_param {
module: "norm2layer"
layer: "Norm2Layer"
}
}
add only norm2 layer is just good. If u want to reduce the dimension, u can move the norm2 layer to the next to the last ip layer "fc9_1". In one word, the feature is supposed to be normalized before being fed to the triplet loss layer. Hope it helps.

from tripletloss.

peternara avatar peternara commented on July 26, 2024

@JoeFannie sorry very late..and thanks.

fc7 -> fc9_1 -> norm2 ->"triplet_select"
Do you mean this order?

so, below...

,,,

layer {
  name: "fc7"
  type: "InnerProduct"
  bottom: "fc6"
  top: "fc7"
  param {
    lr_mult: 0
    decay_mult: 0
  }
  param {
    lr_mult: 0
    decay_mult: 0
  }
  inner_product_param {
    num_output: 4096
    weight_filler {
      type:"xavier"
    }
  }
}
layer {
  name: "relu7"
  type: "ReLU"
  bottom: "fc7"
  top: "fc7"
}
layer {
  name: "drop7"
  type: "Dropout"
  bottom: "fc7"
  top: "fc7"
  dropout_param {
    dropout_ratio: 0.5
  }
}

layer {
  name: "fc9_1"
  type: "InnerProduct"
  bottom: "fc7"
  top: "fc9_1"
  param {
    lr_mult: 1
    decay_mult: 0
  }
  inner_product_param {
    num_output: 512
    weight_filler {
      type: "xavier"
    }
  }
}

layer {
  name: "norm2"
  type: "Python"
  bottom: "fc9_1"
  top: "norm2"
  python_param {
    module: "norm2layer"
    layer: "Norm2Layer"
  }
}
#add activation layer may increase the feature's expression
layer {
  name: "triplet_select"
  type: "Python"
  bottom: "norm2"
  bottom: "labels"
  top: "archor"
  top: "positive"
  top: "negative"
  python_param {
    module: "tripletselectlayer"
    layer: "TripletSelectLayer"
  }
}
layer {
  name: "tripletloss"
  type: "Python"
  bottom: "archor"
  bottom: "positive"
  bottom: "negative"
  top: "loss"
  python_param {
    module: "tripletlosslayer"
    layer: "TripletLayer"
    param_str: "'margin': 0.2"
  }
  loss_weight: 1
}

from tripletloss.

JoeFannie avatar JoeFannie commented on July 26, 2024

It is what I mean

from tripletloss.

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.