Skip to content
This repository has been archived by the owner on Oct 15, 2019. It is now read-only.

Commit

Permalink
fix bug in xavier FC initialization, and README about SYNC_FREQ
Browse files Browse the repository at this point in the history
  • Loading branch information
sneakerkg committed Jun 28, 2015
1 parent 29dd5eb commit 30b070d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 2 additions & 3 deletions owl/owl/net/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,7 @@ def init_weights_with_filler(self):
elif self.bias_filler.type == "uniform":
npbias = np.random.uniform(self.bias_filler.min, self.bias_filler.max, self.bshape)
elif self.bias_filler.type == "xavier":
fan_in = np.prod(self.in_shape[:])
scale = np.sqrt(float(3)/fan_in)
scale = np.sqrt(float(3)/self.fan_in)
npbias = np.random.uniform(-scale, scale, self.bshape)
self.bias = owl.from_numpy(npbias.astype(np.float32)).reshape(self.bshape)

Expand Down Expand Up @@ -590,7 +589,7 @@ def compute_size(self, from_btm, to_top):
self.start_on_ori = to_top[self.top_names[0]]['start_on_ori']
#set fan_in fan_out
self.fan_out = self.inner_product_param.num_output
self.fan_in = from_btm[self.btm_names[0]]['out_shape'][0]
self.fan_in = np.prod(from_btm[self.btm_names[0]]['out_shape'][0:len(from_btm[self.btm_names[0]]['out_shape'])])


def ff(self, act, phase):
Expand Down
5 changes: 3 additions & 2 deletions scripts/learning/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ Train network

Use following command to start training given Caffe's solver and configure file
```bash
./net_trainer.py <solver_file> <SNAPSHOT> <NUM_GPU>
./net_trainer.py <solver_file> <SNAPSHOT> <NUM_GPU> <SYNC_FREQ>
```
* `solver_file` is the file name in Caffe's [solver](https://github.com/BVLC/caffe/blob/master/models/bvlc_googlenet/quick_solver.prototxt) format.
* `SNAPSHOT` is the index of the snapshot to start with (default: 0). If SNAPSHOT is not equal to 0, it means we continue training from the formal snapshot
* `NUM_GPU` is the number of gpu to use.
* `SYNC_FREQ` is the option to hide IO time consuming, set SYN_FREQ > 1 usually have better speed but will consume more GPU RAM. Please propally set it to let Minerva run smoothly on your machine. (default: 1)

Example:
```bash
./net_trainer.py /path/to/solver.txt 0 4
./net_trainer.py /path/to/solver.txt 0 4 2
```

Test network
Expand Down

0 comments on commit 30b070d

Please sign in to comment.