Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
8f579f2
Add some debug info in security_barrier_camera_demo.
yangwang201911 Jan 24, 2022
fef9a0a
Update.
yangwang201911 Mar 7, 2022
d101b67
Update the debug msg and Add result paser for security_barrier_camera…
yangwang201911 Mar 10, 2022
7d5ff26
Add correctness checker interface for demo.
yangwang201911 Mar 10, 2022
3551ada
Implement parser and correcteness checker for security_barrier_camera…
yangwang201911 Mar 14, 2022
3fb15e0
Add correctness checker script and instantiate checker of demo securi…
yangwang201911 Mar 16, 2022
6fb10ef
. exit when task list is empty and inputs source is image instead of …
yangwang201911 Mar 22, 2022
7eca858
Exit worker thread when the inferences of all frames have been comple…
yangwang201911 Mar 23, 2022
a2f8421
Update parameters of demo security_barrier_camera_demo so that just i…
yangwang201911 Mar 23, 2022
b0845bc
Merge branch 'master' into ywang2/analysis_result_automatically_for_A…
yangwang201911 Mar 23, 2022
cc86f1d
Add the comment of replacing model for the demo security_barrier_cam…
yangwang201911 Mar 23, 2022
37f8371
Input single image for demo security_barrier_camera_demo.
yangwang201911 Mar 23, 2022
237dcf3
Update.
yangwang201911 Mar 23, 2022
d0e831b
Update.
yangwang201911 Mar 23, 2022
6b9ce5a
Update.
yangwang201911 Mar 25, 2022
85327ef
Decouple of the raw data saving from the run_tests.py.
yangwang201911 Mar 25, 2022
ab9d19c
Update.
yangwang201911 Mar 28, 2022
f1c5c87
Add scope 'correctness' to enable correctness checking.
yangwang201911 Mar 31, 2022
b4d110b
Remove the log save for each demo and update the correctness checker.
yangwang201911 Apr 1, 2022
dbe9f13
Update.
yangwang201911 Apr 1, 2022
065ca07
Update format and remove some redundant code.
yangwang201911 Apr 1, 2022
3755135
Update.
yangwang201911 Apr 1, 2022
603c120
Revert the common thread.
yangwang201911 Apr 2, 2022
2e2ade4
Update.
yangwang201911 Apr 6, 2022
3596cd2
Merge branch 'master' into ywang2/analysis_result_automatically_for_A…
yangwang201911 Apr 6, 2022
a3e464a
Update correctness checker as the common measure for all demos.
yangwang201911 Apr 7, 2022
8631f93
1. Fix the issue that demo lost the inference of the last frame when …
yangwang201911 Apr 8, 2022
91baf7d
Updata correctness checker and revert inputing images hanlder for se…
yangwang201911 Apr 11, 2022
2fe3933
1. Update correctness checker to support the multi models inputting. …
yangwang201911 Apr 12, 2022
128ec7e
Merge branch 'master' into ywang2/analysis_result_automatically_for_A…
yangwang201911 Apr 12, 2022
0914845
Update exit code when correctness checking falied.
yangwang201911 Apr 13, 2022
796e315
Modify the input dataset path when updating option '-i' for demo.
yangwang201911 Apr 15, 2022
f33983d
Update correctness checker.
yangwang201911 Apr 15, 2022
7c47ce7
Correct the output layer order of the attributes model for the securi…
yangwang201911 Apr 24, 2022
2f066d1
1. Stop reborning if images frame ID is invalid. 2. clone image frame…
yangwang201911 Apr 26, 2022
1562b9b
Update correctness checking logic.
yangwang201911 Apr 28, 2022
d2d37e3
1. fix the bug in the security demo that lost the results of the infe…
yangwang201911 May 5, 2022
65fe33b
1. Throw the exception when parsing raw data failed. 2. Correct the v…
yangwang201911 May 6, 2022
1f44622
Add logic to check if the size of vehicle attributs is correct.
yangwang201911 May 7, 2022
0ff6d8c
Update correctness checking.
yangwang201911 May 9, 2022
3958ea4
Fix the hang issue when inputting images folder.
yangwang201911 May 23, 2022
42171be
Update correctness checking logic to handle the exception.
yangwang201911 May 25, 2022
ba629d0
Update.
yangwang201911 May 25, 2022
6c43933
Fix hange issue when inputting images folder.
yangwang201911 May 26, 2022
c10b3ce
Merge branch 'master' of https://github.com/openvinotoolkit/open_mode…
yangwang201911 Jun 24, 2022
5ccace4
Fix the run_tests.py terminated with exception when timeout occurs.
yangwang201911 Jun 28, 2022
a5d84dc
Update.
yangwang201911 Aug 15, 2022
77968e6
Merge branch 'master' into ywang2/analysis_result_automatically_for_A…
yangwang201911 Aug 15, 2022
7c57fd2
update.
yangwang201911 Aug 16, 2022
f7d7a1d
Update.
yangwang201911 Sep 13, 2022
bb8e615
Merge branch 'ywang2/fix_run_tests_terminated_with_exception_when_tim…
yangwang201911 Sep 13, 2022
19f9ff1
Update.
yangwang201911 Sep 13, 2022
8739a29
Merge branch 'ywang2/fix_run_tests_terminated_with_exception_when_tim…
yangwang201911 Sep 13, 2022
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
Prev Previous commit
Next Next commit
Update the debug msg and Add result paser for security_barrier_camera…
…_demo.

Signed-off-by: Wang, Yang <[email protected]>
  • Loading branch information
yangwang201911 committed Mar 10, 2022
commit d101b6778182f9ccd8c300e9f3510337c38cf3c3
3 changes: 0 additions & 3 deletions demos/common/cpp/utils/include/utils/threads_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,8 @@ class Worker {
}
void runThreads() {
running = true;
slog::debug << "thread pool size: " << threadPool.size() << slog::endl;
for (std::thread& t : threadPool) {
t = std::thread(&Worker::threadFunc, this);
slog::debug << "thread is pushing now." << slog::endl;
}
}
void push(std::shared_ptr<Task> task) {
Expand All @@ -79,7 +77,6 @@ class Worker {
tasksCondVar.notify_one();
}
void threadFunc() {
slog::debug << "thread is running now." << slog::endl;
while (running) {
std::unique_lock<std::mutex> lk(tasksMutex);
while (running && tasks.empty()) {
Expand Down
6 changes: 3 additions & 3 deletions demos/security_barrier_camera_demo/cpp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ class ClassifiersAggregator {
std::mutex& printMutex = static_cast<ReborningVideoFrame*>(sharedVideoFrame.get())->context.classifiersAggregatorPrintMutex;
printMutex.lock();
if (FLAGS_r && !rawDetections.empty()) {
//slog::debug << "--Channel #" << sharedVideoFrame->sourceID <<"--Frame #" << sharedVideoFrame->frameId << "-----" << slog::endl;
slog::debug << rawDetections;
for (const std::string& rawDetection : rawDetections)
slog::debug << rawDetection << slog::endl;
// destructor assures that none uses the container
for (const std::string& rawAttribute : rawAttributes.container) {
slog::debug << rawAttribute << slog::endl;
Expand Down Expand Up @@ -431,6 +431,7 @@ bool DetectionsProcessor::isReady() {
classifiersAggregator = std::make_shared<ClassifiersAggregator>(sharedVideoFrame);
std::list<Detector::Result> results;
results = context.inferTasksContext.detector.getResults(*inferRequest, sharedVideoFrame->sourceID, sharedVideoFrame->frameId, sharedVideoFrame->frame.size(), classifiersAggregator->rawDetections);

for (Detector::Result result : results) {
switch (result.label) {
case 1:
Expand Down Expand Up @@ -833,7 +834,6 @@ int main(int argc, char* argv[]) {
readerCount++;
}
}
slog::debug << "Reader Count: " << readerCount << slog::endl;

// Running
worker->runThreads();
Expand Down
10 changes: 3 additions & 7 deletions demos/security_barrier_camera_demo/cpp/net_wrappers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ class Detector {
std::list<Result> results;
ov::Tensor output_tensor = inferRequest.get_tensor(m_detectorOutputName);
const float* const detections = output_tensor.data<float>();
slog::debug << "------- Channel #" << channelID << " - Frame #" << frameID << slog::endl;
// pretty much regular SSD post-processing
for (int i = 0; i < maxProposalCount; i++) {
float image_id = detections[i * objectSize + 0]; // in case of batch
Expand All @@ -159,14 +158,11 @@ class Detector {
rect.height = static_cast<int>(detections[i * objectSize + 6] * upscale.height) - rect.y;
results.push_back(Result{label, confidence, rect});
std::ostringstream rawResultsStream;
rawResultsStream << "[" << i << "," << label << "] element, prob = " << confidence
<< " (" << rect.x << "," << rect.y << ")-(" << rect.width << "," << rect.height << ")";

rawResultsStream << "ChannelId:" << channelID << ",FrameId:" << frameID << ",";
rawResultsStream << "ObjId:" << i << "," << label << "," << confidence
<< "," << rect.x << "," << rect.y << "," << rect.width << "," << rect.height;
rawResults.push_back(rawResultsStream.str());
}

if(results.size() != 3)
slog::debug << "==== Channel #" << channelID << "-Frame #" << frameID << "-ROI Number #" << results.size() << " ====" << slog::endl;
return results;
}

Expand Down
50 changes: 42 additions & 8 deletions demos/tests/cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@
# TODO with Python3.7 use namedtuple defaults instead
TestCase.__new__.__defaults__ = [],


class Demo:
IMPLEMENTATION_TYPES = set()

def __init__(self, name, implementation, model_keys=None, device_keys=None, test_cases=None):
def __init__(self, name, implementation, model_keys=None, device_keys=None, test_cases=None, parser=None):
self.implementation = implementation
self.subdirectory = name + '/' + implementation
self.device_keys = device_keys
Expand All @@ -40,7 +39,8 @@ def __init__(self, name, implementation, model_keys=None, device_keys=None, test
self.test_cases = test_cases

self._exec_name = self.subdirectory.replace('/', '_')
self.parser = None
self.parser = parser
self.results = {}

Demo.IMPLEMENTATION_TYPES.add(implementation)

Expand Down Expand Up @@ -69,9 +69,13 @@ def add_parser(self, parser):
self.parser = parser(self)
return self

def parse_output(self, output, test_case, device):
def parse_output(self, output, device, test_case_index):
if self.parser:
self.parser(output, test_case, device)
tmp = self.parser(output)
if device not in self.results:
self.results[device] = {}
self.results[device][test_case_index] = tmp
print (self.results)

def update_option(self, updated_options):
for case in self.test_cases[:]:
Expand Down Expand Up @@ -122,8 +126,8 @@ def set_precisions(self, precisions, model_info):


class CppDemo(Demo):
def __init__(self, name, implementation='cpp', model_keys=None, device_keys=None, test_cases=None):
super().__init__(name, implementation, model_keys, device_keys, test_cases)
def __init__(self, name, implementation='cpp', model_keys=None, device_keys=None, test_cases=None, parser=None):
super().__init__(name, implementation, model_keys, device_keys, test_cases, parser)

self._exec_name = self._exec_name.replace('_cpp', '')

Expand Down Expand Up @@ -151,7 +155,6 @@ def join_cases(*args):
for case in args: extra_models.update(case.extra_models)
return TestCase(options=options, extra_models=list(case.extra_models))


def combine_cases(*args):
return [join_cases(*combination)
for combination in itertools.product(*[[arg] if isinstance(arg, TestCase) else arg for arg in args])]
Expand All @@ -160,6 +163,35 @@ def combine_cases(*args):
def single_option_cases(key, *args):
return [TestCase(options={} if arg is None else {key: arg}) for arg in args]

def security_barrier_camera_damo_parser(output):
output = output.split('\n')
channel_results = {}
for line in output:
if "ChannelID" in line:
print (line)
if "DEBUG" not in line:
continue
item = line[line.find('Channel') : ].split(',')
# Channel ID
frame_results = {}
channel = item[0].split(':')
if channel[1] not in channel_results:
channel_results[channel[1]] = frame_results

# Frame ID
object_results = {}
frame = item[1].split(':')
if frame[1] not in channel_results[channel[1]]:
channel_results[channel[1]][frame[1]] = object_results

# Object ID
label_prob_pos_results = []
objid = item[2].split(':')
if objid[1] not in channel_results[channel[1]][frame[1]]:
channel_results[channel[1]][frame[1]][objid[1]] = label_prob_pos_results
channel_results[channel[1]][frame[1]][objid[1]] = item[3:]

return channel_results


DEMOS = [
Expand Down Expand Up @@ -590,9 +622,11 @@ def single_option_cases(key, *args):
CppDemo(name='security_barrier_camera_demo',
model_keys=['-m', '-m_lpr', '-m_va'],
device_keys=['-d', '-d_lpr', '-d_va'],
parser=security_barrier_camera_damo_parser,
test_cases=combine_cases(
TestCase(options={'-no_show': None,
**MONITORS,
'-r': None,
'-i': DataDirectoryArg('vehicle-license-plate-detection-barrier')}),
TestCase(options={'-m': ModelArg('vehicle-license-plate-detection-barrier-0106')}),
single_option_cases('-m_lpr',
Expand Down
5 changes: 3 additions & 2 deletions demos/tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import contextlib
import csv
import json
from operator import contains
import os
import platform
import shlex
Expand Down Expand Up @@ -321,13 +322,13 @@ def option_to_args(key, value):
stderr=subprocess.STDOUT, universal_newlines=True, encoding='utf-8',
env=demo_environment)
execution_time = timeit.default_timer() - start_time
demo.parse_output(output, test_case, device)
demo.parse_output(output, device, test_case_index)
except subprocess.CalledProcessError as e:
print(e.output)
print('Exit code:', e.returncode)
num_failures += 1
execution_time = -1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please restore it


if args.report_file:
collect_result(demo.subdirectory, device, case_model_names, execution_time, args.report_file)

Expand Down