Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow security segmentation models to be used in auto annotation #759

Merged
merged 1 commit into from
Oct 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions cvat/apps/auto_annotation/model_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,19 @@ def __init__(self, model, weights):

iter_inputs = iter(network.inputs)
self._input_blob_name = next(iter_inputs)
self._input_info_name = ''
self._output_blob_name = next(iter(network.outputs))

self._require_image_info = False

info_names = ('image_info', 'im_info')

# NOTE: handeling for the inclusion of `image_info` in OpenVino2019
if 'image_info' in network.inputs:
if any(s in network.inputs for s in info_names):
self._require_image_info = True
if self._input_blob_name == 'image_info':
self._input_info_name = set(network.inputs).intersection(info_names)
self._input_info_name = self._input_info_name.pop()
if self._input_blob_name in info_names:
self._input_blob_name = next(iter_inputs)

self._net = plugin.load(network=network, num_requests=2)
Expand All @@ -56,7 +61,7 @@ def infer(self, image):
info[0, 1] = w
# frame number
info[0, 2] = 1
inputs['image_info'] = info
inputs[self._input_info_name] = info

results = self._net.infer(inputs)
if len(results) == 1:
Expand Down