Splitting video with ffmpeg and Python

I had a project to build a simple website that split uploaded video into parts that have same duration (except the last one if the division has remainder). Almost everyone in the internet suggest ffmpeg which is so far considered the best open-source swiss-army knife for video manipulation. After hours of browsing and trial-and-errors, I… Read More

Keras VGG16 with different input shape

Featured image is from analyticsvidhya.com Update (June 19, 2019): Recently, I revisit this case and found out the latest version of Keras==2.2.4 and tensorflow-gpu==1.13.1 make customizing VGG16 easier. For example, we can use pre-trained VGG16 to fit CIFAR-10 (32×32) dataset just like this: X, y = load_cfar10_batch(dir_path, 1) base_model = VGG16(include_top=False, weights=vgg16_weights, input_shape=(32, 32, 3))… Read More

Facebook page news auto-poster

So you have learned a bit about machine learning and web crawling. Now you are excited to build something simple yet still useful. What can you make? Here is one idea. Let’s say you managed a Facebook Page for your business or community and want to regularly post relevant news or articles from the internet…. Read More

Compiling, deploying and calling Ethereum smartcontract using Python

We use Python 3.5.3 on Ubuntu 16.04 with setup below: pip3 install web3==4.7.2 py-solc==3.2.0 python3 -m solc.install v0.4.24 export PATH=”$PATH:$HOME/.py-solc/solc-v0.4.24/bin” The core packages are: web3 : official python interface to interact with Ethereum blockchain py-solc: official python wrapper for solc (solidity compiler). Hence solc needs to be installed (covered in setup above) To compile a solidity… Read More

SIFT/SURF BoW for big number of clusters

If you spend some time browsing, there are some examples already available for Python SIFT/SURF bag of words (BoW) classifier in the internet. They use clustering (usually K-Means) to build dictionary of visual vocabularies (usually with sklearn or cv2 clustering library) of SIFT/SURF features. However, most of the sample codes that I found can’t properly… Read More