[IE Python Samples] Add a check for existence of output images (#6319)

* Add a check for existence of output images

* Change log messages to pass sample tests
This commit is contained in:
Dmitry Pigasin
2021-07-02 11:24:00 +03:00
committed by GitHub
parent c2e4e64079
commit 0c8147fdf8
3 changed files with 15 additions and 3 deletions

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: Apache-2.0
import argparse
import logging as log
import os
import sys
import cv2
@@ -133,7 +134,10 @@ def main():
cv2.rectangle(output_image, (xmin, ymin), (xmax, ymax), (0, 255, 0), 2)
cv2.imwrite('out.bmp', output_image)
log.info('Image out.bmp was created!')
if os.path.exists('out.bmp'):
log.info('Image out.bmp was created!')
else:
log.error('Image out.bmp was not created. Check your permissions.')
# ----------------------------------------------------------------------------------------------------------------------
log.info('This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool\n')

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: Apache-2.0
import argparse
import logging as log
import os
import sys
import cv2
@@ -146,7 +147,10 @@ def main(): # noqa
cv2.rectangle(output_image, (xmin, ymin), (xmax, ymax), (0, 255, 0), 2)
cv2.imwrite('out.bmp', output_image)
log.info('Image out.bmp created!')
if os.path.exists('out.bmp'):
log.info('Image out.bmp created!')
else:
log.error('Image out.bmp was not created. Check your permissions.')
# ----------------------------------------------------------------------------------------------------------------------
log.info('This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool\n')

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: Apache-2.0
import argparse
import logging as log
import os
import sys
import cv2
@@ -135,7 +136,10 @@ def main():
output_image = cv2.resize(output_image, (w, h))
cv2.imwrite(f'out_{i}.bmp', output_image)
log.info(f'Image out_{i}.bmp created!')
if os.path.exists(f'out_{i}.bmp'):
log.info(f'Image out_{i}.bmp created!')
else:
log.error(f'Image out_{i}.bmp was not created. Check your permissions.')
# ----------------------------------------------------------------------------------------------------------------------
log.info('This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool\n')