facebookresearch / Detectron

FAIR's research platform for object detection research, implementing popular algorithms like Mask R-CNN and RetinaNet.
Apache License 2.0
26.21k stars 5.45k forks source link

convert_pkl_to_pb.py import error: ModuleNotFoundError: No module named 'caffe2.caffe2' #969

Open erickim555 opened 4 years ago

erickim555 commented 4 years ago

A recent Detectron commit added an import statement that throws an Exception on my system when using tools/convert_pkl_to_pb.py:

$ cd Detectron
$ python3.6 tools/convert_pkl_to_pb.py -h
Traceback (most recent call last):
  File "tools/convert_pkl_to_pb.py", line 44, in <module>
    from caffe2.caffe2.fb.predictor import predictor_exporter, predictor_py_utils
ModuleNotFoundError: No module named 'caffe2.caffe2'

Commit: https://github.com/facebookresearch/Detectron/commit/a6a835f5b8208c45d0dce217ce9bbda915f44df7#diff-077e2ae71af52724d94c3522525d2e7fR44

Specifically, this is the problematic import: from caffe2.caffe2.fb.predictor import predictor_exporter, predictor_py_utils

I am using this pytorch github commit: c3c0dcf6e35efdb843587a03522c37a7d1184539 I verified that, even on the latest pytorch commit (756f279d95d14729e52ccbc4a8d4167725dcaac3), there is no python package caffe2.caffe2.fb.predictor.

One simple workaround fix is to replace the problematic import with the following: from caffe2.python.predictor import predictor_exporter, predictor_py_utils

I'm unsure if caffe2.caffe2.fb.predictor contains special functionality required for the logfiledb stuff.

Expected results

What did you expect to see?

I expected convert_pkl_to_pb.py to not throw an ImportError

Actual results

What did you observe instead?

I saw an ImportError.

Detailed steps to reproduce

Clone + install Detectron (and pytorch/caffe2), using the above git hashes. Then, run the following commands:

cd Detectron/
python3.6 tools/convert_pkl_to_pb.py -h

System information

This issue is not related to CUDA/GPU.