vasgaowei / pytorch_MELM

The pytorch implementation of the Min-Entropy Latent Model for Weakly Supervised Object Detection
104 stars 19 forks source link

pool5_roi' referenced before assignment #16

Open ltc576935585 opened 5 years ago

ltc576935585 commented 5 years ago
if cfg.POOLING_MODE == 'crop':
  pool5 = self._crop_pool_layer(net_conv, rois)
else:
  pool5_roi = self._roi_ring_pool_layer(net_conv, rois, 0., 1.0)
  pool5_context = self._roi_ring_pool_layer(net_conv, rois, 1.0, 1.8)
  pool5_frame = self._roi_ring_pool_layer(net_conv, rois, scale_inner = 1.0 / 1.8, scale_outer = 1.0)

if self._mode == 'TRAIN':
  torch.backends.cudnn.benchmark = True # benchmark because now the input size are fixed
#print('pool5 ', pool5.shape)
fc7_roi = self._head_to_tail(pool5_roi)
fc7_context = self._head_to_tail(pool5_context)
fc7_frame = self._head_to_tail(pool5_frame)

Hello, I didn't see your code here too clearly, pool5_roi has no assignment, how can I use it?

xiaohuihui52309 commented 5 years ago

+1

vicchu commented 4 years ago
if cfg.POOLING_MODE == 'crop':
  pool5 = self._crop_pool_layer(net_conv, rois)
else:
  pool5_roi = self._roi_ring_pool_layer(net_conv, rois, 0., 1.0)
  pool5_context = self._roi_ring_pool_layer(net_conv, rois, 1.0, 1.8)
  pool5_frame = self._roi_ring_pool_layer(net_conv, rois, scale_inner = 1.0 / 1.8, scale_outer = 1.0)

if self._mode == 'TRAIN':
  torch.backends.cudnn.benchmark = True # benchmark because now the input size are fixed
#print('pool5 ', pool5.shape)
fc7_roi = self._head_to_tail(pool5_roi)
fc7_context = self._head_to_tail(pool5_context)
fc7_frame = self._head_to_tail(pool5_frame)

Hello, I didn't see your code here too clearly, pool5_roi has no assignment, how can I use it?

Hi, could you tell me how do you solve this problem? thank you ! @ltc576935585

dkswxd commented 4 years ago

I meet the same question when I try to run demo.py.

After compare demo.py and test_net.py, I found that cfg_from_file() is missed in demo.py. So the program load model/config.py instead of experiments/cfgs/vgg16.yml.

In order to run demo.py, you should add from model.config import cfg, cfg_from_file, cfg_from_list at the head of the file, and add cfg_from_file('experiments/cfgs/vgg16.yml') after if __name__ == '__main__'.

Also, in demo.py, line 31 from nets.vgg16 import vgg16 should be modified to from nets.vgg16 import MELM_vgg16 as vgg16. and in line 51 NETS = {'vgg16': ('vgg16_faster_rcnn_iter_%d.pth',),'res101': ('res101_faster_rcnn_iter_%d.pth',)} faster_rcnn should be modified to MELM