Comments (10)
Some hints for those trying to execute your (awesome 😍 ) piece of software without a Cuda-supporting GPU:
In ColorizeVisualization.ipynb
- Remove the line
torch.cuda.set_device(0)
, since you don't use cuda - Remove the line
"IMAGENET = Path('data/imagenet/ILSVRC/Data/CLS-LOC/train')\n",
- Modify the following to
"colorizer_path = 'colorize_gen_192.h5'\n",
In DeFadeVisualization.ipynb
- Replace all
.cuda(gpu)
calls with.cpu()
Bonus, if you want to transform an entire input folder (e.g. called "input_images"):
"import os\n",
"for subdir, dirs, files in os.walk('input_images'):\n",
" for file in files:\n",
" vis.plot_transformed_image(os.path.join(subdir, file))"
For this, you might also want to patch fastai, since it does keep the figures in memory which will eventually cause you to run out of memory.
In fasterai/visualize.py:37
- Add
plt.close(fig)
Cheers, Ichaelus
from deoldify.
Hi again!
Yes, I followed your installation guide and chose "CPU" whenever possible 😉 That said, I am launching the application with conda activate fastai-cpu && jupyter notebook
. The render speed is not that regarding the possible outcome. Yesterday, I went over to creating colorizations for 8 different render factors per image to spot the right one (which is by far not always the highest possible render factor!), and it takes me about 1-2 minutes per batch (of 8). The bottleneck of choosing higher render factors was rather my 16GB of RAM than the Coffee Lake CPU. Code see Appendinx.
Colab/Jupyter and all this was new to me, so I felt more comfortable having all set up locally at first.
That's a good point with mathplotlib, I always went straight to the result_images directory to see the images and didn't mind the plotted figure :)
Appendix: Code to create multiple versions of the input image. I needed to patch the underlying method to create different output images, though.
import os
for subdir, dirs, files in os.walk('input_images'):
for file in files:
print(file)
for render_factor in [6, 12, 18, 24, 30, 36, 42, 48]:
new_path = os.path.join(subdir, file)
vis.plot_transformed_image(new_path, render_factor=render_factor)
from deoldify.
I'm going to close this. It's not actually worth it if you have a gpu (almost everybody does these days) and there's a Colab notebook that provides the hardware if you don't have it.
from deoldify.
Thanks! This will be a good reference before I try to programmatically support this stuff.
The plt.close(fig) thing in particular- great catch. I'll look at fixing that today.
Did you use the pytorch-cpu install for this? That was the only way I got it working at a reasonable speed (it's a PITA to have a separate install just for cpu though). For rendering mind you (don't try to train with CPU!) And by reasonable I mean slow as fuck but not infinitely slow (like maybe a minute or two for some renders on a 16 core threadripper lol).
conda install -c pytorch pytorch-cpu
from deoldify.
Also- ultimately if you're just interested in rendering with pretrained weights, I strongly recommend to just use the Colab notebook. They give you a free 11GB (!!!) gpu and it's as hassle free as you can get right now. Though I do understand it's nice to just have it on your own machine and do whatever you want with it.
from deoldify.
Update on the plt.close(fig) thing- It turns out that if you close the figure, it makes the image disappear in Juptyer (doh!). Currently at least- I'm sure there's a way around it. I do wonder if it's worth trying to address it though. I suppose if somebody is doing a huge batch then yeah...problem. But then really should they be plotting to matplotlib to begin with...(and therefore the plot_transformed_image function)? Sounds like it should just be going straight to file, because it'd also be problematic to load up Jupyter with tons of images (I've tried...it doesn't like it).
I'm going to let this go for now unless I hear of concrete problems with this that convince me it needs to be changed. #TradeOffs and whatnot.
from deoldify.
I have a problem fou you. I follow your guidance. Everything went successful until this step:
Hope get your help, thanks!!
from deoldify.
So what are you attempting to do here- gpu or cpu rendering?
from deoldify.
I attempted the -cpu rendering. @jantic
from deoldify.
You might have to do this
conda remove pytorch
then
conda install -c pytorch=0.4.1 pytorch-cpu=0.4.1
I -think- the second command will work but haven't tried it.
I say that because it's complaining about CUDA, yet CUDA is only relevant to GPUs. And it shouldn't even get to this point unless something's screwed up with the pytorch-cpu install.
from deoldify.
Related Issues (20)
- Having trouble trying to colorize and save a single image.. HOT 8
- trying to run this as an extension in stable diffusion extension is not working HOT 1
- Can you help fix a bug in AnimeColorDeOldify? HOT 1
- Can you create a model for coloring anime (art, sketch, manga horizontal and vertical)? HOT 1
- How to stablize the colors between frames of a video? HOT 3
- simple command line interface? HOT 1
- dataset distribute HOT 2
- Some problems occurred during the training HOT 1
- video building only works for mp4s HOT 3
- Dependencies in `requirements.txt` have module conflicts. HOT 4
- I develop a deoldify plugin for stable-diffusion-webui,can you add to readme? HOT 2
- Everything fails HOT 4
- How to adjust bach during inference? HOT 2
- The weight link (https://www.dropbox.com/s/7r2wu0af6okv280/colorize_gen_192.h5) in dana-kelley repository is broken, would you please share again? HOT 3
- How to output result without show image HOT 1
- TypeError: 'NoneType' object is not subscriptable HOT 2
- unable to run HOT 1
- Any known update for MyHeritage edition? HOT 1
- Get error when Create black and white training images HOT 1
- RuntimeError: Given input size: (512x1x1). Calculated output size: (512x0x0). Output size is too small HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deoldify.