From modules.conv import conv, conv_dw, conv_dw_no_bn ModuleNotFoundError: No module named 'modules'

Could you please guide me how to fix this error?

$ python demo.py 
Traceback (most recent call last):
  File "demo.py", line 22, in <module>
    from bodymocap.body_bbox_detector import BodyPoseEstimator
  File "./frankmocap/bodymocap/body_bbox_detector.py", line 18, in <module>
    from detectors.body_pose_estimator.pose2d_models.with_mobilenet import PoseEstimationWithMobileNet
  File "./frankmocap/detectors/body_pose_estimator/pose2d_models/with_mobilenet.py", line 4, in <module>
    from modules.conv import conv, conv_dw, conv_dw_no_bn
ModuleNotFoundError: No module named 'modules'

I wrote the demo.py file similar to frankmocap/demo_frankmocap.py at master · facebookresearch/frankmocap · GitHub as you see in line 23 and 24 I used the same imports while I get error and running demo_frankmocap.py doesn’t cause any error.

These imports are failing in the posted repository and it seems that someone already answered in the double post.

So, I have detectors installed.

Here’s the piece of code:

import cv2
import matplotlib.pyplot as plt
import numpy as np
import tqdm
import torch
from PIL import Image

import neural_renderer as nr
from detectron2.data import MetadataCatalog
from detectron2.structures import Boxes, BitMasks
from detectron2.utils.visualizer import Visualizer as PointRendVisualizer

from phosa.bodymocap import (
    get_bodymocap_predictor,
    process_mocap_predictions,
    visualize_orthographic,
)
from phosa.global_opt import optimize_human_object, visualize_human_object
from phosa.pointrend import get_pointrend_predictor
from phosa.pose_optimization import find_optimal_poses
from phosa.utils import bbox_xy_to_wh, center_vertices

prop = torch.cuda.get_device_properties(0)
print(f"GPU: {prop.name}")
print(f"VRAM: {prop.total_memory / 1e9:.1f}GB")
print(f"CC: {prop.major}.{prop.minor}")

and
here’s the error:


---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-72d9ee5c2242> in <module>
     11 from detectron2.utils.visualizer import Visualizer as PointRendVisualizer
     12 
---> 13 from phosa.bodymocap import (
     14     get_bodymocap_predictor,
     15     process_mocap_predictions,

~/research/code/phosa/phosa/bodymocap.py in <module>
---> 12 from bodymocap.body_bbox_detector import BodyPoseEstimator
     

~/research/code/phosa/external/frankmocap/bodymocap/body_bbox_detector.py in <module>
     16 pose2d_estimator_path = './detectors/body_pose_estimator'
     17 sys.path.append(pose2d_estimator_path)
---> 18 from detectors.body_pose_estimator.pose2d_models.with_mobilenet import PoseEstimationWithMobileNet
     19 from detectors.body_pose_estimator.modules.load_state import load_state
     20 from detectors.body_pose_estimator.val import normalize, pad_width

~/research/code/phosa/external/frankmocap/detectors/body_pose_estimator/pose2d_models/with_mobilenet.py in <module>
      2 from torch import nn
      3 
----> 4 from modules.conv import conv, conv_dw, conv_dw_no_bn
      5 
      6 

ModuleNotFoundError: No module named 'modules'

So I am not sure what’s going on exactly here.