Skip to content

Instantly share code, notes, and snippets.

View jzuern's full-sized avatar
🚙

Jannik Zürn jzuern

🚙
View GitHub Profile
@jzuern
jzuern / balance.py
Last active October 29, 2019 17:48
#!/usr/bin/env python3
# coding=utf-8
import collections
import sys
import itertools
import matplotlib.pyplot as plt
import matplotlib as mpl
import time
import datetime
from tensorflow.python.platform import gfile
import tensorflow as tf
from tensorflow.contrib import tensorrt as trt
graph_filename ='resnetV150_frozen.pb'
f = gfile.FastGFile(graph_filename, 'rb')
# define graph def object
frozen_graph_def = tf.GraphDef()
import tensorflow as tf
import numpy as np
def int_shape(x):
list = x.get_shape().as_list()
return list
def _activation_summary(x):
class Landmark {
public:
Landmark(float x, float y, SDL_Color id);
~Landmark();
Position pos;
SDL_Color id;
void render(SDL_Renderer * ren);
};
@jzuern
jzuern / Robot.h
Created September 17, 2018 08:21
class Robot {
public:
Robot(int x_start, int y_start, float orientation, int radius, SDL_Color col);
~Robot();
void render(SDL_Renderer * ren);
void move(const Uint8 * , Eigen::VectorXf & control);
void moveForward(Eigen::VectorXf & control);
void moveBackward(Eigen::VectorXf & control);
void rotateLeft(Eigen::VectorXf & control);
class KalmanFilter {
public:
/**
* Create a Kalman filter with the specified matrices.
* A - System dynamics matrix
* C - Output matrix
* Q - Process noise covariance
* R - Measurement noise covariance
import numpy as np
import matplotlib.pyplot as plt
import time
L = 1.0 # length of 1-D heat-conducting object
Nx = 100 # number of spatial grid points
T = 10.0 # maximum time
Nt = 1000 # number of time steps
a = 0.005 # material proberty alpha
def resnet_layer(inputs,
num_filters=16,
kernel_size=3,
strides=1,
activation='relu',
batch_normalization=True,
conv_first=True):
"""2D Convolution-Batch Normalization-Activation stack builder
# Arguments
inputs (tensor): input tensor from input image or previous layer
import os
import pprint
import tensorflow as tf
if 'COLAB_TPU_ADDR' not in os.environ:
print('ERROR: Not connected to a TPU runtime; please see the first cell in this notebook for instructions!')
else:
tpu_address = 'grpc://' + os.environ['COLAB_TPU_ADDR']
print ('TPU address is', tpu_address)
# This address identifies the TPU we'll use when configuring TensorFlow.
TPU_WORKER = 'grpc://' + os.environ['COLAB_TPU_ADDR']
tf.logging.set_verbosity(tf.logging.INFO)
resnet_model = tf.contrib.tpu.keras_to_tpu_model(
resnet_model,
strategy=tf.contrib.tpu.TPUDistributionStrategy(
tf.contrib.cluster_resolver.TPUClusterResolver(TPU_WORKER)))