Skip to content

Instantly share code, notes, and snippets.

View jzuern's full-sized avatar
🚙

Jannik Zürn jzuern

🚙
View GitHub Profile
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)
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 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
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
@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 Landmark {
public:
Landmark(float x, float y, SDL_Color id);
~Landmark();
Position pos;
SDL_Color id;
void render(SDL_Renderer * ren);
};
import tensorflow as tf
import numpy as np
def int_shape(x):
list = x.get_shape().as_list()
return list
def _activation_summary(x):
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()
@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