Category Archives: Uncategorized

OpenVINO on Raspberry

OpenVINO is the short term for Open Visual Inference and Neural network Optimization toolkit. There is a port to the Raspberry platform running Rasbian OS.

To setup on a Raspberry Pi, download the latest zip from OpenVINO, and run the commands below.

sudo tar -xf l_openvino_toolkit_runtime_raspbian_p_2019.2.242.tgz --strip 1 -C /opt/intel/openvino
sudo apt install cmake
source /opt/intel/openvino/bin/
echo "source /opt/intel/openvino/bin/" >> ~/.bashrc
sudo usermod -a -G users "$(whoami)"
sh /opt/intel/openvino/install_dependencies/
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-march=armv7-a" /opt/intel/openvino/deployment_tools/inference_engine/samples
make -j2 object_detection_sample_ssd


Once the installation completed, download the pre-built model for facial recognition. The following test will return an output image with the face detected using an input image.

wget --no-check-certificate
wget --no-check-certificate

./armv7l/Release/object_detection_sample_ssd -m face-detection-adas-0001.xml -d MYRIAD -i barack-obama-12782369-1-402.jpg 





Visualizing a MLP Neural Network with TensorBoard

The Multi-Layer Perceptron model is supported in Keras as a form of Sequential model container as MLP in its predefined layer type. For visualization of the training results, TensorBoard is handy with only a few line of code to add to the Python program.

log_dir="logs/fit/" +"%Y%m%d-%H%M%S")
tensorboard_callback = tf.keras.callbacks.TensorBoard(log_dir=log_dir, histogram_freq=1)

Finally add callbacks to the corresponding fitting model command to collect model information.

history =, Y_train, validation_split=0.2,
epochs=100, batch_size=10


Once the training is completed, start the TensorBoard and point browser to the designated port number.

Click on the Graph tab to see a detailed visualization of the model.

Click on the Distributions tab to check the layer output.

Click on the Histograms tab for a 3D visualization of the dense layers.



Binomial Tree methods for European options using GPU

Binomial methods are versatile in pricing options for it is suitable for American, European, and Asian options. With an European call option with maturity t, strike price k, spot price S, volatility σ, risk-free rate r:


For put option, the last effective term shall be in the max function shall be:

Stock’s increment, decrements, and probability to move up are given by the below respectively:


One of the CUDA samples from Nvidia is to implement the binomial model on GPU.



The birthday paradox riddle with TI Nspire

In probability theory, the birthday paradox is an interesting problem in that it is an easy vehicle to grasp several important statistical concepts like likelihood and combinatorics and the surprising conclusion it arrives.

The problem of the birthday is simple, in a room with n people, how many of them will have to same birthday? It turns out, using the following equation, it only takes 23 people to reach a 50% probability of having two people with the same birthday.


Visualizing operating characteristic curve with TI Nspire

In the study of quality control, sampling is an important technique to assess the overall quality level of a lot of production run. Operating characteristic curve is a great tool to understand the quality profile of acceptance sampling.

In TI Nspire, the OC curve can be defined as following using binomial distribution as an alternative to hypergeometric distribution.


With the function defined, visualizing of 10% failure rate and sampling size of 20 can be done by graphing this function.


Interesting applications of Generative Adversarial Network to crack CAPTCHA

Interesting results from a recent paper presented at the 25th ACM conference on Computer and Communications Security shown advances in Generative Adversarial Network (GAN). In particular the paper focused on tackling Captcha with GAN. GANs take a game theory approach in the training of network and during the deep learning process two entities compete in a game that one trying to fool the other while the other strives not to be fooled.

Comparison of performance of machine learning the probability distributions are usually considered as metrics for benchmark. One such commonly used is the Jensen–Shannon Divergence and a generalization can be given as



Visualizing Volatility Sensitivity in Delta hedged gains with TI Nspire

The TI Nspire calculator is a great platform for visualizing data via interactive graphs. The built-in facility like input slider for variable value adjustment allowed dynamic visualization to complex equations, like the volatility sensitivity in delta-hedged gains used financial investment. Since this strategy involved a single call option, the volatility exposure equals the vega value of the option.

The following setup on the Nspire provided the functions to calculate the vega values.

This spreadsheet input screen stores the spot prices and the calculated Black Scholes vega values.

Finally, with the data plotting screen the graph of Delta hedged gains of volatility sensitivity is completed. An additional slider control can easily be added on it to adjust an offset variable so as to visualize scenarios under different spot price.