Skip to content

A Tensorflow API to pull the pixels from most salient objects in image

License

Notifications You must be signed in to change notification settings

tothepoweroftom/outliner

Repository files navigation

Fabricating Alternatives - Outliner API

This is an app for generating a masked cutout of the most salient object in a image. Building upon the work of Ge Zheng

The API was build to take a DataURL base64 string as a post request and returns the masked image in the same format.

The code can easily be shipped to Google Cloud Run or other Docker container service.

Demo

VideoBlocks AudioBlocks

Setup Project

Download Pretrained Model

https://drive.google.com/open?id=0B6l9O8aWij8fUGtVNldUTXA4eHc
  1. Download pretrained model and put them under folder "salience_model" ,(need to create folder yourself)

How to Build the Container And Start Cloud Run

Since Cloud Run is stateless without access to local storage, you must bundle the model within the container. First, download/clone this repo and copy the model into the folder (the model should be in the form of the folder hierarchy /checkpoint/run1, which is the case by default for most finetuning scripts)

Then build the image:

docker build . -t outliner

If you want to test the image locally with the same specs as Cloud Run, you can run:

docker run -p 8080:8080 --memory="2g" --cpus="1" outliner

Then, tag the image and upload it to the Google Container Registry (note, this will take awhile due to the image size!):

docker tag outliner gcr.io/[PROJECT-ID]/outliner
docker push gcr.io/[PROJECT-ID]/outliner

Once done, deploy the uploaded image to Cloud Run via the console. Set Memory Allocated to 2 GB and Maximum Requests Per Container to 1!

The Cloud Run logs will tell you how the service runs, and the INFO log level contains Cloud Run diagnostic info, including the time it takes for a request to run.

Interacting with the API in Cloud Run

Make a POST request to your given url with your base64 image string passed as a param 'img'

About

A Tensorflow API to pull the pixels from most salient objects in image

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published