Home

Awesome

DeOldify.NET

C# implementation of Jason Antic's DeOldify(https://github.com/jantic/DeOldify) Only for photos for now!

Paper "DeOldify.NET: cross-platform application for coloring black and white photos" was accepted to poster session of Neuroinformatics - 2022 conference. The paper describes technical details of managed C# implementation of the original DeOldify and contains some comparisons with different other image colorization products.

How to run

On Windows 7, 8, 8.1, 10, 11

ModelDetailsFile
float32 ArtisticArtistic model with single-precision floating point weights. More accurate than compressed float16 model.https://github.com/ColorfulSoft/DeOldify.NET/releases/download/Weights/Artistic.model
float16 ArtisticArtistic model with half-precision floating point weights. Less accurate than original float32 model, but requires 2 times less disk space.https://github.com/ColorfulSoft/DeOldify.NET/releases/download/Weights/Artistic.hmodel
float32 StableStable model with single-precision floating point weights. More accurate than compressed float16 model.https://github.com/ColorfulSoft/DeOldify.NET/releases/download/Weights/Stable.model
float16 StableStable model with single-precision floating point weights. Less accurate than original float32 model, but requires 2 times less disk space.https://github.com/ColorfulSoft/DeOldify.NET/releases/download/Weights/Stable.hmodel
BuildDetailsScript
ArtisticBasic version of Artistic colorizer with float16 weightsCompile.artistic.bat
Artistic.w32Artistic colorizer with float32 weightsCompile.artistic.float.bat
Artistic.simdArtistic colorizer with SIMD acceleration and float16 weightsCompile.artistic.simd.bat
Artistic.simd.w32Artistic colorizer with SIMD acceleration and float32 weightsCompile.artistic.simd.float.bat
StableBasic version of Stable colorizer with float16 weightsCompile.stable.bat
Stable.w32Stable colorizer with float32 weightsCompile.stable.float.bat
Stable.simdStable colorizer with SIMD acceleration and float16 weightsCompile.stable.simd.bat
Stable.simd.w32Stable colorizer with SIMD acceleration and float32 weightsCompile.stable.simd.float.bat

Windows GUI

On Linux (Tested on Mint)

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install mono-complete
ModelDetailsFile
float32 ArtisticArtistic model with single-precision floating point weights. More accurate than compressed float16 model.https://github.com/ColorfulSoft/DeOldify.NET/releases/download/Weights/Artistic.model
float16 ArtisticArtistic model with half-precision floating point weights. Less accurate than original float32 model, but requires 2 times less disk space.https://github.com/ColorfulSoft/DeOldify.NET/releases/download/Weights/Artistic.hmodel
float32 StableStable model with single-precision floating point weights. More accurate than compressed float16 model.https://github.com/ColorfulSoft/DeOldify.NET/releases/download/Weights/Stable.model
float16 StableStable model with single-precision floating point weights. Less accurate than original float32 model, but requires 2 times less disk space.https://github.com/ColorfulSoft/DeOldify.NET/releases/download/Weights/Stable.hmodel
<details> <summary>Using git and terminal</summary>
git clone https://github.com/ColorfulSoft/DeOldify.NET.git
cd DeOldify.NET
wget <model url> -O Implementation/src/Resources/<model name>
</details> <details> <summary>Using GUI</summary> </details>
BuildDetailsScript
ArtisticBasic version of Artistic colorizer with float16 weightsCompile.artistic.sh
Artistic.w32Artistic colorizer with float32 weightsCompile.artistic.float.sh
Artistic.simdArtistic colorizer with SIMD acceleration and float16 weightsCompile.artistic.simd.sh
Artistic.simd.w32Artistic colorizer with SIMD acceleration and float32 weightsCompile.artistic.simd.float.sh
StableBasic version of Stable colorizer with float16 weightsCompile.stable.sh
Stable.w32Stable colorizer with float32 weightsCompile.stable.float.sh
Stable.simdStable colorizer with SIMD acceleration and float16 weightsCompile.stable.simd.sh
Stable.simd.w32Stable colorizer with SIMD acceleration and float32 weightsCompile.stable.simd.float.sh

Linux GUI

Please note, that DeOldify.NET using Mono is a bit slower, than using .NET Framework

Examples

Example1

Example2

OriginalArtisticStable
OriginalArtisticStable

New algorithms

DeOldify.NET has become a platform for testing the latest highly optimized algorithms, which will then be applied in the System.AI project. In this section you can find some information about the results of the experiments.

Patch2Vec Conv2d

The meaning of most fast convolution algorithms, such as im2col or im2row, involves bringing the convolution to matrix multiplication, which allows optimizing memory access operations by using the processor cache. However, such methods either require a buffer for srcC * kernelY * kernelH * dstH * dstW elements, which is extremely irrational. The proposed patch2vec method unwraps each patch of the input image on the fly, and then applies all convolution filters to it. This implementation is not inferior in efficiency to classical algorithms like im2col, and in practice even surpasses them. The buffer for this algorithm will have the size of srcC * kernelY * kernelX, which is much smaller than in the case of similar methods. Moreover, patch2vec does not impose restrictions on the convolution parameters, unlike, for example, the Shmuel Vinograd method. The proposed algorithm is difficult to fit into classical machine learning frameworks due to the fact that they are focused on using GEMM as the core. Pure C#-based implementations make it easy to do this.

For more detailed information, please see official Patch2Vec repository: https://github.com/GlebSBrykin/Patch2Vec

In DeOldify.NET two versions of the patch2vec conv2d algorithm are implemented - with and without SIMD support. You can choose, which version to use by executing the corresponding compilation command file. Vectorization is implemented through the Vector4 structure of the System.Numerics namespace. Vectorization is only available for x86-64 processors at version .NET Framework 4.6 and higher, or when using Mono newer than 2008.

MethodTime (ms)
im2col123902
patch2vec114970
patch2vec + simd33270

All tests was done in Windows 7 x64 laptop with Intel(R) Core(TM) i5-6300HQ CPU and 32 GB of RAM

Updates