Skip to content

Instantly share code, notes, and snippets.

View HTLife's full-sized avatar

Jacky Liu HTLife

  • National Chung Cheng University
  • Tokyo, Japan
View GitHub Profile
@HTLife
HTLife / summary.py
Created March 16, 2018 06:37
Pytorch model summary
def summary(input_size, model):
def register_hook(module):
def hook(module, input, output):
class_name = str(module.__class__).split('.')[-1].split("'")[0]
module_idx = len(summary)
m_key = '%s-%i' % (class_name, module_idx+1)
summary[m_key] = OrderedDict()
summary[m_key]['input_shape'] = list(input[0].size())
summary[m_key]['input_shape'][0] = -1
@HTLife
HTLife / commit-msg
Created April 3, 2020 05:58
prepend JIRA ticket prefix to git commit message
#!/bin/sh
# Add git branch if relevant
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
# Extact tracker abbreviation and ticket number (e.g. DS-123)
parse_git_tracker_and_ticket() {
parse_git_branch | grep -e '[A-Z]\+-[0-9]\+' -o
@HTLife
HTLife / gist:af5b26744f17985ba52320f66eb874f4
Created June 9, 2020 08:29
cartographer_rosbag_validate
rosrun cartographer_ros cartographer_rosbag_validate -bag_filename example.bag
rosrun cartographer_ros cartographer_rosbag_validate -bag_filename /root/Downloads/example.bag
W0609 08:13:02.642072 3306 rosbag_validate_main.cc:166] Sensor with frame_id "lidar_2d_front" measurements overlap in time. Previous range message, ending at time stamp 637182091821391433, must finish before current range message, which ranges from 637182091821374868 to 637182091821485979
W0609 08:13:02.646579 3306 rosbag_validate_main.cc:203] Sensor with frame_id "lidar_2d_front" range measurements have longest overlap of 0.0016565 s
I0609 08:13:02.646610 3306 rosbag_validate_main.cc:398] Time delta histogram for consecutive messages on topic "/laser_scan" (frame_id: "lidar_2d_front"):
Count: 1612 Min: 0.009455 Max: 0.040663 Mean: 0.025044
[0.009455, 0.012575) Count: 1 (0.062035%) Total: 1 (0.062035%)
[0.012575, 0.015696) Count: 0 (0.000000%) Total: 1 (0.062035%)
[0.01569
@HTLife
HTLife / install.sh
Last active December 1, 2020 07:09
Double click to open pcd with open3d
sudo apt-get install python3-pip
pip3 install open3d
wget https://gist.githubusercontent.com/HTLife/bcf98f24eac68f709ae5a205ca63ffc8/raw/315bab82d2f485d521c01fcc64f1b3fa15ff4663/open3d.desktop
wget https://gist.githubusercontent.com/HTLife/bcf98f24eac68f709ae5a205ca63ffc8/raw/315bab82d2f485d521c01fcc64f1b3fa15ff4663/view_point_cloud.py
sudo cp open3d.desktop /usr/share/applications
sudo sh -c "echo 'image/x-photo-cd=open3d.desktop' >> /usr/share/applications/defaults.list"
//
// GPSPoint.swift
//
// Created by Jacky Liu on 2020/11/22.
// AkoTech
import Foundation
import KDTree
# python3 plot.py 22760.csv
import matplotlib.pyplot as plt
import csv
import sys
x = []
y1 = []
y2 = []
@HTLife
HTLife / cnn_lstm.py
Last active April 8, 2021 05:00
Time distributed CNNs + LSTM in Keras
def defModel():
model = Sequential()
#Izda.add(TimeDistributed(
# Convolution2D(40,3,3,border_mode='same'), input_shape=(sequence_lengths, 1,8,10)))
model.add(
TimeDistributed(
Conv2D(32, (7, 7), padding='same', strides = 2),
input_shape=(None, 540, 960, 2)))
model.add(Activation('relu'))
@HTLife
HTLife / CMakeLists.txt
Last active October 21, 2021 03:55
Open3D linkage problem
cmake_minimum_required(VERSION 3.18)
project(Open3DCMakeFindPackage LANGUAGES C CXX)
# add_definitions(-D _GLIBCXX_USE_CXX11_ABI=1)
find_package(Open3D REQUIRED)
find_package(Boost REQUIRED COMPONENTS program_options)
@HTLife
HTLife / convert_kitti_bin_to_pcd.py
Created February 11, 2019 11:46
Convert KITTI velodyne bin to open3d pcd
import numpy as np
import struct
from open3d import *
def convert_kitti_bin_to_pcd(binFilePath):
size_float = 4
list_pcd = []
with open(binFilePath, "rb") as f:
byte = f.read(size_float * 4)
while byte:
@HTLife
HTLife / CMakeLists.txt
Last active November 11, 2022 08:29
GTSAM segmentation fault at evaluateError
cmake_minimum_required(VERSION 3.16)
project(robomap_gtsam_example LANGUAGES C CXX)
find_package(GTSAM 4.0 REQUIRED QUIET)
set(INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
include_directories(include
${INCLUDE_DIR} # make sure your .h all inside.