Comments (8)
@josephrocca this is very helpful actually! it is my goal to let everyone experience this phenomenon easily :)
from stylegan2-pytorch.
Oh, I've just converted them to jpg
s and it seems to be working now!
mogrify -format jpg ./twemoji/assets/72x72/*.png
rm ./twemoji/assets/72x72/*.png
from stylegan2-pytorch.
ok, try again! ff09e94
from stylegan2-pytorch.
All working fine now! Thanks again for this! :)
from stylegan2-pytorch.
I tried resizing the twemoji images to 256x256
like so:
sudo apt-get install imagemagick
git clone https://github.com/twitter/twemoji.git
mogrify -resize 256x256 ./twemoji/assets/72x72/*.png
stylegan2_pytorch --data ./twemoji/assets/72x72
But that didn't help, although the error message was slightly different:
RuntimeError: Given groups=1, weight of size 16 3 1 1, expected input[3, 4, 128, 128] to have 3 channels, but got 4 channels instead
from stylegan2-pytorch.
@lucidrains Perhaps an error message could be shown to tell people that they can't use png images? I assumed it would be as easy as (something like) this (stylegan2_pytorch.py#L133):
def __getitem__(self, index):
path = self.paths[index]
img = Image.open(path)
img.convert('RGB')
img.save('__tmp395739487394.jpg')
jpg = Image.open('__tmp395739487394.jpg')
return self.transform(jpg)
But that still results in the same error for some reason (using the mnist_png
):
RuntimeError: Given groups=1, weight of size 16 3 1 1, expected input[3, 1, 128, 128] to have 3 channels, but got 1 channels instead
and this on the twemoji
dataset:
UserWarning: Palette images with Transparency expressed in bytes should be converted to RGBA images
from stylegan2-pytorch.
@josephrocca I made another patch! upgrade the package!
from stylegan2-pytorch.
Works for the mnist_png
code now! Getting this for the twemoji example:
0%| | 0/100000 [00:00<?, ?it/s]G: -3314.26 | D: 52.87 | GP: 103.12 | PL: 0.20
0%| | 15/100000 [00:10<18:33:42, 1.50it/s]Traceback (most recent call last):
File "/home/user/miniconda/envs/py36/bin/stylegan2_pytorch", line 56, in <module>
fire.Fire(train_from_folder)
File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/fire/core.py", line 138, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/fire/core.py", line 471, in _Fire
target=component.__name__)
File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/fire/core.py", line 675, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File "/home/user/miniconda/envs/py36/bin/stylegan2_pytorch", line 51, in train_from_folder
model.train()
File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/stylegan2_pytorch/stylegan2_pytorch.py", line 459, in train
image_batch = next(self.loader).cuda()
File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/stylegan2_pytorch/stylegan2_pytorch.py", line 75, in cycle
for i in iterable:
File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 345, in __next__
data = self._next_data()
File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 856, in _next_data
return self._process_data(data)
File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 881, in _process_data
data.reraise()
File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/_utils.py", line 394, in reraise
raise self.exc_type(msg)
RuntimeError: Caught RuntimeError in DataLoader worker process 13.
Original Traceback (most recent call last):
File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop
data = fetcher.fetch(index)
File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/stylegan2_pytorch/stylegan2_pytorch.py", line 140, in __getitem__
return self.transform(img)
File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 70, in __call__
img = t(img)
File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 322, in __call__
return self.lambd(img)
File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/stylegan2_pytorch/stylegan2_pytorch.py", line 112, in expand_to_rgb
return tensor.expand(3, -1, -1)
RuntimeError: The expanded size of the tensor (3) must match the existing size (4) at non-singleton dimension 0. Target sizes: [3, -1, -1]. Tensor sizes: [4, 128, 128]
0%| | 15/100000 [00:13<24:54:58, 1.11it/s]
Exception in thread Thread-2:
Traceback (most recent call last):
File "/home/user/miniconda/envs/py36/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/home/user/miniconda/envs/py36/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/utils/data/_utils/pin_memory.py", line 25, in _pin_memory_loop
r = in_queue.get(timeout=MP_STATUS_CHECK_INTERVAL)
File "/home/user/miniconda/envs/py36/lib/python3.6/multiprocessing/queues.py", line 113, in get
return _ForkingPickler.loads(res)
File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/multiprocessing/reductions.py", line 294, in rebuild_storage_fd
fd = df.detach()
File "/home/user/miniconda/envs/py36/lib/python3.6/multiprocessing/resource_sharer.py", line 57, in detach
with _resource_sharer.get_connection(self._id) as conn:
File "/home/user/miniconda/envs/py36/lib/python3.6/multiprocessing/resource_sharer.py", line 87, in get_connection
c = Client(address, authkey=process.current_process().authkey)
File "/home/user/miniconda/envs/py36/lib/python3.6/multiprocessing/connection.py", line 493, in Client
answer_challenge(c, authkey)
File "/home/user/miniconda/envs/py36/lib/python3.6/multiprocessing/connection.py", line 732, in answer_challenge
message = connection.recv_bytes(256) # reject large message
File "/home/user/miniconda/envs/py36/lib/python3.6/multiprocessing/connection.py", line 216, in recv_bytes
buf = self._recv_bytes(maxlength)
File "/home/user/miniconda/envs/py36/lib/python3.6/multiprocessing/connection.py", line 407, in _recv_bytes
buf = self._recv(4)
File "/home/user/miniconda/envs/py36/lib/python3.6/multiprocessing/connection.py", line 379, in _recv
chunk = read(handle, remaining)
ConnectionResetError: [Errno 104] Connection reset by peer
Exact replication:
sudo docker run --gpus all --rm -it anibali/pytorch:cuda-10.1 bash
pip install stylegan2_pytorch
git clone https://github.com/twitter/twemoji.git
stylegan2_pytorch --data ./twemoji/assets/72x72
This is not important at all though (very easy to convert to jpg
) - only reporting to help make your package super easy for others to get started with. I'm worried that I'm taking your time away from more important things with these nit picks 😅
from stylegan2-pytorch.
Related Issues (20)
- Parameters for generating faces HOT 1
- Performance on MNIST
- Out of memory after exactly 5024 iterations? HOT 1
- Web application for generating content while reloading.
- Tesla V100 GPU - 2600 Image - Too Slow Training HOT 1
- Uneven GPU utilization.
- Trainning on images with one (single) channel HOT 1
- Bug: random_hflip function HOT 1
- where can i download train data?
- Bug: gradient_accumulate_contexts function HOT 1
- Generate full resolution images 1024x1024 HOT 1
- generate all seeds of latent space
- ability to calculate Perpectual Path Length (PPL)? HOT 1
- Save Interval Flag
- /torch_utils/custom_ops.py - _find_compiler_bindir: incorrect Visual Studio Path
- Inconsistent evaluation of self.av HOT 2
- How to Train on a Single Image
- Examples on save_every and evaluate_every in README section needed.
- 3D adaptation for medical imaging HOT 1
- Training on t4 gpu 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 stylegan2-pytorch.