-
Notifications
You must be signed in to change notification settings - Fork 125
TypeError: 'Convolution2D' object has no attribute '__getitem__' #3
Comments
Hi @zjsjack, |
I cannot find out how to get the right pretrained-model and weights. Could you explain more on it or show me where to get the model and weights? Loading caffe weights... So I tried to convert the wights from VGG_ILSVRC_16_layers.caffemodel and then got the TypeError |
Hi @zjsjack , |
Now my configuration is: Namespace(es_host='localhost', es_index='im_data', es_port=9200, es_type='obj', input='tf-faster-rcnn/data/demo/', model_path='./coco_2014_train+coco_2014_valminusminival/vgg16_faster_rcnn_iter_1190000.ckpt', weight='./imagenet_weights/vgg16.weights') Any suggestions? |
As I checked, some variable scopes are changed in the new pretrained model so it will throws errors as you see. So you have tried with old pretrained model ( coco_2014_train+coco_2014_valminusminival/vgg16_faster_rcnn_iter_490000). Otherwise you have to adapt your code to new model. |
Also tried the 490000, the same error. |
How does ./coco_2014_train+coco_2014_valminusminival/ folder look like ? Does it contains all metadata files ? |
ubuntu@ip-172-31-18-140:~/workspace/visual_search/visual_search$ tree coco_2014_train+coco_2014_valminusminival/ |
This error means that variable bias with name (vgg16_default/cls_score/bias) is not found in the check point path. The model you downloaded is different with the model I used when I work on it. I can't access to my PC right now, so I can't share you the model file that I used. cat coco_2014_train+coco_2014_valminusminival/vgg16_faster_rcnn_iter_490000.ckpt.index | grep -a conv4 |
The output is not readable. Just copy&paste as below: ubuntu@ip-172-31-18-140:~/workspace/visual_search/visual_search$ cat coco_2014_train+coco_2014_valminusminival/vgg16_faster_rcnn_iter_490000.ckpt.index | grep -a conv4 |
sorry, I point to wrong file. cat coco_2014_train+coco_2014_valminusminival/vgg16_faster_rcnn_iter_490000.ckpt.meta | grep -a conv4 |
value0B$vgg_16/conv4/conv4_3/biases/Momentum* save_1/Assign_39Assignvgg_16/conv4/conv4_3/weightssave_1/RestoreV2_39* |
Unluckly, you have to fix all the variable scope names manually in (https://github.com/tuan3w/visual_search/blob/master/visual_search/lib/nets/vgg16.py) to fit names as above.
should change to:
Does anyone here can share the old pretrained file ? |
After manually change the source code, still got the Error as blew: Not sure if you have the old pretrained file to share? |
Hi @zjsjack, |
Hi, thanks for sharing the model. But one of the .tgz file can not be decompressed. gzip: stdin: invalid compressed data--format violated And with these partial data, I got the below new error msg. |
You can get it now. |
Hi, thanks for sharing the model.But I can not find cython_nms. |
Hi @xiesibo , $ cd visual_search/visual_search/lib/
$ make |
Hi @tuan3w , |
This error means that only extension for gpu cannot be built. So it still works fine with CPU. The author also claim that, see $ cd visual_search/visual_search/lib/
$ python -c 'from utils.cython_nms import nms, nms_new' If no exception throws, it's ok |
I convent the VGG16 model to pkl as instructed by https://github.com/mitmul/chainer-faster-rcnn/issues/15:
import pickle
from chainer.links.caffe import CaffeFunction
vgg16 = CaffeFunction('VGG_ILSVRC_16_layers.caffemodel')
pickle.dump(vgg16, open('VGG16.model', 'wb'))
Got TypeError when run python index.es.py.
2017-06-23 09:23:26.732486: I tensorflow/core/common_runtime/gpu/gpu_device.cc:940] Found device 0 with properties:
name: Tesla K80
major: 3 minor: 7 memoryClockRate (GHz) 0.8235
pciBusID 0000:00:1e.0
Total memory: 11.17GiB
Free memory: 11.11GiB
2017-06-23 09:23:26.732530: I tensorflow/core/common_runtime/gpu/gpu_device.cc:961] DMA: 0
2017-06-23 09:23:26.732539: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 0: Y
2017-06-23 09:23:26.732555: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1030] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tesla K80, pci bus id: 0000:00:1e.0)
Namespace(es_host='localhost', es_index='im_data', es_port=9200, es_type='obj', input='tf-faster-rcnn/data/demo/', model_path='./coco_2014_train+coco_2014_valminusminival/vgg16_faster_rcnn_iter_490000.ckpt.data-00000-of-00001', weight='./VGG16.model')
Loading caffe weights...
Done!
Traceback (most recent call last):
File "index_es.py", line 104, in
sess=sess)
File "/home/ubuntu/workspace/visual_search/visual_search/extractor.py", line 53, in init
tag='default', anchor_scales=anchors)
File "/home/ubuntu/workspace/visual_search/visual_search/lib/nets/vgg16.py", line 496, in create_architecture
rois, cls_prob, bbox_pred = self._vgg16_from_imagenet(sess, training)
File "/home/ubuntu/workspace/visual_search/visual_search/lib/nets/vgg16.py", line 303, in _vgg16_from_imagenet
net = self._conv_layer(sess, self._image, "conv1_1", False)
File "/home/ubuntu/workspace/visual_search/visual_search/lib/nets/vgg16.py", line 111, in _conv_layer
filt=self._get_conv_filter(sess, name, trainable=trainable)
File "/home/ubuntu/workspace/visual_search/visual_search/lib/nets/vgg16.py", line 64, in _get_conv_filter
w=self._caffe2tf_filter(name)
File "/home/ubuntu/workspace/visual_search/visual_search/lib/nets/vgg16.py", line 59, in _caffe2tf_filter
f=self._caffe_weights(name)
File "/home/ubuntu/workspace/visual_search/visual_search/lib/nets/vgg16.py", line 52, in _caffe_weights
return layer['weights']
TypeError: 'Convolution2D' object has no attribute 'getitem'
The text was updated successfully, but these errors were encountered: