This wiki explains how to convert Tensorflow Object Detection SSD models to TFLite format.
These instructions use python3
and pip3
.
class Ralamb(Optimizer): | |
def __init__(self, params, lr=1e-3, betas=(0.9, 0.999), eps=1e-8, weight_decay=0): | |
defaults = dict(lr=lr, betas=betas, eps=eps, weight_decay=weight_decay) | |
self.buffer = [[None, None, None] for ind in range(10)] | |
super(Ralamb, self).__init__(params, defaults) | |
def __setstate__(self, state): | |
super(Ralamb, self).__setstate__(state) |
This wiki explains how to convert Tensorflow Object Detection SSD models to TFLite format.
These instructions use python3
and pip3
.
import numpy as np | |
def pointcloud_to_depth_map(pointcloud: np.ndarray, theta_res=150, phi_res=32, max_depth=50, phi_min_degrees=60, | |
phi_max_degrees=100) -> np.ndarray: | |
""" | |
All params are set so they match default carla lidar settings | |
""" | |
assert pointcloud.shape[1] == 3, 'Must have (N, 3) shape' | |
assert len(pointcloud.shape) == 2, 'Must have (N, 3) shape' |
# from https://stackoverflow.com/questions/42463172/how-to-perform-max-mean-pooling-on-a-2d-array-using-numpy | |
import numpy as np | |
def asStride(arr,sub_shape,stride): | |
'''Get a strided sub-matrices view of an ndarray. | |
See also skimage.util.shape.view_as_windows() | |
''' | |
s0,s1=arr.strides[:2] | |
m1,n1=arr.shape[:2] | |
m2,n2=sub_shape | |
view_shape=(1+(m1-m2)//stride[0],1+(n1-n2)//stride[1],m2,n2)+arr.shape[2:] |
#!/usr/bin/env python3 | |
''' | |
This script exctracts training variables from all logs from | |
tensorflow event files ("event*"), writes them to Pandas | |
and finally stores in long-format to a CSV-file including | |
all (readable) runs of the logging directory. | |
The magic "5" infers there are only the following v.tags: | |
[lr, loss, acc, val_loss, val_acc] |
import numpy as np | |
import torch | |
import keras | |
def pyt_to_keras(pytorch_model, keras_model): | |
""" | |
Given a PyTorch model, this method transfers the weight to | |
a Keras Model (with backend TensorFlow) with the same architecture. | |
Assumptions: | |
1. The corresponding layer names in both the models will be the same |
import tensorflow as tf | |
from tensorflow.python.platform import gfile | |
with tf.Session() as sess: | |
model_filename ='PATH_TO_PB.pb' | |
with gfile.FastGFile(model_filename, 'rb') as f: | |
graph_def = tf.GraphDef() | |
graph_def.ParseFromString(f.read()) | |
g_in = tf.import_graph_def(graph_def) | |
LOGDIR='/logs/tests/1/' | |
train_writer = tf.summary.FileWriter(LOGDIR) |
sudo apt-get update | |
sudo apt-get install -y libevent-dev libncurses-dev make | |
wget https://github.com/tmux/tmux/releases/download/2.3/tmux-2.3.tar.gz | |
tar xvzf tmux-2.3.tar.gz | |
cd tmux-2.3/ | |
./configure && make | |
sudo make install |
n02119789 1 kit_fox | |
n02100735 2 English_setter | |
n02110185 3 Siberian_husky | |
n02096294 4 Australian_terrier | |
n02102040 5 English_springer | |
n02066245 6 grey_whale | |
n02509815 7 lesser_panda | |
n02124075 8 Egyptian_cat | |
n02417914 9 ibex | |
n02123394 10 Persian_cat |