From 30b070d1bf631ee037d391a7ff6af2d582e1cfd2 Mon Sep 17 00:00:00 2001 From: sneakerkg Date: Sun, 28 Jun 2015 17:28:33 +0800 Subject: [PATCH] fix bug in xavier FC initialization, and README about SYNC_FREQ --- owl/owl/net/net.py | 5 ++--- scripts/learning/README.md | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/owl/owl/net/net.py b/owl/owl/net/net.py index 9a3caa30..ebb06662 100644 --- a/owl/owl/net/net.py +++ b/owl/owl/net/net.py @@ -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): diff --git a/scripts/learning/README.md b/scripts/learning/README.md index e7f4db04..873d34ec 100644 --- a/scripts/learning/README.md +++ b/scripts/learning/README.md @@ -5,15 +5,16 @@ Train network Use following command to start training given Caffe's solver and configure file ```bash -./net_trainer.py +./net_trainer.py ``` * `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