Comments (7)
Hi,
I think the problem arises due to the large input size. The partial non-local block is a memory consuming operation. One solution is to scale your input using original ratio in advance. We also implement this option in the code, but it will cost your some time to slightly modify the run.py. Hence, just try to scale the input and see if it will work :)
from bringing-old-photos-back-to-life.
I have reduced my images to 288 × 368 and 480 × 656 (less than 200KB) for --with_scratch, it works well. By the way, I do not think the file size would matter, I guess the key is to make the width and height to be reduced, because your images would become matrices in the code. Therefore, just try to simply reduce the total pixels by reducing the size and see if it works :)
from bringing-old-photos-back-to-life.
I added a log to the Skipped *.jpg output and the reason the model fails is that its trying to allocate more memory than is available in the collab. For example
CUDA out of memory. Tried to allocate 168.00 MiB (GPU 0; 7.43 GiB total capacity; 6.42 GiB already allocated; 88.94 MiB free; 6.75 GiB reserved in total by PyTorch)
So from that im pretty sure that the issue will not be the file size but rather the number of pixels in the image. As jpeg is compressed the input file size could be deceiving. Along with the fact that the image will most likely be upscaled to some power of 2. Based on trial/error I was for example able to process 1127x742 but not 1278x842 (without scratch, scratch seems to up the memory requirements significantly).
from bringing-old-photos-back-to-life.
I need to test it more. It might just be a file size thing. But I found that as long as one of the dimensions is either 256 or 512 it works (Divisable by 256). Like 512px wide by 683 px high. 1024 seems to be too high in resolution for colab.
from bringing-old-photos-back-to-life.
Thanks a lot, it works well after I reduce the input size!
from bringing-old-photos-back-to-life.
@HengjieWang which is the max image size in bytes it can be handled?
I have noticed that using the option --with_scratch
will also skip images of less that 1MB:
EMILIA 55.png(image/png) - 936193 bytes, last modified: 19/9/2020 - 100% done
Saving EMILIA 55.png to EMILIA 55.png
while without the option it works for that size:
Running Stage 1: Overall restoration
initializing the dataloader
model weights loaded
directory of testing image: /content/photo_restoration/test_images/upload
processing EMILIA 55.png
You are using NL + Res
Now you are processing EMILIA 55.png
/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py:3121: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details.
"See the documentation of nn.Upsample for details.".format(mode))
Skip EMILIA 55.png
Finish Stage 1 ...
Running Stage 2: Face Detection
Finish Stage 2 ...
Running Stage 3: Face Enhancement
The main GPU is
0
dataset [FaceTestDataset] of size 0 was created
The size of the latent vector size is [8,8]
Network [SPADEGenerator] was created. Total number of parameters: 92.1 million. To see the architecture, do print(network).
hi :)
Finish Stage 3 ...
Running Stage 4: Blending
Finish Stage 4 ...
All the processing is done. Please check the results.
while if the size is < 500KB it works:
EMILIA 55.png(image/png) - 462560 bytes, last modified: 19/9/2020 - 100% done
Saving EMILIA 55.png to EMILIA 55.png
from bringing-old-photos-back-to-life.
I confirm that when using the option --with_scratch will significantly increase the memory pressure and therefore reduce the file size.
from bringing-old-photos-back-to-life.
Related Issues (20)
- i am not able to run code for installation HOT 3
- dataset information and details of training and hyperparameter and number of epoch HOT 1
- this project still available?
- Why do I get this error when I add my own photo
- MemoryError
- 代码里好多错误,pix2pixHD_model_DA.py里面的netE是什么了?
- how can I use my own model
- 很多很多问题,应该是没有再维护了
- 尝试从google.protobuf.internal模块导入名为'builder'的子模块时出现了问题
- Not working (conda with env) HOT 5
- Not working HOT 2
- Out of memory error
- : unrecognized arguments HOT 1
- Deprecated dependencies detected
- refined dockerfile HOT 2
- How can I use the GPU on the macbook(m1) ?
- No errors, but output images are blank/white
- IndexError: list index out of range (model on replicate.com) HOT 2
- cast error - line 219 in align_warp_back_multiple_dlib.py, using Python 3.10.12
- GUI warns it has gone commercial and a licence will be required
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 bringing-old-photos-back-to-life.