智能秤分析
This commit is contained in:
@ -2,7 +2,7 @@ import os
|
||||
import shutil
|
||||
import random
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
def is_image_file(filename):
|
||||
"""检查文件是否为图像文件"""
|
||||
image_extensions = ('.jpg', '.jpeg', '.png', '.bmp', '.gif', '.tiff')
|
||||
@ -61,10 +61,12 @@ def control_train_number():
|
||||
pass
|
||||
|
||||
if __name__ == "__main__":
|
||||
# 设置目录路径
|
||||
TRAIN_DIR = "scatter_data/train"
|
||||
VAL_DIR = "scatter_data/val"
|
||||
# # 设置目录路径
|
||||
# TRAIN_DIR = "/home/lc/data_center/electornic/v1/train"
|
||||
# VAL_DIR = "/home/lc/data_center/electornic/v1/val"
|
||||
|
||||
with open('../configs/scatter_data.yml', 'r') as f:
|
||||
conf = yaml.load(f, Loader=yaml.FullLoader)
|
||||
print("开始分割数据集...")
|
||||
split_directory(TRAIN_DIR, VAL_DIR)
|
||||
split_directory(conf)
|
||||
print("数据集分割完成")
|
||||
|
@ -141,7 +141,7 @@ class ImageExtendProcessor:
|
||||
same_directory,
|
||||
dir_name)
|
||||
|
||||
def random_remove_image(self, subdir_path, max_count=200):
|
||||
def random_remove_image(self, subdir_path, max_count=1000):
|
||||
"""
|
||||
随机删除子目录中的图像文件,直到数量不超过max_count
|
||||
:param subdir_path: 子目录路径
|
||||
|
Reference in New Issue
Block a user