Skip to content

Instantly share code, notes, and snippets.

View shtern's full-sized avatar

Alexey Shtern shtern

  • XTEND
  • Tel Aviv, Israel
View GitHub Profile
import numpy as np
import cv2
import math
import json
import re
path_to_files = '/Users/shtern/runner-new-motion'
movement_json_path = '/Users/shtern/Downloads/movement.json'
res_prod_map = {2773: 'd2mj5veol0', 3139: '493lkx9o7e', 3113: 'y9m6nnl3e2', 2938: 'vjmkdv93qy'}
extra_json_name = 'scan_0_extra.json'
@shtern
shtern / opencv-fourcc-on-mac-os-x.md
Created July 13, 2020 16:39 — forked from takuma7/opencv-fourcc-on-mac-os-x.md
OpenCV Video Writer on Mac OS X
@shtern
shtern / opencv-fourcc-on-mac-os-x.md
Created July 13, 2020 16:39 — forked from takuma7/opencv-fourcc-on-mac-os-x.md
OpenCV Video Writer on Mac OS X
import matplotlib.pyplot as plt
from keras.datasets import mnist
import numpy as np
from keras.layers import Input, Dense, Conv2D, MaxPooling2D, UpSampling2D
from keras.models import Model
from keras import backend as K
(x_train, _), (x_test, _) = mnist.load_data()
x_train = x_train.astype('float32') / 255.
#
# packages 2 install
#
# !pip install tqdm
# !conda install -y Pillow
# ---------------------------------------------------------------------
# Load util
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid
import numpy as np
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
print('Training.images shape: ', mnist.train.images.shape)
print('Training.labels shape: ', mnist.train.labels.shape)
print('Shape of an image: ', mnist.train.images[0].shape)
import tensorflow as tf
import numpy as np
class AlexNet(object):
def __init__(self, x, keep_prob, num_classes, skip_layer,
weights_path='DEFAULT'):
# Parse input arguments into class variables
def adaboost_fit(X,y, M=10, learning_rate = 1):
#Initialization of utility variables
N = len(y)
estimator_list, y_predict_list, estimator_error_list, estimator_weight_list, sample_weight_list = [], [],[],[],[]
#Initialize the sample weights
sample_weight = np.ones(N) / N
sample_weight_list.append(sample_weight.copy())
for m in range(M):