提交 1889f122 编写于 作者: Y Yibing Liu

Change optimizer & default learning rate

上级 75d242f4
...@@ -49,7 +49,7 @@ def parse_args(): ...@@ -49,7 +49,7 @@ def parse_args():
parser.add_argument( parser.add_argument(
'--learning_rate', '--learning_rate',
type=float, type=float,
default=0.002, default=0.00016,
help='Learning rate used to train. (default: %(default)f)') help='Learning rate used to train. (default: %(default)f)')
parser.add_argument( parser.add_argument(
'--device', '--device',
...@@ -125,8 +125,7 @@ def profile(args): ...@@ -125,8 +125,7 @@ def profile(args):
class_num=1749, class_num=1749,
parallel=args.parallel) parallel=args.parallel)
optimizer = fluid.optimizer.Momentum( optimizer = fluid.optimizer.Adam(learning_rate=args.learning_rate)
learning_rate=args.learning_rate, momentum=0.9)
optimizer.minimize(avg_cost) optimizer.minimize(avg_cost)
place = fluid.CPUPlace() if args.device == 'CPU' else fluid.CUDAPlace(0) place = fluid.CPUPlace() if args.device == 'CPU' else fluid.CUDAPlace(0)
......
...@@ -58,7 +58,7 @@ def parse_args(): ...@@ -58,7 +58,7 @@ def parse_args():
parser.add_argument( parser.add_argument(
'--learning_rate', '--learning_rate',
type=float, type=float,
default=0.002, default=0.00016,
help='Learning rate used to train. (default: %(default)f)') help='Learning rate used to train. (default: %(default)f)')
parser.add_argument( parser.add_argument(
'--device', '--device',
...@@ -143,8 +143,7 @@ def train(args): ...@@ -143,8 +143,7 @@ def train(args):
class_num=1749, class_num=1749,
parallel=args.parallel) parallel=args.parallel)
optimizer = fluid.optimizer.Momentum( optimizer = fluid.optimizer.Adam(learning_rate=args.learning_rate)
learning_rate=args.learning_rate, momentum=0.9)
optimizer.minimize(avg_cost) optimizer.minimize(avg_cost)
# program for test # program for test
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册