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

username: Mona_Jalal
cooked: <p>Could you please guide me how to fix this error?</p>
<pre><code class="lang-auto">$ python demo.py 
Traceback (most recent call last):
  File "demo.py", line 22, in &lt;module&gt;
    from bodymocap.body_bbox_detector import BodyPoseEstimator
  File "./frankmocap/bodymocap/body_bbox_detector.py", line 18, in &lt;module&gt;
    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 &lt;module&gt;
    from modules.conv import conv, conv_dw, conv_dw_no_bn
ModuleNotFoundError: No module named 'modules'
</code></pre>
<p>I wrote the demo.py file similar to <a href="https://github.com/facebookresearch/frankmocap/blob/master/demo/demo_frankmocap.py" class="inline-onebox" rel="noopener nofollow ugc">frankmocap/demo_frankmocap.py at master · facebookresearch/frankmocap · GitHub</a> 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.</p>

username: ptrblck
cooked: <p>These imports are failing in the posted repository and it seems that someone already answered in the <a href="https://github.com/facebookresearch/frankmocap/issues/97#issuecomment-822137964">double post</a>.</p>

username: Mona_Jalal
cooked: <p>So, I have detectors installed.</p>
<p>Here’s the piece of code:</p>
<pre><code class="lang-auto">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}")
</code></pre>
<p>and<br>
here’s the error:</p>
<pre><code class="lang-auto">
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
&lt;ipython-input-1-72d9ee5c2242&gt; in &lt;module&gt;
     11 from detectron2.utils.visualizer import Visualizer as PointRendVisualizer
     12 
---&gt; 13 from phosa.bodymocap import (
     14     get_bodymocap_predictor,
     15     process_mocap_predictions,

~/research/code/phosa/phosa/bodymocap.py in &lt;module&gt;
---&gt; 12 from bodymocap.body_bbox_detector import BodyPoseEstimator
     

~/research/code/phosa/external/frankmocap/bodymocap/body_bbox_detector.py in &lt;module&gt;
     16 pose2d_estimator_path = './detectors/body_pose_estimator'
     17 sys.path.append(pose2d_estimator_path)
---&gt; 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 &lt;module&gt;
      2 from torch import nn
      3 
----&gt; 4 from modules.conv import conv, conv_dw, conv_dw_no_bn
      5 
      6 

ModuleNotFoundError: No module named 'modules'
</code></pre>
<p>So I am not sure what’s going on exactly here.</p>