Skip to content

Instantly share code, notes, and snippets.

View dkurt's full-sized avatar

Dmitry Kurtaev dkurt

View GitHub Profile
import numpy as np
from openvino.inference_engine import IENetwork, IECore
import cv2 as cv
PERSON_ID = 11
net = IENetwork('semantic-segmentation-adas-0001.xml', 'semantic-segmentation-adas-0001.bin')
ie = IECore()
# This is the config to install Kubeflow on an existing k8s cluster.
# If the cluster already has istio, comment out the istio install part below.
apiVersion: kfdef.apps.kubeflow.org/v1alpha1
kind: KfDef
metadata:
name: kubeflow_app
namespace: kubeflow
spec:
repos:
  1. Скачайте OpenVINO с официального сайта: https://software.seek.intel.com/openvino-toolkit
  2. Установите OpenVINO
  3. Откройте терминал (Development Command Prompt на Windows)
  4. Выставите окружение
  • Windows
    "C:\Program Files (x86)\IntelSWTools\openvino\bin\setupvars.bat"
    
    Ожидаемое сообщение:
Collecting webrtcvad (from -r requirements.txt (line 3))
Using cached https://files.pythonhosted.org/packages/89/34/e2de2d97f3288512b9ea56f92e7452f8207eb5a0096500badf9dfd48f5e6/webrtcvad-2.0.10.tar.gz
Requirement already satisfied: numpy>=1.13.3 in c:\python36\lib\site-packages (from pandas->-r requirements.txt (line 1))
Requirement already satisfied: python-dateutil>=2.6.1 in c:\python36\lib\site-packages (from pandas->-r requirements.txt (line 1))
Requirement already satisfied: pytz>=2017.2 in c:\python36\lib\site-packages (from pandas->-r requirements.txt (line 1))
Requirement already satisfied: six>=1.5 in c:\python36\lib\site-packages (from python-dateutil>=2.6.1->pandas->-r requirements.txt (line 1))
Installing collected packages: webrtcvad
Running setup.py install for webrtcvad ... error
Complete output from command C:\Python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\dkurtaev\\AppData\\Local\\Temp\\pip-build-961ir8ti\\webrtcvad\\setup.py';f=getattr(tokenize, 'open', o
  1. Prepare the model (tested with mobilenetv2_coco_cityscapes_trainfine from https://github.com/tensorflow/models/blob/master/research/deeplab/g3doc/model_zoo.md)
import tensorflow as tf
from tensorflow.tools.graph_transforms import TransformGraph
from tensorflow.python.tools import optimize_for_inference_lib


graph = 'deeplabv3_mnv2_cityscapes_train/frozen_inference_graph.pb'
with tf.gfile.FastGFile(graph, 'rb') as f:
 graph_def = tf.GraphDef()
FROM ubuntu:18.04
RUN apt-get update && \
apt-get install -y \
git \
cmake \
wget \
unzip
RUN git clone https://github.com/intel/intel-graphics-compiler igc && \
#include <opencv2/dnn.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
std::vector<Rect> boxes; std::vector<float> confidences; std::vector<int> classIds;
#include <opencv2/dnn/layer.details.hpp>
#include <iostream>
import cv2 as cv
import numpy as np
def getBoardPoints():
pts = []
for x in range(0, 9):
for y in range(0, 6):
pts.append([x, y, 0])
return np.array(pts, dtype=np.float32)
  1. Download Android Studio

  2. Download Android NDK and SDK (as far as I remember SDK comes with Android Studio or might be installed from it's manager).

  3. Clone master branch of OpenCV. Create a /path/to/opencv/build folder and run cmake with the following flags. You may emit BUILD_LIST flag to build all the modules.

export ANDROID_NDK=/home/dkurtaev/Downloads/android-ndk-r14b
export ANDROID_SDK=/home/dkurtaev/Android/Sdk/
export ANDROID_HOME=/home/dkurtaev/Android/Sdk/
import cv2 as cv
import numpy as np
img = cv.imread('/home/dkurt/Pictures/download.jpeg')
inp = cv.dnn.blobFromImage(img, 0.017, (224, 224), (103.94,116.78,123.68), swapRB=False, crop=False)
net = cv.dnn.readNet('shufflenet_1x_g3_deploy.prototxt', 'shufflenet_1x_g3.caffemodel')
net.setPreferableBackend(cv.dnn.DNN_BACKEND_OPENCV)
net.setInput(inp)
out = net.forward()