Skip to content

Instantly share code, notes, and snippets.

View czming's full-sized avatar

Zhe Ming Chng czming

View GitHub Profile
@czming
czming / gaussian_convolution.py
Last active August 28, 2022 21:04
Visualizes pre-filtered and filtered data #aits
# columns in the data that you want to visualize (visualize each column's value along the rows, where the row number is the x-axis)
VISUALIZED_COLUMNS = [0, -1, -2, -3, -4]
# show visualization of data, change to only one column (second argument) if only want to visualize current set of data instead of contrasting pre- vs post-filtering
fig, axs = plt.subplots(len(VISUALIZED_COLUMNS), 2)
for i, column in enumerate(VISUALIZED_COLUMNS):
old_data = data[:, column]
# plot pre-filtered data
axs[i, 0].plot(range(len(data)), old_data)
@czming
czming / aruco_binning_script
Last active August 28, 2022 21:04
Converts the sparse vector of aruco markers to a single integer representing pick markers - place markers #aits
# pick bin dimensions in the vector [aruco_marker[:72], color_bins[72:92], optical_flow_avg[92:94], hand_loc[94:96]]
pick_bins = [i for i in range(24 * 2)]
place_bins = [i for i in range(24 * 2, 36 * 2)]
for i in range(1,41):
with open(f"htk_inputs_aruco/picklist_{i}.txt") as infile:
infile = infile.readlines()
for line in infile:
line = line.split()
aruco_markers = line[:72]
@czming
czming / htk_processing_script
Last active August 28, 2022 20:55
Processes ground truth label files into HTK labels #aits
import glob
files = glob.glob("*_raw.txt")
for file in files:
with open(file, "r") as infile:
phrase = infile.read().strip()
with open(file.replace("_raw.txt", "_place.lab"), "w") as outfile:
#prepend sil for HTK formatting
outfile.write("sil\n")