Skip to content

Commit

Permalink
update multi label doc
Browse files Browse the repository at this point in the history
  • Loading branch information
winstywang committed Apr 28, 2015
1 parent c61ec42 commit 1fbef73
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ In general, cxxnet configuration file contains four kinds of configurations in a
- This page includes all the four tasks you could try by cxxnet.
* [Other Setting](other.md)
- Set other parameters for neural network, related to device selection, running control.
* [Advanced Usages](advanced.md)
- Some advanced usages of cxxnet can he found here.
28 changes: 28 additions & 0 deletions doc/advanced.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#### Introduction
This page will introduce some advanced usages in cxxnet, including:
* [Multi-label Training](#multi-label-training)

#### Multi-label Training
* To use multi-label training, you need the following three steps in additional to the case of single label training:
- First, you need to specify the number of labels in the network by setting ```label_width``` variable in global settings. The following setting denotes that we have 5 labels in the network.
```bash
label_width = 5
```
- In the [image list file](io.md#image-list-file), you need to provide ```label_width``` labels instead of one label. Namely, each line is in the format:
```
image_index \t label_1 \t label_2 ... \t label_n \t file_name
```
- In global setting, you need to specify how each field of the labels form a label vector. For example, we are interested in a localization task. In the task, we first need to output the label for one image, and next predict its position denoted by a bounding box. The configuration can be written as:
```
label_vec[0, 1) = class
label_vec[1, 5) = bounding_box
```
- At last, in each loss layer, you need to specify the target of the loss:
```
layer[19->21] = softmax
target = class
layer[20->22] = l2_loss
target = bounding_box
```
This means for the first field of the labels, we treat it as a class label, and apply standard softmax loss function on it. For the other four labels, we treat them as the coordinates of the bounding box, and train them using Euclidean loss.

2 changes: 1 addition & 1 deletion doc/io.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Deterministic transformations are usually used in test to generate diverse predi

=
### CSV Iterator
This iterator can be used to read data files that stores in a raw CSV file. The CSV file should have the following data structure ```label(s) | other_columns```. The number of label columns can be controlled via ```label_width``` parameter, by default it is set to 1, i.e. first column of CSV file is treated as labels. Example:
This iterator can be used to read data files that stores in a raw CSV file. The CSV file should have the following data structure ```label(s) , other_columns```. The number of label columns can be controlled via ```label_width``` parameter, by default it is set to 1, i.e. first column of CSV file is treated as labels. Example:
```bash
iter = csv
filename = "train.csv"
Expand Down

0 comments on commit 1fbef73

Please sign in to comment.