facebookarchive / caffe2

Caffe2 is a lightweight, modular, and scalable deep learning framework.
https://caffe2.ai
Apache License 2.0
8.42k stars 1.95k forks source link

AttributeError: Method ImageInput is not a registered operator #1156

Open renganxu opened 7 years ago

renganxu commented 7 years ago

I have compiled caffe2 with CUDA 9, CUDNN 7.0 and NCCL 2.0 on ubuntu 16.04 successfully. But it has runtime error in resnet50 example. The caffe2 version I used is commit 4580ec558380da8d16a789c607fe5686e4b17331. The run command is: python -m caffe2.python.examples.resnet50_trainer \ --train_data /cm/shared/scratch/rengan/database/caffe/ilsvrc12_train_lmdb/ \ --test_data /cm/shared/scratch/rengan/database/caffe/ilsvrc12_val_lmdb/ \ --gpus 0,1,2,3 \ --batch_size 256 \ --epoch_size 1280000 \ --num_epochs 1

And the detailed runtime error is: INFO:resnet50_trainer:Running on GPUs: [0, 1, 2, 3] INFO:resnet50_trainer:Using epoch size: 1280000 INFO:data_parallel_model:Parallelizing model for devices: [0, 1, 2, 3] INFO:data_parallel_model:Create input and model training operators INFO:data_parallel_model:Model for GPU : 0 Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main Ignoring @/caffe2/caffe2/contrib/nccl:nccl_ops as it is not a valid file. Ignoring @/caffe2/caffe2/contrib/gloo:gloo_ops as it is not a valid file. Ignoring @/caffe2/caffe2/contrib/gloo:gloo_ops_gpu as it is not a valid file. Ignoring @/caffe2/caffe2/distributed:file_store_handler_ops as it is not a valid file. Ignoring @/caffe2/caffe2/distributed:redis_store_handler_ops as it is not a valid file. "main", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/cm/shared/scratch/rengan/caffe2/build/caffe2/python/examples/resnet50_trainer.py", line 500, in main() File "/cm/shared/scratch/rengan/caffe2/build/caffe2/python/examples/resnet50_trainer.py", line 496, in main Train(args) File "/cm/shared/scratch/rengan/caffe2/build/caffe2/python/examples/resnet50_trainer.py", line 340, in Train cpu_device=args.use_cpu, File "/cm/shared/scratch/rengan/caffe2/build/caffe2/python/data_parallel_model.py", line 166, in Parallelize input_builder_fun(model_helper_obj) File "/cm/shared/scratch/rengan/caffe2/build/caffe2/python/examples/resnet50_trainer.py", line 318, in add_image_input dtype=args.dtype, File "/cm/shared/scratch/rengan/caffe2/build/caffe2/python/examples/resnet50_trainer.py", line 65, in AddImageInput mirror=1 File "/cm/shared/scratch/rengan/caffe2/build/caffe2/python/brew.py", line 100, in scope_wrapper return func(*args, new_kwargs) File "/cm/shared/scratch/rengan/caffe2/build/caffe2/python/helpers/tools.py", line 16, in image_input outputs = model.net.ImageInput(blob_in, blob_out, kwargs) File "/cm/shared/scratch/rengan/caffe2/build/caffe2/python/core.py", line 1975, in getattr ",".join(workspace.C.nearby_opnames(op_type)) + ']' AttributeError: Method ImageInput is not a registered operator. Did you mean: []

Does anyone has the same error and know how to fix it? Thanks.

Regards, Rengan

blacky-i commented 7 years ago

Via model.net imageinput operator creates with error (do not know why). I resolved this replacing model.net.ImageInput to brew.image_input . In short: use brew.

blacky-i commented 7 years ago

Oh, you use brew, sorry) I had this issue but replacing was working for me. Try to update caffe2.

nlaptev commented 6 years ago

Hello @hfutxrg you need to compile Caffe2 with OpenCV to fix this.