From fce342dca2782a1b00b3985ed14b07334df77316 Mon Sep 17 00:00:00 2001 From: Kaipeng Deng Date: Tue, 10 Dec 2019 21:31:20 +0800 Subject: [PATCH] fix mixup error when dataset has only 1 sample (#101) * fix mixup error when dataset has only 1 sample * refine log --- ppdet/data/source/roidb_source.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ppdet/data/source/roidb_source.py b/ppdet/data/source/roidb_source.py index 7d42e87b8..4d898d951 100644 --- a/ppdet/data/source/roidb_source.py +++ b/ppdet/data/source/roidb_source.py @@ -28,6 +28,9 @@ import copy import pickle as pkl from ..dataset import Dataset +import logging +logger = logging.getLogger(__name__) + class RoiDbSource(Dataset): """ interface to load roidb data from files @@ -134,6 +137,11 @@ class RoiDbSource(Dataset): if self._is_shuffle: random.shuffle(self._roidb) + if self._mixup_epoch > 0 and self._samples < 2: + logger.info("Disable mixup for dataset samples " + "less than 2 samples") + self._mixup_epoch = -1 + if self._epoch < 0: self._epoch = 0 else: -- GitLab