Skip to content

Newmu/stylize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stylize

Regressor based image stylization.

Inspired by the various projects implementing polygonal stylization of images via blends of genetic algorithms and hill climbing and Andrej Karpathy's rephrasing of the problem in a machine learning framework.

Whereas genetic algorithm and hill climbing approaches can take hours, stylize runs in seconds with much greater flexibility and higher fidelity when desired.

Usage (example.py has more detail):

from stylize import render
from scipy.misc import imread

image = imread('resources/iggy_small.jpg')
defaults = render(image)
Our Test Subject, my cat Iggy Default stylization render(image)
Iggy Iggy
Abstract render(image,depth=4) Smooth render(image,iterations=25)
Iggy Iggy
More Detail render(image,ratio=0.00005) Less Detail render(image,ratio=0.001)
Iggy Iggy
Visualizing how it works Why
Iggy stylize is currently based off of regression trees and an ensembled version of that model, the random forest regressor. Regression trees work by recursively partitoning ("splitting") their input feature space and assigning associations to those partitions (such as colors). At each frame the model splits every partition in half again until hitting its minimum partition size, click the gif to see a larger version!

About

Regressor based image stylization.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages