user24080474
user24080474

Reputation: 1

Python: ModuleNotFoundError while importing from git even though the file exists

I am trying to use GLIP from https://github.com/microsoft/GLIP and running into the problem.

I try to import GLIPDemo, but get the ModuleNotFoundError with the following Traceback:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
/tmp/ipykernel_2910032/3288011003.py in <module>
      8 pylab.rcParams['figure.figsize'] = 20, 12
      9 from maskrcnn_benchmark.config import cfg
---> 10 from maskrcnn_benchmark.engine.predictor_glip import GLIPDemo

/opt/conda/lib/python3.7/site-packages/maskrcnn_benchmark/engine/predictor_glip.py in <module>
      9 from torchvision import transforms as T
     10 import pdb
---> 11 from maskrcnn_benchmark.modeling.detector import build_detection_model
     12 from maskrcnn_benchmark.utils.checkpoint import DetectronCheckpointer
     13 from maskrcnn_benchmark.structures.image_list import to_image_list

/opt/conda/lib/python3.7/site-packages/maskrcnn_benchmark/modeling/detector/__init__.py in <module>
----> 1 from .generalized_rcnn import GeneralizedRCNN
      2 from .generalized_vl_rcnn import GeneralizedVLRCNN
      3 
      4 _DETECTION_META_ARCHITECTURES = {"GeneralizedRCNN": GeneralizedRCNN,
      5                                  "GeneralizedVLRCNN": GeneralizedVLRCNN

/opt/conda/lib/python3.7/site-packages/maskrcnn_benchmark/modeling/detector/generalized_rcnn.py in <module>
     10 
     11 from ..backbone import build_backbone
---> 12 from ..rpn import build_rpn
     13 from ..roi_heads import build_roi_heads
     14 

/opt/conda/lib/python3.7/site-packages/maskrcnn_benchmark/modeling/rpn/__init__.py in <module>
      6 from .atss import ATSSModule
      7 from .dyhead import DyHeadModule
----> 8 from .vldyhead import VLDyHeadModule
      9 
     10 _RPN_META_ARCHITECTURES = {"RPN": RPNModule,

/opt/conda/lib/python3.7/site-packages/maskrcnn_benchmark/modeling/rpn/vldyhead.py in <module>
     12 from maskrcnn_benchmark.layers import NaiveSyncBatchNorm2d, FrozenBatchNorm2d
     13 from maskrcnn_benchmark.modeling.backbone.fbnet import *
---> 14 from maskrcnn_benchmark.engine.inference import create_positive_map_label_to_token_from_positive_map
     15 from ..utils import cat, concat_box_prediction_layers, permute_and_flatten
     16 

/opt/conda/lib/python3.7/site-packages/maskrcnn_benchmark/engine/inference.py in <module>
     10 from collections import defaultdict
     11 
---> 12 from maskrcnn_benchmark.data.datasets.evaluation import evaluate, im_detect_bbox_aug
     13 from ..utils.comm import is_main_process
     14 from ..utils.comm import all_gather

/opt/conda/lib/python3.7/site-packages/maskrcnn_benchmark/data/datasets/evaluation/__init__.py in <module>
      1 from maskrcnn_benchmark.data import datasets
      2 
----> 3 from .coco import coco_evaluation
      4 from .voc import voc_evaluation
      5 from .vg import vg_evaluation

/opt/conda/lib/python3.7/site-packages/maskrcnn_benchmark/data/datasets/evaluation/coco/__init__.py in <module>
----> 1 from .coco_eval import do_coco_evaluation
      2 
      3 
      4 def coco_evaluation(
      5     dataset,

/opt/conda/lib/python3.7/site-packages/maskrcnn_benchmark/data/datasets/evaluation/coco/coco_eval.py in <module>
      9 from tqdm import tqdm
     10 
---> 11 from maskrcnn_benchmark.modeling.roi_heads.mask_head.inference import Masker
     12 from maskrcnn_benchmark.structures.bounding_box import BoxList
     13 from maskrcnn_benchmark.structures.boxlist_ops import boxlist_iou

/opt/conda/lib/python3.7/site-packages/maskrcnn_benchmark/modeling/roi_heads/__init__.py in <module>
      4 from .box_head.box_head import build_roi_box_head
      5 from .mask_head.mask_head import build_roi_mask_head
----> 6 from .keypoint_head.keypoint_head import build_roi_keypoint_head
      7 
      8 

ModuleNotFoundError: No module named 'maskrcnn_benchmark.modeling.roi_heads.keypoint_head'

But when I am looking into GLIP git, the file keypoint_head under maskrcnn_benchmark.modeling.roi_heads.keypoint_head exists.

May be it is important, I use Docker Image as I run the code on the university server and was placing the git-link in the requirements.txt file. The Python version I use is 3.7.10.

I tried so far to restart kernel, but it didn't help.

What can I do to resolve the problem?

Upvotes: 0

Views: 56

Answers (0)

Related Questions