Skip to content

Instantly share code, notes, and snippets.

View thibthibaut's full-sized avatar
🐧
~

Thibaut Vercueil thibthibaut

🐧
~
  • Paris, France
View GitHub Profile
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# thibthibaut wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return Poul-Henning Kamp
# ----------------------------------------------------------------------------
import cv2
import numpy as np
import pytesseract as ts
@thibthibaut
thibthibaut / stm32ai_downloader.sh
Last active January 3, 2022 13:37
stm32ai_downloader
#!/bin/bash -e
SW="stm32ai-linux-5.1.2.zip"
URL="aHR0cHM6Ly9zdy1jZW50ZXIuc3QuY29tL3BhY2tzL3gtY3ViZS1haS9zdG0zMmFpLWxpbnV4LTUuMS4yLnppcAo="
LIC_URL="https://www.st.com/content/ccc/resource/legal/legal_agreement/license_agreement/group0/eb/8e/f9/c1/9e/64/49/95/SLA0048/files/SLA0048.txt/jcr:content/translations/en.SLA0048.txt"
LIC_FILE="en.SLA0048.txt"
echo "==============================="
echo " Welcome to stm32ai_downloader "
echo "==============================="
find . -type f -iname "*.[chS]" | xargs ctags
vi /etc/xdg/weston/weston.ini
[output]
name=HDMI-A-1                                                                           
mode=1280x720
+ transform=180

Display raw data

/bin/cat *.data | ffplay -f rawvideo -pix_fmt rgb24 -s 640x480 -framerate 1 -i -  

Remove sound with FFMPEG

find *.mp4 | xargs -I '{}' ffmpeg -i '{}' -c copy -an ns_'{}'
# https://www.tensorflow.org/lite/guide/inference#load_and_run_a_model_in_python
#Simple version
interpreter = tf.lite.Interpreter(model_path='./upsampling_float.tflite')
interpreter.allocate_tensors()
interpreter.set_tensor(interpreter.get_input_details()[0]['index'], sample_input )
interpreter.invoke()
output_tflite_float = interpreter.get_tensor(output_details[0]['index'])[0]
https://github.com/opencv/opencv/blob/a66f61748fc4861374b8dc458866a9614925350a/modules/calib3d/src/ptsetreg.cpp#L1018
// From dlib
template <typename T>
point_transform_affine find_similarity_transform (
const std::vector<dlib::vector<T,2> >& from_points,
const std::vector<dlib::vector<T,2> >& to_points
)
{
// make sure requires clause is not broken
dataset = numpy.loadtxt("pima-indians-diabetes.csv", delimiter=",")
data = dataset[:,0:8]
label = dataset[:,8]
X = Input(shape=(8,))
Y = Input(shape=(1,))
x = Dense(12, input_dim=8, activation='relu')(X)
x = Dense(8, activation='relu')(x)
predictions = Dense(1, activation='sigmoid')(x)
import numpy as np
#https://stackoverflow.com/questions/6811183/rolling-window-for-1d-arrays-in-numpy/6811241#6811241
def rolling_window(a, window):
shape = a.shape[:-1] + (a.shape[-1] - window + 1, window)
strides = a.strides + (a.strides[-1],)
return np.lib.stride_tricks.as_strided(a, shape=shape, strides=strides)
a = np.array(range(20))
STM32_Programmer_CLI --extload \
"<C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin\ExternalLoader\MT25TL01G_STM32H747I-DISCO.stldr>" \
-c port=swd mode=UR reset=HWrst -d build/Project.elf -s