Permalink
Browse files

fix bug in xavier FC initialization, and README about SYNC_FREQ

  • Loading branch information...
1 parent 29dd5eb commit 30b070d1bf631ee037d391a7ff6af2d582e1cfd2 @sneakerkg sneakerkg committed Jun 28, 2015
Showing with 5 additions and 5 deletions.
  1. +2 −3 owl/owl/net/net.py
  2. +3 −2 scripts/learning/README.md
View
@@ -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)
@@ -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):
@@ -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

0 comments on commit 30b070d

Please sign in to comment.