diff --git a/dygraph/configs/yolov3/yolov3_darknet53_270e_voc.yml b/dygraph/configs/yolov3/yolov3_darknet53_270e_voc.yml new file mode 100644 index 0000000000000000000000000000000000000000..bb7a315ef29a09eb5d223447789af83ca40a1619 --- /dev/null +++ b/dygraph/configs/yolov3/yolov3_darknet53_270e_voc.yml @@ -0,0 +1,10 @@ +_BASE_: [ + '../datasets/voc.yml', + '../runtime.yml', + '_base_/optimizer_270e.yml', + '_base_/yolov3_darknet53.yml', + '_base_/yolov3_reader.yml', +] + +snapshot_epoch: 5 +weights: output/yolov3_darknet53_270e_voc/model_final diff --git a/dygraph/ppdet/data/reader.py b/dygraph/ppdet/data/reader.py index ad3e96d41aa454e53902604e7272a209cc551ffd..a212c6e0048cf75368f01036afd8c4a4c764aab3 100644 --- a/dygraph/ppdet/data/reader.py +++ b/dygraph/ppdet/data/reader.py @@ -43,9 +43,11 @@ class Compose(object): for t in self.transforms: for k, v in t.items(): op_cls = getattr(transform, k) - self.transforms_cls.append(op_cls(**v)) - if hasattr(op_cls, 'num_classes'): - op_cls.num_classes = num_classes + f = op_cls(**v) + if hasattr(f, 'num_classes'): + f.num_classes = num_classes + + self.transforms_cls.append(f) def __call__(self, data): for f in self.transforms_cls: @@ -109,8 +111,6 @@ class BatchCompose(Compose): class BaseDataLoader(object): - __share__ = ['num_classes'] - def __init__(self, inputs_def=None, sample_transforms=[], @@ -194,6 +194,8 @@ class BaseDataLoader(object): @register class TrainReader(BaseDataLoader): + __shared__ = ['num_classes'] + def __init__(self, inputs_def=None, sample_transforms=[], @@ -211,6 +213,8 @@ class TrainReader(BaseDataLoader): @register class EvalReader(BaseDataLoader): + __shared__ = ['num_classes'] + def __init__(self, inputs_def=None, sample_transforms=[], @@ -228,6 +232,8 @@ class EvalReader(BaseDataLoader): @register class TestReader(BaseDataLoader): + __shared__ = ['num_classes'] + def __init__(self, inputs_def=None, sample_transforms=[], diff --git a/tools/x2coco.py b/tools/x2coco.py index ee29c12353885bbb1a93a5015d05ec70e79e5d1a..86548a50aabc632f2d8973c9111276f9dc40d226 100644 --- a/tools/x2coco.py +++ b/tools/x2coco.py @@ -43,8 +43,8 @@ class MyEncoder(json.JSONEncoder): return obj.tolist() else: return super(MyEncoder, self).default(obj) - - + + def images_labelme(data, num): image = {} image['height'] = data['imageHeight']