GitXplorerGitXplorer
g

caffe-weighted-samples

public
23 stars
14 forks
1 issues

Commits

List of commits on branch master.
Unverified
e5c028f40baa1383142de990c3f3d536fba3a22d

Link to newer repo

ggustavla committed 9 years ago
Unverified
440bebbe081fc78aa2177256c0ff5879da4bfc5a

Made inputs optional in HDF5 data layer.

ggustavla committed 10 years ago
Unverified
ea4bf9749bce60ad84a854e45335ae79dace9e3b

Added SOFTMAX_CROSS_ENTROPY_LOSS layer.

ggustavla committed 10 years ago
Unverified
eee4168194aaf2479df66c24aa443212584068be

Added note about sample_weight being required.

ggustavla committed 10 years ago
Unverified
e5830fa334e54dc91a4674f4e9b611c1cc9e2788

Updated pycaffe to include sample weights.

ggustavla committed 10 years ago
Unverified
45cc5dfdd2d456a46a8d9f3869df01dad78fdb2a

Fixed typo in README.

ggustavla committed 10 years ago

README

The README file for this repository.

Caffe with weighted samples

This is a branch of Caffe that allows training with weighted samples. The branch is experimental, so not every layer is updated to fit this new paradigm, nor are unit tests updated (yet). It might also easily break, since it has not be throughly tested.

How it works

The input data in Caffe is normally an associate array with the keys "data" and "label". The sample weights are input through this data structure by adding another key called "sample_weight". The weights should have the same shape as the labels.

Now, sample_weight can be accessed just like data and label, so we need to make sure our network's data layer loads them in:

layers { # Your data layer
    # ...
    top: "data"
    top: "label"
    top: "sample_weight"
}

Connect them to your loss layer:

layers { # Your loss layer
    name: "loss"
    type: SOFTMAX_LOSS
    bottom: "ip1"  # or whatever name it might have
    bottom: "label"
    bottom: "sample_weight"
    top: "loss"
}

Features

Read sample_weight through:

  • HDF5
  • lmdb (untested)
  • leveldb (untested)

The layers that have been made to appreciate sample_weight are:

  • SOFTMAX_LOSS (label and sample_weight should be 1D)
  • EUCLIDEAN_LOSS (label and sample_weight should be 2D)

New layers althogether include:

  • SOFTMAX_CROSS_ENTROPY_LOSS (a multi-class generalization of SIGMOID_CROSS_ENTROPY_LOSS)

For now, sample_weight is required to be specified, both in the training and testing data (even though it is not used in the latter).

Original Caffe note

Caffe is a deep learning framework developed with cleanliness, readability, and speed in mind.
Consult the project website for all documentation.