VCDP / FFmpeg-patch

This repository contains a collection of FFmpeg* patches and samples to enable CNN model based video analytics capabilities (such as object detection, classification, recognition) in FFmpeg* framework.
Other
65 stars 23 forks source link

Unable to run inference with mobilenet-ssd #9

Open ndujar opened 4 years ago

ndujar commented 4 years ago

Hi,

I have followed instructions to create a Docker image here and successfully built and run a container with the following command:

$ docker run -it --privileged --net=host -v ~/.Xauthority:/root/.Xauthority -v /tmp/.X11-unix:/tmp/.X11-unix:rw -e DISPLAY=unix$DISPLAY -e HTTP_PROXY=$HTTP_PROXY -e HTTPS_PROXY=$HTTPS_PROXY -e http_proxy=$http_proxy -e https_proxy=$https_proxy -v /dev/video2:/dev/video2 -v ~/ffva/FFmpeg-patch:/FFmpeg-patch -v ~/ffva/data/models/intel:/root/intel_models:ro -v ~/ffva/data/models/common:/root/common_models:ro -e MODELS_PATH=/root/common_models -v ~/ffva/data/video:/root/video-examples:rw -e VIDEO_EXAMPLES_DIR=/root/video-examples ffmpeg-video-analytics-package:latest

Happily, the face detection sample works like a charm after some reconstruction from the commands in the scripts provided:

$ ffmpeg -i /root/video-examples/news.mkv -vf "detect=model=/root/face-detection-0102.xml:device=CPU,classify=model=/root/mobilenet-ssd.xml:model_proc=/root/age-gender-recognition-retail-0013.json:device=CPU,ocv_overlay" -y /root/video-examples/faces.mp4

However, I have been going through the Advanced usage examples and I keep receiving a Create network failed! message:

I would expect that

$ ffmpeg -i /root/video-examples/news.mkv -vf "detect=model=/root/mobilenet-ssd.xml:device=CPU:nireq=8,ocv_overlay" -y /root/video-examples/objects.mp4

Would also work, however this is the output I keep getting:

ffmpeg version 4.2 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04) configuration: --prefix=/usr --extra-cflags=-I/opt/intel/openvino/deployment_tools/inference_engine/include --extra-ldflags=-L/opt/intel/openvino/deployment_tools/inference_engine/lib/intel64 --libdir=/usr/lib/x86_64-linux-gnu --extra-libs='-lpthread -lm' --enable-shared --enable-gpl --enable-libass --enable-libfreetype --enable-openssl --enable-nonfree --enable-libdrm --enable-libmfx --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libx264 --enable-libx265 --enable-libjson_c --enable-libsrt --enable-libinference_engine_c_api --enable-libopencv --enable-python3 libavutil 56. 31.100 / 56. 31.100 libavcodec 58. 54.100 / 58. 54.100 libavformat 58. 29.100 / 58. 29.100 libavdevice 58. 8.100 / 58. 8.100 libavfilter 7. 57.100 / 7. 57.100 libswscale 5. 5.100 / 5. 5.100 libswresample 3. 5.100 / 3. 5.100 libpostproc 55. 5.100 / 55. 5.100 Input #0, matroska,webm, from '/root/video-examples/news.mkv': Metadata: COMPATIBLE_BRANDS: iso6avc1mp41 MAJOR_BRAND : dash MINOR_VERSION : 0 ENCODER : Lavf58.35.101 Duration: 00:10:18.98, start: -0.007000, bitrate: 709 kb/s Stream #0:0: Video: h264 (Main), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 50 tbc (default) Metadata: HANDLER_NAME : ISO Media file produced by Google Inc. DURATION : 00:10:18.960000000 Stream #0:1(eng): Audio: opus, 48000 Hz, stereo, fltp (default) Metadata: DURATION : 00:10:18.981000000 Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264)) Stream #0:1 -> #0:1 (opus (native) -> aac (native)) Press [q] to stop, [?] for help Loading model: device=CPU, path=/root/mobilenet-ssd.xml Setting batch_size=1, nireq=8 libavfilter/inference_backend/openvino_image_inference.c:364 : OpenVINOImageInferenceCreate Create network failed! Assertion ret == 0 failed at libavfilter/inference_backend/ff_inference_impl.c:284 Aborted (core dumped)

Any hints are much appreciated

bhargav-sudo commented 3 years ago

Hi @ndujar I had successfully built docker container. can you share the steps to run a container .? Iam using this command to run

docker run -it --privileged --net=host \ \ -v ~/.Xauthority:/root/.Xauthority \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -e DISPLAY=$DISPLAY \ -e HTTP_PROXY=$HTTP_PROXY \ -e HTTPS_PROXY=$HTTPS_PROXY \ -e http_proxy=$http_proxy \ -e https_proxy=$https_proxy \ \ -v ~/ffva/data/models/intel:/root/intel_models:ro \ -v ~/ffva/data/models/common:/root/common_models:ro \ -e MODELS_PATH=/root/intel_models:/root/common_models \ \ -v ~/ffva/data/video:/root/video-examples:ro \ -e VIDEO_EXAMPLES_DIR=/root/video-examples \ \ ffmpeg-video-analytics-

But there are only these 3 folders

common_models
intel_models
video-examples

As I see your issue you said there are some changes. If you share from running a container to run a sample It would help me more.. Because Iam trying this from the past few weeks. Help needed. Thanks

ndujar commented 3 years ago

Hi @bhargav-sudo: As I recall, I followed the Option 2 in the Getting Started Guide As I see in your command, you might be missing some important shared volumes. Have you tried to run the docker image with the same command as mine? docker run -it --privileged --net=host -v ~/.Xauthority:/root/.Xauthority -v /tmp/.X11-unix:/tmp/.X11-unix:rw -e DISPLAY=unix$DISPLAY -e HTTP_PROXY=$HTTP_PROXY -e HTTPS_PROXY=$HTTPS_PROXY -e http_proxy=$http_proxy -e https_proxy=$https_proxy -v /dev/video2:/dev/video2 -v ~/ffva/FFmpeg-patch:/FFmpeg-patch -v ~/ffva/data/models/intel:/root/intel_models:ro -v ~/ffva/data/models/common:/root/common_models:ro -e MODELS_PATH=/root/common_models -v ~/ffva/data/video:/root/video-examples:rw -e VIDEO_EXAMPLES_DIR=/root/video-examples ffmpeg-video-analytics-package:latest

As you can see, then I added the following (missing in your command): -v /dev/video2:/dev/video2 -v ~/ffva/FFmpeg-patch:/FFmpeg-patch

Hope this helps :)

bhargav-sudo commented 3 years ago

Hi @ndujar But I tried option 1 in guide. will try that and let you know.

Thanks.