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

Multiproccessing in resize.py hangs run.py #21

Open
elaidlaw opened this issue Sep 16, 2020 · 1 comment
Open

Multiproccessing in resize.py hangs run.py #21

elaidlaw opened this issue Sep 16, 2020 · 1 comment

Comments

@elaidlaw
Copy link

When I try to start the UI with run.py, the script hangs when it tries to generate the color_levels. Through some investigation, I found that it was hanging in resize_frames(). I'm not sure exactly why the multiprocessing doesn't work, but changing the function to directly resize the images fixed the issue for me. Here's how I altered resize frames:

def resize_frames(src_dir, dst_dir, rig, first, last, threshold=None):
    """Resizes a frame to the appropriate pyramid level sizes. Files are saved in
    level_0/[camera], ..., level_9/[camera] in the destination directory.

    Args:
        src_dir (str): Path to the source directory.
        dst_dir (str): Path to the destination directory.
        rig (dict[str, _]): Rig descriptor object.
        first (str): Name of the first frame to render.
        last (str): Name of the last frame to render.
        threshold (int): Threshold to be used for binary thresholding. No thresholding
            is performed if None is passed in.
    """
    
    for frame in range(int(first), int(last) + 1):
        for camera in rig["cameras"]:
            verify_frame(src_dir, camera["id"], get_frame_name(frame))
            resize_camera(
                src_dir,
                dst_dir,
                camera["id"],
                camera["resolution"],
                get_frame_name(frame),
                threshold,
            )

I'm on Windows 10, using Docker with the WSL 2 configuration. I'm sure this function works on other setups, but in case anyone else sees this issue, this might help.

@yashpatel5400
Copy link

Interesting find! Given that it works when you directly call it, I would assume this has to do with the mp.set_start_method("spawn", force=True) call we do beforehand to work around opencv/opencv#5150. The best way to verify this is by replacing pool.apply_async( with pool.apply( and seeing what errors are produced (since the former silences errors).

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

2 participants