共享目录识别支持(图像类)(Images)两种标识文件
This commit is contained in:
parent
bdb654da09
commit
401c4eae2f
@ -666,7 +666,7 @@ class YOLOSegmentationInference:
|
|||||||
推理结果列表
|
推理结果列表
|
||||||
"""
|
"""
|
||||||
results = []
|
results = []
|
||||||
|
print(f"正在处理共享目录: {input_dir} ")
|
||||||
try:
|
try:
|
||||||
# 检查目录是否存在
|
# 检查目录是否存在
|
||||||
config = get_conf(zip_url=input_dir, user_name=user_name, pwd=pwd)
|
config = get_conf(zip_url=input_dir, user_name=user_name, pwd=pwd)
|
||||||
@ -906,7 +906,7 @@ def predict_images_share_dir(task_id, pt_name, zip_url, user_name, pwd, output_d
|
|||||||
# 查找指定文件夹 图像类
|
# 查找指定文件夹 图像类
|
||||||
config = get_conf(zip_url, user_name, pwd)
|
config = get_conf(zip_url, user_name, pwd)
|
||||||
scanner = get_scanner(zip_url, user_name, pwd)
|
scanner = get_scanner(zip_url, user_name, pwd)
|
||||||
found_paths = scanner.find_folders_by_name(
|
image_class_paths = scanner.find_folders_by_name(
|
||||||
share_path=config['share'],
|
share_path=config['share'],
|
||||||
folder_name='图像类',
|
folder_name='图像类',
|
||||||
start_dir=config['dir'],
|
start_dir=config['dir'],
|
||||||
@ -916,20 +916,27 @@ def predict_images_share_dir(task_id, pt_name, zip_url, user_name, pwd, output_d
|
|||||||
current_time = datetime.now().strftime("%Y%m%d%H%M%S")
|
current_time = datetime.now().strftime("%Y%m%d%H%M%S")
|
||||||
target_path = "" # 识别图片目录
|
target_path = "" # 识别图片目录
|
||||||
flag_dir_path = "" # 标识目录
|
flag_dir_path = "" # 标识目录
|
||||||
if len(found_paths) > 0:
|
if len(image_class_paths) > 0:
|
||||||
# 处理目录
|
# 处理目录
|
||||||
flag_dir_path = found_paths[0]
|
all_images_paths = []
|
||||||
|
for image_class_path in image_class_paths :
|
||||||
|
flag_dir_path = image_class_path
|
||||||
tmpConfig = get_conf(flag_dir_path, user_name, pwd)
|
tmpConfig = get_conf(flag_dir_path, user_name, pwd)
|
||||||
found_paths = scanner.find_folders_by_name(
|
images_paths = scanner.find_folders_by_name(
|
||||||
share_path=config['share'],
|
share_path=config['share'],
|
||||||
folder_name='Images',
|
folder_name='Images',
|
||||||
start_dir=tmpConfig['dir'],
|
start_dir=tmpConfig['dir'],
|
||||||
max_depth=3
|
max_depth=3
|
||||||
)
|
)
|
||||||
if len(found_paths) > 0:
|
if len(images_paths) > 0:
|
||||||
target_path = found_paths[0]
|
all_images_paths.extend(images_paths)
|
||||||
# inference.process_image_directory_share_dir(
|
|
||||||
# input_dir=target_path,
|
if len(all_images_paths) > 0 :
|
||||||
|
target_path = all_images_paths[0]
|
||||||
|
# inference.process_image_directory_share_dir_circle(
|
||||||
|
# task_id=task_id,
|
||||||
|
# current_time=current_time,
|
||||||
|
# input_dir_list=all_images_paths,
|
||||||
# user_name=user_name,
|
# user_name=user_name,
|
||||||
# pwd=pwd,
|
# pwd=pwd,
|
||||||
# output_dir=output_dir,
|
# output_dir=output_dir,
|
||||||
@ -942,8 +949,22 @@ def predict_images_share_dir(task_id, pt_name, zip_url, user_name, pwd, output_d
|
|||||||
# )
|
# )
|
||||||
|
|
||||||
# 创建并启动线程
|
# 创建并启动线程
|
||||||
thread1 = threading.Thread(target=inference.process_image_directory_share_dir_circle, args=(task_id,current_time,found_paths,user_name,pwd,output_dir,conf_threshold,iou_threshold,save_mask,save_label,show,result_save))
|
thread1 = threading.Thread(target=inference.process_image_directory_share_dir_circle, args=(task_id,current_time,all_images_paths,user_name,pwd,output_dir,conf_threshold,iou_threshold,save_mask,save_label,show,result_save))
|
||||||
|
# 启动线程
|
||||||
|
thread1.start()
|
||||||
|
else:
|
||||||
|
# 直接找Images目录
|
||||||
|
tmpConfig = get_conf(zip_url, user_name, pwd)
|
||||||
|
images_paths = scanner.find_folders_by_name(
|
||||||
|
share_path=config['share'],
|
||||||
|
folder_name='Images',
|
||||||
|
start_dir=tmpConfig['dir'],
|
||||||
|
max_depth=3
|
||||||
|
)
|
||||||
|
if len(images_paths) > 0:
|
||||||
|
target_path = images_paths[0]
|
||||||
|
# 创建并启动线程
|
||||||
|
thread1 = threading.Thread(target=inference.process_image_directory_share_dir_circle, args=(task_id,current_time,images_paths,user_name,pwd,output_dir,conf_threshold,iou_threshold,save_mask,save_label,show,result_save))
|
||||||
# 启动线程
|
# 启动线程
|
||||||
thread1.start()
|
thread1.start()
|
||||||
else :
|
else :
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user