X-Team Blog - The Most-Loved Company for Engineers

Machine Learning Needn't Be Difficult: a Few Projects to Inspire You

Written by Rodrigo Venancio | May 5, 2020 4:00:00 AM

The possibilities of machine learning and artificial intelligence seem endless. But people have this idea that ML and AI are generally reserved for brilliant data scientists, Python wizards, and PhD statisticians who eat Markov Decision Processes for breakfast.

That's a misconception. Machine learning needn't be hard and it's available for everyone. This article will introduce a few projects to show you how easy it can be to experiment (and have fun) with AI and ML.

Let's Talk About TensorFlow

TensorFlow is an open-source machine learning platform for everyone, and it's one of the most popular ways to build an ML project. It's great for handwritten digit classification, image recognition, sentiment analysis, flaw detection, speech recognition, and even self-driving cars.

Google developed TensorFlow and released it in 2015. Since then, a huge open-source community has developed around the platform. It's never been easier to start, even if you only know JavaScript. TensorFlow.js is a library for building and training machine learning models in JavaScript. Just type this in to get going:

import * as tf from "@tensorflow/tfjs"

To give you an idea of what you can build with TensorFlow.js, here are a few ML projects built with it.

Let's Make it Easier: Pre-Trained Models

If you don't want to build everything from scratch with TensorFlow.js, you can use a pre-trained TensorFlow.js model. Find a list of pre-trained models here. You can pick from many different scenarios: classifying images, detecting objects, determining the toxicity of a text, and more.

Let's say you want to extract some information about an image. Well, you can do that with only a few lines of code:

import * as mobilenet from '@tensorflow-models/mobilenet';

const img = document.getElementById('img');

// Load the model.
const model = await mobilenet.load();

// Classify the image.
const predictions = await model.classify(img);

console.log(predictions);

One Step Easier Still: APIs

What's even easier than pre-trained models is just using an API. I'll list a few examples of cool APIs that you can plug into your AI/ML project.

TeleportHQ

TeleportHQ built a computer-vision API that's specifically trained for detecting atomic UI elements from pictures of hand-drawn wireframes. It's quite magical:

Isn't this just crazy!

This could be an excellent tool for prototyping a website or even for generating codebases on the fly. Yes, you can use their API on your own project. The only requirement and limitation is your imagination.

Create a wireframe in less than a minute with this API

Microsoft Azure Cognitive Services

Microsoft Azure Cognitive Services provide a vast array of APIs for different needs. All you need to do is send a request to their API for it to return JSON data from one of its models. They have trained models for image recognition, face detection, text recognition, and much more.

Image recognition APIs

Have a look at this demo (takes a while to load) and the corresponding code. It uses Microsoft Azure's API to transform what's in the image into text. A dog sitting in the grass, in the below example. Imagga in particular is great for image categorization and tagging. Check out a demo of it here.

"A dog sitting in the grass," the machine accurately said.

vid2vid

Nvidia's vid2vid project allows you to generate human motions from poses, like so:

Keep in mind that the output isn't a real human! This is both amazing and scary (deep-fake videos are already a big thing online). The point here is that it's very easy to experiment with advanced ML models without deeply understanding how it all works underneath the hood.

aijs.rocks

aijs.rocks is a curated collection of AI-powered JavaScript apps that may inspire you to build your next AI project. You can find projects like this PAC-MAN game. Control the PAC-MAN with movements picked up by your webcam.

In Conclusion

AI and ML needn't be scary. You definitely shouldn't be held back from starting your first AI/ML project because of the perceived complexity of it. Sure, underneath the hood it's complex, but so is everything if you really break it down.

TensorFlow, TensorFlow.js, and the numerous APIs freely available make it very easy to get started with artificial intelligence and machine learning. If you're an X-Teamer and want to learn about machine learning, don't forget that you can use your Unleash+ budget to pay for some of the courses!