AIception, paint me like one of your French girls

Here is a nice thought:

What if one of the great painters (Picasso, van Gogh, Monet) was still alive?

Wouldn’t you be really excited to ask him/her to paint you?


Thanks to modern technology you can!

Morgan Starry


AIception has a public endpoint that will help “paint” any image in the “style” of any great painter.


Let’s get started!

We wish to implement it in Python but you can use your favorite programming language.

1. Create the following directory structure:

2. Get  <from the github here>.

3. Download and install Anaconda ( a great package, dependency and environment manager)

4. Create a virtual environment with Python 3.*

5. Activate your new environment

6. Install extra packages like the requests HTTP library

7. Do your first API call

You get the following JSON response from the server:

Great! So the age of the man in the picture is 60.5 years old…wait…that’s not what we want… we want to get a painting!

Let’s use the correct endpoint now, artistic_image, and we need an extra parameter for the style of the image.

8. Call the artistic_image endpoint

It will take a while (around 55 seconds) so please be patient.

You can’t rush art!

We receive the following JSON response that is a bit more complex than the first one:

The JSON contains 3 urls.

Each is the same stylized image at different stages (iterations) in the digital painting process. You cannot control this parameter (yet).


9. We want to be able to automatically download the received images.

We picked the one at iteration 300 because it looks better.



Now it’s your turn!

Use this technology in your next great

  • mobile app
  • facebook app
  •  unity game

People will want their own photos/cats/dogs stylized.

Try the other endpoints:

r = face_age(token, image_url)
r = detect_object(token, image_url)
r = adult_content(token, image_url)
r = faces(token, image_url)

Mix and match the eye to catch…


Publish your own crazy idea that uses AIception API and if we love it we will share it on this blog as well!



AIception faces + asteroids


We, human beings, take a lot of pictures of our surroundings. A lot them contain human faces (strange, right?).

An interesting task (and a prerequisite for others) is to be able to find the human faces in images. This is called face detection.

AIception has a public endpoint to help us find faces in images and we will use it.


  1. Call the AIception face endpoint
  2. Draw bounding boxes for the detected faces
  3. Crop a face
  4. Image of friends + asteroids game = faceteroids

All github code is here:

1. Call the AIception face endpoint

Create the following folder structure.

Download aiception.js from [here].

Add the following to index1.html:

We are now ready to call the AIception API and see what it returns! All we need is the token and an image_url.

Now, open index1.html and check your chrome console (CTRL+SHIFT+i).

Ta da:

If everythings looks similar to above congratulations! You made your first API call to AIception.

The answer is what we are looking for. The JSON response has a “faces” key with a list of faces. Each face is a list of coordinates.

If we use another image_url with 2 faces:

We will get:

Just the coordinates makes little sense so let’s actually see what they mean.

2. Draw bounding boxes for the detected faces

What do those coordinates mean? Each list of 4 coordinates is actually a bounding box x1, y1, x2, y2 of the detected face.

Let’s add a canvas element “myCanvas” and begin our processing when the document is ready:

Create a function that can draw green rectangles.

Create a function that will call the API and draw each rectangle from the result.

Finally load the image and call drawFaces.


Putting everything together this is how index2.html looks.

Cool! Try a few different images of you or your friends.

Now, let’s say you want to do something more advanced like cropping Brad’s Pitt/Angelina Jolie face and putting it into your own image. Can you do it automatically?

3. Crop a face

Create index3.html. And use the code from index2.html.

We want to create a new canvas and draw only the extracted face.

Create another canvas.

Reference it.

Let’s extra the first face we find.

context.drawImage seems daunting at first but here is a great reference

Putting everything together.

Nice! Now you know how to extract the head. Want can you do with it?

Well we had a crazy idea that combines all the tricks we learned so far and we will share it with you.


4. Image of friends + asteroids game = faceteroids maybe?

Play it <here> (arrow keys, spacebar)

How we did it?

We took a very cleanly written html5 javascript canvas asteroids game and we added the AIception face detection to extract the faces and make them into asteroids!

Here is the AIception fork and the commit to make it all possible.

  • we hijacked the main loop
  • we added code for the extraction and drawing of the face


What’s next?

Here are some ideas to get you started with your own with AIception API:

  • extend 2. draw bounding boxes to allow the user to select a custom image_url
  • make an android / ios app that swaps faces
  • jigsaw puzzle using faces

Publish your own crazy idea that uses AIception API, if we love it we will share it on this blog as well!


Welcome to AIception!

AIception, the artificial intelligence platform as a service.


Why did we do AIception?

We are passionate about artificial intelligence and we want to share the magic with you. Artificial intelligence brought a lot of insight and fun into our work and life and we are excited to now be able to give back.

How AIception came to be?

We are are a group of friends. We are engineers and researchers that build and train our own deep neural networks.

What is AIception?

AIception is AI as a service.
We export the functionality of different task specific modules (object detection, face recognition…) through a clean and simple RESTful API.

Can I join AIception?

We will open AIception as a marketplace where you can publish and monetize your own Artificial Intelligence modules.