Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在调用 seg_model._seg_out_img_with_segmap 时,seg_model 是 None #26

Open
Arthurzhangsheng opened this issue Nov 9, 2024 · 0 comments

Comments

@Arthurzhangsheng
Copy link

windows环境
首先手动修改了源代码里用命令行cp 复制的相关代码,改成了shutil.copy,解决了windows下cp命令不支持的情况,
然后把utils/commons/os_utils.py的所有调用命令行执行的linux指令,改成了如下python代码

import os
import shutil
import glob
from utils.commons.multiprocess_utils import multiprocess_run_tqdm

def link_file(from_file, to_file):
# 创建符号链接
os.symlink(from_file, to_file)

def move_file(from_file, to_file):
# 移动文件
shutil.move(from_file, to_file)

def copy_file(from_file, to_file):
# 复制文件
shutil.copy(from_file, to_file)

def remove_file(*fns):
# 删除文件或目录
for f in fns:
if os.path.isdir(f):
shutil.rmtree(f) # 删除目录
else:
os.remove(f) # 删除文件

def glob_job(d, f):
pattern = os.path.join(d, f)
return glob.glob(pattern)

def multiprocess_glob(pattern, num_workers=None):
split_pattern = pattern.split("/")
recursive_depth = 0 # number of recursive depth
for split in split_pattern:
if '*' in split:
recursive_depth += 1
if recursive_depth == 1:
return glob.glob(pattern)
else:
dirs = glob.glob('/'.join(split_pattern[:-1]))
ret = []
args = [(d, split_pattern[-1]) for d in dirs]
for (i, res) in multiprocess_run_tqdm(glob_job, args=args, desc=f"globing {pattern}", num_workers=num_workers):
ret += res
return ret

然后运行gradio页面,用初始默认的素材点击train
命令行在处理generating segment images in multi-processes时,全程报错

generating segment images in multi-processes...: 76%|███████████████████████▋ | 382/500 [00:24<00:05, 23.42it/s]Traceback (most recent call last):
File "Y:\code\MimicTalk\utils\commons\multiprocess_utils.py", line 19, in chunked_worker
res = map_func_(*arg)
File "Y:\code\MimicTalk\data_gen\utils\process_video\extract_segment_imgs.py", line 287, in segment_and_generate_for_image_job
segmap_name = generate_segment_imgs_job(img_name=img_name, segmap=segmap_mask, img=img)
File "Y:\code\MimicTalk\data_gen\utils\process_video\extract_segment_imgs.py", line 270, in generate_segment_imgs_job
out_img, mask = seg_model._seg_out_img_with_segmap(img, segmap, mode=mode)
AttributeError: 'NoneType' object has no attribute 'seg_out_img_with_segmap'
Traceback (most recent call last):
File "Y:\code\MimicTalk\utils\commons\multiprocess_utils.py", line 19, in chunked_worker
res = map_func
(*arg)
File "Y:\code\MimicTalk\data_gen\utils\process_video\extract_segment_imgs.py", line 287, in segment_and_generate_for_image_job
segmap_name = generate_segment_imgs_job(img_name=img_name, segmap=segmap_mask, img=img)
File "Y:\code\MimicTalk\data_gen\utils\process_video\extract_segment_imgs.py", line 270, in generate_segment_imgs_job
out_img, mask = seg_model._seg_out_img_with_segmap(img, segmap, mode=mode)
AttributeError: 'NoneType' object has no attribute 'seg_out_img_with_segmap'
Traceback (most recent call last):
File "Y:\code\MimicTalk\utils\commons\multiprocess_utils.py", line 19, in chunked_worker
res = map_func
(*arg)
File "Y:\code\MimicTalk\data_gen\utils\process_video\extract_segment_imgs.py", line 287, in segment_and_generate_for_image_job
segmap_name = generate_segment_imgs_job(img_name=img_name, segmap=segmap_mask, img=img)
File "Y:\code\MimicTalk\data_gen\utils\process_video\extract_segment_imgs.py", line 270, in generate_segment_imgs_job
out_img, mask = seg_model._seg_out_img_with_segmap(img, segmap, mode=mode)
AttributeError: 'NoneType' object has no attribute 'seg_out_img_with_segmap'
Traceback (most recent call last):
File "Y:\code\MimicTalk\utils\commons\multiprocess_utils.py", line 19, in chunked_worker
res = map_func
(*arg)
File "Y:\code\MimicTalk\data_gen\utils\process_video\extract_segment_imgs.py", line 287, in segment_and_generate_for_image_job
segmap_name = generate_segment_imgs_job(img_name=img_name, segmap=segmap_mask, img=img)
File "Y:\code\MimicTalk\data_gen\utils\process_video\extract_segment_imgs.py", line 270, in generate_segment_imgs_job
out_img, mask = seg_model._seg_out_img_with_segmap(img, segmap, mode=mode)
AttributeError: 'NoneType' object has no attribute 'seg_out_img_with_segmap'
Traceback (most recent call last):
File "Y:\code\MimicTalk\utils\commons\multiprocess_utils.py", line 19, in chunked_worker
res = map_func
(*arg)
File "Y:\code\MimicTalk\data_gen\utils\process_video\extract_segment_imgs.py", line 287, in segment_and_generate_for_image_job
segmap_name = generate_segment_imgs_job(img_name=img_name, segmap=segmap_mask, img=img)
File "Y:\code\MimicTalk\data_gen\utils\process_video\extract_segment_imgs.py", line 270, in generate_segment_imgs_job
out_img, mask = seg_model._seg_out_img_with_segmap(img, segmap, mode=mode)
AttributeError: 'NoneType' object has no attribute '_seg_out_img_with_segmap'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant