Comments (35)
What kind of images did you compress? The models are trained on natural images. And when you say 600-800KB, you mean the .l3c
files generated with --write_to_file
or the bpsp outputted by test.py
?
from l3c-pytorch.
Or are you using l3c.py
?
from l3c-pytorch.
After I update my gcc, I can run the codes now.
But I also find that when I run l3c.py on a .jpg file of the size 100kB, the out.l3c becomes to 850kB and the out.png becomes to 1.6M :P (the bpsp of output is great:2.68, but the file is so big...)
Then I tried larger pictures but it allocated more than 10G memory of GPU and it was been killed.
uh...I don't know if it is normal...
from l3c-pytorch.
@BUAAHugeGun This is because it's a JPG, a lossy format :) So if you feed a .jpg to L3C you are asking it to compress the artefacts from JPG losslessly. The number you should care about is how L3C compares to PNG, which is also lossless.
Regarding the GPU: this is the problem of using CNNs. I think this could be optimized but I did not spend the time. If you have more RAM, you can also try the CPU version of torchac.
from l3c-pytorch.
@fab-jul thanks a lot for your response. 👍
I made the mistake because I thought it could conpress any picture sRGB images.
thx
from l3c-pytorch.
uh...I'm coming back here for your help.
Today I tried .png & .NEF files.
But I found that the output image(out.png) was full of blur and noise. :(
I used:
python l3c.py 'logs dir' 0524_0001 enc 'input dir' out.l3c
and
python l3c.py 'logs dir' 0524_0001 dec out.l3c out.png
from l3c-pytorch.
the output will always be equal to the input. what kind of images are in input dir
?
from l3c-pytorch.
First I tried .jpg as I said. They were the same, Though the size of output is much larger than input.
Then I tried a .png image from Internet
, a .png image from kodak test dataset
, two .NEF images from the test dataset mentioned in your paper
and got outputs of them which were full of noise and blur.
I'm sorry if this will trouble you. : (
from l3c-pytorch.
Can you post one such .png that produces noise here?
from l3c-pytorch.
from l3c-pytorch.
I just downloaded this image and ran it through L3C:
python l3c.py $RELEASED_CKPTS 0524_0001 enc ~/62377157-db349180-b574-11e9-851d-b79e5efc8067.png out.l3c
python l3c.py $RELEASED_CKPTS 0524_0001 dec out.l3c ~/decoded_github.png
And I get the same image back, as expected, i.e. decoded_github.png
is exactly the same image I put in.
In theory, the code will always produce the same image. I'm really confused by what you get. Can you post the blurred result as well?
from l3c-pytorch.
from l3c-pytorch.
This is very unexpected. It looks very much like you are getting a sampled version of the image. Some questions:
- Are you putting in exactly the image you posted above? I.e. what happens when you download that image and feed it?
- Are you using the command you posted above? I.e. no
--sample
or anything? - Are you on the latest git commit?
from l3c-pytorch.
I'm sure about the 3 questions. And I tried some times again.
It is strange that I succeeded once using the image above.
And then it failed again.
I noticed that the size of out.l3c is constant, so I guess there is something wrong when using decoder?
from l3c-pytorch.
...I downloaded the code again.
And then I installed torchac(GPU).
Now when I use a .jpg image, I also get a blurred image...
from l3c-pytorch.
Maybe something with torchac is wrong. Can you try to run
python test.py /path/to/logdir 0524_0001 /some/imgdir --write_to_files=files_out_dir
because that runs multiscale_tester.py
's _write_to_file
which has an assert
to check decoding works.
from l3c-pytorch.
Alternatively, can you send out.l3c
?
from l3c-pytorch.
I sent a email to you. : )
from l3c-pytorch.
Thanks! I’ll have a look. If you can, running the above command (the one with --write_to_files
) would also be really helpful.
from l3c-pytorch.
from l3c-pytorch.
So, I just tried, and I get the same blurry output as you. I then went and compared the binary file you gave me to the one I get when I encode. They only match in the part that encodes the smallest bottleneck (which is encoded with a uniform prior). So, for some reason, your network must produce different probability distributions when encoding.
Now, I don't see how --write_to_files
worked, because it should raise an assertion. I'm really not sure what's going on here. Are you encoding on GPU? If so, which GPU do you have? If you try with this file here, does it work, i.e., does --write_to_files
work and does l3c.py
work?
from l3c-pytorch.
Hey
I have the same problem, tested it with the .png files from the CIFAR10 dataset like this car.
I used this command to get the l3c:
python test.py ../ 0524_0001 ~/images/bar/ --names "L3C" --recursive=auto --write_to_files ~/images/foo/
and this command to decode it again:
python l3c.py ../ 0524_0001 dec ~/Bilder/foo/automobile4.l3c auto.png
yielding these blurs:
When I use the command for encoding,
python l3c.py ../ 0524_0001 enc ~/images/bar/automobile4.png foo.l3c
The code is executed on NVIDIA RTX 2070, with the anaconda environment installed according to the repository, with torch 1.1.0
from l3c-pytorch.
I‘ll check this out. Since it happens on CIFAR also, it most likely is not a memory issue
from l3c-pytorch.
It is strange that when I first used l3c.py, the output was the same as the input, but when I found this problem, I tried the same input as the first one, the output changed to a blurred image.
And the only commit between the two tries was the modification of torchac...
from l3c-pytorch.
Wait, are you saying that everything worked before that commit? Or are you not 100% sure?
Edit: Are you running both encoding and decoding on the CPU?
from l3c-pytorch.
Uh, I just tried .jpg images on GPU before that commit and they were OK.
Round after the commit, I asked you why the output was larger than input when trying .jpg.
Then I edit the code of torchac as your description and run it on .png images and it didn't work well.
Finally I download code again and found it also didn't work well on .jpg images.
from l3c-pytorch.
So, I finally have some time to dig into this. Good news: I can now finally reproduce it, with the steps provided by @ChipsSpectre.
from l3c-pytorch.
Update: This has to do with CUDA.
If I compile torchac without CUDA support AND run all commands with CUDA_VISIBLE_DEVICES=""
, no errors appear.
Currently however, there is some weird behavior in torchac.py
, where it always thinks CUDA is available. I'll dig more later this week.
from l3c-pytorch.
thx a lot. I guess it's hard to find this problem.
from l3c-pytorch.
Thank you for the tip. I will also have a look into the torchac module.
I could reproduce correct encryption and decryption with
CUDA_VISIBLE_DEVICES=""
on my machine, too.
Edit: The Arithmetic coder does not adapt the device before calling the torchac module.
The data are transferred to the default device (e.g. a GPU) before starting the bitcoding, where the data is only converted to float.
I assume now that maybe the error can be avoided by transferring the data to cpu if torchac-cpu is available only, similar to the function encode_logistic_mixture
in torchac.
from l3c-pytorch.
@ChipsSpectre Yes I realized that too now. Another problem is that if you compile with GPU support once, it stays in your build
dir, and then torchac.py
will always use the GPU version. I'll fix both things.
What's really weird to me however is that it works when using test.py
. Because there is a line in there that does an assert output == input
. So, when using the decoder in test.py
, everything works. Somehow however, when using the decoder through l3c.py
, it doesn't work anymore...
If you want to dig into that, it would also be much appreciated :)
from l3c-pytorch.
fixed.
the restorer class was the problem.
i create a pull request.
from l3c-pytorch.
Still working on making the backend selection more seamless, so keeping this open.
from l3c-pytorch.
@BUAAHugeGun Please try again with the latest master commit and let me know how it goes
from l3c-pytorch.
Closing this due to inactivity.
from l3c-pytorch.
Related Issues (20)
- AssertionError: Expected a base dir for every component, got ['0524_0001'] and ['configs/ms', 'configs/dl'] HOT 8
- The loss value remained around 5 HOT 4
- questions about the probability prediction part in the paper HOT 1
- Question about the computation of cdf in the code HOT 13
- torchac: how to find <EOM> to separate bytes strings (channels) ? HOT 1
- get errors when compress image HOT 2
- run train.py error HOT 7
- questions about AC code
- weird problem when encoding HOT 1
- Question about CDF function and AC code HOT 2
- CDF function and model p HOT 3
- Error while decompressing HOT 4
- AttributeError: module 'torchac.torchac' has no attribute 'CUDA_SUPPORTED' HOT 2
- Size of compressed file HOT 1
- Evaluation Sets
- How to modify this code to enable compression of 16Bit Images HOT 1
- Running time
- python .\setup.py install faill HOT 1
- Do not able to learn the latent representations
- question about header
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 l3c-pytorch.