yeezhu / SPN.pytorch

PyTorch implementation of "Soft Proposal Networks for Weakly Supervised Object Localization", ICCV 2017.
http://yzhu.work/spn.html
MIT License
211 stars 37 forks source link

SP_GoogleNet_ImageNet.pt model error? #16

Open choasup opened 6 years ago

choasup commented 6 years ago
model_path = os.path.join(DATA_ROOT, 'SP_GoogleNet_ImageNet.pt')
model_dict = utils.load_model_imagenet(model_path)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-22-3ddac1dff075> in <module>()
      1 model_path = os.path.join(DATA_ROOT, 'SP_GoogleNet_ImageNet.pt')
----> 2 model_dict = utils.load_model_imagenet(model_path)

~/choas/method/SPN.pytorch/demo/experiment/util.py in load_model_imagenet(filename, scale)
    223 
    224 def load_model_imagenet(filename, scale=224):
--> 225     model = SP_GoogLeNet(state_dict=filename).cuda()
    226     model.inference()
    227     return {scale: model}

~/choas/method/SPN.pytorch/demo/evaluation/SP_GoogLeNet.py in __init__(self, state_dict)
     34         super(SP_GoogLeNet, self).__init__()
     35 
---> 36         state_dict = load_lua(state_dict)
     37         pretrained_model = state_dict[0]
     38         pretrained_model.evaluate()

~/anaconda/envs/py3.5/lib/python3.5/site-packages/torch/utils/serialization/read_lua_file.py in load_lua(filename, **kwargs)
    597     with open(filename, 'rb') as f:
    598         reader = T7Reader(f, **kwargs)
--> 599         return reader.read()

~/anaconda/envs/py3.5/lib/python3.5/site-packages/torch/utils/serialization/read_lua_file.py in read(self)
    584             return self.read_object()
    585         elif typeidx == TYPE_TABLE:
--> 586             return self.read_table()
    587         else:
    588             raise T7ReaderException("unknown type id {}. The file may be "

~/anaconda/envs/py3.5/lib/python3.5/site-packages/torch/utils/serialization/read_lua_file.py in wrapper(self, *args, **kwargs)
    512             if index in self.memo:
    513                 return self.memo[index]
--> 514             result = fn(self, *args, **kwargs)
    515             self.memo[index] = result
    516             return result

~/anaconda/envs/py3.5/lib/python3.5/site-packages/torch/utils/serialization/read_lua_file.py in read_table(self)
    561         for i in range(size):
    562             k = self.read()
--> 563             v = self.read()
    564             table[k] = v
    565         if self.list_heuristic and self._can_be_list(table):

~/anaconda/envs/py3.5/lib/python3.5/site-packages/torch/utils/serialization/read_lua_file.py in read(self)
    584             return self.read_object()
    585         elif typeidx == TYPE_TABLE:
--> 586             return self.read_table()
    587         else:
    588             raise T7ReaderException("unknown type id {}. The file may be "

~/anaconda/envs/py3.5/lib/python3.5/site-packages/torch/utils/serialization/read_lua_file.py in wrapper(self, *args, **kwargs)
    512             if index in self.memo:
    513                 return self.memo[index]
--> 514             result = fn(self, *args, **kwargs)
    515             self.memo[index] = result
    516             return result

~/anaconda/envs/py3.5/lib/python3.5/site-packages/torch/utils/serialization/read_lua_file.py in read_table(self)
    561         for i in range(size):
    562             k = self.read()
--> 563             v = self.read()
    564             table[k] = v
    565         if self.list_heuristic and self._can_be_list(table):

~/anaconda/envs/py3.5/lib/python3.5/site-packages/torch/utils/serialization/read_lua_file.py in read(self)
    582             return self.read_function()
    583         elif typeidx == TYPE_TORCH:
--> 584             return self.read_object()
    585         elif typeidx == TYPE_TABLE:
    586             return self.read_table()

~/anaconda/envs/py3.5/lib/python3.5/site-packages/torch/utils/serialization/read_lua_file.py in wrapper(self, *args, **kwargs)
    512             if index in self.memo:
    513                 return self.memo[index]
--> 514             result = fn(self, *args, **kwargs)
    515             self.memo[index] = result
    516             return result

~/anaconda/envs/py3.5/lib/python3.5/site-packages/torch/utils/serialization/read_lua_file.py in read_object(self)
    535 
    536         if cls_name in reader_registry:
--> 537             return reader_registry[cls_name](self, version)
    538         if self.unknown_classes:
    539             return TorchObject(cls_name, self.read())

~/anaconda/envs/py3.5/lib/python3.5/site-packages/torch/utils/serialization/read_lua_file.py in read_tensor(reader, version)
    144         storage_offset = reader.read_long() - 1
    145         # read storage:
--> 146         storage = reader.read()
    147 
    148         if storage is None or ndim == 0 or len(size) == 0 or len(stride) == 0:

~/anaconda/envs/py3.5/lib/python3.5/site-packages/torch/utils/serialization/read_lua_file.py in read(self)
    582             return self.read_function()
    583         elif typeidx == TYPE_TORCH:
--> 584             return self.read_object()
    585         elif typeidx == TYPE_TABLE:
    586             return self.read_table()

~/anaconda/envs/py3.5/lib/python3.5/site-packages/torch/utils/serialization/read_lua_file.py in wrapper(self, *args, **kwargs)
    512             if index in self.memo:
    513                 return self.memo[index]
--> 514             result = fn(self, *args, **kwargs)
    515             self.memo[index] = result
    516             return result

~/anaconda/envs/py3.5/lib/python3.5/site-packages/torch/utils/serialization/read_lua_file.py in read_object(self)
    535 
    536         if cls_name in reader_registry:
--> 537             return reader_registry[cls_name](self, version)
    538         if self.unknown_classes:
    539             return TorchObject(cls_name, self.read())

~/anaconda/envs/py3.5/lib/python3.5/site-packages/torch/utils/serialization/read_lua_file.py in read_storage(reader, version)
    163         # https://github.com/torch/torch7/blob/master/generic/Storage.c#L244
    164         size = reader.read_long() * element_size
--> 165         return python_class.from_buffer(reader.f.read(size), 'native')
    166     return read_storage
    167 

ValueError: buffer size (3557762) must be a multiple of element size (4)

I download the model SP_GoogleNet_ImageNet.pt, then run the demo, but meet this error.

wangbo2016 commented 5 years ago

Can you share a model file with me? wangbo@ia.ac.cn

ltc576935585 commented 5 years ago

can you share me a model and annotions with me please?576935585@qq.com

junx1992 commented 4 years ago

can you share me a model and annotions with me ? junx1992@gmail.com