Skip to content

Instantly share code, notes, and snippets.

View jzuern's full-sized avatar
🚙

Jannik Zürn jzuern

🚙
View GitHub Profile
from nuscenes.map_expansion.map_api import NuScenesMap
import matplotlib.pyplot as plt
nuscenes_dataroot = "/path/to/nuscenesroot/v1.0-trainval/"
map_name = "boston-seaport"
# Map object
nusc_map = NuScenesMap(map_name=map_name,
dataroot=nuscenes_dataroot)
a = tf.Constant(1.0, dtype=tf.float32)
b = tf.Constant(3.0, dtype=tf.float32)
c = a + b
@jzuern
jzuern / vae.py
Created February 24, 2019 10:06
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.keras.layers import Lambda, Input, Dense
from tensorflow.keras.models import Model
from tensorflow.keras.losses import mse, binary_crossentropy
from tensorflow.keras.utils import plot_model
from tensorflow.keras import backend as K
from keras.layers import Input, Dense
from keras.models import Model
import matplotlib.pyplot as plt
import numpy as np
from sklearn.neighbors import LSHForest
import matplotlib.pyplot as plt
from keras.datasets import fashion_mnist
from keras.datasets import mnist
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.keras.layers import InputLayer, Conv2D, MaxPooling2D, Conv2DTranspose, Flatten, Dense, Reshape
from tensorflow.keras import Model, Sequential
import random
from scipy.ndimage.interpolation import zoom
from tensorflow.keras.models import load_model
from sklearn.metrics.pairwise import cosine_similarity
import time
import numpy as np
from collections import deque
from RoadEnv import RoadEnv
from DQNAgent import DQNAgent
# Initialize environment
env = RoadEnv()
# size of input image
@jzuern
jzuern / agent.py
Last active October 29, 2019 17:44
import random
import numpy as np
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Conv2D, Activation, Flatten
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.models import model_from_yaml
from tensorflow.keras.models import load_model
from collections import deque
import gym
from gym import spaces
import numpy as np
from gym import utils
from random import randint
class Obstacle:
def __init__(self):
#
# .... body of model_fn
#
optimizer = tf.train.AdamOptimizer()
if FLAGS.use_tpu:
optimizer = tf.contrib.tpu.CrossShardOptimizer(optimizer)
train_op = optimizer.minimize(loss, global_step=tf.train.get_global_step())
# 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)))