How to speed up PyTorch model on Android using GPU inference and MACE library

Image for post
Image for post

In recent years, there has been a trend towards using GPU inference on mobile phones. In Tensorflow, GPU support on mobile devices is built into the standard library, but it is not yet implemented in the case of PyTorch, so we need to use third-party libraries. In this article, we will look at the PyTorch➔ONNX➔libMACE bundle.

Installation of libMACE

Next, we will look at the steps for installing libMACE.

Let’s create a separate virtual environment that will contain the library and everything it needs to work.

Image for post
Image for post

To start with the definition, reconstruction is a 3D model of an object developed on the basis of long-range data processing. Reconstruction can be performed using a wide variety of principles: stereometric, stereophotometric, volume removal, or motion data.

This work is a guide that explains how to develop a simple application to reconstruct an object shape using GPU, i.e. a video card.

Among the principles mentioned above, we have chosen the volume removal algorithm, suggested by Brian Cureless and Mark Levoy in their article titled “A Volumetric Method for Building Complex Models from Range Images”.

The figure below clarifies the…

Free exercises with a personal coach at any time

Image for post
Image for post

Doing sport on your own is quite complicated. Sadly, there is often not enough discipline to continue. I explain. Sometimes, when looking in the mirror we make a promise to start training since Monday, first day of the month or since beginning of the year… Alas, only few of us can actually boast to stick to this promise.

A gym can be a solution. It’s even better if you’re training with a personal coach who is assisting you in achieving desired results. But what to do if there’s no such an opportunity? Is it possible to organize workout yourself?


Note: in this article I will talk about the work I did while studying at the University, so this paper is more educational than practical.

Image for post
Image for post

Since the late 90’s, a lot of dynamic chaos-based ciphers have been released, many of them have a fairly low strength. This paper analyzes one of these systems, published by Pareek in 2004[3].

Cipher “Multiple one-dimensional chaotic maps”

Multiple one-dimensional chaotic maps is a cryptographic algorithm that implements block symmetric encryption.
Developed by Pareek, Patidar and Sud in 2004. It consists of four chaotic generators (logistic, tent, sine and cubic) that perform data protection in the order determined by the 128-bit key.

Image for post
Image for post

Disclaimer, this tutorial is intended more for people who just need to remove the background on the image, and not for advanced computer vision developers.

In this tutorial, we will make a pipeline for high-quality automatic background removal around a person using AI.

The pipeline includes following steps:
1. Background areas selection.
2. Filtering.
3. The final cleaning.

Software installation

The project requires python with the installed jupyter, pytorch 1.6, torchvision and opencv.

We will install these programs for Windows 10, if you know how to do it yourself, skip this section.

At first, download Anaconda Individual Edition and install it(you can…

How to make 2d game recognition using classical computer vision approach

Image for post
Image for post

Methods based on deep learning are the most popular for object recognition today. A good deep learning model can find an object at different scales, angles, light conditions and even when it partially overlapped by other objects.

To create such model, you need to have a set of source data and an augmentation algorithm that could generate training examples based on this data, as similar as possible to those your the program will see in reality. The more accurate the model should work, the stricter the requirements for training examples and the more difficult it is to create them.


Vitaliy Hramchenko

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