Skip to content

Instantly share code, notes, and snippets.

@r7vme
r7vme / gist:7276929c7ddcce41eb0872d389634e4d
Created July 8, 2019 12:45
jetson xavier cuda info (deviceQuery)
Device 0: "Xavier"
CUDA Driver Version / Runtime Version 10.0 / 10.0
CUDA Capability Major/Minor version number: 7.2
Total amount of global memory: 15700 MBytes (16462909440 bytes)
( 8) Multiprocessors, ( 64) CUDA Cores/MP: 512 CUDA Cores
GPU Max Clock rate: 1500 MHz (1.50 GHz)
Memory Clock rate: 1377 Mhz
Memory Bus Width: 256-bit
L2 Cache Size: 524288 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
@r7vme
r7vme / gist:d9a3f29771c3c69fc5702fd90ca7739a
Created July 8, 2019 12:44
jetson tx2 cuda info (deviceQuery)
Device 0: "NVIDIA Tegra X2" [2/141]
CUDA Driver Version / Runtime Version 10.0 / 10.0
CUDA Capability Major/Minor version number: 6.2
Total amount of global memory: 7852 MBytes (8233566208 bytes)
( 2) Multiprocessors, (128) CUDA Cores/MP: 256 CUDA Cores
GPU Max Clock rate: 1020 MHz (1.02 GHz)
Memory Clock rate: 1300 Mhz
Memory Bus Width: 128-bit
L2 Cache Size: 524288 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
@r7vme
r7vme / patch1.txt
Created July 6, 2019 00:14
patch1.txt
diff --git a/net/bbox_3D_net.py b/net/bbox_3D_net.py
index 6daafdd..8146caa 100644
--- a/net/bbox_3D_net.py
+++ b/net/bbox_3D_net.py
@@ -18,7 +18,7 @@ def bbox_3D_net(input_shape=(224, 224, 3), vgg_weights=None, freeze_vgg=False, b
for layer in vgg16_model.layers:
layer.trainable = False
- x = Flatten()(vgg16_model.output)
+ x = Reshape((25088,))(vgg16_model.output)
@r7vme
r7vme / convert_bonnet_to_tensorrt.py
Last active July 4, 2019 20:44
convert_bonnet_to_tensorrt.py
#!/usr/bin/env python3
import graphsurgeon as gs
import tensorflow as tf
import tensorrt as trt
import uff
if __name__ == "__main__":
data_type = trt.DataType.HALF
#data_type = trt.DataType.FLOAT
output_node = "test_model/model/logits/linear/BiasAdd"
@r7vme
r7vme / add_tf_operation_to_graph.py
Created June 23, 2019 21:32
Add new TensorFlow opeation to existing (freezed) graph
import tensorflow as tf
def get_graph_def_from_file(graph_filepath):
with tf.Graph().as_default():
with tf.gfile.GFile(graph_filepath, 'rb') as f:
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())
return graph_def
# inputs
@r7vme
r7vme / camera_intrinsics_from_FOV.py
Last active June 18, 2019 08:04
Find camera intrinsics matrix from FOV and resolution
#!/usr/bin/env python3
import math
# input
VFOV=60
H=480
W=856
aspRatio=W/H
VFOV_rad=VFOV*math.pi/180.
HFOV_rad= 2 * math.atan( math.tan(VFOV_rad/2) * aspRatio )
python3 scripts/convert_plan.py box3d.pb box3d.plan input 224 224 dimension/LeakyRelu 1 0 float
/usr/lib/python3/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
WARNING:tensorflow:From /usr/lib/python3.6/dist-packages/uff/converters/tensorflow/conversion_helpers.py:185: FastGFile.__init__ (from tensorflow.python.platform.gfile) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.gfile.GFile.
UFF Version 0.5.5
=== Automatically deduced input nodes ===
[name: "input_1"
op: "Placeholder"
@r7vme
r7vme / gist:afd08f3c7056c6c67a122a990493926c
Created May 31, 2019 19:39
projeciton matrix (cam -> world)
import math
import numpy as np
# camera : x->right, y->down, z->forward
# world: x->forward, y->left, z->up
world_frame_from_cam_frame = np.array([
[ 0., 0., 1.],
[ -1., 0., 0.],
[ 0., -1., 0.]
@r7vme
r7vme / flop.py
Created April 2, 2018 11:06
Script to augment training data for self-driving donkey car
#!/usr/bin/env python
'''
Script to augment data by flopping images and steering angle.
It will outout new tub into separate directory with "_flopped"
suffix.
Usage: ./flop.py <tub directory>
'''
@r7vme
r7vme / gist:76551fb06260b0b575005f5facded6c5
Created March 13, 2019 08:07
cv2 write video to file
#!/usr/bin/env python3
import cv2
import time
def write_video(name):
# first camera
stream = 0
# camera