Skip to content

Instantly share code, notes, and snippets.

View dkurt's full-sized avatar

Dmitry Kurtaev dkurt

View GitHub Profile
@dkurt
dkurt / rpi
Last active July 30, 2020 10:48
# docker build raspberry_pi -t vineyard_rpi --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy
# docker run -v $(pwd):/mnt vineyard_rpi cp opencv.tar.gz /mnt
FROM debian:buster
RUN dpkg --add-architecture armhf && \
apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
crossbuild-essential-armhf \
git \
import numpy as np
import cv2 as cv
import tensorflow as tf
img = cv.imread('img1.jpg')
img = np.ascontiguousarray(img[:,:,[2, 1, 0]])
resized_img = cv.resize(img, (640, 640))
#
# Run TensorFlow
@dkurt
dkurt / opencv_for_android_studio.md
Last active April 9, 2023 00:02
OpenCV for Android Studio
import tensorflow as tf
from tensorflow.python.tools import optimize_for_inference_lib
pb_file = 'resnet_v2_101_299_frozen.pb'
graph_def = tf.compat.v1.GraphDef()
try:
with tf.io.gfile.GFile(pb_file, 'rb') as f:
graph_def.ParseFromString(f.read())
except:
// g++ main.cpp -o out && ./out
#include <stdio.h>
class Counter {
public:
Counter() : i(0) {}
int next() {
i += 1;
from math import ceil
d = 2
h = 3
w = 4
scale_d = 3
scale_h = 3
scale_w = 2
c = 3
curl -o GPG-PUB-KEY-INTEL-OPENVINO-2020 https://apt.repos.intel.com/openvino/2020/GPG-PUB-KEY-INTEL-OPENVINO-2020
apt-key add GPG-PUB-KEY-INTEL-OPENVINO-2020
echo "deb https://apt.repos.intel.com/openvino/2020 all main" | tee - a /etc/apt/sources.list.d/intel-openvino-2020.list
apt-get update
apt-get install -y --no-install-recommends intel-openvino-dev-ubuntu18
node {
name: "normalized_input_image_tensor"
op: "Placeholder"
attr {
key: "dtype"
value {
type: DT_FLOAT
}
}
attr {
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: