add project files
After Width: | Height: | Size: 462 KiB |
After Width: | Height: | Size: 366 KiB |
After Width: | Height: | Size: 469 KiB |
After Width: | Height: | Size: 520 KiB |
After Width: | Height: | Size: 401 KiB |
After Width: | Height: | Size: 529 KiB |
After Width: | Height: | Size: 388 KiB |
After Width: | Height: | Size: 431 KiB |
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
# make a 3x3 grid of all pngs in current directory
|
||||
# requires pytorch
|
||||
# License AGPLv3
|
||||
import os
|
||||
|
||||
import torch
|
||||
import torchvision
|
||||
from torchvision.io import read_image
|
||||
from torchvision.utils import make_grid
|
||||
|
||||
filenames = []
|
||||
|
||||
for n in os.listdir('.'):
|
||||
if n.endswith('.png'):
|
||||
filenames.append(n)
|
||||
|
||||
cells = []
|
||||
|
||||
for n in filenames:
|
||||
cells.append(read_image(n))
|
||||
|
||||
print(len(cells))
|
||||
grid = make_grid(cells, nrow=3)
|
||||
print("size of grid:", grid.size())
|
||||
img = torchvision.transforms.ToPILImage()(grid)
|
||||
img.show()
|
||||
img.save(f'tenowls.png')
|
After Width: | Height: | Size: 2.7 MiB |
After Width: | Height: | Size: 302 KiB |
After Width: | Height: | Size: 480 KiB |
After Width: | Height: | Size: 445 KiB |
After Width: | Height: | Size: 469 KiB |
After Width: | Height: | Size: 421 KiB |
After Width: | Height: | Size: 641 KiB |