This commit is contained in:
autumn 2024-10-09 12:55:55 +08:00
parent 18a3072a9a
commit 710ef701e1
64 changed files with 47 additions and 4 deletions

View File

@ -1,3 +1,5 @@
import random
import cv2
import numpy as np
import os
@ -46,8 +48,8 @@ def grow_node(root, width, height):
elif can_grow_down:
return grow_down(root, width, height)
else:
root.width=root.width+width
root.height=root.height+height
root.width=root.width+width//2
root.height=root.height+height//2
return grow_node(root, width, height)
@ -96,15 +98,21 @@ def stitch_images_bin_packing(images):
def load_images_from_folder(folder,max_height=384,max_width=284):
def load_images_from_folder(folder,max_height=512,max_width=512):
images = []
for filename in os.listdir(folder):
img = cv2.imread(os.path.join(folder, filename))
if img is not None:
if max_height is not None and max_width is not None:
if img.shape[0] > max_height or img.shape[1] > max_width:
img = cv2.resize(img, (min(img.shape[1], max_width), min(img.shape[0], max_height)))
scw=img.shape[1]/max_width
sch=img.shape[0]/max_height
mac=max(scw,sch)
img = cv2.resize(img, (int(img.shape[1]//mac),int(img.shape[0]//mac)))
# img = cv2.resize(img, (min(img.shape[1], max_width), min(img.shape[0], max_height)))
# img = cv2.resize(img, (min(img.shape[1], max_width), min(img.shape[0], max_height)))
images.append(img)
random.shuffle(images)
return images

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 444 KiB

35
r_name.py Normal file
View File

@ -0,0 +1,35 @@
import os
import glob
import random
def rename_files_in_folder(folder_path):
files = glob.glob(os.path.join(folder_path, '*'))
files = [os.path.basename(f) for f in files]
files.sort()
random.shuffle(files)
for index, file_name in enumerate(files):
ext = os.path.splitext(file_name)[1]
new_name = f"{index + 1}_{ext}"
old_file_path = os.path.join(folder_path, file_name)
new_file_path = os.path.join(folder_path, new_name)
os.rename(old_file_path, new_file_path)
print(f'Renamed: {old_file_path} to {new_file_path}')
folder_path = 'zh_cn'
rename_files_in_folder(folder_path)

BIN
zh_cn/10_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 140 KiB

After

Width:  |  Height:  |  Size: 140 KiB

BIN
zh_cn/12_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
zh_cn/13_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
zh_cn/14_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
zh_cn/15_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
zh_cn/16_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
zh_cn/17_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
zh_cn/18_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

BIN
zh_cn/19_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
zh_cn/1_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
zh_cn/20_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
zh_cn/21_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
zh_cn/22_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

BIN
zh_cn/23_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
zh_cn/24_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
zh_cn/25_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
zh_cn/26_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
zh_cn/27_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
zh_cn/28_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
zh_cn/29_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
zh_cn/2_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
zh_cn/30_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
zh_cn/31_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 79 KiB

BIN
zh_cn/33_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

BIN
zh_cn/34_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

View File

Before

Width:  |  Height:  |  Size: 147 KiB

After

Width:  |  Height:  |  Size: 147 KiB

BIN
zh_cn/37_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
zh_cn/38_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
zh_cn/39_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 200 KiB

After

Width:  |  Height:  |  Size: 200 KiB

BIN
zh_cn/40_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
zh_cn/41_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
zh_cn/42_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
zh_cn/43_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
zh_cn/44_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
zh_cn/45_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB

BIN
zh_cn/47_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
zh_cn/48_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
zh_cn/49_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 489 KiB

After

Width:  |  Height:  |  Size: 489 KiB

BIN
zh_cn/50_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
zh_cn/51_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
zh_cn/52_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
zh_cn/53_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
zh_cn/54_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
zh_cn/55_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

BIN
zh_cn/56_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
zh_cn/57_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
zh_cn/58_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
zh_cn/59_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
zh_cn/5_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
zh_cn/6_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
zh_cn/7_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
zh_cn/8_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
zh_cn/9_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB