Thundernet_Pytorch icon indicating copy to clipboard operation
Thundernet_Pytorch copied to clipboard

Train Error.

Open wanglaotou opened this issue 5 years ago • 3 comments

Hi, i met the error when i train my own data and the error like this: Traceback (most recent call last): File "trainval_net.py", line 484, in rois_label = _RCNN(im_data, im_info, gt_boxes, num_boxes, File "/home/mario/.conda/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in call result = self.forward(*input, **kwargs) File "/home/mario/Projects/Obj_det/faster-rcnn.pytorch-pytorch-1.0/lib/model/faster_rcnn/faster_rcnn.py", line 51, in forward base_feat = self.RCNN_base(im_data) File "/home/mario/.conda/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in call result = self.forward(*input, **kwargs) File "/home/mario/Projects/Obj_det/Thundernet_Pytorch/lib/model/faster_rcnn/Snet.py", line 147, in forward return cem_out UnboundLocalError: local variable 'cem_out' referenced before assignment could you please tell me how to fix it. thanks:)

wanglaotou avatar Jan 06 '20 11:01 wanglaotou

你是改了代码吧

DayBreak-u avatar Jan 06 '20 14:01 DayBreak-u

你好,我执行的是sh train_146.sh,发现trainval_net.py中--cfg的参数默认是cfgs/res101_ls.yml,这个在cfg下没有,我修改为cfgs/snet.yml,并且参数中resume参数默认是False的,但是我在打印这个args.resume的时候,它显示为True,不是很明白。由于没有训练好的模型,我在参数中将--r True --checkepoch 2注释掉了。

wanglaotou avatar Jan 07 '20 03:01 wanglaotou

我只是修改代码换成我自己的数据集,还是VOC格式,另外将trainval_net.py中cfg_file设置为cfgs/snet.yml,resume设置为False,去掉了checkpoint,其它代码没有做相应改动。 我百度了下,说是变量名前面定义过,需要声明为global,但是明显不太对,试过也不行。。

wanglaotou avatar Jan 07 '20 08:01 wanglaotou