diff --git a/auto_pack_img.py b/auto_pack_img.py index 768ff4e..ad74c28 100644 --- a/auto_pack_img.py +++ b/auto_pack_img.py @@ -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 diff --git a/pullrequests/2.png b/pullrequests/2.png deleted file mode 100644 index 4a2a83c..0000000 Binary files a/pullrequests/2.png and /dev/null differ diff --git a/pullrequests/3.png b/pullrequests/3.png deleted file mode 100644 index ad09898..0000000 Binary files a/pullrequests/3.png and /dev/null differ diff --git a/pullrequests/paper-build-tools.png b/pullrequests/paper-build-tools.png deleted file mode 100644 index 5f2b1aa..0000000 Binary files a/pullrequests/paper-build-tools.png and /dev/null differ diff --git a/r_name.py b/r_name.py new file mode 100644 index 0000000..68d0640 --- /dev/null +++ b/r_name.py @@ -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) diff --git a/zh_cn/10_.png b/zh_cn/10_.png new file mode 100644 index 0000000..0a87ce6 Binary files /dev/null and b/zh_cn/10_.png differ diff --git a/zh_cn/1.png b/zh_cn/11_.png similarity index 100% rename from zh_cn/1.png rename to zh_cn/11_.png diff --git a/zh_cn/12_.png b/zh_cn/12_.png new file mode 100644 index 0000000..f1ad9fd Binary files /dev/null and b/zh_cn/12_.png differ diff --git a/zh_cn/13_.png b/zh_cn/13_.png new file mode 100644 index 0000000..cf6a984 Binary files /dev/null and b/zh_cn/13_.png differ diff --git a/zh_cn/14_.png b/zh_cn/14_.png new file mode 100644 index 0000000..1b37469 Binary files /dev/null and b/zh_cn/14_.png differ diff --git a/zh_cn/15_.png b/zh_cn/15_.png new file mode 100644 index 0000000..8763410 Binary files /dev/null and b/zh_cn/15_.png differ diff --git a/zh_cn/16_.png b/zh_cn/16_.png new file mode 100644 index 0000000..48ad0ce Binary files /dev/null and b/zh_cn/16_.png differ diff --git a/zh_cn/17_.png b/zh_cn/17_.png new file mode 100644 index 0000000..c44c085 Binary files /dev/null and b/zh_cn/17_.png differ diff --git a/zh_cn/18_.png b/zh_cn/18_.png new file mode 100644 index 0000000..ba75481 Binary files /dev/null and b/zh_cn/18_.png differ diff --git a/zh_cn/19_.png b/zh_cn/19_.png new file mode 100644 index 0000000..cb4dce2 Binary files /dev/null and b/zh_cn/19_.png differ diff --git a/zh_cn/1_.png b/zh_cn/1_.png new file mode 100644 index 0000000..4cf78a3 Binary files /dev/null and b/zh_cn/1_.png differ diff --git a/zh_cn/20_.png b/zh_cn/20_.png new file mode 100644 index 0000000..49ffa14 Binary files /dev/null and b/zh_cn/20_.png differ diff --git a/zh_cn/21_.png b/zh_cn/21_.png new file mode 100644 index 0000000..efd9d9f Binary files /dev/null and b/zh_cn/21_.png differ diff --git a/zh_cn/22_.png b/zh_cn/22_.png new file mode 100644 index 0000000..691ea40 Binary files /dev/null and b/zh_cn/22_.png differ diff --git a/zh_cn/23_.png b/zh_cn/23_.png new file mode 100644 index 0000000..d61f6a2 Binary files /dev/null and b/zh_cn/23_.png differ diff --git a/zh_cn/24_.png b/zh_cn/24_.png new file mode 100644 index 0000000..7df7363 Binary files /dev/null and b/zh_cn/24_.png differ diff --git a/zh_cn/25_.png b/zh_cn/25_.png new file mode 100644 index 0000000..23344cd Binary files /dev/null and b/zh_cn/25_.png differ diff --git a/zh_cn/26_.png b/zh_cn/26_.png new file mode 100644 index 0000000..3bea7aa Binary files /dev/null and b/zh_cn/26_.png differ diff --git a/zh_cn/27_.png b/zh_cn/27_.png new file mode 100644 index 0000000..a195a3a Binary files /dev/null and b/zh_cn/27_.png differ diff --git a/zh_cn/28_.png b/zh_cn/28_.png new file mode 100644 index 0000000..7bd9ed2 Binary files /dev/null and b/zh_cn/28_.png differ diff --git a/zh_cn/29_.png b/zh_cn/29_.png new file mode 100644 index 0000000..a7811cd Binary files /dev/null and b/zh_cn/29_.png differ diff --git a/zh_cn/2_.png b/zh_cn/2_.png new file mode 100644 index 0000000..994bb0d Binary files /dev/null and b/zh_cn/2_.png differ diff --git a/zh_cn/30_.png b/zh_cn/30_.png new file mode 100644 index 0000000..30ac382 Binary files /dev/null and b/zh_cn/30_.png differ diff --git a/zh_cn/31_.png b/zh_cn/31_.png new file mode 100644 index 0000000..b74643f Binary files /dev/null and b/zh_cn/31_.png differ diff --git a/zh_cn/4.png b/zh_cn/32_.png similarity index 100% rename from zh_cn/4.png rename to zh_cn/32_.png diff --git a/zh_cn/33_.png b/zh_cn/33_.png new file mode 100644 index 0000000..7665f65 Binary files /dev/null and b/zh_cn/33_.png differ diff --git a/zh_cn/34_.png b/zh_cn/34_.png new file mode 100644 index 0000000..da60589 Binary files /dev/null and b/zh_cn/34_.png differ diff --git a/zh_cn/5.png b/zh_cn/35_.png similarity index 100% rename from zh_cn/5.png rename to zh_cn/35_.png diff --git a/zh_cn/2.png b/zh_cn/36_.png similarity index 100% rename from zh_cn/2.png rename to zh_cn/36_.png diff --git a/zh_cn/37_.png b/zh_cn/37_.png new file mode 100644 index 0000000..58d9761 Binary files /dev/null and b/zh_cn/37_.png differ diff --git a/zh_cn/38_.png b/zh_cn/38_.png new file mode 100644 index 0000000..0de7bb7 Binary files /dev/null and b/zh_cn/38_.png differ diff --git a/zh_cn/39_.png b/zh_cn/39_.png new file mode 100644 index 0000000..d25dcf0 Binary files /dev/null and b/zh_cn/39_.png differ diff --git a/zh_cn/6.png b/zh_cn/3_.png similarity index 100% rename from zh_cn/6.png rename to zh_cn/3_.png diff --git a/zh_cn/40_.png b/zh_cn/40_.png new file mode 100644 index 0000000..f7004c9 Binary files /dev/null and b/zh_cn/40_.png differ diff --git a/zh_cn/41_.png b/zh_cn/41_.png new file mode 100644 index 0000000..2bd55de Binary files /dev/null and b/zh_cn/41_.png differ diff --git a/zh_cn/42_.png b/zh_cn/42_.png new file mode 100644 index 0000000..34a70bd Binary files /dev/null and b/zh_cn/42_.png differ diff --git a/zh_cn/43_.png b/zh_cn/43_.png new file mode 100644 index 0000000..88b5a5c Binary files /dev/null and b/zh_cn/43_.png differ diff --git a/zh_cn/44_.png b/zh_cn/44_.png new file mode 100644 index 0000000..d309678 Binary files /dev/null and b/zh_cn/44_.png differ diff --git a/zh_cn/45_.png b/zh_cn/45_.png new file mode 100644 index 0000000..f2b750c Binary files /dev/null and b/zh_cn/45_.png differ diff --git a/zh_cn/7.png b/zh_cn/46_.png similarity index 100% rename from zh_cn/7.png rename to zh_cn/46_.png diff --git a/zh_cn/47_.png b/zh_cn/47_.png new file mode 100644 index 0000000..a9dfe24 Binary files /dev/null and b/zh_cn/47_.png differ diff --git a/zh_cn/48_.png b/zh_cn/48_.png new file mode 100644 index 0000000..77be378 Binary files /dev/null and b/zh_cn/48_.png differ diff --git a/zh_cn/49_.png b/zh_cn/49_.png new file mode 100644 index 0000000..8572879 Binary files /dev/null and b/zh_cn/49_.png differ diff --git a/zh_cn/3.png b/zh_cn/4_.png similarity index 100% rename from zh_cn/3.png rename to zh_cn/4_.png diff --git a/zh_cn/50_.png b/zh_cn/50_.png new file mode 100644 index 0000000..c88e888 Binary files /dev/null and b/zh_cn/50_.png differ diff --git a/zh_cn/51_.png b/zh_cn/51_.png new file mode 100644 index 0000000..ae97a1d Binary files /dev/null and b/zh_cn/51_.png differ diff --git a/zh_cn/52_.png b/zh_cn/52_.png new file mode 100644 index 0000000..63d7c81 Binary files /dev/null and b/zh_cn/52_.png differ diff --git a/zh_cn/53_.png b/zh_cn/53_.png new file mode 100644 index 0000000..1b44892 Binary files /dev/null and b/zh_cn/53_.png differ diff --git a/zh_cn/54_.png b/zh_cn/54_.png new file mode 100644 index 0000000..28814c9 Binary files /dev/null and b/zh_cn/54_.png differ diff --git a/zh_cn/55_.png b/zh_cn/55_.png new file mode 100644 index 0000000..152aa93 Binary files /dev/null and b/zh_cn/55_.png differ diff --git a/zh_cn/56_.png b/zh_cn/56_.png new file mode 100644 index 0000000..b8dea21 Binary files /dev/null and b/zh_cn/56_.png differ diff --git a/zh_cn/57_.png b/zh_cn/57_.png new file mode 100644 index 0000000..c5573c6 Binary files /dev/null and b/zh_cn/57_.png differ diff --git a/zh_cn/58_.png b/zh_cn/58_.png new file mode 100644 index 0000000..7759ea0 Binary files /dev/null and b/zh_cn/58_.png differ diff --git a/zh_cn/59_.png b/zh_cn/59_.png new file mode 100644 index 0000000..18515bf Binary files /dev/null and b/zh_cn/59_.png differ diff --git a/zh_cn/5_.png b/zh_cn/5_.png new file mode 100644 index 0000000..a14cee5 Binary files /dev/null and b/zh_cn/5_.png differ diff --git a/zh_cn/6_.png b/zh_cn/6_.png new file mode 100644 index 0000000..5d0e76b Binary files /dev/null and b/zh_cn/6_.png differ diff --git a/zh_cn/7_.png b/zh_cn/7_.png new file mode 100644 index 0000000..e46a13c Binary files /dev/null and b/zh_cn/7_.png differ diff --git a/zh_cn/8_.png b/zh_cn/8_.png new file mode 100644 index 0000000..7f27aff Binary files /dev/null and b/zh_cn/8_.png differ diff --git a/zh_cn/9_.png b/zh_cn/9_.png new file mode 100644 index 0000000..207d937 Binary files /dev/null and b/zh_cn/9_.png differ