python单步调试

python单步调试:

import pdb  
pdb.set_trace()  

n(ext) #执行下一行代码
s(tep) #执行下一行代码,若为函数,则进入函数体,执行

~/fast-rcnn$ ./tools/train_net.py --cpu 11 --solver models/VGG_CNN_M_1024/solver.prototxt
 --weights data/imagenet_models/VGG_CNN_M_1024.v2.caffemodel --imdb KakouTrain
> /home//fast-rcnn/lib/datasets/kakou.py(25)<module>()
-> class kakou(datasets.imdb):
(Pdb) n
TypeError: 'Error when calling the metaclass bases\n    module.__init__()
 takes at most 2 arguments (3 given)'
> /home//fast-rcnn/lib/datasets/kakou.py(25)<module>()
-> class kakou(datasets.imdb):
(Pdb) 
~/fast-rcnn$ ./tools/train_net.py --cpu 11 --solver models/VGG_CNN_M_1024/solver.prototxt
 --weights data/imagenet_models/VGG_CNN_M_1024.v2.caffemodel --imdb KakouTrain
> /home//fast-rcnn/lib/datasets/kakou.py(25)<module>()
-> class kakou(datasets.imdb):
(Pdb) s
--Call--
> /home//fast-rcnn/lib/datasets/kakou.py(25)kakou()
-> class kakou(datasets.imdb):
(Pdb) n
> /home//fast-rcnn/lib/datasets/kakou.py(25)kakou()
-> class kakou(datasets.imdb):
(Pdb) n
> /home//fast-rcnn/lib/datasets/kakou.py(26)kakou()
-> def __init__(self, image_set, devkit_path=None):
(Pdb) n
> /home//fast-rcnn/lib/datasets/kakou.py(47)kakou()
-> def image_path_at(self, i):
(Pdb) n
> /home//fast-rcnn/lib/datasets/kakou.py(53)kakou()
-> def image_path_from_index(self, index):
(Pdb) n
> /home//fast-rcnn/lib/datasets/kakou.py(62)kakou()
-> def _load_image_set_index(self, imagelist):
(Pdb) 

找到问题:

(Pdb) n
> /home//fast-rcnn/lib/datasets/kakou.py(258)kakou()
-> def competition_mode(self, on):
(Pdb) n
--Return--
> /home//fast-rcnn/lib/datasets/kakou.py(258)kakou()->{'__init__':
>  , '__module__':
 'datasets.kakou', '__return__': {'__init__': ,
  '__module__': 'datasets.kakou', '__return__': {'__init__': ,
 , ...}, '_do_matlab_eval': , ...},
  '_do_matlab_eval': , ...}, '_do_matlab_eval':
 , ...}
-> def competition_mode(self, on):
(Pdb) n
TypeError: 'Error when calling the metaclass bases\n    
module.__init__() takes at most 2 arguments (3 given)'
> /home//fast-rcnn/lib/datasets/kakou.py(25)()
-> class kakou(datasets.imdb):
(Pdb) 

p #打印某个变量

(Pdb) l
 20     
 21     
 22     import pdb  
 23     pdb.set_trace()  
 24     
 25  -> class kakou(datasets.imdb):
 26         def __init__(self, image_set, devkit_path=None):
 27             datasets.imdb.__init__(self, image_set)#imageset Ϊtrain val trainval test
 28             self._image_set = image_set
 29             self._devkit_path = devkit_path
 30             self._data_path = os.path.join(self._devkit_path)
(Pdb) p datasets.imdb
<module 'datasets.imdb' from '/home//fast-rcnn/tools/../lib/datasets/imdb.pyc'>
(Pdb) 

你可能感兴趣的:(python,调试,Deep,Learning,Python)