Skip to content

Commit 7d7e121

Browse files
author
Dmitry Sidnev
committed
Update name of class and arg
1 parent 114555e commit 7d7e121

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

demos/background_subtraction_demo/python/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Based on this an instance segmentation model must be trained at least for person
4343

4444
As input, the demo application accepts a path to a single image file, a video file or a numeric ID of a web camera specified with a command-line argument `-i`
4545

46-
> **NOTE**: if you use image background matting models, `--bgr` argument should be specified. This is a background image that equal to a real background behind a person on an input frame and must have the same shape as an input image.
46+
> **NOTE**: if you use image background matting models, `--background` argument should be specified. This is a background image that equal to a real background behind a person on an input frame and must have the same shape as an input image.
4747
4848
The demo workflow is the following:
4949

@@ -92,7 +92,8 @@ usage: background_subtraction_demo.py [-h] -m MODEL
9292
[-d DEVICE] [-t PROB_THRESHOLD]
9393
[--resize_type {crop,standard,fit_to_window,fit_to_window_letterbox}]
9494
[--labels LABELS]
95-
[--target_bgr TARGET_BGR] [--bgr BGR]
95+
[--target_bgr TARGET_BGR]
96+
[--background BACKGROUND]
9697
[--blur_bgr BLUR_BGR]
9798
[-nireq NUM_INFER_REQUESTS]
9899
[-nstreams NUM_STREAMS]
@@ -130,7 +131,8 @@ Options:
130131
--target_bgr TARGET_BGR
131132
Optional. Background onto which to composite the
132133
output (by default to green field).
133-
--bgr BGR Optional. Background image for background-matting
134+
--background BACKGROUND
135+
Optional. Background image for background-matting
134136
model.
135137
--blur_bgr BLUR_BGR Optional. Background blur strength (by default with
136138
value 0 is not applied).

demos/background_subtraction_demo/python/background_subtraction_demo.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
sys.path.append(str(Path(__file__).resolve().parents[2] / 'common/python'))
2828

29-
from openvino.model_zoo.model_api.models import MaskRCNNModel, OutputTransform, RESIZE_TYPES, YolactModel, BackgroundMattingWithBGR, VideoBackgroundMatting
29+
from openvino.model_zoo.model_api.models import MaskRCNNModel, OutputTransform, RESIZE_TYPES, YolactModel, BackgroundMattingWithBackground, VideoBackgroundMatting
3030
from openvino.model_zoo.model_api.models.utils import load_labels
3131
from openvino.model_zoo.model_api.performance_metrics import PerformanceMetrics
3232
from openvino.model_zoo.model_api.pipelines import get_user_config, AsyncPipeline
@@ -62,7 +62,7 @@ def build_argparser():
6262
args.add_argument('--labels', help='Optional. Labels mapping file.', default=None, type=str)
6363
args.add_argument('--target_bgr', default=None, type=str,
6464
help='Optional. Background onto which to composite the output (by default to green field).')
65-
args.add_argument('--bgr', default=None, type=str,
65+
args.add_argument('--background', default=None, type=str,
6666
help='Optional. Background image for background-matting model.')
6767
args.add_argument('--blur_bgr', default=0, type=int,
6868
help='Optional. Background blur strength (by default with value 0 is not applied).')
@@ -113,15 +113,15 @@ def get_model(model_adapter, configuration, args):
113113
model = VideoBackgroundMatting(model_adapter, configuration)
114114
is_matting_model = True
115115
elif len(inputs) == 2 and len(outputs) in (2, 3) and 'bgr' in inputs.keys():
116-
if args.bgr is None:
117-
raise ValueError('The BackgroundMattingWithBGR model expects the specified "--bgr" option.')
118-
model = BackgroundMattingWithBGR(model_adapter, configuration)
116+
if args.background is None:
117+
raise ValueError('The BackgroundMattingWithBackground model expects the specified "--background" option.')
118+
model = BackgroundMattingWithBackground(model_adapter, configuration)
119119
need_bgr_input = True
120120
is_matting_model = True
121121
else:
122122
model = MaskRCNNModel(model_adapter, configuration)
123-
if not need_bgr_input and args.bgr is not None:
124-
log.warning('The \"--bgr\" option works only for BackgroundMattingWithBGR model. Option will be omitted.')
123+
if not need_bgr_input and args.background is not None:
124+
log.warning('The \"--background\" option works only for BackgroundMattingWithBackground model. Option will be omitted.')
125125

126126
if args.raw_output_message and is_matting_model:
127127
log.warning('\'--raw_output_message\' argument is set but is used background-matting based model, nothing to show')
@@ -223,7 +223,7 @@ def main():
223223

224224
model, need_bgr_input = get_model(model_adapter, configuration, args)
225225

226-
input_bgr = open_images_capture(args.bgr, False).read() if need_bgr_input else None
226+
input_bgr = open_images_capture(args.background, False).read() if need_bgr_input else None
227227

228228
person_id = -1
229229
for i, label in enumerate(labels):

demos/common/python/openvino/model_zoo/model_api/models/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717

1818
from .bert import BertEmbedding, BertNamedEntityRecognition, BertQuestionAnswering
19-
from .background_matting import BackgroundMattingWithBGR, VideoBackgroundMatting
19+
from .background_matting import BackgroundMattingWithBackground, VideoBackgroundMatting
2020
from .centernet import CenterNet
2121
from .classification import Classification
2222
from .deblurring import Deblurring
@@ -38,7 +38,7 @@
3838
from .yolo import YOLO, YoloV3ONNX, YoloV4, YOLOF, YOLOX
3939

4040
__all__ = [
41-
'BackgroundMattingWithBGR',
41+
'BackgroundMattingWithBackground',
4242
'BertEmbedding',
4343
'BertNamedEntityRecognition',
4444
'BertQuestionAnswering',

demos/common/python/openvino/model_zoo/model_api/models/background_matting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def initialize_rec(self):
8989
return rec
9090

9191

92-
class BackgroundMattingWithBGR(ImageModel):
92+
class BackgroundMattingWithBackground(ImageModel):
9393
__model__ = 'Background-matting'
9494

9595
def __init__(self, model_adapter, configuration, preload=False):

0 commit comments

Comments
 (0)