Skip to main content

Posts

A General Purpose Transfer Learning Framework Based on Keras

Objective Transfer Learning technique is used when the dataset is not of sufficient size. It is common to fine tune a network which is pre-trained on large datasets like Imagenet for classification tasks. For further information, the reader is advised to refer to CS231N by Standford . A framework for general purpose transfer learning is proposed. This framework is developed for my MSc. thesis study and made publicly available to let researchers make use of it. Using this framework, the researcher will easily be able to fine-tune a network for a classification task. Audience This article can be useful for anyone seeking information about transfer learning implementation. Python knowledge is required to make use of the supplied code. Introductory information about Keras , a deep learning API, is necessary. Also in order to run the code, a proper deep learning system with a decent graphics card (GPU) with CUDA Compute Capability 3.0 or higher   is necessar...

Obfuscating Spring Boot Projects Using Maven Proguard Plugin

Introduction Obfuscation is the act of reorganizing bytecode such that it becomes hard to decompile. Many developers rely on obfuscation to save their sensitive code from undesired eyes. Publishing jars without obfuscation may hinder competitiveness because rivals may take advantage of easily decompilable nature of java binaries. Objective Spring Boot applications make use of public interfaces, annotations which makes applications harder to obfuscate. Additionally, maven Spring Boot plugin creates a fat jar which contains all dependent jars. It is not viable to obfuscate the whole fat jar. Thus obfuscating Spring Boot applications is different than obfuscating regular java applications and requires a suitable strategy. Audience Those who use Spring Boot and Maven and wish to obfuscate their application using Proguard are the target audience for this article. Sample Application As the sample application, I will use elastic search synch application from my G...

How To Use Keras Trained CNN Models

Introduction Keras is a popular deep learning api. It can run on top of Tensorflow , CNTK and Theano frameworks. Keras provides an easy to use interface which makes deep learning practice straight forward. It is widely used thus resources are easily accessible. Objective This article aims to give an introductory information about using a Keras trained CNN model for inference. This article does not contain information about CNN training. Audience This article assumes introductory information about python and Convolutional Neural Networks. For those who lack information may first begin with information from following resources. For python use  Python For Beginners For Convolutional Neural Networks use  CS231n Convolutional Neural Networks for Visual Recognition Software Installation Keras is a high level API. It requires a back-end framework to be installed. In this article, Tensorflow is used. Keras can transparently select CPU or GPU for processing. If use ...

Using Docker Container for MySQL Service

Problem Suppose you are working on a project that relies on Mysql service but you do not want to install MySQL to your system. Using a Docker image can be a good solution. Remember that you can use many services through Docker containers. Steps 1- Install docker  Docker Community Edition can be freely downloaded from the  official page. It requires registration. https://www.docker.com/community-edition Install docker image. It may require a restart, if it does, do so. In case any problems occur that prevent Docker for Windows from starting check trouble shooting page. https://docs.docker.com/docker-for-windows/troubleshoot/ In Windows 10, hypervisor launch type needs to be "auto".  In order to check current status bcdedit command can be used via PowerShell (Administrator Mode). In order to set to "auto" following command can be used. bcdedit /set hypervisorlaunchtype auto 2- Find the Relevant Container Go to  Docker Store . Type M...

Facial Landmark Detector

Dlib is a popular library. It can be used for face detection or face recognition. In this article I will use it for facial landmark detection. Facial landmarks are fecial features like nose, eyes, mouth or jaw. Start with installing Dlib library. Dlib requires Lib Boost. sudo apt-get install libboost-all-dev Now we can install Dlib. sudo pip install dlib Following example uses PIL and numpy packages. Instead of Pillow it is possible to use skimage package. pip install Pillow pip install numpy Note that in order to detect facial landmarks, a previously trained model file is needed. You can download one from Dlib site. Download model file from this link : http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2 After download is completed, extract the archive and make sure its location is correctly referenced in the source file. The application first tries to detect faces in the given image. After that for each face it tries to detect landmarks. For ...

Prepare a Ubuntu System for Deep Learning

An Ubuntu Deep Learning System A.                     Install latest Nvidia drivers 1-       Run following  commands  to add latest drivers from PPA. sudo add-apt-repository ppa:graphics-drivers/ppa sudo apt update 2-       Then use Ubuntu  Software &Updates  Additional Drivers application to update your driver. For my GTX-1070 I chose driver with version 384.69. 3-       After installation Restart your PC. You may need to disable safe boot using bios menu. 4-       Run following command to ensure that drivers are installed correctly. lsmod | grep nvidia 5-       İf you have issue with the new driver remove it with following command. sudo apt-get purge nvidia* For more information see: https://askubuntu.com/questions/...

Java Custom ClassLoader

Problem I want my previously written java application to be run multiple times by a shell script with calculated parameters. However, target platforms may not contain bash. Thus I decied to write another class which acts like a bash script file and launch my application with generated parameters. My application has static variables and static classes. Before every launch I want the state information be cleared. But since I work in the same JVM, static objects will not be removed. It comes out using static fileds and initializers may not be a good approach. There should be a way to solve this.  The solution is to use a custom classloader. Classloader will load all classes. At the end of the execution, the classloader and all the classes loaded will be garbage collected. At next execution, all classes will be reloaded. Solution : Custom Class Loader Class loaders can be considered a container to launch an application. Servlet containers like Tomcat uses a custom classl...