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
1. fix the bug in the security demo that lost the results of the infe…
…rred frames. 2. update correctness checking logic that could validate the correctness the multi results within 1 frame individually.

Signed-off-by: Wang, Yang <[email protected]>
  • Loading branch information
yangwang201911 committed May 5, 2022
commit d2d37e322abada743b86c3790fa87bd2c7d46853
9 changes: 8 additions & 1 deletion demos/security_barrier_camera_demo/cpp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,8 @@ void DetectionsProcessor::process() {
const cv::Rect vehicleRect = *vehicleRectsIt;
ov::InferRequest& attributesRequest = *attributesRequestIt;
context.detectionsProcessorsContext.vehicleAttributesClassifier.setImage(attributesRequest, sharedVideoFrame->frame, vehicleRect);
// Decrease total inferred frames count by 1 when the ROI of frame has availiable attributes.
context.totalInferFrameCounter--;

attributesRequest.set_callback(
std::bind(
Expand All @@ -538,6 +540,8 @@ void DetectionsProcessor::process() {
classifiersAggregator->push(
BboxAndDescr{BboxAndDescr::ObjectType::VEHICLE, rect, attributes.first + ' ' + attributes.second});
context.attributesInfers.inferRequests.lockedPushBack(attributesRequest);
// Increased the total inferred frames count by 1 when attributes classification is done.
context.totalInferFrameCounter++;
}, classifiersAggregator,
std::ref(attributesRequest),
vehicleRect,
Expand All @@ -558,7 +562,8 @@ void DetectionsProcessor::process() {
const cv::Rect plateRect = *plateRectsIt;
ov::InferRequest& lprRequest = *lprRequestsIt;
context.detectionsProcessorsContext.lpr.setImage(lprRequest, sharedVideoFrame->frame, plateRect);

// Decrease the total inferred frames count by 1 when the ROI of frame has license plate.
context.totalInferFrameCounter--;
lprRequest.set_callback(
std::bind(
[](std::shared_ptr<ClassifiersAggregator> classifiersAggregator,
Expand All @@ -574,6 +579,8 @@ void DetectionsProcessor::process() {
}
classifiersAggregator->push(BboxAndDescr{BboxAndDescr::ObjectType::PLATE, rect, std::move(result)});
context.platesInfers.inferRequests.lockedPushBack(lprRequest);
// Increased by 1 total inferred frames count by 1 when license plate recognization is done.
context.totalInferFrameCounter++;
}, classifiersAggregator,
std::ref(lprRequest),
plateRect,
Expand Down
8 changes: 8 additions & 0 deletions demos/security_barrier_camera_demo/cpp/net_wrappers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,17 @@ class Detector {

cv::Rect rect;
rect.x = static_cast<int>(detections[i * objectSize + 3] * upscale.width);
if(rect.x < 0)
rect.x = 0;
rect.y = static_cast<int>(detections[i * objectSize + 4] * upscale.height);
if(rect.y < 0)
rect.y = 0;
rect.width = static_cast<int>(detections[i * objectSize + 5] * upscale.width) - rect.x;
if(rect.width > upscale.width)
rect.width = upscale.width;
rect.height = static_cast<int>(detections[i * objectSize + 6] * upscale.height) - rect.y;
if(rect.height > upscale.height)
rect.height = upscale.height;
results.push_back(Result{label, confidence, rect});
std::ostringstream rawResultsStream;
rawResultsStream << i << "," << label << "," << confidence
Expand Down
104 changes: 74 additions & 30 deletions demos/tests/correctness_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@ def check_difference(self):
"AUTO:CPU" : ["CPU"],
"AUTO:GPU" : ["GPU"],
}
# Record the results for the single device inputting like AUTO:CPU, AUTO:GPU
# {
# device 0: { target 0: {case 0: True/False, case 1: True/False, ...},...,target n:{} },
# device 1: { target 1: {case 0: True/False, case 1: True/False, ...},...,target n:{} },
# }
multi_correctness = {}

# For multi devices like AUTO:GPU,CPU, MULTI:GPU,CPU
# Record the results for the multi devices inputting like AUTO:GPU,CPU, MULTI:GPU,CPU
#{
# device 0:{
# case 0: {
Expand All @@ -94,7 +95,8 @@ def check_difference(self):
#}
multi_correctness_devices = {}

#{
# Record the detailed msg for the inconsistent results
# {
# device 0: {case 0: "error msg", case 1: "error msg", ...},
# device 1: {case 0: "error msg", case 1: "error msg", ...},
# ....
Expand All @@ -115,11 +117,15 @@ def check_difference(self):
multi_correctness[device][target] = {}
multi_correctness_errmsg[device]['-1'] = "\tMiss the results of device {} or device {}.\n".format(device, target)
continue
#if self.results[device] != self.results[target]:
# # Show the detailed inconsistent results
for case in self.results[target]:
if case not in multi_correctness[device][target]:
multi_correctness[device][target][case] = True
if case not in multi_correctness_errmsg[device]:
multi_correctness_errmsg[device][case] = ''

#if self.results[device][case] != self.results[target][case]:
for channel in self.results[device][case]:
for frame in self.results[device][case][channel]:
if channel not in self.results[target][case] or (channel in self.results[target][case] and frame not in self.results[target][case][channel]):
Expand All @@ -131,6 +137,15 @@ def check_difference(self):
multi_correctness[device][target][case] = False
multi_correctness_errmsg[device][case] += "[Device: {}- Case: {}][Not Found on {}]Channel {} - Frame {} : {}\n".format(device, case, device, channel, frame, self.results[target][case][channel][frame])
else:
#print("======Case:{} - Device: {} - Target: {} - channel: {} - frame: {}=======".format(case, device, target, channel, frame))
#print("Device {}: {}".format(device, self.results[device][case][channel][frame][obj]))
#print("{}: {}".format(target, self.results[target][case][channel][frame][obj]))
#if 'CPU' in device and 'GPU' in device:
# if target == 'CPU':
# print("GPU: {}".format(self.results['GPU'][case][channel][frame][obj]))
# elif target == 'GPU':
# print("CPU: {}".format(self.results['CPU'][case][channel][frame][obj]))

if 'CPU' in device and 'GPU' in device:
if case not in multi_correctness_devices[device][target]:
multi_correctness_devices[device][target][case] = {}
Expand Down Expand Up @@ -162,6 +177,14 @@ def check_difference(self):
else:
if device_vehicle_attr != target_vehicle_attr:
multi_correctness[device][target][case] = False
tmp_msg = ("[Device: {}- Case: {} on {}] Channel {} - Frame {} : {}\n".format(device, case, device, channel, frame, self.results[device][case][channel][frame]))
tmp_msg += ("[Device: {}- Case: {} on {}] Channel {} - Frame {} : {}\n".format(device, case, target, channel, frame, self.results[target][case][channel][frame]))
multi_correctness_errmsg[device][case] += tmp_msg
#if 'CPU' in device and 'GPU' in device:
# print(multi_correctness_devices[device][target][case][channel][frame])
#else:
# print(multi_correctness[device][target][case])
#print("======================================")
if 'CPU' in device and 'GPU' in device:
# Check if correctness result between device and target for multi devices
consistent_flag = False
Expand All @@ -178,6 +201,18 @@ def check_difference(self):
tmp_msg += ("[Device: {}- Case: {} on {}] Channel {} - Frame {} : {}\n".format(device, case, device, channel, frame, self.results[device][case][channel][frame]))
multi_correctness_errmsg[device][case] += tmp_msg

#print("=====================================")
#print(multi_correctness)
#print("=====================================")
print(multi_correctness_errmsg)
#print("=====================================")
#for device in multi_correctness_devices:
# for target in multi_correctness_devices[device]:
# for case in multi_correctness_devices[device][target]:
# for channel in multi_correctness_devices[device][target][case]:
# print("===== Device:{} - target: {} - Case: {} - channel: {}=====".format(device, target, case, channel))
# print(multi_correctness_devices[device][target][case][channel])
#print("=====================================")
final_correctness_flag = True
for device in devices_list:
if 'MULTI:GPU,CPU' != device and 'AUTO:GPU,CPU' != device:
Expand All @@ -197,39 +232,48 @@ def check_difference(self):
consistent_flag = False
err_msg += multi_correctness_errmsg[device][case]
if not consistent_flag:
print("Checking correctness between {} and {} : Failure.\n{}".format(device, devices_list[device], err_msg))
print("Checking device: {} - target : {} - : Fail.\n{}".format(device, devices_list[device], err_msg))
else:
print("Checking correctness between {} and {} : PASS.\n".format(device, devices_list[device]))
print("Checking device: {} - target : {} - : PASS.\n".format(device, devices_list[device]))
else:
consistent_flag = True
err_msg = ''
for case in multi_correctness[device]['CPU']:
if multi_correctness[device]['CPU'][case] == False:
final_correctness_flag = False
consistent_flag = False
err_msg += multi_correctness_errmsg[device][case]
else:
for channel in multi_correctness_devices[device]['GPU'][case]:
for frame in multi_correctness_devices[device]['GPU'][case][channel]:
frame_flag = True
for i in range(len(multi_correctness_devices[device]['GPU'][case][channel][frame])):
gpu_frame_consistent_flag = multi_correctness_devices[device]['GPU'][case][channel][frame][i]
cpu_frame_consistent_flag = multi_correctness_devices[device]['CPU'][case][channel][frame][i]
if gpu_frame_consistent_flag == False and cpu_frame_consistent_flag == False:
frame_flag = False
if not frame_flag:
final_correctness_flag = False
consistent_flag = False
err_msg += "\tDevice: {} - case: {} - channel: {} - frame: {}: {}\n".format(device, case, channel, frame, self.results[device][case][channel][frame][obj])
for target in devices_list[device]:
err_msg += "\tDevice: {} - case: {} - channel: {} - frame: {}: {}\n".format(target, case, channel, frame, self.results[device][case][channel][frame][obj])
for target in devices_list[device]:
err_msg += "\tDevice : {} - case: {} - channel: {} - frame: {}: {}\n".format(target, case, channel, frame, multi_correctness_devices[device]['GPU'][case][channel][frame])
if len(multi_correctness[device][target]) == 0:
final_correctness_flag = False
consistent_flag = False
# Miss results for device
err_msg += multi_correctness_errmsg[device]['-1']
else:
for case in multi_correctness[device]['CPU']:
if multi_correctness[device]['CPU'][case] == False:
final_correctness_flag = False
consistent_flag = False
err_msg += multi_correctness_errmsg[device][case]
#print(multi_correctness_errmsg[device][target][case])
else:
for channel in multi_correctness_devices[device]['GPU'][case]:
for frame in multi_correctness_devices[device]['GPU'][case][channel]:
frame_flag = True
for i in range(len(multi_correctness_devices[device]['GPU'][case][channel][frame])):
gpu_frame_consistent_flag = multi_correctness_devices[device]['GPU'][case][channel][frame][i]
cpu_frame_consistent_flag = multi_correctness_devices[device]['CPU'][case][channel][frame][i]
if gpu_frame_consistent_flag == False and cpu_frame_consistent_flag == False:
frame_flag = False
#print("checking result: {}\nDevice : GPU - case: {} - channel: {} - frame: {}: {}".format(frame_flag, case, channel, frame, multi_correctness_devices[device]['GPU'][case][channel][frame]))
#print("Device : CPU - case: {} - channel: {} - frame: {}: {}".format(case, channel, frame, multi_correctness_devices[device]['CPU'][case][channel][frame]))
if not frame_flag:
final_correctness_flag = False
consistent_flag = False
err_msg += "Inconsistent result:\n\tDevice: {} - case: {} - channel: {} - frame: {}: {}\n".format(device, case, channel, frame, self.results[device][case][channel][frame])
for target in devices_list[device]:
err_msg += "\tDevice: {} - case: {} - channel: {} - frame: {}: {}\n".format(target, case, channel, frame, self.results[target][case][channel][frame])
for target in devices_list[device]:
err_msg += "\tDevice: {} - case: {} - channel: {} - frame: {}: {}\n".format(target, case, channel, frame, multi_correctness_devices[device][target][case][channel][frame])

if not consistent_flag:
print("Checking correctness between {} and {} : Failure.\n{}".format(device, devices_list[device], err_msg))
print("Checking device: {} - target : {} - : Fail.\n{}".format(device, devices_list[device], err_msg))
else:
print("Checking correctness between {} and {} : PASS.\n".format(device, devices_list[device]))
print("Checking device: {} - target : {} - : PASS.\n".format(device, devices_list[device]))
return final_correctness_flag

def write_to_log(self, result, test_case, device):
Expand Down Expand Up @@ -303,12 +347,12 @@ def __call__(self, output, test_case, device, execution_time=0):
self.results[device][case_index][channel][frame][objid].append(item)
else:
self.results[device][case_index][channel][frame][objid].append(roi_attr_license[index])

#print("Device: {}- case: {} - channel: {} - frame: {}: {}".format(device, case_index, channel, frame, self.results[device][case_index][channel][frame]))
self.case_index[device] += 1

DEMOS = [
deepcopy(BASE['security_barrier_camera_demo/cpp'])
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you rebase on the master please

Suggested change
deepcopy(BASE['security_barrier_camera_demo/cpp'])
BASE['security_barrier_camera_demo/cpp']

.update_option({'-r': None,'-ni': '16', '-n_iqs': '1', '-i': '10_images.mp4'})
.update_option({'-r': None,'-ni': '16', '-n_iqs': '1', '-i': '204_images.mp4'})
.add_parser(DemoSecurityBarrierCamera)
]