caffe icon indicating copy to clipboard operation
caffe copied to clipboard

AttributeError: module 'caffe' has no attribute 'Net'

Open poornimajd opened this issue 4 years ago • 10 comments

Even though i followed the official documentation for caffe installation i still get this error ,Can anyone please help me out with this?I am stuck with this issue since long

poornimajd avatar Jan 25 '20 12:01 poornimajd

Hello, Have you resolved this problem?It's so strange.

gmt710 avatar Jul 21 '20 10:07 gmt710

I am also getting same issue.I couldnt fine Net module in caffe github code. AttributeError: module 'caffe' has no attribute 'Net'

Shiven004 avatar Dec 02 '20 03:12 Shiven004

@Shiven004 ,The path must be given correct.

gmt710 avatar Dec 02 '20 03:12 gmt710

@gmt710 Is caffe.Net is Net.py script?

Shiven004 avatar Dec 02 '20 03:12 Shiven004

The root directory of the Caffe you compiled.

gmt710 avatar Dec 02 '20 03:12 gmt710

@gmt710 - I am try to invoke the python script py_demo.py from https://github.com/gcucurull/CAM-Python repo in my Collab notebook.I have copied everything including caffe (Caffe github code- https://github.com/BVLC/caffe) on google drive but in the function , there is a piece of code which invokes :

#load CAM model and extract features
net = caffe.Net(net_model, net_weights, caffe.TEST)

But i couldn't fine the Net.py or Net() function in caffe module.

Collab Nb- https://colab.research.google.com/drive/1t_5gXbp-JfnFbo-iumjyylTO-tRZYRZw?usp=sharing Google drive code link- https://drive.google.com/drive/folders/1risZuudq1A1tAIK_kEG0vCLsZ2igHwH-?usp=sharing

Can you guide on this please? I dont think i need to compile in python.

Shiven004 avatar Dec 02 '20 03:12 Shiven004

@gmt710 I fixed the issue using !apt install -y caffe-cuda in colab.But now i am getting type error-

 net.blobs['data'].reshape(*np.asarray([1,3,crop_size,crop_size])) # run only one image
TypeError: No registered converter was able to produce a C++ rvalue of type int from this Python object of type numpy.int64

Shiven004 avatar Dec 02 '20 03:12 Shiven004

@Shiven004 Hi , Br, did you slove this problems? I mit the same problems

Manchesterunion avatar Oct 18 '21 13:10 Manchesterunion

Hi , did you slove this problems? I mit the same problems

dafeixia123456 avatar Mar 14 '23 01:03 dafeixia123456

not sure i havent worked on it for long now

Shiven004 avatar May 09 '23 23:05 Shiven004