diff --git a/dygraph/yolov3/models/yolov3.py b/dygraph/yolov3/models/yolov3.py index dee29926e220f482f7ba9fb326d515ff052405e7..b49c9f63a75da3f0d24ce12e2f06993457bc74ad 100755 --- a/dygraph/yolov3/models/yolov3.py +++ b/dygraph/yolov3/models/yolov3.py @@ -24,8 +24,8 @@ from paddle.fluid.regularizer import L2Decay from config import cfg from paddle.fluid.dygraph.nn import Conv2D, BatchNorm -from darknet import DarkNet53_conv_body -from darknet import ConvBNLayer +from .darknet import DarkNet53_conv_body +from .darknet import ConvBNLayer from paddle.fluid.dygraph.base import to_variable diff --git a/dygraph/yolov3/train.py b/dygraph/yolov3/train.py index b7e2b6abaeca1c9ae7b3ad50dc7887dc27f04040..7c1548e6faea7ac143e8a2586248b207df065723 100755 --- a/dygraph/yolov3/train.py +++ b/dygraph/yolov3/train.py @@ -80,16 +80,17 @@ def train(): if args.use_data_parallel: strategy = fluid.dygraph.parallel.prepare_context() model = YOLOv3(3, is_train=True) - if args.use_data_parallel: - model = fluid.dygraph.parallel.DataParallel(model, strategy) if cfg.pretrain: restore, _ = fluid.load_dygraph(cfg.pretrain) - model.blocks.set_dict(restore) + model.block.set_dict(restore) if cfg.finetune: restore, _ = fluid.load_dygraph(cfg.finetune) - model.set_dict(restore) + model.set_dict(restore, use_structured_name=True) + + if args.use_data_parallel: + model = fluid.dygraph.parallel.DataParallel(model, strategy) boundaries = cfg.lr_steps gamma = cfg.lr_gamma