Skip to content

Commit

Permalink
Port G-API demos to API2.0 - background_subtraction_demo/cpp_gapi - e…
Browse files Browse the repository at this point in the history
…nable test cases and check with the OpenCV fix
  • Loading branch information
DariaMityagina committed Apr 29, 2024
1 parent 3033c7b commit fcca470
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 22 deletions.
24 changes: 13 additions & 11 deletions .github/workflows/cpp_gapi-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,25 @@ jobs:
path: ${{ github.workspace }}/cache
key: unused
restore-keys: ubuntu20_2023.2.0.13089.cfd42bd2cb0-
- if: ${{ !steps.cache.outputs.cache-hit }}
uses: actions/checkout@v3
with:
repository: opencv/opencv
path: cache/opencv
- if: ${{ !steps.cache.outputs.cache-hit }}
name: Compile OpenCV
- name: Clone and checkout OpenCV
run: |
cd cache
mkdir opencv-with-fix
cd opencv-with-fix
git clone https://github.com/DariaMityagina/opencv.git
cd opencv
git checkout icv/dm/add-media-frame-support-to-govbackend
- name: Compile OpenCV
run: |
rm -rf cache/opencv/.git/ # Minimize cache
mkdir cache/opencv/build
cd cache/opencv/build
cd cache
mkdir opencv-with-fix/opencv/build
cd opencv-with-fix/opencv/build
cmake -DCMAKE_BUILD_TYPE=Release -DWITH_INF_ENGINE=y -DOpenVINO_DIR=$GITHUB_WORKSPACE/ov/runtime/cmake/ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_LINKER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_C_LINKER_LAUNCHER=ccache -DBUILD_TESTS=y -DVIDEOIO_ENABLE_PLUGINS=y -DBUILD_PERF_TESTS=n -DBUILD_EXAMPLES=n -DBUILD_opencv_apps=y -DWITH_OPENCL=n -DWITH_OPENCLAMDBLAS=n -DWITH_GSTREAMER=n -DWITH_V4L=ON -DWITH_LIBV4L=ON -DWITH_OPENCLAMDFFT=n -DWITH_VA=n -DWITH_VA_INTEL=n -DWITH_PROTOBUF=n -DBUILD_PROTOBUF=n -DBUILD_JAVA=n -DBUILD_opencv_java_bindings_generator=n -DBUILD_opencv_python2=n -DBUILD_opencv_python3=n -DWITH_IMGCODEC_HDR=y -DWITH_IMGCODEC_SUNRASTER=y -DWITH_IMGCODEC_PXM=y -DWITH_IMGCODEC_PFM=y -DWITH_PNG=y -DWITH_TIFF=n -DWITH_WEBP=n -DWITH_OPENJPEG=n -DWITH_JASPER=n -DWITH_OPENEXR=n -DBUILD_opencv_dnn=n -DBUILD_opencv_features2d=n -DBUILD_opencv_flann=n -DWITH_TBB=n -DBUILD_INFO_SKIP_EXTRA_MODULES=n -DBUILD_JASPER=n -DBUILD_PNG=n -DBUILD_OPENEXR=n -DBUILD_WEBP=n -DBUILD_ZLIB=n -DWITH_CUDA=n -DWITH_EIGEN=n -DWITH_GPHOTO2=n -DOPENCV_GAPI_GSTREAMER=n -DWITH_LAPACK=n -DWITH_MATLAB=n -DWITH_MFX=n -DWITH_QUIRC=n -DWITH_VTK=n -DINSTALL_PDB=n -DINSTALL_TESTS=n -DINSTALL_C_EXAMPLES=n -DINSTALL_PYTHON_EXAMPLES=n -DOPENCV_GENERATE_SETUPVARS=n -DWITH_1394=n -DWITH_FFMPEG=y -DWITH_GTK_2_X=y -DBUILD_JPEG=y -DWITH_IPP=y -DENABLE_CONFIG_VERIFICATION=y -DBUILD_LIST=core,gapi,highgui,imgcodecs,imgproc,videoio,video ..
cmake --build . -j $((`nproc`*2+2))
- name: build_demos.sh
run: |
source ov/setupvars.sh
OpenCV_DIR=$GITHUB_WORKSPACE/cache/opencv/build CMAKE_CXX_COMPILER_LAUNCHER=ccache CMAKE_CXX_LINKER_LAUNCHER=ccache ./demos/build_demos.sh --build_dir=build # TODO: add CMAKE_CXX_FLAGS=-Werror after background_subtraction_demo/cpp_gapi is updated to ov2.0
OpenCV_DIR=$GITHUB_WORKSPACE/cache/opencv-with-fix/opencv/build CMAKE_CXX_COMPILER_LAUNCHER=ccache CMAKE_CXX_LINKER_LAUNCHER=ccache ./demos/build_demos.sh --build_dir=build # TODO: add CMAKE_CXX_FLAGS=-Werror after background_subtraction_demo/cpp_gapi is updated to ov2.0
- uses: actions/setup-python@v4
with:
python-version: 3.11
Expand Down
28 changes: 17 additions & 11 deletions demos/tests/cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,21 @@ def single_option_cases(key, *args):


DEMOS = [
# CppDemo(name='background_subtraction_demo', device_keys=['-d'], implementation='cpp_gapi', test_cases=combine_cases(
# TestCase(options={'--no_show': None, '-at': 'maskrcnn',
# **MONITORS,
# '-i': DataPatternArg('coco128-subset-480x640x3'),
# }),
# single_option_cases('-m',
# ModelArg('instance-segmentation-person-0007'),
# ModelArg('instance-segmentation-security-0091')),
# )),
CppDemo(name='background_subtraction_demo', device_keys=['-d'], implementation='cpp_gapi', test_cases=combine_cases(
TestCase(options={'--no_show': None, '-at': 'maskrcnn',
**MONITORS,
}),
# TODO: enable this case once E#111291 is fixed
# single_option_cases('-m',
# ModelArg('instance-segmentation-person-0007'),
# ModelArg('instance-segmentation-security-0091')),
single_option_cases('-m',
ModelArg('instance-segmentation-person-0007')),
single_option_cases(
'-i',
DataPatternArg('coco128-every-480x640x3'),
str('video.mp4')),
)),

CppDemo('classification_benchmark_demo', 'cpp_gapi', test_cases=combine_cases(
single_option_cases(
Expand Down Expand Up @@ -251,8 +257,8 @@ def single_option_cases(key, *args):
ModelArg('face-detection-retail-0004')),
single_option_cases(
'-i',
str('video.mp4'),
DataPatternArg('coco128-every-480x640x3')),
DataPatternArg('coco128-every-480x640x3'),
str('video.mp4')),
)),

# TODO: https://github.com/DariaMityagina is to fix the demo
Expand Down

0 comments on commit fcca470

Please sign in to comment.