This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Tools

I have dockerized a number of open source tools for machine learning and data science. For each tool you will find a docker-compose.yml, Dockerfile, and an info.yml. The info.yml provides a standardized view of how to leverage the tool. I have written scripts that use the information defined int he info.yml files to make the tools easy to use in a consistent manner.

Getting Started

In order for the scripts to work, you will need to install the following:

  • python3/pip3/virtualenv (then run pip3 install -r requirements.txt or pip3 install -r dev-requirements.txt for development)
  • docker+docker-compose
  • NVIDIA Container Toolkit

An interactive script (prepare.py) is provided to help:

  • initialize volume directories used by the tools
  • download required datasets/models/checkpoints

Docker

If you are using these for production or dont want bloat I would reccomend using your own images, these images are geared towards making things easy, not optimized

The compose file in each tool directory knows how to build the images (which are not currently on docker hub). All of the tools extend one of the base images defined in this repo:

Alot of data is downloaded in the course of building these images, if you need to share them across multiple machines in a local network I would reccomend using a local registry (example config).

1 -

Machine Learning Tools

Contains a set of dockerized open source ML tools.

2 - Background Remover

This tool removes the background from images or videos. The tool being wrapped is nadermx/backgroundremover

Docker tooling for nadermx/backgroundremover. Can process image or video.

3 - Diffusion Clip

This makes it easy to train and apply diffusion moedls to images. The tool being wrapped is gwang-kim/DiffusionCLIP

Docker tooling for gwang-kim/DiffusionCLIP.

The entrypoint is a highly opinionated wrapper on the edit single image operation, to do other things or to override options override the entrypoint.

Args

Example: docker-compose run dc --model_path pretrained/imagenet_cubism_t601.pth --config imagenet.yml --img_path ../working/test.jpg

FlagValue
--model_pathpretrained/${Name of model you put in checkpoints dir}
--configEither celeba.yml, imagenet.yml, afqh.yml or `` (read in source repo)
--img_path../working/{Name of file you want to process in working dir}

Volumes

Be sure to read in the source repo about what needs to go into pretrained (checkpoints) and data.

Local PathPurpose
../../volumes/checkpointsPretrained models
../../volumes/dataData to train on
../../volumes/workingRepo to put file into for processing and to get processed files out of
../../volumes/cachePython cache

4 - GFPGAN

This tool enhances images in a number of ways, the tool being wrapped is TenacentARC/GFPGAN

Docker tooling for TencentARC/GFPGAN. Upscales images, fixes faces.

5 - Maxim

This tool can denoise, dehaze, deblur, derain, and enhance images. The tool being wrapped is google-research/maxim.

Docker tooling for google-research/maxim.

Put input images in ../../volumes/working/input.

Run docker-compose run ml $OPERATION where $OPERATION is one of: Denoising, Deblurring, Dehazing-Indoor, Deshazing-Outdoor, Deraining-Streak, Deraining-Drop, Enhancement.

6 - Real Esrgan

This tool enhances images in a number of ways, the tool being wrapped is xinntao/Real-ESRGAN

Docker tooling for xinntao/Real-ESRGAN. Upscales images and fixes faces (using gfpgan).

Options:

  • -s - Scale factor (default: 4)
  • --face_enhance - Enhance face using GFPGAN (default: False)
  • --fp32 - Use fp32 precision during inference. Default: fp16 (half precision).

Run on Replicate