共享目录识别支持(图像类)(Images)两种标识文件
This commit is contained in:
parent
bdb654da09
commit
401c4eae2f
@ -666,7 +666,7 @@ class YOLOSegmentationInference:
|
||||
推理结果列表
|
||||
"""
|
||||
results = []
|
||||
|
||||
print(f"正在处理共享目录: {input_dir} ")
|
||||
try:
|
||||
# 检查目录是否存在
|
||||
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)
|
||||
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'],
|
||||
folder_name='图像类',
|
||||
start_dir=config['dir'],
|
||||
@ -915,21 +915,28 @@ 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")
|
||||
target_path = "" # 识别图片目录
|
||||
flag_dir_path = "" # 标识目录
|
||||
if len(found_paths) > 0:
|
||||
flag_dir_path = "" # 标识目录
|
||||
if len(image_class_paths) > 0:
|
||||
# 处理目录
|
||||
flag_dir_path = found_paths[0]
|
||||
tmpConfig = get_conf(flag_dir_path, user_name, pwd)
|
||||
found_paths = scanner.find_folders_by_name(
|
||||
share_path=config['share'],
|
||||
folder_name='Images',
|
||||
start_dir=tmpConfig['dir'],
|
||||
max_depth=3
|
||||
)
|
||||
if len(found_paths) > 0:
|
||||
target_path = found_paths[0]
|
||||
# inference.process_image_directory_share_dir(
|
||||
# input_dir=target_path,
|
||||
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)
|
||||
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:
|
||||
all_images_paths.extend(images_paths)
|
||||
|
||||
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,
|
||||
# pwd=pwd,
|
||||
# output_dir=output_dir,
|
||||
@ -942,11 +949,25 @@ 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:
|
||||
print(f"错误: 输入 {zip_url} 不是有效的文件或目录")
|
||||
# 直接找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()
|
||||
else :
|
||||
print(f"错误: 输入 {zip_url} 不是有效的文件或目录")
|
||||
|
||||
return standardized_path(f"{target_path}_识别/{task_id}/{current_time}/{task_id}.zip"), "success"
|
||||
Loading…
x
Reference in New Issue
Block a user