Use Chainner to upscale your AI generated art with your AMD card on Debian Linux
A tool to upscale images
I have a old AMD RX480 in my Linux desktop that I really should update
to an nVidia GPU. I have been resisting this due to GPU's being obnoxiously priced.
In this post I will walk through ChaiNNer and set it up to upscale [make pictures bigger] the art created with either Stable Diffusion or MidJourney.
- What is ChaiNNer
- Chainner Install on Debian
- Get models
- Setup the flow
- Upscale an image
What is ChaiNNer
A flowchart/node-based image processing GUI aimed at making chaining
image processing tasks (especially upscaling done by neural networks) easy,
intuitive, and customizable.
If you are familiar with node based coding Unreal Engine Blueprints,
or setting up geometry nodes in Blender, you will will feel right
at home using ChaiNNer to manipulate your images.
One of the features I enjoy is the ability to upscale the small images that are
produced by MidJourney or Stable Diffusion for editing or physical products
like stickers or prints.
The product below was scaled up using ChaiNNer:
Wy’East Dreaming
Or you can setup different chains to do mundane things like cropping, or blurring all the images in a directory.
Chainner Install on Debian
I mentioned in the intro that I have an older GPU [AMD RX480] that still works extremely well for Minetest, Portal, and Penguin Platformer that I just haven't gotten around to upgrading. Also, the GPU landscape has been a bit frothy due to Crypto mining. I was waiting on the Ethereum merge to maybe be able to get a new card soon.
Luckily, the Linux install of ChaiNNer found my card and actively uses it for NCNN upscaling!
Here's how I installed it
Go to the GitHub project:
Select releases. I am running Debian so I selected the .deb
file
[Note: it is in rapid development and this link may be old]:
https://github.com/chaiNNer-org/chaiNNer/releases/download/v0.13.0/chaiNNer-0.13.0-x64-linux-debian.deb
Once downloaded, open a terminal and change in to your Download directory. Use dpkg
as an elevated user to install:
cd Downloads
sudo dpkg -i chaiNNer-0.13.0-x64-linux-debian.deb
Now that it is installed you can run it from your terminal by typing chainner
chainner
We need to make sure it sees your AMD card. If you have a nVidia card, you should just check to see what options are available to you.
Next, scroll to the bottom on the left, and click the button to open the
dependency manager [kind of wish this was in settings...]. Download all the things relevant to your build. Since I am using NCNN, I want to make sure I have that.
OK, now you are all set to go out and get your models. Restart ChaiNNer if you added any dependencies.
Get the models
We need some models to get setup the upscaler. Go to the upscale.wiki and search for 4x-UltraSharp, by Kim2091.
Open the link which takes you to Mega for the files, surprised Mega still is around...
Download the NCNN directory.
You will need the bin
and param
files for the next step:
4x-UltraSharp-opt-fp16.bin
4x-UltraSharp-opt-fp16.param
I have a 8GB GPU and the f16 files worked nicely, YMMV.
Setup the flow
You will need the following nodes:
- LOAD MODEL
- LOADIMAGE
- UPSCALE IMAGE
- TEXT APPEND
- SAVE IMAGE
Connect them like the screenshot above.
I added a text append
node to make sure the new saved image has the model appended to the name.
You can find more templates from Kim2091 in the following Github repo:
Upscale an image
Now you are ready to upscale an image.
Select your image, I am using my 400x400 avatar image for example.
Select a destination for your new image.
Then after been fully caffeinated, click the play button.
With the RX480, upscaling the 400x400 image to 1600x1600 took barely one minute.
You now have a new image to go out and play with, or make some cool products like this:
Anthropomorphic Mouse Space Engineer
Final Thoughts
You can still use your old hardware to do great things, you just need to be patient
with it. I highly recommend using ChaiNNer if you are creating art with the current set of AI helpers as the image exports are small. I love being able to setup an iterator, point it at a directory, pressing play and then walking away.
Example Product:
Bauhaus Golden Retriever
ChaiNNer is an awesome addition to my workflow.