Training machine learning model without a single line of code!

Image for post
Image for post

BigQuery has a nice feature for creating and executing machine learning models standard SQL commands. This allows you to bring the models to data instead of the other way around. BigQuery ML supports different models starting from linear and logistic regression to deep neural networks. You can also upload your previously trained Tensorflow model and use BigQuery ML for making predictions.

I wanted to test how you use it for sentiment classification. This post walks you through the (simple) process of loading the data into BigQuery and creating a classification model. Let’s get started!

Data

I used the IMDB dataset from Kaggle which contains 50,000 movie reviews and the sentiment (positive/negative) for them. This dataset is quite small, only ~65 MB, but with Biquery, there is no limit on the size of the dataset since Bigquery can analyze petabytes of data quickly. …


How to test and label data for motion detection

Image for post
Image for post

Background

As you might have noticed from my previous articles, I have (everlasting) project where I’m building a security camera system for myself. The idea is to use the object detection to spot the intruders on my property and then notify me on my phone. Here are some of my previous articles about this:

Object detection is relatively easy nowadays due to all the pre-trained models but developing the motion detection on top of it turned out to be a bit challenging than I originally thought. …


Building a language-agnostic classifier using sentence embeddings

The folks at Google published a multilingual BERT embedding model, called LaBSE. It produces language-agnostic sentence embeddings for more than 100 languages in a single model. The model is trained to generate similar embeddings for bilingual sentence pairs that are translations of each other.

I wanted to build a language-agnostic text classifier, which can be used to detect texts about soccer in any language. The plan was to train it with English texts and then classify texts in other languages. Let’s see how to do it.

Training data

My training data consisted of ~550k short texts and half of them were related to soccer. …


Image for post
Image for post

As a learning project, I wanted to build a hate-speech detector for the web. There’s really no practical use for such an application but it felt like a fun thing to do. It would record user’s webcam and then (virtually) hush the user’s when she says something that is frowned upon. This article describes how I ended up doing it, and hopefully, it’ll be useful for you as well!

Here’s a sneak peek of the final implementation (starring me!!):


Image for post
Image for post

The software running on Raspberry Pi is like any (production) system which benefits from proper logs. Logs are crucial to debugging, monitoring, alerting, and just keeping the systems up and running without interruptions. Depending on your setup, you might have several Raspberry Pis (other any IoT devices) so the logs from all the devices need to be aggregated and accessible in a single place.

There are many alternatives for centralized logging and Google Cloud Logging is one of the options. But why choose it? Well, it’s practically free at least on a small scale and it provides centralized logging with easy integration. …


Image for post
Image for post

I finally managed to find time for testing the Coral USB Accelerator from Google. This USB device provides Edge TPU as a coprocessor enabling high-speed ML inferencing in local devices.

I wanted to track objects using a standard IP camera and Raspberry Pi. Raspberry Pi will record the RTSP stream from the IP camera and will pass the image to Coral USB Accelerator to do all the heavy lifting.

I’ll describe next how this was implemented. The steps are:

  1. Setting up Coral for Raspberry Pi (using Docker)
  2. Packaging the Coral’s object detection library as a Docker image
  3. Grabbing images from RSTP…


Spring boot + Docker + Gitlab + Raspberry Pi = Success!

Image for post
Image for post
By frank mckenna on Unsplash

Docker is a really useful tool for running applications because it enables you to easily pack, deploy, and run any application, which can run anywhere. As Docker containers don’t have much overhead you can even run them on low-end IoT devices. Like Raspberry Pi (even though they’re quite powerful nowadays!)

Building the Docker images for Raspberry Pi is a bit different due to the ARM-based CPUs it has but luckily Docker’s new multi-arch builds makes this much easier. Let’s go through how to build a custom Docker image for Raspberry Pi and run a Spring Boot application with it.

Setting up Raspberry Pi

I’m using the great chilipie-kiosk image from Futurice. It allows booting directly into full-screen Chrome so you can easily start your web app on boot. …


Image for post
Image for post

We’re using application monitoring at work for making sure any issues with our services won’t go unnoticed. Notification email is always sent in case of emergency, but the emails often get lost in people’s inboxes and the investigation of the problem is delayed. Therefore, I wanted to create a real world counterpart of the alert emails to inform us when our services encounter issues. Since a single email may go unnoticed, but bright flashing light in the middle of the room will not.

Therefore, I needed to create a link between physical and digital world. I had an extra Raspberry Pi board lying around, which could be the missing link. …


Image for post
Image for post

For my project of building a real world warning light for application monitors, I needed a way to control 12 V beacon light with my Raspberry Pi 3. Details about the project can be found in here:

While I understand there are already many different relay boards for Raspberry Pi, but I had my reasons for building it from scratch:

  • To fit it inside an official Raspberry Pi 3 case
  • To power it directly from Raspberry Pi 3
  • To be able to drive 5 V, 12 V and 24 V devices
  • To build it myself ☺

The main goal was to keep the device as small and simple as possible, hence I didn’t want a second device with an external power in addition to the Raspberry Pi. There are also a lot of different types of beacon lights out here and I wanted to be able to use most of them regardless of the their supply voltage. …


Image for post
Image for post

I came across an article about smart mirrors a while ago and have wanted to build myself one ever since. Smart mirror (usually) works by placing a display behind a two-way mirror and configure it show time-sensitive information, such as the weather or upcoming appointments. There are many different custom builds out there and many of them seem to be based on an open source framework called MagicMirror2. It’s quite simple framework for displaying useful data on a display, but it removes the need of doing everything by yourself. …

About

Antti Havanko

Manager. Maker of things. Optimist. Happy.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store