From 1388b4ec47daea5efa5f32288bad6ffcc7266f7e Mon Sep 17 00:00:00 2001 From: David de la Iglesia Castro <daviddelaiglesiacastro@gmail.com> Date: Thu, 25 Mar 2021 03:49:58 +0100 Subject: [PATCH] [Refactor]: Add deprecate warnings of LoadImage (#4813) * Remove LoadImage * Add deprecation warning --- mmdet/apis/inference.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mmdet/apis/inference.py b/mmdet/apis/inference.py index 739fb372..464d1e2d 100644 --- a/mmdet/apis/inference.py +++ b/mmdet/apis/inference.py @@ -54,7 +54,10 @@ def init_detector(config, checkpoint=None, device='cuda:0', cfg_options=None): class LoadImage(object): - """A simple pipeline to load image.""" + """Deprecated. + + A simple pipeline to load image. + """ def __call__(self, results): """Call function to load images into results. @@ -62,10 +65,13 @@ class LoadImage(object): Args: results (dict): A result dict contains the file name of the image to be read. - Returns: dict: ``results`` will be returned containing loaded image. """ + warnings.simplefilter('once') + warnings.warn('`LoadImage` is deprecated and will be removed in ' + 'future releases. You may use `LoadImageFromWebcam` ' + 'from `mmdet.datasets.pipelines.` instead.') if isinstance(results['img'], str): results['filename'] = results['img'] results['ori_filename'] = results['img'] -- GitLab