Skip to content

Process SpawnPoolWorker Problem - Solved #152

@Yarroudh

Description

@Yarroudh

Hello everyone,

I'm trying to use MVSNet on COLMAP results. I faced some issues when I tried to run python colmap2mvsnet.py --dense_folder <PATH>. I wanted to share with you how I solved this problem in case someone is still struggling with it.

This error typically occurs when the calc_score function is defined in the same module as the code that is being executed by a multiprocessing pool. This is how I solved it:

  • I deleted the calc_score() function from colmap2mvsnet.py file and I created a new file calc_score.py:
import numpy

def calc_score(inputs):
    i, j, images, extrinsic, points3d, args = inputs
    id_i = images[i+1].point3D_ids
    id_j = images[j+1].point3D_ids
    id_intersect = [it for it in id_i if it in id_j]
    cam_center_i = -np.matmul(extrinsic[i+1][:3, :3].transpose(), extrinsic[i+1][:3, 3:4])[:, 0]
    cam_center_j = -np.matmul(extrinsic[j+1][:3, :3].transpose(), extrinsic[j+1][:3, 3:4])[:, 0]
    score = 0
    for pid in id_intersect:
        if pid == -1:
            continue
        p = points3d[pid].xyz
        theta = (180 / np.pi) * np.arccos(np.dot(cam_center_i - p, cam_center_j - p) / np.linalg.norm(cam_center_i - p) / np.linalg.norm(cam_center_j - p))
        score += np.exp(-(theta - args.theta0) * (theta - args.theta0) / (2 * (args.sigma1 if theta <= args.theta0 else args.sigma2) ** 2))
    return i, j, score
  • Then, I imported the function from that module: from calc_score import calc_score

  • As I added new arguments, I changed result = p.map(calc_score, queue) to:

result = p.map(calc_score, [(i, j, images, extrinsic, points3d, args) for i, j in queue])

This should solve the problem and launch the multiprocessing without errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions