• Stars
    star
    104
  • Rank 319,897 (Top 7 %)
  • Language
    Lua
  • Created about 8 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Neural style in Android

Arcade

Neural style in Android

Arcade is an experimental Android port of Torch-7 implementation of neural-style.

Get the demo app from Google Play

Building

This repository contains prebuilt shared libraries needed to build torch-android and libarcade.so. If you want to build the shared libraries go to neural-style-android which is based on top of torch-android and adds support for Protobuf and loadcaffe. NIN ImageNet models are used in Arcade due to smaller size than VVG models. Models have to be seperately downloaded. Demo app module have a ModelDownloader class to download and place models in correct path

Build the libraries by NDK ndk-build and then directly run from Android studio. The build configuration is taken from Android.mk in src/main/jni and Gradle's native build system is ignored (Gradle currently ignores existing Android.mk and I was unable to figure out how to include prebuilt shared libraries from Gradle).

Note - only armeabi-v7a libraries are built currently and app will not work on other architectures.

Arcade is built as a seperate Android library and contains a Builder for all styling settings and helper functions. You can use this library to create your own implementation. Regular callbacks are also provided from Lua -> C -> Java for progress, iteration updates, completion and Images saved listeners.

Most of the middelware code between java and lua is located in arcade.cpp

Usage

Usage is pretty straightforward. Compile library project and use builder to setup configuration.

 ArcadeBuilder builder = new ArcadeBuilder(this);
      
  builder.setStyleimage(stylePath);
  builder.setContentImage(contentPath);
  builder.setModelFile(modelPath);
  builder.setProtoFIle(protoPath);
  builder.setImageSize(512);
  builder.setIterations(30);
   ....
  Arcade arcade = builder.build();
        
  //initialize and load lua script
  arcade.initialize();
  //set listeners
  arcade.setProgressListener(progressListener);
  //begin styling
  arcade.stylize();
         

Results

Due to no no GPU and limited processing power and memory, the styling is pretty slow and unusable for image sizes greater than 512. Due to speed limitations, getting respectable result is only unlikely. Better results can be achieved by trying different combination of style settings like style weight, content weight and number of iterations.

30 iterations,Image Size - 256, Device - Nexus 6, Time taken - 25 minutes

15 iterations,Image Size - 512, Device - Nexus 6, Time taken - 40 minutes

Conclusion

I started this project just for experimenting the end result of this thing. I wouldn't say that results are great though can be better by trying different combinations and improving things in the code. On CUDA enabled devices (Tegra K1), this should be a lot faster but support for cutorch is not there currently. Contributions are welcome!

More Repositories

1

Timber

Material Design Music Player
Java
6,950
star
2

TimberX

Material theme music player that works across all form factors (phones, wear, auto, cast, assistant) and uses latest tools (Kotlin, Architecture components, Room, Databinding)
Kotlin
1,483
star
3

AlgorithmVisualizer-Android

Visualize algorithms and data structures using animations
Java
1,117
star
4

adb-tools-mac

Mac menu bar app for common adb tools
Swift
950
star
5

MaterialPowerMenu

A demo of the power menu with Reveal and other animations
Java
884
star
6

PlayAnimations

A demo of various animation in latest PlayGames app
Java
410
star
7

WashingMachineView

An interactive view with water waves flowing like in a Washing machine
Java
362
star
8

PlayNewsStandDemo

Demo app for achieving UI like the one used in latest Google Play Newsstand app.
Java
329
star
9

TAndroidLame

Android/Java wrapper around Lame mp3 encoder
C
249
star
10

Muzei-macOS

Muzei wallpaper app for macOS
Swift
245
star
11

S-Tools

Keep track of your CPU and Sensors alongwith useful features like Color Picker,Compass and device information
Java
196
star
12

Hacktoberfest-Android

Android app to check Hacktoberfest status and explore projects and issues
Java
83
star
13

FieldMapView

A demo of MapView as in FieldTrip with smooth animations
Java
82
star
14

Spider

Monitor and modify network requests
Kotlin
80
star
15

gnome-android-tool

Gnome shell extension for adb tools
JavaScript
73
star
16

TerminalScreensaver

OSX screensaver simulating a terminal
Swift
66
star
17

csgolive

CS:GO live scorebot using game state integration
JavaScript
18
star
18

neural-style-android

Torch 7 + Android port of Neural style algorithm
C
11
star
19

Accord

Automated performance monitoring for Android
Kotlin
11
star
20

FaisalCrush

Java
11
star
21

NDKSample

Sample app showing the usage of Android NDK
C++
5
star
22

Armageddon-2014

App for the Annual Tech Week of IET DTU
Java
5
star
23

naman14.github.io

JavaScript
4
star
24

VolumeMediaControl

Control media volume instead of ringer volume for selected apps
Kotlin
4
star
25

timber-cast-receiver

HTML
2
star
26

linux-rog

Kernel patches for asus rog support
C
1
star
27

ethglobal-ny

TypeScript
1
star
28

Spar

Swift
1
star
29

XposedUI

[WIP]
Java
1
star
30

zkbnb-android-sdk

Android SDK for zkbnb APIs
Kotlin
1
star
31

ethglobal-sf

JavaScript
1
star
32

CodingBlocks_CustomViews

Java
1
star
33

AdbToolsElectron

do not look here
CSS
1
star